diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 0000000000..dbdd97501c --- /dev/null +++ b/.bazelignore @@ -0,0 +1,18 @@ +semantic/dist-newstyle +semantic-analysis/dist-newstyle +semantic-ast/dist-newstyle +semantic-codeql/dist-newstyle +semantic-go/dist-newstyle +semantic-java/dist-newstyle +semantic-json/dist-newstyle +semantic-parse/dist-newstyle +semantic-proto/dist-newstyle +semantic-python/dist-newstyle +semantic-ruby/dist-newstyle +semantic-scope-graph/dist-newstyle +semantic-source/dist-newstyle +semantic-tags/dist-newstyle +semantic-tsx/dist-newstyle +semantic-typescript/dist-newstyle +dist-newstyle +tmp diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000000..6661141677 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,22 @@ +build:ci --loading_phase_threads=1 +build:ci --jobs=2 +build:ci --verbose_failures +common:ci --color=no +test:ci --test_output=errors + +build --disk_cache=.bazel-cache/bazel-disk +build --repository_cache=.bazel-cache/bazel-repo +build --color=yes +build --jobs=8 +build --compilation_mode=fastbuild + +# test environment does not propagate locales by default +# some tests reads files written in UTF8, we need to propagate the correct +# environment variables, such as LOCALE_ARCHIVE +# We also need to setup an utf8 locale +test --test_env=LANG=en_US.utf8 --test_env=LOCALE_ARCHIVE + +test --test_output=errors +test --compilation_mode=fastbuild + +try-import .bazelrc.local diff --git a/.dockerignore b/.dockerignore index 94143827ed..ed06c91b51 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,19 @@ Dockerfile +/.licenses +/.git +.ghci +.ghci_history +.ghc.environment.x86_64-darwin-8.6.5 +*.yaml +*.md + +/bin +/dist +/dist-newstyle +/notices +/docs +/tmp +/semantic-source +/bench +/script +/test diff --git a/.ghci b/.ghci deleted file mode 100644 index 639be45281..0000000000 --- a/.ghci +++ /dev/null @@ -1,42 +0,0 @@ --- Load the pretty-show & hscolour packages for use with :pretty. -:set -package pretty-show -package hscolour - --- See docs/πŸ’‘ProTip!.md -:undef pretty -:def pretty \ _ -> return ":set -interactive-print Semantic.Util.Pretty.prettyShow" - --- See docs/πŸ’‘ProTip!.md -:undef no-pretty -:def no-pretty \_ -> return ":set -interactive-print System.IO.print" - --- See docs/πŸ’‘ProTip!.md -:undef r -:def r \_ -> return (unlines [":reload", ":pretty"]) - --- See docs/πŸ’‘ProTip!.md for documentation & examples. -:{ -assignmentExample lang = case lang of - "Python" -> mk "py" "python" - "Go" -> mk "go" "go" - "Ruby" -> mk "rb" "ruby" - "JavaScript" -> mk "js" "typescript" - "TypeScript" -> mk "ts" "typescript" - "Haskell" -> mk "hs" "haskell" - "Markdown" -> mk "md" "markdown" - "JSON" -> mk "json" "json" - "Java" -> mk "java" "java" - "PHP" -> mk "php" "php" - _ -> mk "" "" - where mk fileExtension parser = putStrLn ("example: fmap (() <$) . runTask . parse " ++ parser ++ "Parser =<< Semantic.Util.blob \"example." ++ fileExtension ++ "\"") >> return ("import Parsing.Parser\nimport Semantic.Task\nimport Semantic.Util") -:} -:undef assignment -:def assignment assignmentExample - --- Enable breaking on errors for code written in the repl. -:seti -fbreak-on-error - --- Continue loading after warnings when in the repl. -:set -Wwarn - --- Use a cyan lambda as the prompt. -:set prompt "\ESC[1;36m\STXΞ» \ESC[m\STX" diff --git a/.ghci.repl b/.ghci.repl new file mode 100644 index 0000000000..9b5a126ffc --- /dev/null +++ b/.ghci.repl @@ -0,0 +1,53 @@ +-- GHCI settings for script/repl. +-- These live here instead of script/repl for ease of commenting. +-- These live here instead of .ghci so cabal repl remains unaffected. +-- These live here instead of script/ghci-flags so ghcide remains unaffected. + +-- Basic verbosity +:set -v1 + +-- Compile to object code +:set -fwrite-interface -fobject-code + +-- Bonus: silence β€œadd these modules to your .cabal file” warnings for files we :load +:set -Wno-missing-home-modules + +-- Warnings for code written in the repl +:seti -Weverything +:seti -Wno-all-missed-specialisations +:seti -Wno-implicit-prelude +:seti -Wno-missed-specialisations +:seti -Wno-missing-import-lists +:seti -Wno-missing-local-signatures +:seti -Wno-monomorphism-restriction +:seti -Wno-name-shadowing +:seti -Wno-safe +:seti -Wno-unsafe +:seti -Wno-star-is-type +-- 8.8+ +:seti -Wno-missing-deriving-strategies +-- 8.10+ +:seti -Wno-missing-safe-haskell-mode +:seti -Wno-prepositive-qualified-module + +-- Turn on some language extensions you use a lot +:seti -XFlexibleContexts -XOverloadedStrings -XTypeApplications + +-- Break on errors +:seti -fbreak-on-error + +-- Automatically show the code around breakpoints +:set stop :list + +-- Use a cyan lambda as the prompt +:set prompt "\ESC[1;36m\STXΞ» \ESC[m\STX" + +-- Better errors +:set -ferror-spans -freverse-errors -fprint-expanded-synonyms + +-- Better typed holes +:set -funclutter-valid-hole-fits -fabstract-refinement-hole-fits -frefinement-level-hole-fits=2 + +-- We have this one on in the project but not in the REPL to reduce noise +:seti -Wno-type-defaults +:set -Wno-unused-packages diff --git a/.ghci.sample b/.ghci.sample new file mode 100644 index 0000000000..8a1e7f5068 --- /dev/null +++ b/.ghci.sample @@ -0,0 +1,26 @@ +-- Consider copying this to your ~/.ghc/ghci.conf file: + +-- Pretty-printing +:set -package-id prtty-smpl-3.1.1.0-c89f0500 +:set -interactive-print Text.Pretty.Simple.pPrint + +-- Turn on some language extensions you use a lot +:seti -XFlexibleContexts -XOverloadedStrings -XTypeApplications + +-- Break on errors +:seti -fbreak-on-error + +-- Automatically show the code around breakpoints +:set stop :list + +-- Use a cyan lambda as the prompt +:set prompt "\ESC[1;36m\STXΞ» \ESC[m\STX" + +-- Better errors +:set -ferror-spans -freverse-errors -fprint-expanded-synonyms + +-- Path-local ghci history +:set -flocal-ghci-history + +-- Better typed holes +:set -funclutter-valid-hole-fits -fabstract-refinement-hole-fits -frefinement-level-hole-fits=2 diff --git a/.gitattributes b/.gitattributes index 102ed8bdbc..9d2f2cec44 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ test/fixtures linguist-vendored test/repos linguist-vendored vendor linguist-vendored +*.protobuf.bin binary diff --git a/.github/workflows/bazel.yml.disabled b/.github/workflows/bazel.yml.disabled new file mode 100644 index 0000000000..05389979a5 --- /dev/null +++ b/.github/workflows/bazel.yml.disabled @@ -0,0 +1,44 @@ +name: Bazel CI + +on: + # Trigger the workflow on push or pull request, + # but only for the master branch + push: + branches: + - master + pull_request: {} + +jobs: + build: + name: Bazel + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master' + + - uses: actions/cache@v2 + id: caching-stage + name: Cache Bazel artifacts + with: + path: | + .bazel-cache + bin + key: ${{ runner.os }}-bazel-${{ github.run_id }} + restore-keys: | + ${{ runner.os }}-bazel- + + - name: Download/cache bazel version + if: steps.caching-stage.outputs.cache-hit != 'true' + run: | + if [ ! -f bin/bazel ]; then + curl -LO "https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel-3.1.0-linux-x86_64" + mv bazel-3.1.0-linux-x86_64 "bin/bazel" + chmod +x "bin/bazel" + fi + + - name: Build & test + run: | + bin/bazel clean + bin/bazel test --config=ci --test_tag_filters=language-test //... + bin/bazel test --config=ci //semantic-source //semantic:spec diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml new file mode 100644 index 0000000000..e42629b3be --- /dev/null +++ b/.github/workflows/haskell.yml @@ -0,0 +1,73 @@ +name: Haskell CI + +on: + # Trigger the workflow on push or pull request, + # but only for the master branch + push: + branches: + - master + pull_request: + +jobs: + build: + name: ghc ${{ matrix.ghc }} + runs-on: ubuntu-latest + strategy: + matrix: + ghc: ["8.10", "9.2"] + + steps: + - uses: actions/checkout@v2 + if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master' + + - uses: haskell/actions/setup@v1 + name: Setup Haskell + with: + ghc-version: ${{ matrix.ghc }} + + - uses: actions/cache@v1 + id: cache-cabal + name: Cache Cabal artifacts + with: + path: dist-cache + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-cabal-cache-${{ hashFiles('**/*.cabal') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-cabal-cache- + ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}- + ${{ runner.os }}-${{ matrix.ghc }}- + ${{ runner.os }}- + + - name: Get cabal-cache + run: | + curl -L https://github.com/haskell-works/cabal-cache/releases/download/v1.0.1.8/cabal-cache_x86_64_linux.tar.gz > ./cc.tar.gz + tar -xvf ./cc.tar.gz + + - name: Configure project + run: | + cabal v2-update + cabal v2-configure --project-file=cabal.project.ci --disable-optimization --enable-tests --write-ghc-environment-files=always -j2 + cd semantic-source && cabal v2-configure --project-file=cabal.project.ci --disable-optimization --enable-tests --write-ghc-environment-files=always -j2 + + - name: Restore from cache + run: ./cabal-cache sync-from-archive --threads=2 --archive-uri=dist-cache || true + + - name: Build & test + run: | + cabal v2-build --project-file=cabal.project.ci semantic:exe:semantic + cabal v2-run --project-file=cabal.project.ci semantic:test + cabal v2-build --project-file=cabal.project.ci semantic-analysis + cabal v2-run --project-file=cabal.project.ci semantic-codeql:test + cabal v2-run --project-file=cabal.project.ci semantic-go:test + cabal v2-run --project-file=cabal.project.ci semantic-java:test + cabal v2-run --project-file=cabal.project.ci semantic-json:test + cabal v2-run --project-file=cabal.project.ci semantic-python:test + # cabal v2-run --project-file=cabal.project.ci semantic-python:test:compiling + # cabal v2-run --project-file=cabal.project.ci semantic-python:test:graphing + cabal v2-run --project-file=cabal.project.ci semantic-ruby:test + cabal v2-run --project-file=cabal.project.ci semantic-tags:test + cabal v2-run --project-file=cabal.project.ci semantic-tsx:test + cabal v2-run --project-file=cabal.project.ci semantic-typescript:test + cd semantic-source && cabal v2-run --project-file=cabal.project.ci semantic-source:test + + - name: Write out cache + run: ./cabal-cache sync-to-archive --threads=2 --archive-uri=dist-cache diff --git a/.gitignore b/.gitignore index 68d3a974c3..f4875d9332 100644 --- a/.gitignore +++ b/.gitignore @@ -8,14 +8,20 @@ stack.yaml.lock profiles /tags -cabal.project.local +cabal.project.local* dist dist-newstyle +dist-repl +.ghci .ghc.environment.* +.ghci_history tmp/ /bin/ +/bazel-* +/.bazel-cache +/src/Semantic/Version.hs.bak /semanticd/test/current /semanticd/test/rover-example-config/semantic.log /test/fixtures/*/examples diff --git a/.gitmodules b/.gitmodules index 6dab354824..e69de29bb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "vendor/haskell-tree-sitter"] - path = vendor/haskell-tree-sitter - url = https://github.com/tree-sitter/haskell-tree-sitter.git diff --git a/.hlint.yaml b/.hlint.yaml index 2b89659d7b..2c987f4a1b 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -1,7 +1,7 @@ # HLint configuration file # https://github.com/ndmitchell/hlint -- arguments: [--color=auto, -XDataKinds, -XDeriveFoldable, -XDeriveFunctor, -XDeriveGeneric, -XDeriveTraversable, -XFlexibleContexts, -XFlexibleInstances, -XMultiParamTypeClasses, -XOverloadedStrings, -XRecordWildCards, -XStandaloneDeriving, -XStrictData, -XTypeApplications, -XDerivingVia] +- arguments: [--color=auto, -XStrictData] # Blacklist some functions by default. - functions: @@ -12,6 +12,7 @@ - {name: init, within: []} - {name: last, within: []} - {name: fromJust, within: []} + - {name: decodeUtf8, within: [], message: "Use decodeUtf8' or decodeUtf8With lenientDecode"} # Replace a $ b $ c with a . b $ c - group: {name: dollar, enabled: true} @@ -23,7 +24,7 @@ - warn: {group: {name: default}} # Ignore the highly noisy module export list hint -- ignore: {name: Use module export list} +- ignore: {name: Use explicit module export list} # Ignore some builtin hints - ignore: {name: Use mappend} @@ -34,19 +35,44 @@ # Change the severity of hints we don’t want to fail CI for - suggest: {name: Eta reduce} +# While I think DerivingStrategies is good, it's too noisy to suggest by default +- ignore: + name: Use DerivingStrategies + # Ignore eta reduce in the assignment modules - ignore: name: Eta reduce within: - Language.Go.Assignment - - Language.PHP.Assignment - Language.Python.Assignment - Language.Ruby.Assignment - ignore: {name: Use ., within: [Analysis.Abstract.Graph.graphingModules, Semantic.Distribute]} -- ignore: {name: Reduce duplication, within: [Semantic.Util, Semantic.UtilDisabled]} -- ignore: {name: Use newtype instead of data, within: [Semantic.Api.V1.CodeAnalysisPB]} +- ignore: + within: + - Proto.Semantic + - Proto.Semantic_Fields + - Proto.Semantic_JSON + +- ignore: + name: Reduce duplication + within: + - Semantic.Util + - Language.Ruby.Tags + +# hlint has issues with QuantifiedConstraints (see https://github.com/ndmitchell/hlint/issues/759) +# Once the above is fixed, we can drop this error. + +- ignore: { name: Parse error } + +# hlint is too paranoid about NonEmpty functions (https://github.com/ndmitchell/hlint/issues/787) + +- ignore: + name: Avoid restricted function + within: + - Language.Python.Syntax + - Data.Syntax.Expression # Our customized warnings @@ -67,7 +93,7 @@ # Conveniences - warning: {lhs: maybe a pure, rhs: maybeM a, name: Use maybeM} - warning: {lhs: either (const a) id, rhs: fromRight a, name: use fromRight} -- warning: {lhs: either id (const a), rhs: fromLeft a, name: use fromRight} +- warning: {lhs: either id (const a), rhs: fromLeft a, name: use fromLeft} # Applicative style - warning: {lhs: f <$> pure a <*> b, rhs: f a <$> b, name: Avoid redundant pure} diff --git a/.licenses/semantic/cabal/cryptohash.txt b/.licenses/semantic/cabal/cryptohash.txt deleted file mode 100644 index 7f355aff1f..0000000000 --- a/.licenses/semantic/cabal/cryptohash.txt +++ /dev/null @@ -1,35 +0,0 @@ ---- -type: cabal -name: cryptohash -version: 0.11.9 -summary: collection of crypto hashes, fast, pure and practical -homepage: https://github.com/vincenthz/hs-cryptohash -license: bsd-3-clause ---- -Copyright (c) 2010-2014 Vincent Hanquez - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. Neither the name of the author nor the names of his contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/.licenses/semantic/cabal/free.txt b/.licenses/semantic/cabal/free.txt deleted file mode 100644 index c0380c9176..0000000000 --- a/.licenses/semantic/cabal/free.txt +++ /dev/null @@ -1,38 +0,0 @@ ---- -type: cabal -name: free -version: '5.1' -summary: Monads for free -homepage: https://github.com/ekmett/free/ -license: bsd-3-clause ---- -Copyright 2008-2013 Edward Kmett - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the author nor the names of his contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/.licenses/semantic/cabal/http-client-tls.txt b/.licenses/semantic/cabal/http-client-tls.txt deleted file mode 100644 index 398db97fb3..0000000000 --- a/.licenses/semantic/cabal/http-client-tls.txt +++ /dev/null @@ -1,28 +0,0 @@ ---- -type: cabal -name: http-client-tls -version: 0.3.5.3 -summary: http-client backend using the connection package and tls library -homepage: https://github.com/snoyberg/http-client -license: mit ---- -The MIT License (MIT) - -Copyright (c) 2013 Michael Snoyman - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/.licenses/semantic/cabal/http-client.txt b/.licenses/semantic/cabal/http-client.txt deleted file mode 100644 index afc1a34540..0000000000 --- a/.licenses/semantic/cabal/http-client.txt +++ /dev/null @@ -1,28 +0,0 @@ ---- -type: cabal -name: http-client -version: 0.5.14 -summary: An HTTP client engine -homepage: https://github.com/snoyberg/http-client -license: mit ---- -The MIT License (MIT) - -Copyright (c) 2013 Michael Snoyman - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/.licenses/semantic/cabal/http-media.txt b/.licenses/semantic/cabal/http-media.txt deleted file mode 100644 index 1013aec70c..0000000000 --- a/.licenses/semantic/cabal/http-media.txt +++ /dev/null @@ -1,28 +0,0 @@ ---- -type: cabal -name: http-media -version: 0.7.1.3 -summary: Processing HTTP Content-Type and Accept headers -homepage: https://github.com/zmthy/http-media -license: mit ---- -Copyright (c) 2012-2015 Timothy Jones - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/.licenses/semantic/cabal/http-types.txt b/.licenses/semantic/cabal/http-types.txt deleted file mode 100644 index f2be57f9fd..0000000000 --- a/.licenses/semantic/cabal/http-types.txt +++ /dev/null @@ -1,39 +0,0 @@ ---- -type: cabal -name: http-types -version: 0.12.3 -summary: Generic HTTP types for Haskell (for both client and server code). -homepage: https://github.com/aristidb/http-types -license: bsd-3-clause ---- -Copyright (c) 2011, Aristid Breitkreuz -Copyright (c) 2011, Michael Snoyman - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of Aristid Breitkreuz nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/.stylish-haskell.yaml b/.stylish-haskell.yaml index 19825baca3..086cfc319e 100644 --- a/.stylish-haskell.yaml +++ b/.stylish-haskell.yaml @@ -173,7 +173,7 @@ steps: # `{-#LANGUAGE #-}'. # # Default: vertical. - style: compact + style: vertical # Align affects alignment of closing pragma brackets. # @@ -183,7 +183,7 @@ steps: # between actual import and closing bracket. # # Default: true - align: true + align: false # stylish-haskell can detect redundancy of some language pragmas. If this # is set to true, it will remove those redundant pragmas. Default: true. diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0fcfe68a2b..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -language: c - -cache: - directories: - - $HOME/.cabal/packages - - $HOME/.cabal/store - -before_cache: - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log - # remove files that are regenerated by 'cabal update' - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.* - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx - - - rm -rfv $HOME/.cabal/packages/head.hackage - -matrix: - include: - - compiler: "ghc-8.6.4" - addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.4], sources: [hvr-ghc]}} - -before_install: -- mkdir -p $HOME/.local/bin -- "PATH=/opt/ghc/bin:$HOME/local/bin:$PATH" -- ghc --version -- cabal --version - -install: -- cabal new-update -- cabal new-configure --enable-tests --write-ghc-environment-files=always -- cabal new-build --only-dependencies -j - -script: -- cabal new-build -j semantic-core semantic:exe:semantic -- cabal new-test semantic:test semantic-core:spec -- cabal new-run semantic:parse-examples - -# Any branch linked with a pull request will be built, as well as the non-PR -# branches listed below: -branches: - only: - - master diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000000..955c61a903 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,66 @@ +# This build file specifies the packages from GHC bindists that +# we want to use, as well as the top-level hie-bios REPL target +# that the tooling uses. You probably don't need to edit it. + +package(default_visibility = ["//visibility:public"]) + +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_repl", + "haskell_toolchain_library", +) + +# You can specify what kind of compilation mode you want by providing +# --compilation_mode=MODE to `bazel build`, where MODE is one of +# 'fastbuild', 'dbg', or 'opt'. We declare targets corresponding to this +# setting, which are used in common.bzl to vary compiler flags based +# on the compilation mode. Note that you can also just write `-c opt` +# if you're not into writing out compilation_mode. + +config_setting( + name = "release", + values = {"compilation_mode": "opt"}, +) + +config_setting( + name = "development", + values = {"compilation_mode": "fastbuild"}, +) + +config_setting( + name = "debug", + values = {"compilation_mode": "dbg"}, +) + +# The GHC bindists provide us with a set of builtin libraries. +# We use them rather than looking up those in stackage. + +haskell_toolchain_library(name = "base") + +haskell_toolchain_library(name = "bytestring") + +haskell_toolchain_library(name = "containers") + +haskell_toolchain_library(name = "deepseq") + +haskell_toolchain_library(name = "filepath") + +haskell_toolchain_library(name = "ghc-prim") + +haskell_toolchain_library(name = "text") + +haskell_toolchain_library(name = "haskeline") + +haskell_toolchain_library(name = "process") + +haskell_toolchain_library(name = "template-haskell") + +haskell_toolchain_library(name = "transformers") + +# This repl target is used by hie-bios + ghcide. + +haskell_repl( + name = "hie-bios", + collect_data = False, + deps = ["//semantic"], +) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000000..c010ba8c15 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @github/semantic-code diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 701353e354..0a08581069 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,6 +7,8 @@ Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. +We're happy to accept code and documentation contributions, as well as issues suggesting new features, asking questions about how things work, or generally about what we're trying to accomplish! However, we are not opening up the code review process to the public. PRs should _only_ be reviewed by one of the project maintainers. Therefore, we ask that you refrain from leaving approvals or change requests on in-progress pull requests, as spurious reviews make it difficult to discern which patches are truly ready for integration. + Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE.md). Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. @@ -15,7 +17,7 @@ Please note that this project is released with a [Contributor Code of Conduct][c 0. [Fork][fork] and clone the repository 0. Configure and install the dependencies: `script/bootstrap` -0. Make sure the tests pass on your machine: `cabal new-build` +0. Make sure the tests pass on your machine: `cabal v2-test` 0. Create a new branch: `git checkout -b my-branch-name` 0. Make your change, add tests, and make sure the tests still pass 0. Push to your fork and [submit a pull request][pr] @@ -28,6 +30,8 @@ Here are a few things you can do that will increase the likelihood of your pull - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). +Unless you are a member of the Semantic team or a code owner, we ask that you refrain from leaving approvals or change requests on in-progress pull requests, as spurious reviews make it difficult to discern which patches are truly ready for integration. + Please be aware that contributions to Semantic may multiple cycles of code reviewβ€”we are grateful for all community involvement, but because Semantic powers real systems, we must maintain a high standard of code quality. For reasons of compatibility with production uses of Semantic within GitHub, we may also reject or require modifications to changes that would affect these systems. We may also reject patches that don't fit with our vision of the project; should this be the case, we will be clear about our rationale. ## Resources diff --git a/Dockerfile b/Dockerfile index 6099b3b175..d8b43d8f17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,38 @@ -FROM haskell:8.6 as build +# Put protoc and twirp tooling in its own image +FROM haskell:8.8.1 as haskell +RUN cabal v2-update && \ + cabal v2-install proto-lens-protoc +RUN which proto-lens-protoc + +FROM golang:1.13-stretch AS protoc +RUN apt-get update && apt-get install -y unzip +ENV PROTOBUF_VERSION=3.7.1 +RUN wget "https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protoc-$PROTOBUF_VERSION-linux-x86_64.zip" && \ + unzip "protoc-$PROTOBUF_VERSION-linux-x86_64.zip" -d "/protobuf" + +RUN go get github.com/golang/protobuf/proto && \ + go get github.com/twitchtv/protogen/typemap && \ + GO111MODULE=on go get github.com/tclem/proto-lens-jsonpb/protoc-gen-jsonpb_haskell@e4d10b77f57ee25beb759a33e63e2061420d3dc2 + +COPY --from=haskell /root/.cabal/bin/proto-lens-protoc /usr/local/bin/proto-lens-protoc + +# Bit of a hack so that proto-lens-protoc actually runs +COPY --from=haskell /opt/ghc/8.8.1/lib/ghc-8.8.1/* /opt/ghc/8.8.1/lib/ghc-8.8.1/ + +ENTRYPOINT ["/protobuf/bin/protoc", "-I/protobuf", "--plugin=protoc-gen-haskell=/usr/local/bin/proto-lens-protoc"] + +# Build semantic +FROM haskell:8.8.1 as build WORKDIR /build -RUN cabal new-update - -# Build our upstream dependencies after copying in only enough to tell cabal -# what they are. This will make these layers cache better even as we change the -# code of semantic itself. -COPY semantic.cabal . -COPY cabal.project . -COPY semantic-core/semantic-core.cabal ./semantic-core/ -COPY vendor ./vendor -RUN cabal new-build --only-dependencies - -# Once the dependencies are built, copy in the rest of the code and compile -# semantic itself. -COPY . /build -RUN cabal new-build semantic:exe:semantic - -# A fake `install` target until we can get `cabal new-install` to work -RUN cp $(find dist-newstyle -name semantic -type f -perm -u=x) /usr/local/bin/semantic + +# Build all of semantic +COPY . . +RUN cabal v2-update && \ + cabal v2-configure --flags="release" && \ + cabal v2-build semantic:exe:semantic + +# A fake `install` target until we can get `cabal v2-install` to work +RUN cp $(find dist-newstyle/build/x86_64-linux -name semantic -type f -perm -u=x) /usr/local/bin/semantic # Create a fresh image containing only the compiled CLI program, so that the # image isn't bulked up by all of the extra build state. diff --git a/HACKING.md b/HACKING.md new file mode 100644 index 0000000000..67b1fd6af6 --- /dev/null +++ b/HACKING.md @@ -0,0 +1,29 @@ +# Effective `semantic` Hacking for Fun and Profit + +The Semantic repository is a large one, containing dozens of subprojects. This means that GHC has to do a lot of work when compiling. For this reason, it's important to keep in mind the principles that will let you avoid recompiling the whole world as soon as you change a single .cabal file. + +## The Landscape + +We officially recommend [Visual Studio Code](https://code.visualstudio.com) with the [`ghcide`](https://marketplace.visualstudio.com/items?itemName=DigitalAssetHoldingsLLC.ghcide) extension. Though our tooling scripts may work with other editor integration solutions, we can't guarantee that they'll do so indefinitely. + +## Things to Do + +1. *Use `script/repl`.* The REPL script is much more powerful than `cabal repl`; it ensures that all packages can be loaded (including tests), so you should be able to `:load` any on-disk package that you wantβ€”and you shouldn't have to restart the REPL every time you add a new file, as GHCi will optimistically read from any `import` statements it encounters. Keep in mind that `:load` accepts both file paths and module identifiers. + +2. *Use the editor integration.* There is no substitute for a workflow that allows you to fix errors without switching applications. If you're using tooling other than VS Code and `ghcide`, we recommend you configure its GHCi process to be `script/repl`. + +3. *Run tests in the REPL.* Unlike `cabal repl`, all the testing packages are loaded into the REPL, so you can `:load` a path to a test file and invoke the relevant test with `main`. This will enable the fastest fix/build/test cycle possible. It may take some time to get used to avoiding `cabal test`. If all you're wanting to see is if the `semantic` CLI tool builds correctly, `:load src/Semantic/CLI.hs`. + +4. *If you have to build, be sure to disable optimizations and parallelize aggressively.* `cabal` builds with `-O1` on by default; this entails a significant hit to compile speed. If you find yourself building some product repeatedly, add `optimizations: False`. + +5. *Turn on stylish-haskell integration.* Most editors are capable of running Haskell code through `stylish-haskell` on save; enabling this does wonders towards keeping your code in compliance with our style guide, frees you from having to fret over the minor details of how something should be formatted, and saves us time in the review process. The VSCode extension for `stylish-haskell` can be found here. + +## Things to Avoid + +1. *Don't `cabal clean`*. `cabal clean` doesn't take any arguments that determine what to clean; as such, running it will clean everything, including the language ASTs, which take some time to recompile. + +2. *Don't `cabal configure` if humanly possible*. It nukes all your build caches. Should you need to modify a global build setting, edit `cabal.project.local` manually. + +3. *Write small modules with minimal dependencies.* Keep the code that deals with language ASTs well-isolated. + +4. *Avoid fancy type tricks if possible.* Techniques like [advanced overlap](https://wiki.haskell.org/GHC/AdvancedOverlap) can save on boilerplate but may not be worth the pain it puts the type checker through. If the only downside to avoiding a fancy type trick is some boilerplate, consider that boilerplate is often preferable to slowing down everyone's build for the indefinite future. diff --git a/README.md b/README.md index 236f0b5e53..e9359e609c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +**NOTE**: _This repository is no longer supported or updated by GitHub. If you wish to continue to develop this code yourself, we recommend you fork it._ + # Semantic `semantic` is a Haskell library and command line tool for parsing, analyzing, and comparing source code. @@ -18,116 +20,87 @@ Run `semantic --help` for complete list of up-to-date options. #### Parse ``` -Usage: semantic parse ([--sexpression] | [--json] | [--json-graph] | [--symbols] - | [--dot] | [--show] | [--quiet]) [FILES...] +Usage: semantic parse [--sexpression | (--json-symbols|--symbols) | + --proto-symbols | --show | --quiet] [FILES...] Generate parse trees for path(s) Available options: --sexpression Output s-expression parse trees (default) - --json Output JSON parse trees - --json-graph Output JSON adjacency list - --symbols Output JSON symbol list - --dot Output DOT graph parse trees + --json-symbols,--symbols Output JSON symbol list + --proto-symbols Output protobufs symbol list --show Output using the Show instance (debug only, format subject to change without notice) --quiet Don't produce output, but show timing stats + -h,--help Show this help text ``` -#### Diff -``` -Usage: semantic diff ([--sexpression] | [--json] | [--json-graph] | [--toc] | - [--dot] | [--show]) [FILE_A] [FILE_B] - Compute changes between paths - -Available options: - --sexpression Output s-expression diff tree (default) - --json Output JSON diff trees - --json-graph Output JSON diff trees - --toc Output JSON table of contents diff summary - --dot Output the diff as a DOT graph - --show Output using the Show instance (debug only, format - subject to change without notice) - ``` - -#### Graph -``` -Usage: semantic graph ([--imports] | [--calls]) [--packages] ([--dot] | [--json] - | [--show]) ([--root DIR] [--exclude-dir DIR] - DIR:LANGUAGE | FILE | --language ARG (FILES... | --stdin)) - Compute a graph for a directory or from a top-level entry point module - -Available options: - --imports Compute an import graph (default) - --calls Compute a call graph - --packages Include a vertex for the package, with edges from it - to each module - --dot Output in DOT graph format (default) - --json Output JSON graph - --show Output using the Show instance (debug only, format - subject to change without notice) - --root DIR Root directory of project. Optional, defaults to - entry file/directory. - --exclude-dir DIR Exclude a directory (e.g. vendor) - --language ARG The language for the analysis. - --stdin Read a list of newline-separated paths to analyze - from stdin. -``` - ## Language support -| Priority | Language | Parse | Assign | Diff | ToC | Symbols | Import graph | Call graph | Control flow graph | -| :---: | :------------- | :---: | :---: | :---: | :--:| :---: | :---: | :---: | :---: | -| 1 | Ruby | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | 🚧 | | -| 2 | JavaScript | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | 🚧 | | -| 3 | TypeScript | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | 🚧 | | -| 4 | Python | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | 🚧 | | -| 5 | Go | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | 🚧 | | -| | PHP | βœ… | βœ… | βœ… | βœ… | βœ… | | | | -| | Java | βœ… | βœ… | βœ… | πŸ”Ά | βœ… | | | | -| | JSON | βœ… | βœ… | βœ… | N/A | N/A | N/A | N/A| | -| | JSX | βœ… | βœ… | βœ… | πŸ”Ά | | | | | -| | Haskell | βœ… | βœ… | βœ… | πŸ”Ά | βœ… | | | | -| | Markdown | βœ… | βœ… | βœ… | πŸ”Ά | N/A | N/A | N/A |   | - +| Language | Parse | AST Symbols† | Stack graphs | +| :------------- | :---: | :---: | :---: | +| Ruby | βœ… | βœ… | | +| JavaScript | βœ… | βœ… | | +| TypeScript | βœ… | βœ… | 🚧 | +| Python | βœ… | βœ… | 🚧 | +| Go | βœ… | βœ… | | +| PHP | βœ… | βœ… | | +| Java | 🚧 | βœ… | | +| JSON | βœ… | ⬜️ | ⬜️ | +| JSX | βœ… | βœ… | | +| TSX | βœ… | βœ… | | +| CodeQL | βœ… | βœ… | | +| Haskell | 🚧 | 🚧 | | + +† Used for [code navigation](https://help.github.com/en/github/managing-files-in-a-repository/navigating-code-on-github) on github.com. * βœ… β€” Supported * πŸ”Ά β€” Partial support * 🚧 β€” Under development +* ⬜ - N/A ️ ## Development +`semantic` requires at least GHC 8.10.1 and Cabal 3.0. We strongly recommend using [`ghcup`][ghcup] to sandbox GHC versions, as GHC packages installed through your OS's package manager may not install statically-linked versions of the GHC boot libraries. `semantic` currently builds only on Unix systems; users of other operating systems may wish to use the [Docker images](https://github.com/github/semantic/packages/11609). + We use `cabal's` [Nix-style local builds][nix] for development. To get started quickly: ```bash git clone git@github.com:github/semantic.git cd semantic -git submodule sync --recursive && git submodule update --init --recursive --force -cabal new-update -cabal new-build -cabal new-test -cabal new-run semantic -- --help +script/bootstrap +cabal v2-build all +cabal v2-run semantic:test +cabal v2-run semantic:semantic -- --help ``` -`semantic` requires at least GHC 8.6.4. We recommend using [`ghcup`][ghcup] to sandbox GHC versions. Our version bounds are based on [Stackage][stackage] LTS versions. The current LTS version is 13.13. `stack` as a build tool is not officially supported; there is an unofficial [`stack.yaml`](https://gist.github.com/jkachmar/f200caee83280f1f25e9cfa2dd2b16bb) available, though we cannot make guarantees as to its stability. +You can also use the [Bazel](https://bazel.build) build system for development. To learn more about Bazel and why it might give you a better development experience, check the [build documentation](docs/build.md). + +``` bash +git clone git@github.com:github/semantic.git +cd semantic +script/bootstrap-bazel +bazel build //... +``` + + + `stack` as a build tool is not officially supported; there is [unofficial `stack.yaml` support](https://github.com/jkachmar/semantic-stack-yaml) available, though we cannot make guarantees as to its stability. -[nix]: https://www.haskell.org/cabal/users-guide/nix-local-build-overview.html -[stackage]: https://stackage.org +[nix]: https://cabal.readthedocs.io/en/3.4/nix-local-build-overview.html [ghcup]: https://www.haskell.org/ghcup/ ## Technology and architecture Architecturally, `semantic`: -1. Reads blobs. -2. Generates parse trees for those blobs with [tree-sitter][tree-sitter] (an incremental parsing system for programming tools). -3. Assigns those trees into a generalized representation of syntax. -4. Performs analysis, computes diffs, or just returns parse trees. -5. Renders output in one of many supported formats. +1. Generates per-language Haskell syntax types based on [tree-sitter](https://github.com/tree-sitter/tree-sitter) grammar definitions. +2. Reads blobs from a filesystem or provided via a protocol buffer request. +3. Returns blobs or performs analysis. +4. Renders output in one of many supported formats. -Semantic leverages a number of interesting algorithms and techniques: +Throughout its lifecycle, `semantic` has leveraged a number of interesting algorithms and techniques, including: - Myers' algorithm (SES) as described in the paper [*An O(ND) Difference Algorithm and Its Variations*][SES] - RWS as described in the paper [*RWS-Diff: Flexible and Efficient Change Detection in Hierarchical Data*][RWS]. -- Open unions and [data types Γ  la carte](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf). +- Open unions and [data types Γ  la carte](https://www.cambridge.org/core/journals/journal-of-functional-programming/article/data-types-a-la-carte/14416CB20C4637164EA9F77097909409). - An implementation of [Abstracting Definitional Interpreters][adi] extended to work with an Γ  la carte representation of syntax terms. [SES]: http://www.xmailserver.org/diff2.pdf @@ -143,4 +116,4 @@ details on how to participate in our community. ## Licensing -Semantic is licensed under the [MIT license](LICENSE). +Semantic is licensed under the [MIT license](semantic/LICENSE). diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000000..b245f45b6d --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,245 @@ +# This file defines the workspace for the Semantic monorepo. +# It loads the Haskell compilation rules, describes the packages +# that we use from Stackage, and pins the tree-sitter packages +# so that we can access their node-types.json files. + +workspace(name = "semantic") + +# Load the repository rule to download an http archive. +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +# Download rules_haskell and make it accessible as "@rules_haskell". +# +# Note: the git_repository clause is a workaround until rules_haskell#1349 [1] +# is released. One it's released, revert back to the http_archive clause with +# an updated version. +# +# [1] https://github.com/tweag/rules_haskell/issues/1349 +http_archive( + name = "rules_haskell", + sha256 = "cd07e421281c3ad286574ae235f39165e294c850fa4cdf03b5683547d8822c34", + strip_prefix = "rules_haskell-1254b1d9bee9e82cd70c4f7941cb64b8ec048bac", + urls = ["https://github.com/tweag/rules_haskell/archive/1254b1d9bee9e82cd70c4f7941cb64b8ec048bac.tar.gz"], +) + +load( + "@rules_haskell//haskell:repositories.bzl", + "rules_haskell_dependencies", +) + +# Setup all Bazel dependencies required by rules_haskell. +rules_haskell_dependencies() + +load( + "@rules_haskell//haskell:toolchain.bzl", + "rules_haskell_toolchains", +) + +# Download a GHC binary distribution from haskell.org and register it as a toolchain. +rules_haskell_toolchains( + locale = "en_US.UTF-8", + version = "8.10.2", +) + +# Enable GHC persistent worker mode, if that's your bag. +load("@rules_haskell//tools:repositories.bzl", "rules_haskell_worker_dependencies") + +rules_haskell_worker_dependencies() + +load( + "@rules_haskell//haskell:cabal.bzl", + "stack_snapshot", +) + +# This call establishes a @stackage repository, and describes what packages +# we use from Stackage. The resolver, as well as the non-Stackage packages +# on which we depend, are specified in stack-snapshot.yaml. +stack_snapshot( + name = "stackage", + local_snapshot = "//:stack-snapshot.yaml", + packages = [ + "Glob", + "HUnit", + "QuickCheck", + "aeson", + "aeson-pretty", + "algebraic-graphs", + "ansi-terminal", + "async", + "attoparsec", + "base", + "base64-bytestring", + "bazel-runfiles", + "bifunctors", + "bytestring", + "containers", + "deepseq", + "directory", + "directory-tree", + "doctest", + "filepath", + "foldl", + "fused-effects", + "fused-effects-exceptions", + "fused-effects-readline", + "gauge", + "generic-lens", + "generic-monoid", + "hashable", + "haskeline", + "hedgehog", + "hostname", + "hscolour", + "hspec", + "hspec-core", + "hspec-expectations", + "lens", + "lingo", + "neat-interpolation", + "network", + "network-uri", + "optparse-applicative", + "optparse-generic", + "parsers", + "pathtype", + "pretty-show", + "pretty-simple", + "prettyprinter", + "prettyprinter-ansi-terminal", + "process", + "proto-lens", + "proto-lens-jsonpb", + "proto-lens-runtime", + "raw-strings-qq", + "recursion-schemes", + "reducers", + "resourcet", + "safe-exceptions", + "scientific", + "semigroupoids", + "semilattices", + "split", + "stm-chans", + "streaming", + "tasty", + "tasty-golden", + "tasty-hedgehog", + "tasty-hspec", + "tasty-hunit", + "template-haskell", + "temporary", + "terminal-size", + "text", + "time", + "transformers", + "tree-sitter", + "trifecta", + "unix", + "unordered-containers", + "vector", + "yaml", + ], + stack_snapshot_json = "//:stackage_snapshot.json", + tools = ["@happy"], + vendored_packages = { + "tree-sitter-{}".format(name): "@tree-sitter-{name}//:tree-sitter-{name}".format(name = name) + for name in [ + "go", + "java", + "json", + "php", + "python", + "ql", + "ruby", + "rust", + "tsx", + "typescript", + ] + }, +) + +# Download Happy and make it accessible to the build process. +http_archive( + name = "happy", + build_file_content = """ +load("@rules_haskell//haskell:cabal.bzl", "haskell_cabal_binary") +haskell_cabal_binary(name = "happy", srcs = glob(["**"]), visibility = ["//visibility:public"]) + """, + sha256 = "fb9a23e41401711a3b288f93cf0a66db9f97da1ce32ec4fffea4b78a0daeb40f", + strip_prefix = "happy-1.19.12", + urls = ["http://hackage.haskell.org/package/happy-1.19.12/happy-1.19.12.tar.gz"], +) + +# Pin the various tree-sitter packages so that we can access their +# node-types.json files. + +load( + "//:build/common.bzl", + "tree_sitter_node_types_hackage", +) + +tree_sitter_node_types_hackage( + name = "tree-sitter-go", + sha256 = "72a1d3bdb2883ace3f2de3a0f754c680908489e984503f1a66243ad74dc2887e", + version = "0.5.0.2", +) + +tree_sitter_node_types_hackage( + name = "tree-sitter-python", + sha256 = "f028c88eabbda9b9bb67895922d753a12ddda83fb917748e0e407e50616b51ae", + version = "0.9.0.3", +) + +tree_sitter_node_types_hackage( + name = "tree-sitter-php", + sha256 = "70fd9f5cc429fa2b59adaa86853fb111f733889f0b2996328efd885903d7ce16", + version = "0.5.0.1", +) + +tree_sitter_node_types_hackage( + name = "tree-sitter-java", + sha256 = "569fa1240cdb7db8436201962933c97dd2c502ed65bd4788880238201c67a1c6", + version = "0.7.0.2", +) + +tree_sitter_node_types_hackage( + name = "tree-sitter-json", + sha256 = "8fbc478268849c16bc7ff85dd6634bb849400bda98575fe26681224a640b9e0a", + version = "0.7.0.2", +) + +tree_sitter_node_types_hackage( + name = "tree-sitter-typescript", + node_types_path = ":vendor/tree-sitter-typescript/typescript/src/node-types.json", + sha256 = "d1cd258e5c83d557ab3481e08c2e8c29ee689e2a9de89b6f72c12080f48c9c62", + version = "0.5.0.2", +) + +tree_sitter_node_types_hackage( + name = "tree-sitter-tsx", + node_types_path = ":vendor/tree-sitter-typescript/tsx/src/node-types.json", + sha256 = "20115194b7e87d53e8ad42a9d5ef212186040e543ccf295135b1342ec6b12447", + version = "0.5.0.2", +) + +tree_sitter_node_types_hackage( + name = "tree-sitter-ruby", + sha256 = "b6bb1fcb23e283f28af2d1ac9444ed63bb7b9f396034d13db62553d998cefc24", + version = "0.5.0.3", +) + +tree_sitter_node_types_hackage( + name = "tree-sitter-ql", + sha256 = "d15eff87a292ec4559295676afbf0e5a763f5f7e7636411933109880c3fd5c5d", + version = "0.1.0.4", +) + +tree_sitter_node_types_hackage( + name = "tree-sitter-rust", + sha256 = "00bc04a31b5c9b0f9b419074238996ee4aadba342e68071ec516077b495e0d41", + version = "0.1.0.1", +) + +load("//:build/example_repos.bzl", "declare_example_repos") + +declare_example_repos() diff --git a/bench/evaluation/Main.hs b/bench/evaluation/Main.hs deleted file mode 100644 index 2eb1228229..0000000000 --- a/bench/evaluation/Main.hs +++ /dev/null @@ -1,50 +0,0 @@ -{-# LANGUAGE DataKinds, FlexibleContexts, TypeFamilies, TypeApplications #-} - -module Main where - -import Control.Monad -import Criterion.Main -import qualified Data.Language as Language -import Data.Proxy -import Parsing.Parser -import Semantic.Config (defaultOptions) -import Semantic.Task (withOptions) -import Semantic.Util hiding (evalRubyProject, evalPythonProject, evaluateProject) - --- Duplicating this stuff from Util to shut off the logging -evalRubyProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.Ruby) rubyParser -evalPythonProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.Python) pythonParser - -evaluateProject proxy parser paths = withOptions defaultOptions $ \ config logger statter -> - evaluateProject' (TaskConfig config logger statter) proxy parser paths - --- We use `fmap show` to ensure that all the parts of the result of evaluation are --- evaluated themselves. While an NFData instance is the most morally correct way --- to do this, I'm reluctant to add NFData instances to every single datatype in the --- projectβ€”coercing the result into a string will suffice, though it throws off the --- memory allocation results a bit. -pyEval :: FilePath -> Benchmarkable -pyEval p = nfIO . evalPythonProject $ ["bench/bench-fixtures/python/" <> p] - -rbEval :: FilePath -> Benchmarkable -rbEval p = nfIO . evalRubyProject $ ["bench/bench-fixtures/ruby/" <> p] - -pyCall :: FilePath -> Benchmarkable -pyCall p = nfIO $ callGraphProject pythonParser (Proxy @'Language.Python) defaultOptions ["bench/bench-fixtures/python/" <> p] - -rbCall :: FilePath -> Benchmarkable -rbCall p = nfIO $ callGraphProject rubyParser (Proxy @'Language.Ruby) defaultOptions ["bench/bench-fixtures/ruby/" <> p] - -main :: IO () -main = defaultMain - [ bgroup "python" [ bench "assignment" $ pyEval "simple-assignment.py" - , bench "function def" $ pyEval "function-definition.py" - , bench "if + function calls" $ pyEval "if-statement-functions.py" - , bench "call graph" $ pyCall "if-statement-functions.py" - ] - , bgroup "ruby" [ bench "assignment" $ rbEval "simple-assignment.rb" - , bench "function def" $ rbEval "function-definition.rb" - , bench "if + function calls" $ rbEval "if-statement-functions.rb" - , bench "call graph" $ rbCall "if-statement-functions.rb" - ] - ] diff --git a/build/common.bzl b/build/common.bzl new file mode 100644 index 0000000000..46663bcbca --- /dev/null +++ b/build/common.bzl @@ -0,0 +1,163 @@ +# This file lets us share warnings and such across the project + +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_library", + "haskell_test", +) +load( + "@bazel_tools//tools/build_defs/repo:http.bzl", + "http_archive", +) + +DEVELOPMENT_GHC_FLAGS = ["-O0"] +RELEASE_GHC_FLAGS = ["-O1"] + +GHC_FLAGS = [ + "-v1", + "-j8", + "-fdiagnostics-color=always", + "-ferror-spans", + "-Weverything", + "-Wno-missing-local-signatures", + "-Wno-missing-import-lists", + "-Wno-implicit-prelude", + "-Wno-safe", + "-Wno-unsafe", + "-Wno-name-shadowing", + "-Wno-monomorphism-restriction", + "-Wno-missed-specialisations", + "-Wno-all-missed-specialisations", + "-Wno-star-is-type", + "-Wno-missing-deriving-strategies", + "-DBAZEL_BUILD=1", + "-Wno-unused-packages", + "-Wno-prepositive-qualified-module", + "-Wno-missing-safe-haskell-mode", +] + select( + { + "//:release": RELEASE_GHC_FLAGS, + "//:development": DEVELOPMENT_GHC_FLAGS, + "//:debug": DEVELOPMENT_GHC_FLAGS, + }, +) + +EXECUTABLE_FLAGS = [ + "-threaded", +] + +# Now we start declaring macros to help us with common patterns +# such as pulling tree-sitter grammars from releases/git hashes. + +_tree_sitter_language_build = """ +package(default_visibility = ["//visibility:public"]) + +load("@rules_haskell//haskell:cabal.bzl", "haskell_cabal_library") +load("@stackage//:packages.bzl", "packages") +exports_files(glob(["**/node-types.json"])) + +alias( + name = "src/node-types.json", + actual = "{node_types_path}", +) + +haskell_cabal_library( + name = "{name}", + version = "{version}", + srcs = glob(["**"]), + deps = packages["{name}"].deps, + visibility = ["//visibility:public"], +) + +filegroup(name = "corpus", srcs = glob(["**/corpus/*.txt"])) +""" + +def tree_sitter_node_types_hackage(name, version, sha256, node_types_path = ""): + """Download a tree-sitter language package from Hackage and build/expose its library and corpus.""" + + if node_types_path == "": + node_types_path = ":vendor/{}/src/node-types.json".format(name) + + info = { + "name": name, + "version": version, + "node_types_path": node_types_path, + } + http_archive( + name = name, + build_file_content = _tree_sitter_language_build.format(**info), + urls = ["https://hackage.haskell.org/package/{name}-{version}/{name}-{version}.tar.gz".format(**info)], + strip_prefix = "{name}-{version}".format(**info), + sha256 = sha256, + ) + +# These macros declare library targets inside the language packages. + +def semantic_language_library(language, name, srcs, ts_package = "", nodetypes = ""): + """Create a new library target with dependencies needed for a language-AST project.""" + if nodetypes == "": + nodetypes = "@tree-sitter-{}//:src/node-types.json".format(language) + if ts_package == "": + ts_package = language + haskell_library( + name = name, + # We can't use Template Haskell to find out the location of the + # node-types.json files, but we can pass it in as a preprocessor + # directive. + compiler_flags = GHC_FLAGS + [ + '-DNODE_TYPES_PATH="../../../../$(rootpath {})"'.format(nodetypes), + ], + repl_ghci_args = GHC_FLAGS + [ + '-DNODE_TYPES_PATH="../../../../$(rootpath {})"'.format(nodetypes), + ], + srcs = srcs, + extra_srcs = [nodetypes, "@tree-sitter-{}//:corpus".format(ts_package)], + deps = [ + "//:base", + "//:containers", + "//:template-haskell", + "//:text", + "//semantic-analysis", + "//semantic-ast", + "//semantic-proto", + "//semantic-scope-graph", + "//semantic-source", + "//semantic-tags", + "@stackage//:aeson", + "@stackage//:algebraic-graphs", + "@stackage//:fused-effects", + "@stackage//:generic-lens", + "@stackage//:hashable", + "@stackage//:lens", + "@stackage//:pathtype", + "@stackage//:semilattices", + "@stackage//:tree-sitter", + "@stackage//:tree-sitter-" + language, + ], + ) + +def semantic_language_parsing_test(language, semantic_package = "", ts_package = ""): + if semantic_package == "": + semantic_package = language + if ts_package == "": + ts_package = language + haskell_test( + name = "test", + srcs = ["test/PreciseTest.hs"], + data = ["@tree-sitter-{}//:corpus".format(ts_package)], + tags = ["language-test"], + deps = [ + ":semantic-{}".format(language), + "//:base", + "//:bytestring", + "//:text", + "//semantic-ast", + "@stackage//:bazel-runfiles", + "@stackage//:hedgehog", + "@stackage//:pathtype", + "@stackage//:tasty", + "@stackage//:tasty-hedgehog", + "@stackage//:tasty-hunit", + "@stackage//:tree-sitter-" + semantic_package, + ], + ) diff --git a/build/example_repos.bzl b/build/example_repos.bzl new file mode 100644 index 0000000000..c006fcad5f --- /dev/null +++ b/build/example_repos.bzl @@ -0,0 +1,135 @@ +load( + "@bazel_tools//tools/build_defs/repo:http.bzl", + "http_archive", +) + +_all_example_repos = { + "numpy": { + "data": [ + "**/*.py", + ], + "commit": "058851c5cfc98f50f11237b1c13d77cfd1f40475", + "repo": "numpy/numpy", + "sha256": "8e60c567cbab3309afa9508ee61dfd207089ebb0056214fe60e863d81e098824", + }, + "python": { + "data": [ + "**/*.py", + ], + "commit": "c6be53e1c43f870f5364eef1499ee1b411c966fb", + "repo": "thealgorithms/python", + "prefix": "Python", + "sha256": "bef087151bea1e479701d0ceed831809c1b916f513752dee914e9c7876b46ea9", + "excludes": [ + "**/data structures/*", + "**/binary tree/*", + "**/graphs/*", + "**/Random Forest*/*", + "**/* */*", + ], + }, + "flask": { + "data": [ + "**/*.py", + ], + "commit": "0b5b4a66ef99c8b91569dd9b9b34911834689d3f", + "repo": "pallets/flask", + "sha256": "224d406f11b13cc8e4c7defd8dc94e0df957c1c90977172cfaa2ee88d8f85e77", + }, + "httpie": { + "data": [ + "**/*.py", + ], + "commit": "358342d1c915d6462a080a77aefbb20166d0bd5d", + "repo": "jakubroztocil/httpie", + "sha256": "2b3172369954d883a2a609dc6bc34a944ce9817afb14733d87f208a40529899c", + }, + "keras": { + "data": [ + "**/*.py", + ], + "commit": "e59570ae26670f788d6c649191031e4a8824f955", + "repo": "keras-team/keras", + "sha256": "2bda5bfd2a2b43d9f4d191e4ed980740429bb86d75e16355b1d33faf9d974ffd", + }, + "requests": { + "data": [ + "**/*.py", + ], + "commit": "64bde6582d9b49e9345d9b8df16aaa26dc372d13", + "sha256": "8f9466ad314b2741c826b164b46bcedb260d424f717fd9553fea5164f493bd20", + "repo": "requests/requests", + }, + "scikit-learn": { + "data": [ + "**/*.py", + ], + "commit": "d0f63a760d9993a7f68cfc5e1a075700d67c53d3", + "repo": "scikit-learn/scikit-learn", + "sha256": "4f337b87d45cabd7db9cd3883fd5168accad7f78bc48df3ae633832b4d0f30d0", + }, + "scrapy": { + "data": [ + "**/*.py", + ], + "commit": "65d631329a1434ec013f24341e4b8520241aec70", + "sha256": "27b2dc9b1a55c356eeec651c76fe82be082c0e8980b2e4d9b99a4f63c733685b", + "repo": "scrapy/scrapy", + }, + "pytorch": { + "data": [ + "**/*.py", + ], + "commit": "c865d46736db4afff51690a712e35ed8e3899490", + "repo": "pytorch/pytorch", + "sha256": "7b54b7a3c40aaf68bb9bd7dcc509389d29c5c37241f29c003bd04cd0dafb60ce", + }, + "certbot": { + "data": [ + "**/*.py", + ], + "commit": "bb8222200a8cbd39a3ce9584ce6dfed6c5d05228", + "sha256": "3477f4c04897f7874249e6362567384246f409c62e1ff18c4d6fa54813f484c2", + "repo": "certbot/certbot", + }, + "spec": { + "data": [ + "**/*.rb", + ], + "commit": "c3e6b9017926f44a76e2b966c4dd35fa84c4cd3b", + "repo": "ruby/spec", + "sha256": "33206954ff6fdbf5b872298efc2697c18ad5371eb55007d54f95c08ec7f46bb4", + }, + "desktop": { + "data": [ + "**/*.[tj]s", + ], + "commit": "d1324f56d02dd9afca5d2e9da545905a7d41d671", + "repo": "desktop/desktop", + "sha256": "cfd1c6d313ff4e756b59da83f3f7799e021e0d0fe94ee4a93638c9b1aa19b5ca", + }, +} + +SEMANTIC_EXTERNAL_TEST_REPOSITORIES = ["@" + k + "//:src" for (k, v) in _all_example_repos.items()] + +def _example_repo(name, data, repo, commit, since = "", excludes = [], sha256 = "", prefix = ""): + if prefix == "": + prefix = name + + http_archive( + name = name, + build_file_content = """ +filegroup( + name = "src", + data = glob(include = {}, exclude={}), + visibility = ["//visibility:public"] +) +""".format(data, excludes), + strip_prefix = prefix + "-" + commit, + sha256 = sha256, + urls = ["https://github.com/{repo}/archive/{commit}.tar.gz".format(repo = repo, commit = commit)], + ) + +def declare_example_repos(): + for k, kwargs in _all_example_repos.items(): + _example_repo(name = k, **kwargs) diff --git a/cabal.project b/cabal.project index 7db9d1e8e2..cc95baa287 100644 --- a/cabal.project +++ b/cabal.project @@ -1,16 +1,20 @@ -packages: vendor/* vendor/haskell-tree-sitter/languages/* . semantic-core +-- ATTENTION: care must be taken to keep this file in sync with cabal.project.ci and script/ghci-flags. If you add a package here, add it there (and add a package stanza with ghc-options to enable errors in CI at the bottom of that file). -source-repository-package - type: git - location: https://github.com/joshvera/proto3-suite.git - tag: 83f3352f0c7c94ea091e6087f60692eda9991fae - -source-repository-package - type: git - location: https://github.com/joshvera/proto3-wire.git - tag: 84664e22f01beb67870368f1f88ada5d0ad01f56 - -source-repository-package - type: git - location: https://github.com/rewinfrey/hspec-expectations-pretty-diff - tag: 94af5871c24ba319f7f72fefa53c1a4d074c9a29 +-- Local packages +packages: semantic + semantic-analysis + semantic-ast + semantic-codeql + semantic-go + semantic-java + semantic-json + semantic-parse + semantic-php + semantic-proto + semantic-python + semantic-ruby + semantic-rust + semantic-scope-graph + semantic-tags + semantic-tsx + semantic-typescript diff --git a/cabal.project.ci b/cabal.project.ci new file mode 100644 index 0000000000..664045ba5a --- /dev/null +++ b/cabal.project.ci @@ -0,0 +1,63 @@ +-- ATTENTION: care must be taken to keep this file in sync with cabal.project and script/ghci-flags. If you add a package here, add it there (and add a package stanza with ghc-options to enable errors in CI at the bottom of this file). + +-- Local packages +packages: semantic + semantic-analysis + semantic-ast + semantic-codeql + semantic-go + semantic-java + semantic-json + semantic-parse + semantic-php + semantic-proto + semantic-python + semantic-ruby + semantic-rust + semantic-scope-graph + semantic-tags + semantic-tsx + semantic-typescript + +-- Treat warnings as errors for CI builds +package semantic + ghc-options: -Werror + +package semantic-analysis + ghc-options: -Werror + +package semantic-ast + ghc-options: -Werror + +package semantic-codeql + ghc-options: -Werror + +package semantic-go + ghc-options: -Werror + +package semantic-java + ghc-options: -Werror + +package semantic-json + ghc-options: -Werror + +package semantic-parse + ghc-options: -Werror + +package semantic-python + ghc-options: -Werror + +package semantic-ruby + ghc-options: -Werror + +package semantic-scope-graph + ghc-options: -Werror + +package semantic-tags + ghc-options: -Werror + +package semantic-tsx + ghc-options: -Werror + +package semantic-typescript + ghc-options: -Werror diff --git a/docs/adding-new-languages.md b/docs/adding-new-languages.md new file mode 100644 index 0000000000..a0baefda7d --- /dev/null +++ b/docs/adding-new-languages.md @@ -0,0 +1,33 @@ +# Adding new languages to Semantic + +This document outlines the process for adding a new language to Semantic. Though the Semantic authors have architected the library such that adding new languages and syntax [requires no changes to existing code](https://en.wikipedia.org/wiki/Expression_problem), adding support for a new language is a nontrivial amount of work. Those willing to take the plunge will probably need a degree of Haskell experience. + +Note that we recently transitioned the system to auto-generate strongly-typed ASTs using [CodeGen](https://github.com/github/semantic/blob/master/docs/codegen.md), our new language support library. More information is provided below in the [FAQs](#FAQs). + +## The procedure + +1. **Find or write a [tree-sitter](https://tree-sitter.github.io) parser for your language.** The tree-sitter [organization page](https://github.com/tree-sitter) has a number of parsers beyond those we currently support in Semantic; look there first to make sure you're not duplicating work. The tree-sitter [documentation on creating parsers](http://tree-sitter.github.io/tree-sitter/creating-parsers) provides an exhaustive look at the process of developing and debugging tree-sitter parsers. Though we do not support grammars written with other toolkits such as [ANTLR](https://www.antlr.org), translating an ANTLR or other BNF-style grammar into a tree-sitter grammar is usually straightforward. +2. **Create a Haskell library providing an interface to that C source.** The [`haskell-tree-sitter`](https://github.com/tree-sitter/haskell-tree-sitter) repository provides a Cabal package for each supported language. You can find an example of a pull request to add such a package [here](https://github.com/tree-sitter/haskell-tree-sitter/pull/276/files), and a file providing: + - A bridged (via the FFI) reference to the toplevel parser in the generated file must be provided ([example](https://github.com/tree-sitter/haskell-tree-sitter/blob/master/tree-sitter-json/TreeSitter/JSON.hs#L11)). + - A way to retrieve [`tree-sitter` data](https://github.com/tree-sitter/haskell-tree-sitter/blob/master/tree-sitter-json/TreeSitter/JSON.hs#L13-L14) used to auto-generate syntax datatypes using the following steps. During parser generation, tree-sitter produces a `node-types.json` file that captures the structure of a language's grammar. The autogeneration described below in Step 4 derives datatypes based on this structural representation. The `node-types.json` is a data file in `haskell-tree-sitter` that gets installed with the package. The function `getNodeTypesPath :: IO FilePath` is defined to access in the contents of this file, using `getDataFileName :: FilePath -> IO FilePath`, which is defined in the autogenerated `Paths_` module. +3. **Create a Haskell library in Semantic to auto-generate precise ASTs.** Create a `semantic-[LANGUAGE]` package. This is an example of [`semantic-python`](https://github.com/github/semantic/tree/master/semantic-python)). Each package needs to provide the following API surfaces: + - `Language.[LANGUAGE].AST` - Derives Haskell datatypes from a language and its `node-types.json` file ([example](https://github.com/github/semantic/blob/master/semantic-python/src/Language/Python/AST.hs)). + - `Language.[LANGUAGE].Grammar` - Provides statically-known rules corresponding to symbols in the grammar for each syntax node, generated with the `mkStaticallyKnownRuleGrammarData` Template Haskell splice ([example](https://github.com/github/semantic/blob/master/semantic-python/src/Language/Python/Grammar.hs)). + - `Language.[LANGUAGE]` - Semantic functionality for programs in a language ([example](https://github.com/github/semantic/blob/master/semantic-python/src/Language/Python.hs)). + - `Language.[LANGUAGE].Tags` - Computes tags for code nav definitions and references found in source ([example](https://github.com/github/semantic/blob/master/semantic-python/src/Language/Python/Tags.hs)). +5. **Add tests for precise ASTs, tagging and graphing, and evaluating code written in that language.** Because tree-sitter grammars often change, we require extensive testing so as to avoid the unhappy situation of bitrotted languages that break as soon as a new grammar comes down the line. Here are examples of tests for [precise ASTs](https://github.com/github/semantic/blob/master/semantic-python/test/PreciseTest.hs), [tagging](https://github.com/github/semantic/blob/master/test/Tags/Spec.hs), and [graphing](https://github.com/github/semantic/blob/master/semantic-python/test-graphing/GraphTest.hs). + +To summarize, each interaction made possible by the Semantic CLI corresponds to one (or more) of the above steps: + +| Step | Interaction | +|------|-----------------| +| 1, 2 | `ts-parse` | +| 3, 4 | `parse`, `diff` | +| 5 | `graph` | + + +# FAQs + +**This sounds hard.** You're right! It is currently a lot of work: just because the Semantic architecture is extensible in the expression-problem manner does not mean that adding new support is trivial. + +**What recent changes have been made?** The Semantic authors have introduced a new architecture for language support and parsing, one that dispenses with the [assignment](https://github.com/github/semantic/blob/master/docs/assignment.md) step altogether. The `semantic-ast` package generates Haskell data types from tree-sitter grammars. As compared with the [historic process]() used to add new languages, these changes entire obviate the process of 1) assigning types into an open-union of syntax functors, and 2) implementing `Evaluatable` instances and adding value effects to describe the control flow of your language. diff --git a/docs/assignment.md b/docs/assignment.md deleted file mode 100644 index 5e9908f447..0000000000 --- a/docs/assignment.md +++ /dev/null @@ -1,133 +0,0 @@ -### What is Assignment? - -"Assignment" refers to the part of our system that parses parse trees. The step preceding assignment uses [`tree-sitter`](https://github.com/tree-sitter/tree-sitter) to parse source code and output rose trees labeled with symbols in the [language's grammar](https://github.com/github/semantic/blob/master/docs/grammar-development-guide.md) and source locations (represented as byte range and span). Assignment is a second layer of parsing required to get these ASTs in a shape appropriate for our Haskell project and to support the types of analyses we'd like to perform further along. Assignment represents a partial map from AST nodes onto another structure, typically terms. - -We do this for a few reasons: -1. **Generalization:** this approach lets us reason about all languages in a standardized way. We can build necessary machinery to define the type of each specific language independently, while retaining the ability to share computations on the overlapping constructs (such as `if` statements). -2. **Type system:** Assignment gives us a way to represent the semantics of a language such that we know its behavior at runtime. Dynamic languages such as Ruby or JavaScript have looser rules which produce unpredictable results or may perform implicit type conversion at runtime. Having a finite list of items in syntax trees gives us a way to place a hard limitation on expected behavior. - -### Relevant files - -- [`Language.InsertSomeLanguage.Assignment`](https://github.com/github/semantic/tree/master/src/Language) -- [`Assigning.Assignment`](https://github.com/github/semantic/blob/master/src/Assigning/Assignment.hs) -- [`Data.Syntax`](https://github.com/github/semantic/blob/master/src/Data/Syntax.hs) -- [`Data.Syntax.SomeSubsetOfLanguageFeatures`](https://github.com/github/semantic/tree/master/src/Data/Syntax) -- [`Parsing.Parser`](https://github.com/github/semantic/blob/master/src/Parsing/Parser.hs) - -#### Relevant ghci commands - -- Assignment AST: `quieterm <$> parseFile javaParser "/example.java"` -- Tree-sitter AST: `fmap nodeSymbol <$> parseFile javaASTParser "/example.java"` - -### How we construct an assignment - -Assignments for supported language are defined in a file that is named something like this: `Language.InsertSomeLanguage.Assignment`. Working in this file is akin to writing another grammar, one that parses the tree-sitter parse tree instead of source code. - -Assignments typically take on this pattern: -```Haskell -someLanguageConstruct :: Assignment -someLanguageConstruct = makeTerm <$> symbol NodeNameOfSymbolToMatch <*> children (SyntaxDataType <$> field1 <*> field2) -``` - -The building blocks that compose this DSL come from: `Assigning.Assignment`, explained below. - -### The underlying machinery of `Assigning.Assignment` - -Assignments are matched based on symbol, sequence and hierarchy. This gives us specificity (ex., in `@x = y@`, both `@x@` and `@y@` might have the same symbol, `@Identifier@`, but we can remove the possibility of doubt by assigning the left hand side to a variable declaration and the right hand side to a variable reference). - -#### Assignments can be any of the following primitive rules -`Assigning.Assignment` gives us the primitive rules: -- [`symbol`](symbol) -- [`location`](location) -- [`source`](source) -- [`children`](children) -- [`Alternative` instance](alternative) -- [`Applicative` instance](applicative) - -#### `symbol`: -- Produces the current node's location by matching against a specific symbol in the source language's grammar. -- Succeeds iff a) a current node exists, and b) its symbol is equal to the argument symbol. This rule fails if no node is found, for example at the end of any branch once we've matched all nodes. -- Matching a `symbol` rule does not advance past the current node, meaning you can match against a symbol and also match against the node's `children`. This also means some care must be taken, as repeating a symbol with `many` or `some` will never advance past the current node and could infinitely loop. - -#### `location`: -- Produces the current node's location (byte Range and Span) -- Always succeeds. If there is no current node (i.e. if matching has advanced past the root node or past the last child node when operating within a `children` rule), the location is instead the end of the most recently matched node, specified as a zero-width Range and Span. `location` rules don't advance past the current node, meaning that you can both match a node's `location` and other properties. Dissimilar to `source` which requires we match a nodeβ€”the `location` rule is only used for bookkeeping and thus does not place that hard expectation. - -#### `source`: -- Produces a node's source as a ByteString. -- `source` rules succeed whenever a current node exists (i.e. matching has not advanced past the root node or past the last child node when operating within a `children` rule). -- `source` is intended to match leaf nodes such as comments. `source` rules advance past the current node. - -#### `children`: -- `children` rules apply their argument (an assignment) to the children of the current node, succeeding iff a) a current node exists, b) the argument assignment matches the children, and c) there are no (regular) nodes left over (the distinction between nodes is given below in the [Matching tokens](matching-tokens) section), producing the result of matching the argument assignment against the children. - - - -#### `Alternative` instance: -- Allows you to define the way you expect to get a `ByteString`, failing if it doesn't meet the standards you've defined. _Insert example_ -- Allows you to accept 0 or more alternativesβ€”0 meaning accept nothing and failing on the choice between them. `empty` assignments always fail. This can be used (in combination with the 'Monad' instance) to, for example, fail if a `source` assignment produces an ill-formatted ByteString. However, see below re: committed choice. - -#### `Applicative` instance: -- `pure` (or via the 'Monad' instance, `return`) assignments always succeed, producing the passed value. They do not advance past the current node. In combination with the `Alternative` instance, `pure` can provide default values when optional syntax is not present in the AST. - -#### Ways to combine assignments - -1. The `Functor` instance maps values from the AST (`Location`, `ByteString`, etc.) onto another structure. - -2. The `Applicative` instance assigns sequences of (sibling) AST nodes in order, as well as providing `pure` assignments. - -3. The `Alternative` instance chooses between a set of assignments, as well as providing `empty` assignments (see above). See below re: committed choice for best practices for efficiency & error reporting when it comes to assigning multiple alternatives. Most high-level assignments (e.g. β€œdeclaration” or β€œstatement” assignments) consist of choices among two or more `Applicative` chains of assignments, mirroring the structure of the parser’s choices. The `Alternative` instance also enables repetitions via the 'many' (β‰₯ 0 repetitions) and 'some' (β‰₯ 1 repetition) methods. Finally, the 'optional' function uses the 'Alternative' instance to assign a value in 'Maybe', succeeding with 'Nothing' when unmatched. - -4. The `Monad` instance allows assignments to depend on the results of earlier assignments. In general, most assignments should not be written using the `Monad` instance; however, some specific situations require it, e.g. assigning 'x += y' to be equivalent to 'x = x + y'. -_need example of this--I thought the monad instance allows us to chain things together such that we don't have to use do notation_ - -#### Assignment best practices - -Because of their flexibility, the same assignment can often be written in multiple different ways. The following best practices should ensure efficient assignment with clear error messages for ill-formed AST. - -#### Committed choice - -Assignments can represent alternatives as either _committed_ or _uncommitted_ choices, both written with `<|>`. β€œCommitted” in this context means that a failure in one of the alternatives will not result in backtracking followed by an attempt of one of the other alternatives; thus, committed choice is more efficient. (By the same token, it enables much better error messages since backtracking erases most of the relevant context.) Committed choices are constructed via the following rules: - -1. `empty` is dropped from choices. -2. `symbol` rules construct a committed choice (with only a single alternative). -3. `fmap` (and by extension `<$>` and `<$`) of a committed choice is a committed choice. -4. `<*>` (and by extension `*>` and `<*`) with a committed choice on the left is a committed choice. -5. `>>=` (and by extension `>>`, `=<<`, and `<<`) of a committed choice is a committed choice. It may be helpful to think of this and the above rule for `<*>` as β€œsequences starting with committed choices remain committed choices.” -6. `<|>` of two committed choices is a committed choice. - -Finally, if a given choice is not a committed choice, it is an uncommitted choice. - -Given the above, it is a good idea to always start an assignment for a given piece of syntax with either a `symbol` rule or an `fmap` over a `symbol` rule. When assigning multiple pieces of syntax, place any known uncommitted choices at the (rightmost) end of the chain; `<|>` is left-associative, so this guarantees that you’re adding at most one uncommitted choice on top of the ones already present. - -#### Matching tokens - -AST symbols are classified by their 'symbolType' as either 'Regular', 'Anonymous', or 'Auxiliary'. 'Regular' is for the symbols of explicitly named productions in the grammar; 'Anonymous' is for unnamed productions of content such as tokens. 'Auxiliary' never appears in ASTs. Most of the time, assignments are only concerned with the named productions, and thus will be using 'Regular' symbols. Therefore, when matching a committed choice of all-'Regular' symbols, nodes with 'Anonymous' symbols will be skipped. However, in some cases grammars don’t provide a named symbol for e.g. every kind of infix operator, and thus the only way to differentiate between them is by means of a `symbol` rule for an 'Anonymous' `token`. In these cases, and before every other kind of assignment, the 'Anonymous' nodes will not be skipped so that matching can succeed. - -This means that in addition to the rule of thumb for committed choices (see above), it's a good idea to try to match 'Regular' symbols up front, and only match 'Anonymous' ones in the middle of a chain. That will ensure that you don’t have to make redundant effort to explicitly skip 'Anonymous' nodes ahead of multiple alternatives, and can instead rely on them being automatically skipped except when explicitly required. - -### `Data.Syntax` - -This is the file from where we get combinators (`makeTerm`, `contextualize`, `emptyTerm`, `handleError`, `infixContext`, `makeTerm`, `makeTerm'`, `makeTerm''`, `makeTerm1`, `parseError`, `postContextualize`). - -#### The difference between `makeTerm`, `makeTerm'` and `makeTerm1` -The `makeTerm` family of functions all construct terms whose `Range` and `Span` are at least as large as the union of all of their child terms’ Ranges and Spans. In the case of makeTerm and makeTerm', it also includes the Range and Span matched by their first argument, typically produced by a `symbol` rule. By way of contrast, `makeTerm1` is named by analogy with `foldr1`, and only takes a single argument, which is expected to be a non-empty piece of syntax, i.e. a piece of syntax which has one or more child terms; the resulting term’s Range and Span are then precisely the union of the child terms’. - - - -### `Data.Syntax.SomeSubsetOfLanguageFeatures` - -These are files where data types for syntaxes are defined for use in your assignment. - - - -### `Parsing.Parser` - -Contains data constructors required to produce ASTs. - -- `ASTParser` - parser producing AST using tree-sitter language grammar. -- `AssignmentParser` - parser producing Γ  la carte term given an `AST`-producing parser and an `Assignment` onto `Term`s in some syntax type. -- `javaParser` - parses according to what's defined in `Language.Java.Assignment`. - - diff --git a/docs/build.md b/docs/build.md new file mode 100644 index 0000000000..28151f0c23 --- /dev/null +++ b/docs/build.md @@ -0,0 +1,73 @@ +# Bazel build instructions + +The Semantic project supports builds with the Bazel build system. This is unconventionalβ€”most Haskell projects either use Cabal or Stack. However, for a project of Semantic's size, Bazel has many advantages. Some reasons you might want to use Bazel: + +* Bazel uses content-addressed hashing and reproducible builds to provide sophisticated caching. Situations where Cabal invalidates caches can result in cascading build requirements, causing many rebuilds of the language syntax packages. +* Bazel's tooling is (on Emacs with lsp-mode and lsp-haskell) more reliable. +* Bazel gets Haskell dependencies from Stackage LTS versions, so we avoid the rebuilds associated with living on the latest Hackage snapshot. + +## How do I get started? + +Assuming you're on macOS, run the script located at ~script/bootstrap-bazel~. This uses Homebrew to install Bazel and creates the `.bazel-cache` directory. + +The first time you run `bazel build`, it'll take some time, as Bazel will compile all of Stackage. Fear not: you won't have to do this again. + +## `cabal` β†’ `bazel` cheatsheet + +| Operation | `cabal` | `bazel` | +|------------------------------|-------------------------------------|-----------------------------------------------------| +| Build all | `cabal build all` | `bazel build //...` | +| Build `TARGET` library | `cabal build TARGET:lib` | `bazel build //TARGET` | +| Build semantic executable | `cabal build semantic:exe:semantic` | `bazel build //semantic:exe` | +| Build/run executable | `cabal run semantic -- ARGS` | `bazel run //semantic:exe -- ARGS` | +| Load REPL component | `script/ghci` and `:load` | `bazel build //TARGET@repl` | +| Run tests | `cabal test all` | `bazel test //...` | +| Build with optimizations | `cabal build --flags="+release"` | `bazel build -c opt //...` | +| Run all languages' AST tests | ETOOLONGTOWRITE | `bazel test --test_tag_filters=language-test //...` | + +## Adding a new dependency + +Here's a breakdown of how to add a new package. + +1. Make sure it's present in [Stackage LTS 13.15](https://www.stackage.org/lts-13.15). If not, add the package (versioned exactly) to the `stack-snapshot.yaml` file. +2. Make sure it's linked into the `WORKSPACE` file, in the `stack_snapshot` call. +3. Make sure it's present in your target's `deps` field. + +If this seems complicated, don't worry: most of the time you'll be able to skip this first point, and you'll often be able to skip the second. + +## Things to know + +1. **Don't generally run `bazel clean`**. Since Bazel builds are reproducible, there's very little reason to clean, unless somehow your whole cache got irrevocably corrupted. +2. **You can load a REPL for any target by appending `@repl`.** (with the exception of the language packages, due to [this](https://github.com/tweag/rules_haskell/issues/1377)). +3. **Some packages come with GHC and are not loaded from Stackage**. These include `base`, `containers`, and [others](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/8.10.1-notes.html?highlight=bytestring#included-libraries). To depend on those packages, you use `//:base`, `//:containers`, etc. They are specified in the `BAZEL.build` at the project root. You probably won't need to add any more. +4. **Getting weird errors from the C compiler?** Try setting `export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1` in your `.profile` or whatnot. + + +## Quick reference links + +* **Bazel manual**: https://docs.bazel.build/versions/3.3.0/bazel-overview.html +* **`rules_haskell` manual**: https://rules-haskell.readthedocs.io +* **`rules_haskell` API docs**: https://api.haskell.build + +## Conventions + +We give library targets the same name as their subproject. Test targets are called `test`, and executable targets are `exe`. + +The default `.bazelrc` file imports a `.bazelrc.local` file if it's present; use that for any Bazel customizations you want. + +The variables that the scripts under `build/` export are SCREAMING_SNAKE_CASE. The functions are snake_case. + +## Shared variables + +* `GHC_FLAGS`: the standard set of Cabal flags that all targets should use. +* `EXECUTABLE_FLAGS`: ditto, but with executable-specific flags. + +## Custom rules + +We have two common custom rules, defined in `build/common.bzl`. The first, `tree_sitter_node_types_release`, uses the `http_archive` rule to download a specified tree-sitter grammar's `node-types.json` file. These calls declare new top-level targets, so they're only present in the top-level `WORKSPACE` file. The second, `semantic_language_library`, takes care of the boilerplate associated with declaring a target for a `semantic-LANG` language package (as these packages' contents are identical, their target declarations are almost identical). + +For the purposes of setting up the examples upon which the `parse-examples` test depends, we have code in `build/example_repos.bzl` which defines them, checks them out, and computes the set of target names. You shouldn't need to change or modify this, unless you're adding new repos. + +## Protips + +* `bazel build --output_filter=REGEXP` does what it says on the tin. diff --git a/docs/codegen.md b/docs/codegen.md new file mode 100644 index 0000000000..8fe62e2da1 --- /dev/null +++ b/docs/codegen.md @@ -0,0 +1,130 @@ +# CodeGen Documentation + +CodeGen is the process for auto-generating language-specific, strongly-typed ASTs to be used in Semantic. Since it is a critical component of Semantic's language support process, we recommend reading [these docs](https://github.com/github/semantic/blob/715971067634f677bff8619add6490e03bb1825e/docs/adding-new-languages.md) first, as they provide an overview of the pipeline CodeGen supports. + +## Table of Contents +- [CodeGen Pipeline](#codegen-pipeline) +- [Generating ASTs](#generating-asts) +- [Inspecting auto-generated datatypes](#inspecting-auto-generated-datatypes) +- [Tests](#tests) +- [Additional notes](#additional-notes) + +## CodeGen Pipeline + +The following diagram outlines the entire language support pipeline. + +![image](https://user-images.githubusercontent.com/875834/80392707-801e9980-887d-11ea-9c95-e004bbe04be0.png) + +1. **Ingest source code.** The input to our system is blob data on GitHub. +2. **Write and generate tree-sitter grammar.** During parser generation, tree-sitter produces a `node-types.json` file that captures the structure of a language's grammar. Based on this JSON file, we're able to derive datatypes representing surface languages, and then use those datatypes to generically build ASTs. +3. **Provide interface to the C source.** The FFI provides us a way to bridge tree-sitter to our Haskell library. For more information, see our docs on [adding a new language](https://github.com/github/semantic/blob/master/docs/adding-new-languages.md). +4. **Automated AST generation via CodeGen APIs.** The CodeGen APIs live in the [`semantic-ast`](https://github.com/github/semantic/tree/715971067634f677bff8619add6490e03bb1825e/semantic-ast) package within [Semantic](https://github.com/github/semantic/tree/715971067634f677bff8619add6490e03bb1825e), and are explained as follows: + - [**Deserialize.**](https://github.com/github/semantic/blob/715971067634f677bff8619add6490e03bb1825e/semantic-ast/src/AST/Deserialize.hs) First, we deserialize the `node-types.json` file for a given language into the desired shape of datatypes via parsing capabilities afforded by the [Aeson](http://hackage.haskell.org/package/aeson) library. There are four distinct types represented in the node-types.json file takes on: sums, products, named leaves and anonymous leaves. + - [**Generate Syntax.**](https://github.com/github/semantic/blob/715971067634f677bff8619add6490e03bb1825e/semantic-ast/src/AST/GenerateSyntax.hs) We then use Template Haskell to auto-generate language-specific, strongly-typed datatypes that represent various language constructs at compile-time. This API exports the top-level function `astDeclarationsForLanguage` to auto-generate datatypes at compile-time, which is is invoked by a given language [AST](https://github.com/github/semantic/blob/715971067634f677bff8619add6490e03bb1825e/semantic-python/src/Language/Python/AST.hs) module. + - [**Unmarshal.**](https://github.com/github/semantic/blob/715971067634f677bff8619add6490e03bb1825e/semantic-ast/src/AST/Unmarshal.hs) Unmarshaling is the runtime process of iterating over tree-sitter’s parse trees using its tree cursor API, and producing Haskell ASTs for the relevant nodes. We parse source code from tree-sitter and unmarshal the data we get to build these ASTs generically. This file exports the top-level function `parseByteString`, which takes source code and a language as arguments, and produces an AST. +5. **Generate strongly-typed trees for a given language.** Finally, we create `semantic-[LANGUAGE]` packages (such as [this one](https://github.com/github/semantic/tree/715971067634f677bff8619add6490e03bb1825e/semantic-python) for Python). From here, we can call our CodeGen APIs to generate language-specific, strongly-typed trees via the following process: + 1. `Language.[LANGUAGE].AST` calls `astDeclarationsForLanguage`, passing in the relevant language as the argument, and using the `getNodeTypesPath` function to access the tree-sitter generated `node-types.json` file. + 2. This triggers the generation of the exhaustive syntax types contained by that language. + 3. `Language.[LANGUAGE]` provides the semantic functionality for Python programs, and calls the unmarshal API. + 4. Finally, the unmarshaling process takes the source code input, and auto-generates a tree using the syntax nodes generated in step 2. + +The remaining document provides more details on generating ASTs, inspecting datatypes, tests, and information on decisions pertaining to relevant APIs. + +## Generating ASTs + +To parse source code and produce ASTs locally: + +1. Load the REPL for a given language package: + +``` +cabal new-repl lib:semantic-python +``` + +2. Set language extensions, `OverloadedStrings` and `TypeApplications`, and import relevant modules, `AST.Unmarshal`, `Source.Range` and `Source.Span`: + +``` +:seti -XOverloadedStrings +:seti -XTypeApplications + +import Source.Span +import Source.Range +import AST.Unmarshal +``` + +3. You can now call `parseByteString`, passing in the desired language you wish to parse (in this case Python is given by the argument `Language.Python.Grammar.tree_sitter_python`), and the source code (in this case an integer `1`). Since the function is constrained by `(Unmarshal t, UnmarshalAnn a)`, you can use type applications to provide a top-level node `t`, an entry point into the tree, in addition to a polymorphic annotation `a` used to represent range and span. In this case, that top-level root node is `Module`, and the annotation is given by `Span` and `Range` as defined in the [semantic-source](https://github.com/github/semantic/tree/master/semantic-source/src/Source) package: + +``` +TS.parseByteString @Language.Python.AST.Module @(Source.Span.Span, Source.Range.Range) Language.Python.Grammar.tree_sitter_python "1" +``` + +This generates the following AST: + +``` +Right (Module {ann = (Span {start = Pos {line = 0, column = 0}, end = Pos {line = 0, column = 1}},Range {start = 0, end = 1}), extraChildren = [R1 (SimpleStatement {getSimpleStatement = L1 (R1 (R1 (L1 (ExpressionStatement {ann = (Span {start = Pos {line = 0, column = 0}, end = Pos {line = 0, column = 1}},Range {start = 0, end = 1}), extraChildren = L1 (L1 (Expression {getExpression = L1 (L1 (L1 (PrimaryExpression {getPrimaryExpression = R1 (L1 (L1 (L1 (Integer {ann = (Span {start = Pos {line = 0, column = 0}, end = Pos {line = 0, column = 1}},Range {start = 0, end = 1}), text = "1"}))))})))})) :| []}))))})]}) +``` + +`Unmarshal` defines both generic and non-generic classes. This is because generic behaviors are different than what we get non-generically, and in the case ofΒ `Β Maybe`,Β `[]`, and `NonEmpty`, we prefer non-generic behavior. SinceΒ `[]`Β is a sum, the generic behavior forΒ `:+:`Β would be invoked. The generic `:+:` expects repetitions represented in the parse tree as right-nested singly-linked lists (ex.,Β `(a (b (c (d…))))`), rather than as consecutive sibling nodes (ex.,Β `(a b c ...d)`, which is what our trees have. We want to match the latter. + +## Inspecting auto-generated datatypes + +Datatypes are derived from a language and its `node-types.json` file using the `GenerateSyntax` API. These datatypes can be viewed in the REPL just as they would for any other datatype, using `:i` after loading the language-specific `AST.hs` module for a given language. + +``` +:l semantic-python/src/Language/Python/AST.hs +Ok, six modules loaded. +*Language.Python.AST Source.Span Source.Range> :i Module +``` + +This shows us the auto-generated `Module` datatype: + +```Haskell +data Module a + = Module {Language.Python.AST.ann :: a, + Language.Python.AST.extraChildren :: [(GHC.Generics.:+:) + CompoundStatement SimpleStatement a]} + -- Defined at /Users/aymannadeem/github/semantic/semantic-python/src/Language/Python/AST.hs:23:1 +instance Show a => Show (Module a) + -- Defined at /Users/aymannadeem/github/semantic/semantic-python/src/Language/Python/AST.hs:23:1 +instance Ord a => Ord (Module a) + -- Defined at /Users/aymannadeem/github/semantic/semantic-python/src/Language/Python/AST.hs:23:1 +instance Eq a => Eq (Module a) + -- Defined at /Users/aymannadeem/github/semantic/semantic-python/src/Language/Python/AST.hs:23:1 +instance Traversable Module + -- Defined at /Users/aymannadeem/github/semantic/semantic-python/src/Language/Python/AST.hs:23:1 +instance Functor Module + -- Defined at /Users/aymannadeem/github/semantic/semantic-python/src/Language/Python/AST.hs:23:1 +instance Foldable Module + -- Defined at /Users/aymannadeem/github/semantic/semantic-python/src/Language/Python/AST.hs:23:1 +``` + +Here is an example that describes the relationship between a Python identifier represented in the tree-sitter generated JSON file, and a datatype generated by Template Haskell based on the provided JSON: + +| Type | JSON | TH-generated code | +|----------|--------------|------------| +|Named leaf|
{
"type": "identifier",
"named": true
}|data TreeSitter.Python.AST.Identifier a
= TreeSitter.Python.AST.Identifier {TreeSitter.Python.AST.ann :: a,
TreeSitter.Python.AST.bytes :: text-1.2.3.1:Data.Text.Internal.Text} -- Defined at TreeSitter/Python/AST.hs:10:1
instance Show a => Show (TreeSitter.Python.AST.Identifier a) -- Defined at TreeSitter/Python/AST.hs:10:1
instance Ord a => Ord (TreeSitter.Python.AST.Identifier a) -- Defined at TreeSitter/Python/AST.hs:10:1
instance Eq a => Eq (TreeSitter.Python.AST.Identifier a) -- Defined at TreeSitter/Python/AST.hs:10:1
instance Traversable TreeSitter.Python.AST.Identifier -- Defined at TreeSitter/Python/AST.hs:10:1
instance Functor TreeSitter.Python.AST.Identifier -- Defined at TreeSitter/Python/AST.hs:10:1
instance Foldable TreeSitter.Python.AST.Identifier -- Defined at TreeSitter/Python/AST.hs:10:1
instance Unmarshal TreeSitter.Python.AST.Identifier -- Defined at TreeSitter/Python/AST.hs:10:1
instance SymbolMatching TreeSitter.Python.AST.Identifier -- Defined at TreeSitter/Python/AST.hs:10:1| + +Annotations are captured by a polymorphic parameter `a` instead of range/span values. + +[Examples](https://github.com/github/semantic/blob/715971067634f677bff8619add6490e03bb1825e/semantic-ast/src/AST/Grammar/Examples.hs) contains a set of pre-defined, hand-written datatypes for which Template Haskell is not used. Any datatypes among the node types defined here will be skipped when the splice is run, allowing customization of the representation of parts of the tree. While this gives us flexibility, we encourage that this is used sparingly, as it imposes extra maintenance burden, particularly when the grammar is changed. This may be used to e.g. parse literals into Haskell equivalents (e.g. parsing the textual contents of integer literals into `Integer`s), and may require defining `TS.UnmarshalAnn` or `TS.SymbolMatching` instances for (parts of) the custom datatypes, depending on where and how the datatype occurs in the generated tree, in addition to the usual `Foldable`, `Functor`, etc. instances provided for generated datatypes. + +## Tests + +As of right now, Hedgehog tests are minimal and only in place for the Python library. + +To run tests: + +`cabal v2-test semantic-python` + +## Background and Motivation for CodeGen + +CodeGen automates the engineering effort historically required for adding a new language, which included writing a second [assignment](https://github.com/github/semantic/blob/715971067634f677bff8619add6490e03bb1825e/docs/assignment.md) grammar, along with manually defining [data types Γ  la carte](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf). + +CodeGen addresses the following challenges posed by the old system: + +**1. No named child nodes.** Tree-sitter’s syntax nodes didn’t provide us with named child nodes, just ordered-lists. In other words, the children were structured as an ordered list, without any name indicating the role of each child. This didn’t match Semantic’s internal representation of syntax nodes, where each type of node has a specific set of named children. This created concerns which meant more Assignment work was necessary to compensate for this discrepancy. For instance, one concern being the way we represent comments, which could be any arbitrary node attached to any part of the AST. But if we had named child nodes, this would allow us to associate comments relative to their parent nodes (for example, if a comment appeared in an if statement, it could be the first child for that if-statement node). However in the old system, comments as well as heredocs could appear anywhere are a source of errors. + +**2. Time and effort.** Our system involves a two-step parsing process, which requires writing two separate language-specific grammars by hand. This is super time-consuming, very developer-intensive, error-prone, and extremely tedious. [Assignment](https://github.com/github/semantic/blob/715971067634f677bff8619add6490e03bb1825e/docs/assignment.md) requires writing a grammar using parser combinators in Haskell that are really close to the tree-sitter grammar specification. The mechanical nature of this work has, for a long time, begged the question of whether we could automate parts of it. Although we’ve open-sourced Semantic, it’s still tough to leverage community support for adding languages with such a grueling process behind it and a brittle system. + +**3. Brittle.** Each language's Assignment code was tightly coupled to the language's Tree-sitter grammar, and it could break at runtime if we changed the structure of the grammar, without any compile-time error. This meant tracking ongoing changes in tree-sitter. This was also tedious, manual, and error prone. Bumping grammars meant making changes to assignment to accommodate new tree-structures, like nodes that have changed names or positions, etc. + +**4. Evaluation and a la carte sum types.** This also gave us an opportunity to re-think our [Γ  la carte datatypes](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf), as well as the evaluation machinery. Γ€ la carte syntax types were motivated by a desire to migrate away from a previous representation of syntax in favor of creating a way to better share effort and tooling involved in diffing, and especially in evaluating common fragments of languages: for example, most languages share if statements, functions, while loops, etc. However, the introduction of these syntax types (and the design of the `Evaluatable` typeclass) made it hard for us to make our analysis sensitive to minor linguistic differences, or even to relate different pieces of syntax together. This is because our Γ  la carte syntax is essentially untyped, in that it enforces only a minimal structure on the tree; but any given subterm can be any element of the syntax, and not some limited subset. This means that a number of `Evaluatable` instances have to deal with error conditions that in practice can’t occur. For example, `function`, `method`, and `class` declarations have a term for their name field, and thus have to deal with the possibility that the term doesn’t have a `declaredName` by throwing an error if this arises.Β  diff --git a/docs/coding-style.md b/docs/coding-style.md index 7c199acc35..0da77c5a02 100644 --- a/docs/coding-style.md +++ b/docs/coding-style.md @@ -13,8 +13,6 @@ Our CI systems ensure that all patches pass `hlint`'s muster. We have our own se We strongly recommend adding Haddock documentation to any function/data type, unless its purpose is immediately apparent from its name. Comments should describe the "why", type signatures should describe the "what", and the code should describe the "how". -The Haskell Prelude is too minimal for serious work. The `Prologue` module should be imported in most files, as it reexports most of what you need. - # Formatting 2 spaces everywhere. Tabs are forbidden. Haskell indentation can be unpredictable, so generally stick with what your editor suggests. @@ -50,14 +48,6 @@ data Pos = Pos } ``` -### Split up imports into logical groups. - -We use the following convention, each section separated by a newline: - -1. Prelude/Prologue import -2. Library/stdlib imports -3. Local in-project imports. - ### Align typographical symbols. `->` in `case` statements and signatures, `=` in functions, and `::` in records should be aligned. Your editor can help with this. In certain situations, aligning symbols may decrease readability, e.g. complicated `case` statements. Use your best judgment. @@ -66,7 +56,7 @@ We use the following convention, each section separated by a newline: Locally bound variables (such as the arguments to functions, or helpers defined in a `where` clause) can have short names, such as `x` or `go`. Globally bound functions and variables should have descriptive names. -You'll often find yourself implementing functions that conflict with Prelude/Prologue definitions. If this is the case, avoid adding a prefix to these functions, and instead import them qualified. +You'll often find yourself implementing functions that conflict with Prelude definitions. If this is the case, avoid adding a prefix to these functions, and instead import them qualified. ``` haskell -- Broke diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000000..5dfc8b53f2 --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,23 @@ +# Configuration + +Semantic has a number of configurable parameters and options specified through +the use of command-line flags or environment variables. See [Config.hs](https://github.com/github/semantic/blob/master/src/Semantic/Config.hs) for details. + +## Environment Variables + +Env. Variable | Description +--- | --- +`MAX_TELEMETRY_QUEUE_SIZE` | Max size of telemetry queues before messages are dropped (default: `1000`). +`TREE_SITTER_PARSE_TIMEOUT` | Timeout in milliseconds before canceling tree-sitter parsing (default: `6000`). +`SEMANTIC_ASSIGNMENT_TIMEOUT` | Millisecond timeout for assignment (default: `4000`). +`STATS_ADDR` | Host and port of statsd (default: `statsd://127.0.0.1:28125`). +`DOGSTATSD_HOST` | Host and port for DataDog, when running in Kubes (default: `statsd://127.0.0.1:28125`). + +## Command-line Arguments: Options + +Flag | Description +--- | --- +`log-level` | Log messages at or above this level. One of `error`, `warning`, `info`, `debug`, `none` (default: `warning`). +`fail-on-warning` | Fail on assignment warnings (default: `False`). +`fail-on-parse-error` | Fail on tree-sitter parse error (default: `False`). +`log-paths-on-error` | Log source paths on parse and assignment error (default: `False`). \ No newline at end of file diff --git a/docs/development.md b/docs/development.md index 495893db8f..28b751a11e 100644 --- a/docs/development.md +++ b/docs/development.md @@ -12,11 +12,11 @@ ### Nix-style local builds -`semantic` is a complicated app with a very large dependency tree. Because managing large dependency trees in a system-wide `ghc` installation is difficult, especially when developing on multiple Haskell projects, `cabal` enables "local" builds: each dependency is linked in per-project, not globally. In practice, this means that you should prefix your commands with the `new-` prefix: `cabal new-build` builds the project, `new-clean` purges its build artifacts, etc. (With versions of the `cabal` command line tool newer than 2.6, local builds become the default, with the `v1-` prefix required to yield old behavior.) +`semantic` is a complicated app with a very large dependency tree. Because managing large dependency trees in a system-wide `ghc` installation is difficult, especially when developing on multiple Haskell projects, `cabal` enables "local" builds: each dependency is linked in per-project, not globally. In practice, this means that you should prefix your commands with the `v2-` prefix: `cabal v2-build` builds the project, `v2-clean` purges its build artifacts, etc. (With versions of the `cabal` command line tool newer than 2.6, local builds become the default, with the `v1-` prefix required to yield old behavior.) ### Running a REPL -Running `cabal new-repl semantic:lib` will boot a GHCi with the right environment for Semantic set up. +Running `cabal v2-repl semantic:lib` will boot a GHCi with the right environment for Semantic set up. See the [πŸ’‘ProTips](πŸ’‘ProTip!.md#ghci) for more info. diff --git a/docs/examples.md b/docs/examples.md index d8241dd69b..91fbf34616 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -14,134 +14,109 @@ Now, let's generate an abstract syntax tree (AST). ``` bash $ semantic parse test.A.py -(Statements - (Annotation - (Function - (Identifier) - (Identifier) - (Return - (Identifier))) - (Empty)) - (Call - (Identifier) - (Call - (Identifier) - (TextElement) - (Empty)) - (Empty))) +(Module + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ReturnStatement + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "x"))))))) + (Identifier "Foo") + (Parameters + (Parameter + (Identifier "x"))))) + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "Foo")) + (ArgumentList + (Expression + (PrimaryExpression + (String)))))))))) ``` -The default s-expression output is a good format for quickly visualizing the structure of code. We can see that there is a function declared and that then there is a call expression, nested in another call expression which matches the function calls to `print` and `Foo`. Feel free to play with some of the other output formats, for example the following will give back the same AST, but in JSON and with much more information about each node including things like the span and range of each syntactic element in the original source file. +The default s-expression output is a good format for quickly visualizing the structure of code. We can see that there is a function declared and that then there is a call expression, nested in another call expression which matches the function calls to `print` and `Foo`. Feel free to play with some of the other output formats, for example the following will give back the same AST, but with much more details about the underlying data structure. ``` bash -$ semantic parse --json test.A.py +$ semantic parse test.py --show ``` -## Diffs - -Now, let's look at a simple, syntax aware diff. Create a second file `test.B.py` that looks like this (The function `Foo` has been renamed). - -``` python -def Bar(x): - return x -print Bar("hi") -``` - -First, let's just see what the diff looks like. +## Symbols -``` bash -$ git diff --no-index test.A.py test.B.py -``` -``` diff -diff --git a/test.A.py b/test.B.py -index 81f210023..5f37f4260 100644 ---- a/test.A.py -+++ b/test.B.py -@@ -1,3 +1,3 @@ --def Foo(x): -+def Bar(x): - return x --print Foo("hi") -+print Bar("hi") -``` +Symbols are named identifiers driven by the ASTs. This is the format that github.com uses to generate code navigation information allowing c-tags style lookup of symbolic names for fast, incremental navigation in all the supported languages. The incremental part is important because files change often so we want to be able to parse just what's changed and not have to analyze the entire project again. -Now, let's look at a syntax aware diff. ``` bash -$ semantic diff test.A.py test.B.py -(Statements - (Annotation - (Function - { (Identifier) - ->(Identifier) } - (Identifier) - (Return - (Identifier))) - (Empty)) - (Call - (Identifier) - (Call - { (Identifier) - ->(Identifier) } - (TextElement) - (Empty)) - (Empty))) -``` - -Notice the difference? Instead of showing that entire lines were added and removed, the semantic diff is aware that the identifier of the function declaration and function call changed. Pretty cool. - -## Import graphs - -OK, now for the fun stuff. Semantic can currently produce a couple of different graph-based views of source code, let's first take a look at import graphs. An import graph shows how files include other files within a software project. For this example, we are going to write a little bit more code in order to see this work. Start by creating a couple of new files: - -``` python -# main.py -import numpy as np -from a import foo as foo_ - -def qux(): - return foo_() - -foo_(1) -``` - -``` python -# a.py -def foo(x): - return x -``` - -Now, let's graph. - -``` bash -$ semantic graph main.py -digraph +$ semantic parse test.py --json-symbols { - - "a.py (Module)" [style="dotted, rounded" shape="box"] - "main.py (Module)" [style="dotted, rounded" shape="box"] - "numpy (Unknown Module)" [style="dotted, rounded" shape="box" color="red" fontcolor="red"] - "main.py (Module)" -> "a.py (Module)" [len="5.0" label="imports"] - "main.py (Module)" -> "numpy (Unknown Module)" [len="5.0" label="imports"] + "files": [ + { + "path": "test.py", + "language": "Python", + "symbols": [ + { + "symbol": "Foo", + "kind": "Function", + "line": "def Foo(x):", + "span": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "nodeType": "DEFINITION" + }, + { + "symbol": "print", + "kind": "Function", + "line": "print Foo(\"hi\")", + "span": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "nodeType": "DEFINITION" + }, + { + "symbol": "Foo", + "kind": "Call", + "line": "Foo(\"hi\")", + "span": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "nodeType": "REFERENCE", + "syntaxType": "CALL" + } + ] + } + ] } ``` -To make this easier to visualize, let's use the `dot` utility from `graphviz` and write this graph to SVG: - -``` -$ semantic graph main.py | dot -Tsvg > main.html && open main.html -``` - -You'll get something that looks like this: - -![an import graph](images/import_graph.svg) - -## Call graphs +There's also a protobuf version of this same information (slightly more compact wire representation). -Call graphs expand on the import graphing capabilities by adding in some additional vertices and edges to the graph to identify named symbols and the connections between them. Taking the same example code, simply add `--call` to the invocation of semantic: - -``` -$ semantic graph --calls main.py | dot -Tsvg > main.html && open main.html -``` +## Diffs -![a call graph](images/call_graph.svg) +NOTE: Diffs are temporarily disabled as part of the effort to migrate to a new AST representation (precise ASTs). diff --git a/docs/images/call_graph.svg b/docs/images/call_graph.svg deleted file mode 100644 index f141410a53..0000000000 --- a/docs/images/call_graph.svg +++ /dev/null @@ -1,133 +0,0 @@ - - -%3 - - - -a.py (Module) - -a.py (Module) - - - -a.py::foo (Function [1, 1] - [3, 1]) - - -foo (Function) - - - - - -a.py (Module)->a.py::foo (Function [1, 1] - [3, 1]) - - -defines - - - -main.py (Module) - -main.py (Module) - - - -main.py (Module)->a.py (Module) - - -imports - - - -numpy (Module) - -numpy (Module) - - - -main.py (Module)->numpy (Module) - - -imports - - - -main.py::foo_ (Variable [7, 1] - [7, 5]) - - -foo_ (Variable) - - - - - -main.py (Module)->main.py::foo_ (Variable [7, 1] - [7, 5]) - - -calls - - - -main.py::qux (Function [4, 1] - [6, 1]) - - -qux (Function) - - - - - -main.py (Module)->main.py::qux (Function [4, 1] - [6, 1]) - - -defines - - - -main.py::foo_ (Variable [5, 12] - [5, 16]) - - -foo_ (Variable) - - - - - -main.py::foo_ (Variable [5, 12] - [5, 16])->a.py::foo (Function [1, 1] - [3, 1]) - - -references - - - -main.py::foo_ (Variable [7, 1] - [7, 5])->a.py::foo (Function [1, 1] - [3, 1]) - - -references - - - -a.py::x (Variable [2, 12] - [2, 13]) - - -x (Variable) - - - - - -a.py::foo (Function [1, 1] - [3, 1])->a.py::x (Variable [2, 12] - [2, 13]) - - -calls - - - -main.py::qux (Function [4, 1] - [6, 1])->main.py::foo_ (Variable [5, 12] - [5, 16]) - - -calls - - - \ No newline at end of file diff --git a/docs/images/import_graph.svg b/docs/images/import_graph.svg deleted file mode 100644 index 097dcea2b7..0000000000 --- a/docs/images/import_graph.svg +++ /dev/null @@ -1,39 +0,0 @@ - - -%3 - - - -a.py (Module) - -a.py (Module) - - - -main.py (Module) - -main.py (Module) - - - -main.py (Module)->a.py (Module) - - -imports - - - -numpy (Unknown Module) - -numpy (Unknown Module) - - - -main.py (Module)->numpy (Unknown Module) - - -imports - - - \ No newline at end of file diff --git a/docs/program-analysis.md b/docs/program-analysis.md deleted file mode 100644 index c19ee76933..0000000000 --- a/docs/program-analysis.md +++ /dev/null @@ -1,66 +0,0 @@ -# Program analysis - -Program analysis allows us to ask questions about and analyze the behavior of computer programs. Analyzing this behavior allows us to (eventually) answer subtle but powerful questions such as, will this use more than 8 GB of RAM? Does this present a user interface? We perform program analysis staticallyβ€”that is, without executing the program. - -We’re able to compute the following end results using evaluation: -1. **Import graph:** graph representing all dependencies (`import`s, `require`s, etc.) -2. **Call graph:** a control flow graph that represents calling relationships (ie., how one particular function calls other functions). This information is often vital for debugging purposes and determining where code is failing. -3. **Control flow graph:** representation of _all_ paths that might be traversed through a program during its execution. - -### Abstract interpretation -To do program analysis, we implement an approach based on the paper [Abstracting Definitional Interpreters](https://plum-umd.github.io/abstracting-definitional-interpreters/), which we've extended to work with our [Γ  la carte representation of syntaxes](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf). This allows us to build a library of interpreters that do different things, but are written with the _same_ evaluation semantics. This approach offers several advantages; we can define _one_ evaluator and get different behaviors out of it (via type-directed polymorphism). - -We employ three types of interpretation: *concrete semantics*, *abstract semantics* and *type-checking*. - -1. Under **concrete semantics**, we are precise; we only compute the result of code that is called. This allows us to see exactly what happens when we run our program. For example, if we expect to return a boolean value and our results differ, we’ll throw an error (which is sub-optimal because in a language like Ruby, a lot of objects that are not booleans could be used as booleans). -2. Under **abstract semantics**, we are exhaustive; we compute the result of all possible permutations. This is how we compute call graphs. Under abstract semantics, we don’t know if something is going to be `true` or `false`, so we take both branchesβ€”non-deterministically producing both using the `<|>` operator which represents choice, building a union of possibilities. -3. Under **type-checking semantics**, we verify that the type of a syntactic construct (ex., an object of type `Int`) matches what is expected when it is used. This helps us check type errors, emulating compile-time static type checking. - -### Evaluation -The [`Evaluatable`](https://github.com/github/semantic/blob/master/src/Data/Abstract/Evaluatable.hs) class defines the necessary interface for a term to be evaluated. While a default definition of `eval` is given, instances with computational content must implement `eval` to perform their small-step operational semantics. Evaluation gives us a way to capture what it means to interpret the syntax data types we create using the [Assignment](https://github.com/github/semantic/blob/master/docs/assignment.md) stage. The evaluation algebra also handles each syntax without caring about any language-specific implementation. We do this by cascading polymorphic functions using the `Evaluatable` type class. - -We have yet to finish implementing `Evaluatable` instances for the various Γ  la carte syntaxes. Doing so requires knowledge of the type and value evaluation semantics of a particular syntax and familiarity with the functions for interacting with the environment and store. - -#### Implementing `Evaluatable` instances -The following is a brief guide to working with the definitional interpreters and implementing instances of `Evaluatable` for the various pieces of syntax. `Semantil.Util` defines a series of language-specific wrapper functions for working in ghci to do evaluation. - -_Helpers:_ -- `parseFile`: parses one file. -- `evaluateLanguageProject`: takes a list of files and evaluates them usually under concrete semantics. -- `callGraphLanguageProject`: uses the same mechanism for evaluating, but uses abstract semantics. -- `typeCheckLanguageFile`: allows us to evaluate under type checking semantics. - -#### Creating good abstractions -When adding `Evaluatable` instances, we may notice that certain language-specific syntaxes share semantics sufficiently enough to be consolidated into a language-agnostic data type (and resultantly, have one `Evaluatable` instance). Other timesβ€”it may be the opposite case where there is not enough overlap in evaluation semantics and therefore requires decoupling. Reasoning through the right abstractions is a big part of determining how to write these `Evaluatable` instances. - -### Effects -To perform these computations, we need effects. An effect is something a piece of code does which isn’t strictly encapsulated in its return value. Outside of taking inputs and returning outputs, programs must capture state in memory by read or write, throw exceptions, fail to terminate, or terminate non-deterministically, etc. These outcomes are known as _effects_. An an example, consider the JS function: - -``` -function square(x) { - return x * x; -} -``` - -This is _pure_ because it performs no effects, whereas the similar function: - -```function square(x) { - console.log("squaring x: " + x); - return x * x; -} -``` -computes the same result value but additionally performs an effect (logging). Effects provide convenient access to powerful and efficient capabilities of the machine such as interrupts, stateful memory, the file system, and the monitor. - -We compute effects non-deterministically. - - - - - -### Potential use-cases - -- *Dead code* analysis: reduce potential surface area (security vulnerabilities). Less code to maintain is always a good thing. Good examples in most IDEs. -- *Symbolic* - allows us to do symbolic execution. https://prepack.io/ -- *Caching* - a way to guarantee that an analysis will terminate. allows us to write a type checker. abstracting variables to their types. Instead of potentially infinite series of integers, you can represent as Int (finitization of values) -- *Collecting* - allows us to have greater precision in other analyses (more useful internally) -- *Tracing and reachable* state - useful for debugging (it's verbose). diff --git a/docs/why-tree-sitter.md b/docs/why-tree-sitter.md index 7df671d6c9..d0b962b47a 100644 --- a/docs/why-tree-sitter.md +++ b/docs/why-tree-sitter.md @@ -1,9 +1,9 @@ # How we parse source code into ASTs #### Table of Contents -1. [Problem space and possible solutions](#solutions) -2. [Why we use tree-sitter](#why-tree-sitter) -3. [Drawbacks of tree-sitter](#drawbacks) +1. [Problem space and possible solutions](#problem-space-and-possible-solutions) +2. [Why we use tree-sitter](#why-we-use-tree-sitter) +3. [Drawbacks of tree-sitter](#drawbacks-of-tree-sitter) ## Problem space and possible solutions @@ -26,10 +26,10 @@ To serve these goals, the following options were considered alongside `tree-sitt 5. **Performance is decoupled from specific algorithm.** Similarly, grammar specifications are intimately coupled to performance characteristics using whatever algorithms will support them; a grammar which parses very efficiently with one algorithm may be a worst case for another. 6. **There isn’t a universally accepted format for grammar specification.** BNF, and EBNF, are under-specified, and often unsupported; useful only for informal specification to humans, and not for formal specification to machines. 7. **Language specifications are complex.** Some languages’ grammar specs turn out to be complex, for example [Java's language specification](https://docs.oracle.com/javase/specs/jls/se9/html/index.html). Similarly problematic is [Swift's spec](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html), described by @robrix as "a subtle and intricate work of fiction". -8. **Open source.** By using tree-sitterβ€”we can lean on open source contributors to do grammar development work. +8. **Open source.** By using tree-sitter we can lean on open source contributors to do grammar development work. 9. **Low learning curve.** Writing grammars in JavaScript (as opposed to some custom notation/language) is quite powerful. 10. **Multiple algorithms for handling ambiguity.** Precedence annotations at compile time, GLR at runtime. -11. **External scanner support.** In case you need to parse a context free grammar. An example of an external scanner is in [Ruby's language support](https://github.com/tree-sitter/tree-sitter-ruby/blob/master/src/scanner.cc). +11. **External scanner support.** In case you need to parse a context-sensitive grammar. An example of an external scanner is in [Ruby's language support](https://github.com/tree-sitter/tree-sitter-ruby/blob/master/src/scanner.cc). 12. **Solid tooling for development and debugging.** Tree-sitter makes it easy to get up and running fairly quickly. It also provides detailed error messages to guide grammar development. 13. **Built in performance tooling.** 14. **Parsing is very fast.** diff --git "a/docs/\360\237\222\241ProTip!.md" "b/docs/\360\237\222\241ProTip!.md" index f65e3ca71a..c518bffe21 100644 --- "a/docs/\360\237\222\241ProTip!.md" +++ "b/docs/\360\237\222\241ProTip!.md" @@ -18,62 +18,20 @@ Space leaks can be detected by running `semantic` with a restricted heap size. N ## Building -`stack build --fast` is a nice way to speed up local development (builds without optimizations). - +Before building with `cabal`, be sure to run `cabal configure --disable-optimizations --enable-tests`. GHC defaults to `-O1`, which can significantly slow recompiles. ## Testing `stack build --fast semantic:test` builds and runs the unit tests. -- Find out what all the possible test arguments are with `stack test --help`. +- Find out what all the possible test arguments are with `cabal run semantic:spec -- --help`. - Focus in on a particular test or set of tests with `-m`/`--match`: - stack test --test-arguments="-m ruby" - -- Use `--skip` to run everything but matching tests: - - stack test --test-arguments="--skip ruby" + cabal run semantic:spec -- -p ruby - It can take a while to run them over the whole project. Focus in on a particular module with `--test-arguments`: - stack test --test-arguments=src/Data/Range.hs - - -## Difftool - -`git` can be configured to open diffs in `semantic` using `git-difftool`: - -1. Install semantic to the local bin path: `stack install :semantic` - -2. Configure `semantic` as a difftool: - - git config difftool.semantic.cmd 'semantic diff --patch "$LOCAL" "$REMOTE"' - -3. Optionally, configure `semantic` as the default difftool: - - git config diff.tool semantic - -4. Perform git diffs using semantic by invoking `git-difftool`: - - # if configured as default - git difftool - # otherwise - git difftool -t semantic - -5. _Bonus round!_ Optionally, configure `git-difftool` to never prompt: - - git config difftool.prompt false - - -## Editing - -- 1. Install ghc-mod from the semantic directory by running: - - `stack install ghc-mod` - -- 2. You'll need the `ide-haskell` plugins for atom. You can install through apm: - - Β  Β  Β  Β `apm install haskell-ghc-mod ide-haskell ide-haskell-cabal linter linter-ui-default` + cabal run semantic:spec -- -p Data.Language # Ctags Support @@ -99,12 +57,6 @@ Alternatively, you can replace `symbols-view` with `joshvera/tags-view` in your Then disable the `symbols-view` package. - -## Semantic documentation in Dash - -You can generate a `semantic` docset and import it into Dash locally. To do so run the `script/haddock` first to ensure Haddock documentation is generated. Then run `script/docset`. This should generate `.docset/semantic.docset` in the `semantic` repo. The last step is to import the `semantic.docset` into Dash. Open dash, open preferences, select the 'Docsets' tab, click the `+` icon to add a new docset, and direct the file browser to `semantic/.docsets/semantic.docset`. - - ## Working with grammar datatypes `haskell-tree-sitter` includes some TemplateHaskell machinery to generate a datatype from a tree-sitter parser’s symbol table. You can generally guess the constructors of that type by turning the snake_case production names from the tree-sitter grammar into UpperCamelCase names, but you can also have the compiler dump the datatype out in full in the repl: @@ -148,19 +100,27 @@ _VoilΓ !_ You’re now looking at the source code for the datatype generated fro ## GHCi -The Haskell interactive repl (GHCi) allows you to quickly typecheck your work and test out ideas interactively. It’s always worth having a repl open, but we’ve particularly tuned some workflows, e.g. semantic assignment development, for the repl. +The Haskell interactive repl (GHCi) allows you to quickly typecheck your work and test out ideas interactively. It’s always worth having a repl open, and we’ve particularly tuned some workflows for the repl. -[pretty-printing]: pretty-printing +Full docs for ghci can be found in the [user’s guide][ghci user’s guide]. +[ghci user’s guide]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html -### Configuration -We configure `ghci` with defaults & macros for use with `semantic` via the [`.ghci` file][] at the project root, and you can further customize its behaviour via the `~/.ghci` file. +### Multiple components -Full docs for ghci can be found in the [user’s guide][ghci user’s guide]. +`semantic` consists of multiple packages and components, which makes it somewhat challenging to load into `ghci` using e.g. `cabal repl`. To help that, we provide [`script/repl`][] to automate working with multiple components & packages. Unlike when using `cabal repl`, after loading you will need to explicitly `:load` (at least some of) the sources you need to work with. For example, when working in the main `semantic` package, almost everything can be loaded with `:load Semantic.CLI`, since the `Semantic.CLI` module ultimately depends on just about everything else in the repo. -[ghci user’s guide]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html -[`.ghci` file]: https://github.com/github/semantic/blob/master/.ghci +This script is also set up to store intermediate build products in a separate `dist-repl` dir to avoid colliding with normal builds. + +[`script/repl`]: https://github.com/github/semantic/blob/master/script/repl + + +### Configuration + +`ghci` can be configured with scripts containing Haskell statements and repl commands. By default, the `~/.ghc/ghci.conf` file will be loaded, as well as a `.ghci` file in the working directory, if any. We don’t currently provide such for use with `semantic`, but we do provide a [`.ghci.sample`][] file which we suggest copying to `~/.ghc/ghci.conf` for better typed holes, pretty-printing via `pretty-simple`, and a simple prompt. + +[`.ghci.sample`]: https://github.com/github/semantic/blob/master/.ghci.sample ### Managing history @@ -178,9 +138,9 @@ maxHistorySize: Nothing ### Pretty-printing -By default, GHCi prints the results of expressions using their `Show` instances, which can be particularly difficult to read for large recursive structures like `Term`s and `Diff`s. The project’s [`.ghci` file][] provides `:pretty` & `:no-pretty` macros which respectively enable & disable colourized, pretty-printed formatting of result values instead. These macros depend on the the `pretty-show` & `hscolour` packages. +By default, GHCi prints the results of expressions using their `Show` instances, which can be particularly difficult to read for large recursive structures like `Term`s and `Diff`s. The project’s [`.ghci.sample`][] file provides `:pretty` & `:no-pretty` macros which respectively enable & disable colourized, pretty-printed formatting of result values instead. These macros depend on the the `pretty-simple` package. -Since `:reload`ing resets local bindings, the [`.ghci` file][] also provides a convenient `:r` macro which reloads and then immediately re-enables `:pretty`. +Since `:reload`ing resets local bindings, the file also provides a convenient `:r` macro which reloads and then immediately re-enables `:pretty`. You can use `:pretty` & `:no-pretty` like so: @@ -203,60 +163,12 @@ You can use `:pretty` & `:no-pretty` like so: ``` -### Working in Assignment - -When working in assignment, some setup is required. This macro automates that by automatically importing the necessary modules and outputs an example command. If you provide the language you are working with as an optional parameter, the example command is formatted for that language's specific needs (parser, example file extension, etc.). - -The macro is defined as: - -``` -:{ -assignmentExample lang = case lang of - "Python" -> mk "py" "python" - "Go" -> mk "go" "go" - "Ruby" -> mk "rb" "ruby" - "JavaScript" -> mk "js" "typescript" - "TypeScript" -> mk "ts" "typescript" - "Haskell" -> mk "hs" "haskell" - "Markdown" -> mk "md" "markdown" - "JSON" -> mk "json" "json" - _ -> mk "" "" - where mk fileExtension parser = putStrLn ("example: fmap (() <$) . runTask . parse " ++ parser ++ "Parser =<< Semantic.Util.blob \"example." ++ fileExtension ++ "\"") >> return ("import Parsing.Parser\nimport Semantic.Task\nimport Semantic.Util") -:} - -:def assignment assignmentExample -``` - -And is invoked in GHCi like: - -``` -Ξ» :assignment Python -``` - -The output produces a one line expression assuming the syntax to assign is in a file named `example` with the relevant programming language extension: - -```haskell -quieterm <$> parseFile pythonParser "example.py" -``` - - -### Inspecting TreeSitter ASTs - -Inspecting the parse tree from TreeSitter can be helpful for debugging. In GHCi, the command below allows viewing the TreeSitter production name of each node in the TreeSitter AST: - -```haskell -import TreeSitter.Java -fmap nodeSymbol <$> parseFile javaASTParser "example.java" -``` - - -### Using Threadscope +## Using Threadscope Threadscope is a tool for profiling the multi-threaded performance of Haskell programs. It allows us to see how work is shared across processors and identify performance issues related to garbage collection or bottlenecks in our processes. To install threadscope: -1. Download a prebuilt binary from https://github.com/haskell/ThreadScope/releases . -2. `chmod a+x` the result of extracting the release. -3. `brew install gtk+ gtk-mac-integration`. -4. profit. +1. Download a prebuilt binary from https://github.com/haskell/ThreadScope/releases +2. `chmod a+x` the result of extracting the release +3. `brew install gtk+ gtk-mac-integration` diff --git a/hie.yaml b/hie.yaml new file mode 100644 index 0000000000..8ccf9cbc31 --- /dev/null +++ b/hie.yaml @@ -0,0 +1,36 @@ +cradle: + cabal: + - path: "semantic" + component: "lib:semantic" + - path: "semantic-analysis" + component: "lib:semantic-analysis" + - path: "semantic-ast" + component: "lib:semantic-ast" + - path: "semantic-codeql" + component: "lib:semantic-codeql" + - path: "semantic-go" + component: "lib:semantic-go" + - path: "semantic-java" + component: "lib:semantic-java" + - path: "semantic-json" + component: "lib:semantic-json" + - path: "semantic-parse" + component: "lib:semantic-parse" + - path: "semantic-php" + component: "lib:semantic-php" + - path: "semantic-python" + component: "lib:semantic-python" + - path: "semantic-ruby" + component: "lib:semantic-ruby" + - path: "semantic-rust" + component: "lib:semantic-rust" + - path: "semantic-scope-graph" + component: "lib:semantic-scope-graph" + - path: "semantic-source" + component: "lib:semantic-source" + - path: "semantic-tags" + component: "lib:semantic-tags" + - path: "semantic-tsx" + component: "lib:semantic-tsx" + - path: "semantic-typescript" + component: "lib:semantic-typescript" diff --git a/proto/semantic.proto b/proto/semantic.proto new file mode 100644 index 0000000000..09330d6ed2 --- /dev/null +++ b/proto/semantic.proto @@ -0,0 +1,127 @@ +syntax = "proto3"; + +package github.semantic; + +option ruby_package = "Semantic::Proto"; + +message PingRequest { + string service = 1; +} + +message PingResponse { + string status = 1; + string hostname = 2; + string timestamp = 3; + string sha = 4; +} + +message ParseTreeRequest { + repeated Blob blobs = 1; +} + +message ParseTreeSymbolResponse { + repeated File files = 1; +} + +message StackGraphRequest { + repeated Blob blobs = 1; +} + +message StackGraphResponse { + repeated StackGraphFile files = 1; +} + +message ParseError { + string error = 1; +} + +message Blob { + string content = 1; + string path = 2; + string language = 3; +} + +message File { + string path = 1; + string language = 2; + repeated Symbol symbols = 3; + repeated ParseError errors = 4; + string blob_oid = 5; +} + +message Symbol { + string symbol = 1; + string kind = 2; + string line = 3; + Span span = 4; + Docstring docs = 5; + NodeType node_type = 6; + SyntaxType syntax_type = 7; + Span utf16_code_unit_span = 8; + ByteRange byte_range = 9; +} + +message Docstring { + string docstring = 1; +} + +message Position { + int32 line = 1; + int32 column = 2; +} + +message Span { + Position start = 1; + Position end = 2; +} + +message ByteRange { + int32 start = 1; + int32 end = 2; +} + +message StackGraphFile { + string path = 1; + string language = 2; + repeated StackGraphNode nodes = 3; + repeated StackGraphPath paths = 4; + repeated ParseError errors = 5; +} + +enum NodeType { + ROOT_SCOPE = 0; + JUMP_TO_SCOPE = 1; + EXPORTED_SCOPE = 2; + DEFINITION = 3; + REFERENCE = 4; +} + +enum SyntaxType { + FUNCTION = 0; + METHOD = 1; + CLASS = 2; + MODULE = 3; + CALL = 4; + TYPE = 5; + INTERFACE = 6; + IMPLEMENTATION = 7; +} + +message StackGraphNode { + int64 id = 1; + string name = 2; + string line = 3; + Span span = 4; + SyntaxType syntax_type = 5; + NodeType node_type = 6; +} + +message StackGraphPath { + repeated string starting_symbol_stack = 1; + int64 starting_scope_stack_size = 2; + int64 from = 3; + string edges = 4; + int64 to = 5; + repeated int64 ending_scope_stack = 6; + repeated string ending_symbol_stack = 7; +} diff --git a/proto/semantic/api/v1/code_analysis.proto b/proto/semantic/api/v1/code_analysis.proto deleted file mode 100644 index 0dd8c4a212..0000000000 --- a/proto/semantic/api/v1/code_analysis.proto +++ /dev/null @@ -1,191 +0,0 @@ -syntax = "proto3"; - -package semantic.api.v1; - -option java_package = "com.github.semantic.api.v1"; - -// Semantic's CodeAnalysis service provides endpoints for parsing, analyzing, -// and comparing source code. -service CodeAnalysis { - // Check health & status of the service. - rpc Ping (PingRequest) returns (PingResponse); - // Calculate c-tags like symbols for blobs. - rpc ParseTreeSymbols (ParseTreeRequest) returns (ParseTreeSymbolResponse); - // Parse trees in adjacency graph representation. - rpc ParseTreeGraph (ParseTreeRequest) returns (ParseTreeGraphResponse); - // Calculate table of contents style diff summaries. - rpc DiffTreeTOC (DiffTreeRequest) returns (DiffTreeTOCResponse); - // Tree diffs in adjacency graph representation. - rpc DiffTreeGraph (DiffTreeRequest) returns (DiffTreeGraphResponse); -} - -message PingRequest { - string service = 1; -} - -message PingResponse { - string status = 1; - string hostname = 2; - string timestamp = 3; - string sha = 4; -} - -message ParseTreeRequest { - repeated Blob blobs = 1; -} - -message ParseTreeSymbolResponse { - repeated File files = 1; -} - -message ParseTreeGraphResponse { - repeated ParseTreeFileGraph files = 1; -} - -message ParseTreeFileGraph { - string path = 1; - string language = 2; - repeated TermVertex vertices = 3; - repeated TermEdge edges = 4; - repeated ParseError errors = 5; -} - -message TermEdge { - int32 source = 1; - int32 target = 2; -} - -message TermVertex { - int32 vertex_id = 1; - string term = 2; - Span span = 3; -} - -message ParseError { - string error = 1; -} - -message DiffTreeRequest { - repeated BlobPair blobs = 1; -} - -message DiffTreeTOCResponse { - repeated TOCSummaryFile files = 1; -} - -message TOCSummaryFile { - string path = 1; - string language = 2; - repeated TOCSummaryChange changes = 3; - repeated TOCSummaryError errors = 4; -} - -message TOCSummaryChange { - string category = 1; - string term = 2; - Span span = 3; - ChangeType change_type = 4; -} - -message TOCSummaryError { - string error = 1; - Span span = 2; -} - -enum ChangeType { - NONE = 0; - ADDED = 1; - REMOVED = 2; - MODIFIED = 3; -} - -message DiffTreeGraphResponse { - repeated DiffTreeFileGraph files = 1; -} - -message DiffTreeFileGraph { - string path = 1; - string language = 2; - repeated DiffTreeVertex vertices = 3; - repeated DiffTreeEdge edges = 4; - repeated ParseError errors = 5; -} - -message DiffTreeEdge { - int32 source = 1; - int32 target = 2; -} - -message DiffTreeVertex { - int32 diff_vertex_id = 1; - oneof diff_term { - DeletedTerm deleted = 2; - InsertedTerm inserted = 3; - ReplacedTerm replaced = 4; - MergedTerm merged = 5; - } -} - -message DeletedTerm { - string term = 1; - Span span = 2; -} - -message InsertedTerm { - string term = 1; - Span span = 2; -} - -message ReplacedTerm { - string before_term = 1; - Span before_span = 2; - string after_term = 3; - Span after_span = 4; -} - -message MergedTerm { - string term = 1; - Span before_span = 2; - Span after_span = 3; -} - -message Blob { - string content = 1; - string path = 2; - string language = 3; -} - -message BlobPair { - Blob before = 1; - Blob after = 2; -} - -message File { - string path = 1; - string language = 2; - repeated Symbol symbols = 3; - repeated ParseError errors = 4; - string blob_oid = 5; -} - -message Symbol { - string symbol = 1; - string kind = 2; - string line = 3; - Span span = 4; - Docstring docs = 5; -} - -message Docstring { - string docstring = 1; -} - -message Position { - int32 line = 1; - int32 column = 2; -} - -message Span { - Position start = 1; - Position end = 2; -} diff --git a/script/astgen b/script/astgen new file mode 100755 index 0000000000..fc33ac88f7 --- /dev/null +++ b/script/astgen @@ -0,0 +1,2 @@ +#!/bin/bash +bazel run //semantic-ast:generate-ast -- --language=all --rootdir=$PWD diff --git a/script/bootstrap b/script/bootstrap new file mode 100755 index 0000000000..ca7655f3e1 --- /dev/null +++ b/script/bootstrap @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +cabal v2-update diff --git a/script/bootstrap-bazel b/script/bootstrap-bazel new file mode 100755 index 0000000000..c98be65f68 --- /dev/null +++ b/script/bootstrap-bazel @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e pipefail + +echo "Installing Bazel..." +brew install bazel +mkdir -p .bazel-cache/bazel-disk || true +mkdir .bazel-cache/bazel-repo || true diff --git a/script/build-and-upload b/script/build-and-upload new file mode 100755 index 0000000000..2445117e5a --- /dev/null +++ b/script/build-and-upload @@ -0,0 +1,106 @@ +#!/usr/bin/env bash + +# Usage: script/build-and-upload PROJECT_NAME +# where PROJECT_NAME is one of the packages present in this repo: +# semantic-source, etc. + +set -e + +PROJECT="$1" +ROOT_DIR="$(dirname "$0")/.." +CABAL_PATH="$ROOT_DIR/$PROJECT/$PROJECT.cabal" + +if [ -z "$PROJECT" ] +then echo "USAGE: build_and_upload PROJECT_NAME"; exit 1 +fi + +if [ ! -f "$CABAL_PATH" ] +then echo "Couldn't find .cabal file at $CABAL_PATH; is $PROJECT a valid package?"; exit 1 +fi + +set -x + +cabal v2-build "$PROJECT" +TGZ_LOC="$(cabal v2-sdist "$PROJECT" | tail -n 1)" +DOCS_LOC="$(cabal v2-haddock --haddock-for-hackage "$PROJECT" | tail -n 1)" +PACKAGE_VERSION="$(basename "$TGZ_LOC" .tar.gz)" + +if [ ! -f "$TGZ_LOC" ] +then echo "Bug in build_and_upload: $PACKAGE_FN doesn't point to a valid path"; exit 1 +fi + +set +x + +echo "You are planning to upload '$PACKAGE_VERSION'." +read -rp "Is this correct? [y/n] " choice +if [ "$choice" != "y" ] + then echo "Aborting."; exit 1 +fi + +echo "Attempting to build $PACKAGE_VERSION from source" +TEMP_PATH=$(mktemp -d) +tar -xvf "$TGZ_LOC" -C "$TEMP_PATH" + +set -x +( + cd "$TEMP_PATH/$PACKAGE_VERSION" + pwd + + cabal v2-update + cabal v2-build --disable-optimization +) +set +x + +if wget -q --spider "https://hackage.haskell.org/package/$PACKAGE_VERSION" +then + echo "The package $PACKAGE_VERSION already exists on Hackage." + echo "If you need to upload code changes, then bump the version number in $PROJECT/$PROJECT.cabal, make a PR, and run this script again." + echo "Otherwise, if you need _only_ to loosen existing constraints in $PROJECT.cabal file, then you can create a new revision of this package on Hackage." + echo "You'll need to make your changes by hand. Be sure to click the 'Review changes' button to check your work." + read -rp "Do you want to open a browser so as to do this? [y/N]" choice + if [ "$choice" == "y" ] + then + echo "Opening…" + sleep 1 + open "https://hackage.haskell.org/package/$PACKAGE_VERSION/$PROJECT.cabal/edit" + exit 0 + else + echo "Aborting" + exit 1 + fi +fi + +echo "******************" +echo "Uploading packages" +echo "******************" + +echo -n "Hackage username: " +read HACKAGE_USER +echo +echo -n "Hackage password: " +read -s HACKAGE_PASS + +cabal upload --username="$HACKAGE_USER" --password="$HACKAGE_PASS" "$TGZ_LOC" +cabal upload --username="$HACKAGE_USER" --password="$HACKAGE_PASS" --documentation "$DOCS_LOC" + +URL="https://hackage.haskell.org/package/$PACKAGE_VERSION/candidate" + +echo "Opening candidate URL in browser…" +sleep 1 +open "$URL" + +echo "About to upload final version. Do you want to proceed?" +echo "Full-fledged package uploads cannot be undone!" +read -rp "Type 'yes' to continue. " choice +if [ "$choice" != "yes" ] + then echo "Aborting."; exit 1 +fi + +set -x + +cabal upload --username="$HACKAGE_USER" --password="$HACKAGE_PASS" --publish "$TGZ_LOC" +cabal upload --username="$HACKAGE_USER" --password="$HACKAGE_PASS" --publish --documentation "$DOCS_LOC" + +echo "Tagging $PACKAGE_VERSION" +git tag "$PACKAGE_VERSION" +git push --tags diff --git a/script/clone-example-repos b/script/clone-example-repos index af2aa98fd6..e6666e801a 100755 --- a/script/clone-example-repos +++ b/script/clone-example-repos @@ -1,19 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash #/ Usage: script/clone-example-repos #/ -#/ Clone some example repositories for smoke testing parsing and assignment +#/ Clone some example repositories for smoke testing parsing, assignment, and precise ASTs. #/ #/ NOTES: #/ - This script is intended to be called by `test/Examples.hs` -#/ - Go and Ruby examples are in submodules -#/ - PHP doesn't have any parse-examples -#/ - Java and Haskell have good examples, but they have assignment failures so currently aren't tested - set -e cd $(dirname "$0")/.. -dir="vendor/haskell-tree-sitter/languages" +mkdir -p tmp # clone_repo LOCAL_PATH URL SHA function clone_repo { @@ -33,7 +29,11 @@ function clone_repo { popd > /dev/null } -python_examples="$dir/python/vendor/tree-sitter-python/examples" +go_examples="tmp/go-examples" +clone_repo "$go_examples/go" golang/go 870e12d7bfaea70fb0d743842f5864eb059cb939 +clone_repo "$go_examples/moby" moby/moby f57f260b49b6142366e6bc1274204ee0a1205945 + +python_examples="tmp/python-examples" clone_repo "$python_examples/numpy" numpy/numpy 058851c5cfc98f50f11237b1c13d77cfd1f40475 clone_repo "$python_examples/thealgorithms" thealgorithms/python c6be53e1c43f870f5364eef1499ee1b411c966fb clone_repo "$python_examples/flask" pallets/flask 0b5b4a66ef99c8b91569dd9b9b34911834689d3f @@ -45,27 +45,19 @@ clone_repo "$python_examples/scrapy" scrapy/scrapy 65d631329a1434ec013f24341e4b8 clone_repo "$python_examples/pytorch" pytorch/pytorch c865d46736db4afff51690a712e35ed8e3899490 clone_repo "$python_examples/certbot" certbot/certbot bb8222200a8cbd39a3ce9584ce6dfed6c5d05228 -ts_examples="$dir/typescript/vendor/tree-sitter-typescript/examples" -clone_repo "$ts_examples/desktop" desktop/desktop d1324f56d02dd9afca5d2e9da545905a7d41d671 +ruby_examples="tmp/ruby-examples" +clone_repo "$ruby_examples/ruby_spec" ruby/spec c3e6b9017926f44a76e2b966c4dd35fa84c4cd3b -# Java examples are disabled because the assignment code is not yet -# robust and for reasons of CI celerity. +ts_examples="tmp/typescript-examples" +clone_repo "$ts_examples/desktop" desktop/desktop d1324f56d02dd9afca5d2e9da545905a7d41d671 +clone_repo "$ts_examples/npm" npm/npm ee147fbbca6f2707d3b16f4fa78f4c4606b2d9b1 -java_examples="$dir/java/vendor/tree-sitter-java/examples" +# java_examples="$dir/tree-sitter-java/vendor/tree-sitter-java/examples" # clone_repo "$java_examples/elasticsearch" elastic/elasticsearch 4d62640bf116af7e825d89c7319a39c3f2f325b4 # clone_repo "$java_examples/guava" google/guava e24fddc5fff7fd36d33ea38737b6606a7e476845 # clone_repo "$java_examples/RxJava" ReactiveX/RxJava 8a6bf14fc9a61f7c1c0016ca217be02ca86211d2 -clone_repo "$ts_examples/npm" npm/npm ee147fbbca6f2707d3b16f4fa78f4c4606b2d9b1 - -haskell_examples="$dir/haskell/vendor/tree-sitter-haskell/examples" -clone_repo "$haskell_examples/effects" joshvera/effects 08f5f36f2600362685af593f4b327e933b60bf97 -clone_repo "$haskell_examples/postgrest" PostgRest/postgrest f80cfbf165f951a062b3cbedac4556019905ca49 -clone_repo "$haskell_examples/ivory" GaloisInc/ivory 3d00324ad1c113c7e70957ff6a6d636d271d0fc4 - -go_examples="$dir/go/vendor/tree-sitter-go/examples" -clone_repo "$go_examples/go" "golang/go" "870e12d7bfaea70fb0d743842f5864eb059cb939" -clone_repo "$go_examples/moby" "moby/moby" "f57f260b49b6142366e6bc1274204ee0a1205945" - -ruby_examples="$dir/ruby/vendor/tree-sitter-ruby/examples" -clone_repo "$ruby_examples/ruby_spec" "ruby/spec" "c3e6b9017926f44a76e2b966c4dd35fa84c4cd3b" +# haskell_examples="$dir/tree-sitter-haskell/vendor/tree-sitter-haskell/examples" +# clone_repo "$haskell_examples/effects" joshvera/effects 08f5f36f2600362685af593f4b327e933b60bf97 +# clone_repo "$haskell_examples/postgrest" PostgRest/postgrest f80cfbf165f951a062b3cbedac4556019905ca49 +# clone_repo "$haskell_examples/ivory" GaloisInc/ivory 3d00324ad1c113c7e70957ff6a6d636d271d0fc4 diff --git a/script/fix-broken-cabal-store b/script/fix-broken-cabal-store new file mode 100755 index 0000000000..ad7f42ba72 --- /dev/null +++ b/script/fix-broken-cabal-store @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +store_dir="$HOME/.cabal/store/ghc-$(ghc --numeric-version)" + +rm -rf "$store_dir"/tr-sttr* +rm -rf "$store_dir"/lib/libHStr-sttr* +rm -rf "$store_dir"/package.db/tr-sttr* diff --git a/script/generate-example b/script/generate-example index e2f9096b82..f9625de032 100755 --- a/script/generate-example +++ b/script/generate-example @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #/ Usage: script/generate-example fileA fileB #/ script/generate-example directory #/ @@ -37,20 +37,20 @@ generate_example () { if [ -e "$fileA" ]; then status $parseFileA - cabal new-run --verbose=0 semantic -- parse --sexpression $fileA > $parseFileA + cabal v2-run --verbose=0 semantic -- parse --sexpression $fileA > $parseFileA fi if [ -e "$fileB" ]; then status $parseFileB - cabal new-run --verbose=0 semantic -- parse --sexpression $fileB > $parseFileB + cabal v2-run --verbose=0 semantic -- parse --sexpression $fileB > $parseFileB fi if [ -e "$fileA" -a -e "$fileB" ]; then status $diffFileAB - cabal new-run --verbose=0 semantic -- diff --sexpression $fileA $fileB > $diffFileAB + cabal v2-run --verbose=0 semantic -- diff --sexpression $fileA $fileB > $diffFileAB status $diffFileBA - cabal new-run --verbose=0 semantic -- diff --sexpression $fileB $fileA > $diffFileBA + cabal v2-run --verbose=0 semantic -- diff --sexpression $fileB $fileA > $diffFileBA fi } diff --git a/script/ghci-flags b/script/ghci-flags new file mode 100755 index 0000000000..8f3a12cb42 --- /dev/null +++ b/script/ghci-flags @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +# Computes the flags for ghcide to pass to ghci. You probably won’t be running this yourself, but rather script/repl will. + +set -e + +cd "$(dirname "$0")/.." + +ghc_version="$(ghc --numeric-version)" + +build_dir="dist-newstyle/build/x86_64-osx/ghc-$ghc_version" +build_products_dir="$build_dir/build-repl" + +function add_autogen_includes { + echo "-optP-include" + echo "-optP$1/cabal_macros.h" + # autogenerated files, .h and .hs + echo "-i$1" + echo "-I$1" +} + +cores=$(sysctl -n machdep.cpu.core_count || echo 4) + +# disable optimizations for faster loading +echo "-O0" +# don’t load .ghci files (for ghcide) +echo "-ignore-dot-ghci" + +# use as many jobs as there are physical cores +echo "-j$cores" + +# where to put build products +echo "-outputdir $build_products_dir" +echo "-odir $build_products_dir" +echo "-hidir $build_products_dir" +echo "-stubdir $build_products_dir" + +if [ -d "$build_dir/semantic-0.11.0.0/build/autogen" ] +then add_autogen_includes "$build_dir/semantic-0.11.0.0/build/autogen" +elif [ -d "$build_dir/semantic-0.11.0.0/noopt/build/autogen" ] +then add_autogen_includes "$build_dir/semantic-0.11.0.0/noopt/build/autogen" +fi + +echo "-optP-Wno-macro-redefined" + +echo "-DBAZEL_BUILD=0" + +# .hs source dirs +# TODO: would be nice to figure this out from cabal.project & the .cabal files +echo "-isemantic/app" +echo "-isemantic/src" +echo "-isemantic/bench" +echo "-isemantic/test" +echo "-isemantic-analysis/src" +echo "-isemantic-ast/src" +echo "-isemantic-codeql/src" +echo "-isemantic-codeql/test" +echo "-isemantic-go/src" +echo "-isemantic-java/src" +echo "-isemantic-json/src" +echo "-isemantic-json/test" +echo "-isemantic-parse/src" +echo "-isemantic-php/src" +echo "-isemantic-proto/src" +echo "-isemantic-python/src" +echo "-isemantic-python/test" +echo "-isemantic-ruby/src" +echo "-isemantic-rust/src" +echo "-isemantic-scope-graph/src" +echo "-isemantic-tsx/src" +echo "-isemantic-typescript/src" +echo "-isemantic-tags/src" + +# disable automatic selection of packages +echo "-hide-all-packages" +echo "-package proto-lens-jsonpb" + +# run cabal and emit package flags from the environment file, removing comments & prefixing with - +cabal v2-exec -v0 bash -- -c 'cat "$GHC_ENVIRONMENT"' | grep -v '^--' | sed -e 's/^/-/' + +# default language extensions +echo "-XHaskell2010" +echo "-XStrictData" + +# treat warnings as warnings +echo "-Wwarn" + +# default warning flags +echo "-Weverything" +echo "-Wno-all-missed-specialisations" +echo "-Wno-implicit-prelude" +echo "-Wno-missed-specialisations" +echo "-Wno-missing-import-lists" +echo "-Wno-missing-local-signatures" +echo "-Wno-monomorphism-restriction" +echo "-Wno-name-shadowing" +echo "-Wno-safe" +echo "-Wno-unsafe" +[[ "$ghc_version" = 8.6.* ]] || [[ "$ghc_version" = 8.8.* ]] || [[ "$ghc_version" = 8.10.* ]] && echo "-Wno-star-is-type" || true +[[ "$ghc_version" = 8.8.* ]] || [[ "$ghc_version" = 8.10.* ]] && echo "-Wno-missing-deriving-strategies" || true +[[ "$ghc_version" = 8.10.* ]] && echo "-Wno-missing-safe-haskell-mode" && echo "-Wno-prepositive-qualified-module" && echo "-Wno-unused-packages" diff --git a/script/profile b/script/profile new file mode 100755 index 0000000000..b4971677db --- /dev/null +++ b/script/profile @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# Usage: script/profile FILE_A FILE_B +# Builds and runs semantic on the given files with profiling enabled. + +set -e + +HEAD_SHA=$(git rev-parse --short HEAD) +CURRENT_BRANCH=$(git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}) + +PROJECT_DIR="$(dirname $0)/.." +PROFILES_DIR="$PROJECT_DIR/profiles" +TODAY="$(date "+%Y-%m-%d")" +NOW=$(date "+%H_%M_%S") +PROFILE_DIR="$PROFILES_DIR/$TODAY/$NOW-$CURRENT_BRANCH-$HEAD_SHA/" +OUTFILE="$PROFILE_DIR/profile.out.log" +ERRFILE="$PROFILE_DIR/profile.err.log" + +cabal v2-build exe:semantic + +mkdir -p "$PROFILE_DIR" + +# NB: Do not try and use -N, it doesn't work and defaults to -N1. +cores=$(sysctl -n machdep.cpu.core_count || echo 4) +cabal v2-run exe:semantic -- +RTS -sstderr -N$((cores * 2)) -A8m -n2m -p -s -h -i0.1 -L1000 -xt -RTS $@ > "$OUTFILE" 2> "$ERRFILE" + +profiteur semantic.prof || true + +hp2pretty semantic.hp + +for f in "$PROJECT_DIR/"semantic.*; do + if [ "$f" != "$PROJECT_DIR/"semantic.cabal ]; then + mv "$f" "$PROFILE_DIR" + fi +done + +(>&2 echo "branch: $CURRENT_BRANCH ($HEAD_SHA)") + +open "$PROFILE_DIR" diff --git a/script/protoc b/script/protoc new file mode 100755 index 0000000000..4c02734021 --- /dev/null +++ b/script/protoc @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +#/ Usage: script/protoc +#/ +#/ Generate code from .proto files + +set -ex +cd "$(dirname "$0")/.." + +docker build -t semantic-protoc --target protoc . + +PARENT_DIR=$(dirname $(pwd)) + +export PROJECT="github.com/github/semantic" + +# Generate Haskell for semantic's protobuf types. See the entrypoint in +# Dockerfile for where the protoc pluggins are configured. +docker run --rm --user $(id -u):$(id -g) -v $(pwd):/go/src/$PROJECT -w /go/src/$PROJECT \ + semantic-protoc --proto_path=proto \ + --haskell_out=./semantic-proto/src \ + --jsonpb_haskell_out=./semantic-proto/src \ + semantic.proto diff --git a/script/publish b/script/publish new file mode 100755 index 0000000000..5fa1f54d6b --- /dev/null +++ b/script/publish @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +#/ Usage: script/publish +#/ +#/ Build a docker image of the semantic CLI and publish to the GitHub Package Registry + +set -e +cd $(dirname "$0")/.. + +VERSION="0.9.0.0" +BUILD_SHA=$(git rev-parse HEAD 2>/dev/null) +DOCKER_IMAGE=docker.pkg.github.com/github/semantic/semantic + +# Set the version to the current commit sha +SED_ARGS="-i" +if [[ "$(uname -s)" = "Darwin" ]]; then + SED_ARGS="$SED_ARGS .bak" +fi +sed $SED_ARGS "s/buildSHA =.*/buildSHA = \"$BUILD_SHA\"/" src/Semantic/Version.hs + +# Build +docker build -t $DOCKER_IMAGE . + +# Make sure semantic is in the image. +docker run --rm $DOCKER_IMAGE --version + +read -p "Do you want to publish to the GitHub Registry [y/n]? " -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + # Requires that you've logged in to the GPR (e.g. `docker login docker.pkg.github.com`) + # https://help.github.com/en/articles/configuring-docker-for-use-with-github-package-registry + docker tag $DOCKER_IMAGE $DOCKER_IMAGE:latest + docker tag $DOCKER_IMAGE $DOCKER_IMAGE:$VERSION + docker tag $DOCKER_IMAGE $DOCKER_IMAGE:sha_$BUILD_SHA + docker push $DOCKER_IMAGE:sha_$BUILD_SHA + docker push $DOCKER_IMAGE:$VERSION + docker push $DOCKER_IMAGE:latest +fi diff --git a/script/repl b/script/repl new file mode 100755 index 0000000000..1932b08564 --- /dev/null +++ b/script/repl @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Usage: script/repl [ARGS...] +# Run a repl session capable of loading all of the packages and their individual components. Any passed arguments, e.g. module names or flags, will be passed to ghci. + +set -e + +cd "$(dirname "$0")/.." + +# do a build of dependencies up front to ensure they’re all available +cabal v2-build all --enable-benchmarks --enable-tests --only-dependencies + +# exec ghci with the appropriate flags, and without the $GHC_ENVIRONMENT variable interfering +cabal v2-exec env -- -u GHC_ENVIRONMENT ghci -ghci-script=.ghci.repl $(script/ghci-flags) -no-ignore-dot-ghci $@ diff --git a/semantic-analysis/.ghci.repl b/semantic-analysis/.ghci.repl new file mode 100644 index 0000000000..f80a093837 --- /dev/null +++ b/semantic-analysis/.ghci.repl @@ -0,0 +1,43 @@ +-- GHCI settings, collected by running cabal repl -v and checking out the flags cabal passes to ghc. +-- These live here instead of script/repl for ease of commenting. +-- These live here instead of .ghci so cabal repl remains unaffected. +-- These live here instead of script/ghci-flags so ghcide remains unaffected. + +-- Basic verbosity +:set -v1 + +-- Compile to object code, write interface files. +:set -fwrite-interface -fobject-code + +-- Disable breaking on error since it hangs on uncaught exceptions when the sandbox is disabled: https://gitlab.haskell.org/ghc/ghc/issues/17743 +-- This was already disabled in .ghci, but it turns out that if your user-wide .ghci file sets -fbreak-on-error, it gets overriden, so we override it back again here. +:set -fno-break-on-error + +-- Bonus: silence β€œadd these modules to your .cabal file” warnings for files we :load +:set -Wno-missing-home-modules + +-- Warnings for code written in the repl +:seti -Weverything +:seti -Wno-all-missed-specialisations +:seti -Wno-implicit-prelude +:seti -Wno-missed-specialisations +:seti -Wno-missing-import-lists +:seti -Wno-missing-local-signatures +:seti -Wno-monomorphism-restriction +:seti -Wno-name-shadowing +:seti -Wno-safe +:seti -Wno-unsafe +-- 8.8+ +:seti -Wno-missing-deriving-strategies +-- 8.10+ +:seti -Wno-missing-safe-haskell-mode +:seti -Wno-prepositive-qualified-module +-- 9.2+ +:seti -Wno-missing-kind-signatures +:seti -Wno-missing-signatures + +-- We have this one on in the project but not in the REPL to reduce noise +:seti -Wno-type-defaults +:set -Wno-unused-packages + +:load Analysis.Analysis.Concrete Analysis.Analysis.Exception Analysis.Syntax Analysis.Analysis.Typecheck diff --git a/semantic-analysis/.gitignore b/semantic-analysis/.gitignore new file mode 100644 index 0000000000..42da211440 --- /dev/null +++ b/semantic-analysis/.gitignore @@ -0,0 +1,2 @@ +*.json +*.py diff --git a/semantic-analysis/BUILD.bazel b/semantic-analysis/BUILD.bazel new file mode 100644 index 0000000000..b4ae2ccdce --- /dev/null +++ b/semantic-analysis/BUILD.bazel @@ -0,0 +1,36 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_binary", + "haskell_library", +) +load( + "@rules_haskell//haskell:cabal.bzl", + "haskell_cabal_binary", + "haskell_cabal_library", +) +load( + "//:build/common.bzl", + "GHC_FLAGS", +) + +haskell_library( + name = "semantic-analysis", + srcs = glob(["src/**/*.hs"]), + compiler_flags = GHC_FLAGS, + deps = [ + "//:base", + "//:bytestring", + "//:containers", + "//:filepath", + "//:text", + "//:transformers", + "//semantic-source", + "@stackage//:aeson", + "@stackage//:fused-effects", + "@stackage//:hashable", + "@stackage//:pathtype", + "@stackage//:vector", + ], +) diff --git a/semantic-core/LICENSE b/semantic-analysis/LICENSE similarity index 100% rename from semantic-core/LICENSE rename to semantic-analysis/LICENSE diff --git a/semantic-analysis/README.md b/semantic-analysis/README.md new file mode 100644 index 0000000000..b8ae449f73 --- /dev/null +++ b/semantic-analysis/README.md @@ -0,0 +1,40 @@ +# semantic-analysis + +Polyglot program analysis by means of abstract definitional interpretation. + + +## Goals + +The goal of this package is to provide + +1. general facilities for performing program analysis of programs via abstract (definitional) interpretation of an intermediate language, + +2. conveniences to aid in translating programs in arbitrary surface languages into said intermediate language, + +3. facilities for tailoring and tuning program analyses to vary performance, precision, and sensitivities, and + +4. a small variety of specific program analyses to serve both as examples and as useful tools in their own right. + + +## Non-goals + +On the other hand, this package will not provide + +1. support for specific surface languages, or + +2. facilities for dealing with the meta-structure of programs, i.e. where to find modules, how projects and their files are configured, etc. + + +## Development + +This project consists of a Haskell package named `semantic-analysis`. The library’s sources are in [`src`][]. + +Development of `semantic-analysis` is typically done using `cabal v2-build`: + +```shell +cabal v2-build # build the library +cabal v2-repl # load the package into ghci +cabal v2-test # build and run the doctests +``` + +[`src`]: https://github.com/github/semantic/tree/master/semantic-analysis/src diff --git a/Setup.hs b/semantic-analysis/Setup.hs similarity index 100% rename from Setup.hs rename to semantic-analysis/Setup.hs diff --git a/semantic-analysis/cabal.project b/semantic-analysis/cabal.project new file mode 100644 index 0000000000..5a052c3fc5 --- /dev/null +++ b/semantic-analysis/cabal.project @@ -0,0 +1,5 @@ +-- NB: This file exists solely for development of this single package. For cross-package development, cd to the root of the project and run `script/repl` from there. + +-- Local packages +packages: . + ../semantic-source diff --git a/semantic-analysis/hie.yaml b/semantic-analysis/hie.yaml new file mode 100644 index 0000000000..46e7712bd7 --- /dev/null +++ b/semantic-analysis/hie.yaml @@ -0,0 +1,4 @@ +cradle: + cabal: + - path: "." + component: "lib:semantic-analysis" diff --git a/semantic-analysis/python.tsg b/semantic-analysis/python.tsg new file mode 100644 index 0000000000..aa660e720f --- /dev/null +++ b/semantic-analysis/python.tsg @@ -0,0 +1,159 @@ +; tree-sitter-graph definitions mapping Python ASTs to an analyzable IR. + +(module) @this +{ + node @this.node + attr (@this.node) type = "module" + attr (@this.node) start-line = (start-row @this) + attr (@this.node) start-col = (start-column @this) + attr (@this.node) end-line = (end-row @this) + attr (@this.node) end-col = (end-column @this) +} + +(identifier) @this +{ + node @this.node + attr (@this.node) type = "identifier" + var @this.text = (source-text @this) + attr (@this.node) text = (source-text @this) +} + +(import_statement) @this +{ + node @this.node + attr (@this.node) type = "import" +} + +(import_statement name: (dotted_name (identifier) @id)) @this +{ + edge @this.node -> @id.node + attr (@id.node) role = "module-name-fragment" + attr (@this.node -> @id.node) index = (named-child-index @id) + attr (@this.node -> @id.node) text = @id.text +} + +(string) @this +{ + node @this.node + attr (@this.node) type = "string" + attr (@this.node) text = (source-text @this) +} + +(true) @this +{ + node @this.node + attr (@this.node) type = "true" +} + +(false) @this +{ + node @this.node + attr (@this.node) type = "false" +} + +(print_statement argument: (_) @arg) @this +{ + node @this.node + attr (@this.node) type = "print" + edge @this.node -> @arg.node + attr (@this.node) start-line = (start-row @this) + attr (@this.node) start-col = (start-column @this) + attr (@this.node) end-line = (end-row @this) + attr (@this.node) end-col = (end-column @this) +} + +(raise_statement (_) @arg) @this +{ + node @this.node + attr (@this.node) type = "throw" + edge @this.node -> @arg.node + attr (@this.node) start-line = (start-row @this) + attr (@this.node) start-col = (start-column @this) + attr (@this.node) end-line = (end-row @this) + attr (@this.node) end-col = (end-column @this) +} + +(call function: (_) @function arguments: (argument_list (_)* @args)) @this +{ + node @this.node + attr (@this.node) function = (source-text @function) + attr (@this.node) type = "call" + for arg in @args { + edge @this.node -> arg.node + } + attr (@this.node) start-line = (start-row @this) + attr (@this.node) start-col = (start-column @this) + attr (@this.node) end-line = (end-row @this) + attr (@this.node) end-col = (end-column @this) +} + +(expression_statement (_) @child) @this +{ + let @this.node = @child.node +} + +(pass_statement) @this +{ + node @this.node + attr (@this.node) type = "noop" +} + +(block (_)* @children) @this +{ + node @this.node + attr (@this.node) type = "block" + for child in @children { + edge @this.node -> child.node + attr (@this.node -> child.node) index = (named-child-index child) + } + attr (@this.node) start-line = (start-row @this) + attr (@this.node) start-col = (start-column @this) + attr (@this.node) end-line = (end-row @this) + attr (@this.node) end-col = (end-column @this) +} + +(else_clause body: (_) @body) @this +{ + let @this.node = @body.node +} + +(if_statement (_)) @this { + node @this.node + attr (@this.node) type = "if" + attr (@this.node) start-line = (start-row @this) + attr (@this.node) start-col = (start-column @this) + attr (@this.node) end-line = (end-row @this) + attr (@this.node) end-col = (end-column @this) +} + +(if_statement condition: (_) @cond consequence: (_) @then) @this { + edge @this.node -> @cond.node + attr (@this.node -> @cond.node) type = "condition" + edge @this.node -> @then.node + attr (@this.node -> @then.node) type = "consequence" +} + +(if_statement alternative: (_) @else) @this +{ + edge @this.node -> @else.node + attr (@this.node -> @else.node) type = "alternative" +} + +(function_definition name: (_) @name body: (_) @body) @this +{ + node @this.node + attr (@this.node) type = "function" + attr (@this.node) name = (source-text @name) + edge @this.node -> @body.node + attr (@this.node -> @body.node) type = "body" + attr (@this.node) start-line = (start-row @this) + attr (@this.node) start-col = (start-column @this) + attr (@this.node) end-line = (end-row @this) + attr (@this.node) end-col = (end-column @this) +} + +(module (_) @child) @this +{ + edge @this.node -> @child.node + attr (@this.node -> @child.node) index = (named-child-index @child) +} diff --git a/semantic-analysis/script/ghci-flags b/semantic-analysis/script/ghci-flags new file mode 100755 index 0000000000..8ab73e366e --- /dev/null +++ b/semantic-analysis/script/ghci-flags @@ -0,0 +1,72 @@ +#!/bin/bash +# Computes the flags for ghcide to pass to ghci. You probably won’t be running this yourself, but rather ghcide will via configuration in hie.yaml. + +set -e + +cd "$(dirname "$0")/.." + +ghc_version="$(ghc --numeric-version)" + +# recent hie-bios requires us to output to the file at $HIE_BIOS_OUTPUT, but older builds & script/repl don’t set that var, so we default it to stdout +output_file="${HIE_BIOS_OUTPUT:-/dev/stdout}" + +build_dir="dist-newstyle/build/x86_64-osx/ghc-$ghc_version" +build_products_dir="$build_dir/build-repl" + +cores=$(sysctl -n machdep.cpu.core_count || echo 4) + +function flags { + # disable optimizations for faster loading + echo "-O0" + # don’t load .ghci files (for ghcide) + echo "-ignore-dot-ghci" + + # use as many jobs as there are physical cores + echo "-j$((cores + 1))" + + # where to put build products + echo "-outputdir $build_products_dir" + echo "-odir $build_products_dir" + echo "-hidir $build_products_dir" + echo "-stubdir $build_products_dir" + + # preprocessor options, for -XCPP + echo "-optP-include" + echo "-optP$build_dir/semantic-analysis-0.0.0.0/build/autogen/cabal_macros.h" + + # autogenerated sources, both .hs and .h (e.g. Foo_paths.hs) + echo "-i$build_dir/semantic-analysis-0.0.0.0/build/autogen" + echo "-I$build_dir/semantic-analysis-0.0.0.0/build/autogen" + + # .hs source dirs + echo "-isrc" + + # disable automatic selection of packages + echo "-hide-all-packages" + + # run cabal and emit package flags from the environment file, removing comments & prefixing with - + cabal v2-exec -v0 bash -- -c 'cat "$GHC_ENVIRONMENT"' | grep -v '^--' | sed -e 's/^/-/' + + # default language extensions + echo "-XHaskell2010" + + # treat warnings as warnings + echo "-Wwarn" + + # default warning flags + echo "-Weverything" + echo "-Wno-all-missed-specialisations" + echo "-Wno-implicit-prelude" + echo "-Wno-missed-specialisations" + echo "-Wno-missing-import-lists" + echo "-Wno-missing-local-signatures" + echo "-Wno-monomorphism-restriction" + echo "-Wno-name-shadowing" + echo "-Wno-safe" + echo "-Wno-unsafe" + [[ "$ghc_version" = 9.4.* ]] || [[ "$ghc_version" = 8.8.* ]] || [[ "$ghc_version" = 8.10.* ]] || [[ "$ghc_version" = 9.2.* ]] && echo "-Wno-missing-deriving-strategies" || true + [[ "$ghc_version" = 9.4.* ]] || [[ "$ghc_version" = 8.10.* ]] || [[ "$ghc_version" = 9.2.* ]] && echo "-Wno-missing-safe-haskell-mode" && echo "-Wno-prepositive-qualified-module" && echo "-Wno-unused-packages" || true + [[ "$ghc_version" = 9.4.* ]] || [[ "$ghc_version" = 9.2.* ]] && echo "-Wno-missing-kind-signatures" || true +} + +flags > "$output_file" diff --git a/semantic-analysis/script/repl b/semantic-analysis/script/repl new file mode 100755 index 0000000000..05870ab14c --- /dev/null +++ b/semantic-analysis/script/repl @@ -0,0 +1,12 @@ +#!/bin/bash +# Usage: script/repl [ARGS...] +# Run a repl session capable of loading all of the components. Any passed arguments, e.g. module names or flags, will be passed to ghci. + +set -e + +cd "$(dirname "$0")/.." + +# cabal v2-build all --only-dependencies + +cores=$(sysctl -n machdep.cpu.core_count || echo 4) +cabal v2-exec env -- -u GHC_ENVIRONMENT ghci +RTS -N$((cores + 1)) -RTS -ghci-script=.ghci.repl $(script/ghci-flags) -no-ignore-dot-ghci $@ diff --git a/semantic-analysis/semantic-analysis.cabal b/semantic-analysis/semantic-analysis.cabal new file mode 100644 index 0000000000..1225f1b309 --- /dev/null +++ b/semantic-analysis/semantic-analysis.cabal @@ -0,0 +1,84 @@ +cabal-version: 2.4 + +name: semantic-analysis +version: 0.0.0.0 +synopsis: Program analysis by abstract definitional interpretation. +description: Program analysis abstractions and implementations by abstract definitional interpretation. +homepage: https://github.com/github/semantic/tree/master/semantic-analysis#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: + GHC == 8.6.5 + +common common + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + +library + import: common + hs-source-dirs: src + exposed-modules: + Analysis.Analysis.Concrete + Analysis.Analysis.DeadCode + Analysis.Analysis.Exception + Analysis.Analysis.Typecheck + Analysis.Blob + Analysis.Carrier.Fail.WithLoc + Analysis.Carrier.Statement.State + Analysis.Carrier.Store.Monovariant + Analysis.Carrier.Store.Precise + Analysis.Data.Snoc + Analysis.Effect.Domain + Analysis.Effect.Env + Analysis.Effect.Statement + Analysis.Effect.Store + Analysis.File + Analysis.FlowInsensitive + Analysis.Functor.Named + Analysis.Module + Analysis.Name + Analysis.Project + Analysis.Reference + Analysis.Syntax + Analysis.Syntax.Python + Analysis.VM + build-depends: + , aeson >= 1.4 && < 3 + , base >= 4.13 && < 5 + , containers ^>= 0.6 + , filepath + , fused-effects ^>= 1.1 + , hashable + , language-python + , semantic-source ^>= 0.2 + , text ^>= 1.2.3.1 + , transformers ^>= 0.5 diff --git a/semantic-analysis/src/Analysis/Analysis/Concrete.hs b/semantic-analysis/src/Analysis/Analysis/Concrete.hs new file mode 100644 index 0000000000..e2669cb58d --- /dev/null +++ b/semantic-analysis/src/Analysis/Analysis/Concrete.hs @@ -0,0 +1,178 @@ +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingVia #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Analysis.Concrete +( Concrete(..) +, concrete +) where + +import Analysis.Carrier.Fail.WithLoc +import qualified Analysis.Carrier.Store.Precise as A +import Analysis.Data.Snoc +import Analysis.Effect.Domain as A +import Analysis.File +import Analysis.Functor.Named +import Analysis.Reference +import Control.Algebra +import Control.Carrier.Fresh.Strict +import Control.Carrier.Reader hiding (Local) +import Control.Effect.Labelled +import Control.Monad.Trans.Class (MonadTrans (..)) +import Data.Foldable (foldl') +import Data.Function (fix, on) +import Data.Semigroup (Last (..)) +import Data.Text as Text (Text) +import Prelude hiding (fail) + +data Concrete + = Closure Reference [Name] ([Concrete] -> Concrete) + | Unit + | Bool Bool + | Int Int + | String Text + -- | A neutral value, consisting of a variable at the head, followed by a β€œspine” of eliminations. + -- + -- This constructor is key to hereditary substitution, whereby a value in 'Concrete' is a normal form by virtue of either being a value (i.e. one of the other constructors) or 'Neutral', somewhere inside a 'Closure'. In the latter case, when the surrounding closure is eliminated, if it substitutes out the variable at the head, the eliminations are applied, immediately reducing it. Since eliminations can’t be applied to any of the other constructors, there’s no way to represent redexes, so we’re left with a new term which is itself either already a value, or else is a neutral term underneath a closure. + -- + -- This is essential for parametric modular analysis, as it allows us to obtain the same benefits not just for variables inside closures, but also variables which aren’t known from the surrounding (local) context (e.g. as-yet-unresolved imports). That in turn allows analysis to be performed 1. before we’ve computed an import graph, which is particularly difficult in some languages, 2. completely in parallel, and 3. incrementally. + | Neutral Name (Snoc (Elim Concrete)) + -- NB: We derive the 'Semigroup' instance for 'Concrete' to take the second argument. This is equivalent to stating that the return value of an imperative sequence of statements is the value of its final statement. + deriving Semigroup via Last Concrete + +instance Eq Concrete where + (==) = (==) `on` quote + +instance Ord Concrete where + compare = compare `on` quote + +instance Show Concrete where + showsPrec p = showsPrec p . quote + + +newtype Elim a = EApp [a] + deriving (Eq, Foldable, Functor, Ord, Show, Traversable) + +vvar :: Name -> Concrete +vvar n = Neutral n Nil + +velim :: Concrete -> Elim Concrete -> Concrete +velim (Closure _ _ f) (EApp a) = f a +velim (Neutral h as) a = Neutral h (as :> a) +velim _ _ = error "velim: cannot eliminate" -- FIXME: fail in the monad instead + +-- FIXME: so why use HOAS at all then? +-- FIXME: construct in de Bruijn-indexed rep & simple eval instead of substituting. +vsubst :: Name -> Concrete -> Concrete -> Concrete +vsubst n v = go + where + go = \case + Neutral n' as + | n == n' -> foldl' velim v as' + | otherwise -> Neutral n' as' + where + as' = fmap go <$> as + Closure r n b -> Closure r n (go . b) -- NB: Shadowing can’t happen because n' can’t occur inside b + Unit -> Unit + Bool b -> Bool b + Int i -> Int i + String s -> String s + + +data FO + = FOVar Name + | FOClosure Reference [Name] FO + | FOUnit + | FOBool Bool + | FOInt Int + | FOString Text + | FOApp FO [FO] + deriving (Eq, Ord, Show) + + +quote :: Concrete -> FO +quote = \case +-- FIXME: should quote take a Level incremented under binders? + Closure r n body -> FOClosure r n (quote (body (map vvar n))) + Unit -> FOUnit + Bool b -> FOBool b + Int i -> FOInt i + String s -> FOString s + Neutral n sp -> foldl' (\ f (EApp a) -> FOApp f (map quote a)) (FOVar n) sp + + +type Eval term m value = (term -> m value) -> (term -> m value) + + +concrete + :: (forall sig m + . (Has (A.Dom Concrete :+: A.Env A.PAddr :+: Reader Reference) sig m, HasLabelled A.Store (A.Store A.PAddr Concrete) sig m, MonadFail m) + => Eval term m Concrete + ) + -> [File term] + -> (A.PStore Concrete, [File (Either (Reference, String) Concrete)]) +concrete eval + = run + . evalFresh 0 + . A.runStore + . traverse (runFile eval) + +runFile + :: HasLabelled A.Store (A.Store A.PAddr Concrete) sig m + => (forall sig m + . (Has (A.Dom Concrete :+: A.Env A.PAddr :+: Reader Reference) sig m, HasLabelled A.Store (A.Store A.PAddr Concrete) sig m, MonadFail m) + => Eval term m Concrete + ) + -> File term + -> m (File (Either (Reference, String) Concrete)) +runFile eval file = traverse run file + where run = runReader (fileRef file) + . runFail + . A.runEnv + . runDomain + . fix eval + + +newtype DomainC m a = DomainC { runDomain :: m a } + deriving (Applicative, Functor, Monad, MonadFail) + +instance MonadTrans DomainC where + lift = DomainC + +instance ( Has (A.Env A.PAddr) sig m + , HasLabelled A.Store (A.Store A.PAddr Concrete) sig m + , Has (Reader Reference) sig m + , MonadFail m + ) + => Algebra (A.Dom Concrete :+: sig) (DomainC m) where + alg hdl sig ctx = case sig of + L (DVar n) -> pure (vvar n <$ ctx) + L (DAbs n b) -> do + b' <- hdl (b (map vvar n) <$ ctx) + ref <- ask + let closure body = Closure ref n (\ args -> let substs = zipWith vsubst n args in foldl' (.) id substs body) + pure $ closure <$> b' + L (DApp f a) -> pure $ velim f (EApp a) <$ ctx + L (DInt i) -> pure (Int i <$ ctx) + L DUnit -> pure (Unit <$ ctx) + L (DBool b) -> pure (Bool b <$ ctx) + L (DIf c t e) -> case c of + Bool b + | b -> hdl (t <$ ctx) + | otherwise -> hdl (e <$ ctx) + _ -> fail "expected Bool" + L (DString s) -> pure (String s <$ ctx) + L (_ :>>> t) -> pure (t <$ ctx) + L (DDie msg) -> fail (show (quote msg)) + + R other -> DomainC (alg (runDomain . hdl) other ctx) diff --git a/semantic-analysis/src/Analysis/Analysis/DeadCode.hs b/semantic-analysis/src/Analysis/Analysis/DeadCode.hs new file mode 100644 index 0000000000..e1ff4ba0a6 --- /dev/null +++ b/semantic-analysis/src/Analysis/Analysis/DeadCode.hs @@ -0,0 +1,120 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Analysis.DeadCode +( deadCodeFlowInsensitive +) where + +import Analysis.Carrier.Fail.WithLoc +import qualified Analysis.Carrier.Statement.State as A +import qualified Analysis.Carrier.Store.Monovariant as A +import Analysis.Effect.Domain as A +import Analysis.File +import Analysis.FlowInsensitive +import Analysis.Reference +import Control.Applicative (Alternative (..)) +import Control.Carrier.Fresh.Church +import Control.Carrier.Reader +import Control.Carrier.State.Church +import Control.Effect.Labelled +import Control.Monad (zipWithM_) +import Control.Monad.Trans.Class +import Data.Function (fix) +import qualified Data.Set as Set + +deadCodeFlowInsensitive + :: Ord term + => (forall sig m + . (Has (A.Dom Unit) sig m, Has (A.Env A.MAddr) sig m, Has (Reader Reference) sig m, Has A.Statement sig m, HasLabelled A.Store (A.Store A.MAddr Unit) sig m, MonadFail m) + => (term -> m Unit) + -> (term -> m Unit) + ) + -> (term -> Set.Set term) + -> [File term] + -> ( Set.Set term + , A.MStore Unit + , [File (Either (Reference, String) (Set.Set Unit))] + ) +deadCodeFlowInsensitive eval subterms + = run + . runState (\ dead (store, files) -> pure (dead, store, files)) Set.empty + . evalFresh 0 + . A.runStoreState + . traverse (runFile eval subterms) + +runFile + :: ( Has Fresh sig m + , Has (State (A.MStore Unit)) sig m + , Has (State (Set.Set term)) sig m + , Ord term + ) + => (forall sig m + . (Has (A.Dom Unit) sig m, Has (A.Env A.MAddr) sig m, Has (Reader Reference) sig m, Has A.Statement sig m, HasLabelled A.Store (A.Store A.MAddr Unit) sig m, MonadFail m) + => (term -> m Unit) + -> (term -> m Unit) + ) + -> (term -> Set.Set term) + -> File term + -> m (File (Either (Reference, String) (Set.Set Unit))) +runFile eval subterms file = traverse run file + where run term = do + modify (<> subterms term) + A.runStatement (const pure) + . runReader (fileRef file) + . A.runEnv @Unit + . runFail + . convergeTerm (A.runStore @Unit . runDomain . fix (cacheTerm . evalDead)) + $ term + evalDead eval' subterm = do + modify (Set.delete subterm) + eval eval' subterm + + +data Unit = Unit + deriving (Eq, Ord, Show) + + +newtype DomainC m a = DomainC { runDomain :: m a } + deriving (Alternative, Applicative, Functor, Monad, MonadFail) + +instance MonadTrans DomainC where + lift = DomainC + + +instance ( Alternative m + , Has (A.Env A.MAddr) sig m + , Has Fresh sig m + , HasLabelled A.Store (A.Store A.MAddr Unit) sig m + , MonadFail m + ) + => Algebra (A.Dom Unit :+: sig) (DomainC m) where + alg hdl sig ctx = case sig of + L (DVar _) -> pure (Unit <$ ctx) + + L (DInt _) -> pure (Unit <$ ctx) + + L DUnit -> pure (Unit <$ ctx) + + L (DBool _) -> pure (Unit <$ ctx) + L (DIf _ t e) -> hdl (t <$ ctx) <|> hdl (e <$ ctx) + + L (DString _) -> pure (Unit <$ ctx) + + L (DAbs n b) -> do + addrs <- traverse A.alloc n + let args = Unit <$ n + zipWithM_ (A..=) addrs args + hdl (b args <$ ctx) + L (DApp _ _) -> pure (Unit <$ ctx) + + L (_ :>>> t) -> pure (t <$ ctx) + + L (DDie msg) -> fail (show msg) + + R other -> DomainC (alg (runDomain . hdl) other ctx) diff --git a/semantic-analysis/src/Analysis/Analysis/Exception.hs b/semantic-analysis/src/Analysis/Analysis/Exception.hs new file mode 100644 index 0000000000..7cadf9722f --- /dev/null +++ b/semantic-analysis/src/Analysis/Analysis/Exception.hs @@ -0,0 +1,195 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Analysis.Exception +( Exception(..) +, ExcSet(..) +, exceptionTracing +, exceptionTracingIndependent +, fromExceptions +, var +, exc +, str +, subst +, nullExcSet +, freeVariablesForLine +, exceptionsForLine +, printExcSet +, refLines + -- * Exception tracing analysis +, ExcC(..) +) where + +import qualified Analysis.Carrier.Statement.State as A +import qualified Analysis.Carrier.Store.Monovariant as A +import Analysis.Effect.Domain +import Analysis.Effect.Env (Env) +import Analysis.Effect.Store +import Analysis.File +import Analysis.FlowInsensitive (cacheTerm, convergeTerm) +import Analysis.Module +import Analysis.Name +import Analysis.Reference +import Control.Algebra +import Control.Applicative (Alternative (..)) +import Control.Carrier.Reader +import Control.Effect.Labelled +import Control.Effect.State +import Control.Monad (unless) +import Data.Foldable (for_) +import qualified Data.Foldable as Foldable +import Data.Function (fix) +import qualified Data.IntSet as IntSet +import qualified Data.Map as Map +import qualified Data.Set as Set +import qualified Data.Text as Text +import qualified Data.Text.IO as Text +import qualified Source.Source as Source +import Source.Span + +-- | Names of exceptions thrown in the guest language and recorded by this analysis. +-- +-- Not to be confused with exceptions thrown in Haskell itself. +data Exception = Exception { exceptionName :: Name, exceptionLines :: IntSet.IntSet } + deriving (Eq, Ord, Show) + +data FreeVariable = FreeVariable { freeVariableName :: Name, freeVariableLines :: IntSet.IntSet } + deriving (Eq, Ord, Show) + +-- | Sets whose elements are each a variable or an exception. +data ExcSet = ExcSet { freeVariables :: Set.Set FreeVariable, exceptions :: Set.Set Exception, strings :: Set.Set Text.Text } + deriving (Eq, Ord, Show) + +instance Semigroup ExcSet where + ExcSet v1 e1 s1 <> ExcSet v2 e2 s2 = ExcSet (v1 <> v2) (e1 <> e2) (s1 <> s2) + +instance Monoid ExcSet where + mempty = ExcSet mempty mempty mempty + +fromExceptions :: Foldable t => t Exception -> ExcSet +fromExceptions es = ExcSet mempty (Set.fromList (Foldable.toList es)) mempty + +var :: FreeVariable -> ExcSet +var v = ExcSet (Set.singleton v) mempty mempty + +exc :: Exception -> ExcSet +exc e = ExcSet mempty (Set.singleton e) mempty + +str :: Text.Text -> ExcSet +str s = ExcSet mempty mempty (Set.singleton s) + +subst :: Name -> ExcSet -> ExcSet -> ExcSet +-- FIXME: this doesn't handle transitivity at all. +subst name (ExcSet _ es' _) (ExcSet fvs es ss) = ExcSet fvs'' (es <> es'') ss + where + (fvs'', es'') = foldMap combine fvs + combine fv + | freeVariableName fv == name = (mempty, Set.map (\ (Exception n _) -> Exception n (freeVariableLines fv)) es') + | otherwise = (Set.singleton fv, mempty) + + +nullExcSet :: ExcSet -> Bool +nullExcSet e = null (freeVariables e) && null (exceptions e) + +freeVariablesForLine :: Int -> ExcSet -> Set.Set FreeVariable +freeVariablesForLine l e = Set.filter (\ fv -> IntSet.member l (freeVariableLines fv)) (freeVariables e) + +exceptionsForLine :: Int -> ExcSet -> Set.Set Exception +exceptionsForLine l e = Set.filter (\ ex -> IntSet.member l (exceptionLines ex)) (exceptions e) + +printExcSet :: Source.Source -> ExcSet -> IO () +printExcSet src e = for_ (zip [0..] (Source.lines src)) $ \ (i, line) -> do + Text.putStr (keywords (Text.dropWhileEnd (== '\n') (Source.toText line))) + let es = exceptionsForLine i e + fvs = freeVariablesForLine i e + unless (null es && null fvs) $ do + Text.putStr " \ESC[30;1m# " + Text.putStr ("{" <> union + ( formatFreeVariables fvs + <> formatExceptions es ) <> "}" <> reset) + Text.putStrLn mempty + where + keyword k s = Text.intercalate ("\ESC[34;1m" <> k <> reset) (Text.splitOn k s) + keywords = keyword "raise" . keyword "import" . keyword "def" . keyword "pass" + union = Text.intercalate ", " + formatFreeVariables fvs = map (\ fv -> "?" <> formatName (freeVariableName fv)) (Set.toList fvs) + formatExceptions excs = map (Text.pack . show . formatName . exceptionName) (Set.toList excs) + reset = "\ESC[0m" + +refLines :: Reference -> IntSet.IntSet +refLines (Reference _ (Span (Pos startLine _) (Pos endLine _))) = IntSet.fromAscList [startLine..endLine] + +exceptionTracing + :: Ord term + => ( forall sig m + . (Has (Env A.MAddr) sig m, HasLabelled Store (Store A.MAddr ExcSet) sig m, Has (Dom ExcSet) sig m, Has (Reader Reference) sig m, Has A.Statement sig m) + => (term -> m ExcSet) + -> (term -> m ExcSet) ) + -> [File term] + -> (A.MStore ExcSet, [File (Module ExcSet)]) +exceptionTracing eval = run . A.runFiles (runFile eval) + +exceptionTracingIndependent + :: Ord term + => ( forall sig m + . (Has (Env A.MAddr) sig m, HasLabelled Store (Store A.MAddr ExcSet) sig m, Has (Dom ExcSet) sig m, Has (Reader Reference) sig m, Has A.Statement sig m) + => (term -> m ExcSet) + -> (term -> m ExcSet) ) + -> File term + -> (A.MStore ExcSet, File (Module ExcSet)) +exceptionTracingIndependent eval = run . A.runStoreState . runFile eval + +runFile + :: ( Has (State (A.MStore ExcSet)) sig m + , Ord term ) + => ( forall sig m + . (Has (Env A.MAddr) sig m, HasLabelled Store (Store A.MAddr ExcSet) sig m, Has (Dom ExcSet) sig m, Has (Reader Reference) sig m, Has A.Statement sig m) + => (term -> m ExcSet) + -> (term -> m ExcSet) ) + -> File term + -> m (File (Module ExcSet)) +runFile eval file = traverse run file where + run + = A.runStatement result + . A.runEnv @ExcSet + . runReader (fileRef file) + . convergeTerm (A.runStore @ExcSet . runExcC . fix (cacheTerm . eval)) + result msgs sets = do + exports <- gets @(A.MStore ExcSet) (fmap Foldable.fold . Map.mapKeys A.getMAddr . A.getMStore) + let set = Foldable.fold sets + imports = Set.fromList (map extractImport msgs) + pure (Module (Foldable.foldl' (flip (uncurry subst)) set . Map.toList) imports exports (Set.map freeVariableName (freeVariables set))) + extractImport (A.Import components) = name (Text.intercalate "." (Foldable.toList components)) + +newtype ExcC m a = ExcC { runExcC :: m a } + deriving (Alternative, Applicative, Functor, Monad) + +instance (Has (Reader Reference) sig m, Alternative m) => Algebra (Dom ExcSet :+: sig) (ExcC m) where + alg hdl sig ctx = ExcC $ case sig of + L dom -> case dom of + DVar n -> do + lines <- asks refLines + pure $ var (FreeVariable n lines) <$ ctx + DAbs _ b -> runExcC (hdl (b mempty <$ ctx)) + DApp f a -> pure $ f <> Foldable.fold a <$ ctx + DInt _ -> pure nil + DUnit -> pure nil + DBool _ -> pure nil + DIf c t e -> fmap (mappend c) <$> runExcC (hdl (t <$ ctx) <|> hdl (e <$ ctx)) + DString s -> pure (str (Text.dropAround (== '"') s) <$ ctx) + t :>>> u -> pure (t <> u <$ ctx) + DDie e -> do + lines <- asks refLines + pure $ e{ strings = mempty } <> fromExceptions [Exception (name n) lines | n <- Set.toList (strings e)] <$ ctx + where + nil = (mempty :: ExcSet) <$ ctx + + R other -> alg (runExcC . hdl) other ctx diff --git a/semantic-analysis/src/Analysis/Analysis/Typecheck.hs b/semantic-analysis/src/Analysis/Analysis/Typecheck.hs new file mode 100644 index 0000000000..fabe2e687e --- /dev/null +++ b/semantic-analysis/src/Analysis/Analysis/Typecheck.hs @@ -0,0 +1,249 @@ +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingVia #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Analysis.Typecheck +( Monotype (..) +, Meta +, Polytype (..) +, typecheckingFlowInsensitive +) where + +import Analysis.Carrier.Fail.WithLoc +import qualified Analysis.Carrier.Store.Monovariant as A +import Analysis.Effect.Domain as A +import Analysis.File +import Analysis.FlowInsensitive +import Analysis.Functor.Named +import Analysis.Reference +import Control.Algebra +import Control.Applicative (Alternative (..)) +import Control.Carrier.Fresh.Strict as Fresh +import Control.Carrier.Reader hiding (Local) +import Control.Carrier.State.Strict +import Control.Effect.Labelled +import Control.Monad (ap, guard, unless) +import Control.Monad.Trans.Class +import Data.Foldable (for_, sequenceA_) +import Data.Function (fix) +import qualified Data.IntMap as IM +import qualified Data.IntSet as IS +import Data.Maybe (fromJust, fromMaybe) +import Data.Semigroup (Last (..)) +import qualified Data.Set as Set +import Data.Void +import GHC.Generics (Generic1) +import Prelude hiding (fail) + +data Monotype a + = Var a + | Unit + | Bool + | Int + | String + | [Monotype a] :-> Monotype a + -- | (Locally) undefined names whose types are unknown. May not be eliminated by unification. + | TypeOf Name + deriving (Eq, Foldable, Functor, Generic1, Ord, Show, Traversable) + +infixr 0 :-> + +-- FIXME: Union the effects/annotations on the operands. + +-- | We derive the 'Semigroup' instance for types to take the second argument. This is equivalent to stating that the type of an imperative sequence of statements is the type of its final statement. +deriving via (Last (Monotype a)) instance Semigroup (Monotype a) + +instance Applicative Monotype where + pure = Var + (<*>) = ap + +instance Monad Monotype where + m >>= f = case m of + Var a -> f a + Unit -> Unit + Bool -> Bool + Int -> Int + String -> String + TypeOf n -> TypeOf n + a :-> b -> (map (>>= f) a) :-> (b >>= f) + + +type Type = Monotype Meta + + +type Meta = Int + + +data Polytype a + = PForAll (Polytype (Maybe a)) + | PType (Monotype a) + deriving (Eq, Foldable, Functor, Generic1, Ord, Show, Traversable) + + +closed :: Traversable f => f a -> Maybe (f b) +closed = traverse (const Nothing) + +abstract :: Eq a => a -> Polytype a -> Polytype (Maybe a) +abstract n = fmap (\ a -> a <$ guard (a == n)) + + +forAll :: Eq a => a -> Polytype a -> Polytype a +forAll n body = PForAll (abstract n body) + +forAlls :: (Eq a, Foldable t) => t a -> Polytype a -> Polytype a +forAlls ns body = foldr forAll body ns + +generalize :: Monotype Meta -> Polytype Void +generalize ty = fromJust (closed (forAlls (IS.toList (mvs ty)) (PType ty))) + + +typecheckingFlowInsensitive + :: Ord term + => (forall sig m + . (Has (A.Dom Type :+: A.Env A.MAddr :+: Reader Reference) sig m, HasLabelled A.Store (A.Store A.MAddr Type) sig m, MonadFail m) + => (term -> m Type) + -> (term -> m Type) + ) + -> [File term] + -> ( A.MStore Type + , [File (Either (Reference, String) (Polytype Void))] + ) +typecheckingFlowInsensitive eval + = run + . evalFresh 0 + . A.runStoreState + . fmap (fmap (fmap (fmap generalize))) + . traverse (runFile eval) + +runFile + :: ( Has Fresh sig m + , Has (State (A.MStore Type)) sig m + , Ord term + ) + => (forall sig m + . (Has (A.Dom Type :+: A.Env A.MAddr :+: Reader Reference) sig m, HasLabelled A.Store (A.Store A.MAddr Type) sig m, MonadFail m) + => (term -> m Type) + -> (term -> m Type) + ) + -> File term + -> m (File (Either (Reference, String) Type)) +runFile eval file = traverse run file + where run + = (\ m -> do + (subst, t) <- m + modify @(A.MStore Type) (A.MStore . fmap (Set.map (substAll subst)) . A.getMStore) + pure (substAll subst <$> t)) + . runState @Substitution mempty + . runReader (fileRef file) + . A.runEnv @Type + . runFail + . (\ m -> do + (cs, t) <- m + t <$ solve cs) + . runState @(Set.Set (Type, Type)) mempty + . (\ m -> do + v <- meta + bs <- m + v <$ for_ bs (unify v)) + . convergeTerm (A.runStore @Type . runDomain . fix (cacheTerm . eval)) + + +data Solution + = Int := Type + deriving (Eq, Ord, Show) + +infix 5 := + +meta :: Has Fresh sig m => m Type +meta = pure <$> Fresh.fresh + +unify :: Has (State (Set.Set (Type, Type))) sig m => Type -> Type -> m () +unify t1 t2 + | t1 == t2 = pure () + | otherwise = modify (<> Set.singleton (t1, t2)) + +type Substitution = IM.IntMap Type + +solve :: (Has (State Substitution) sig m, MonadFail m) => Set.Set (Type, Type) -> m () +solve cs = for_ cs (uncurry solve) + where solve = curry $ \case + (a1 :-> b1, a2 :-> b2) -> sequenceA_ (zipWith solve a1 a2) *> solve b1 b2 + (Var m1 , Var m2) | m1 == m2 -> pure () + (Var m1 , t2) -> do + sol <- solution m1 + case sol of + Just (_ := t1) -> solve t1 t2 + Nothing | m1 `IS.member` mvs t2 -> fail ("Occurs check failure: " <> show m1 <> " :===: " <> show t2) + | otherwise -> modify (IM.insert m1 t2 . fmap (substAll (IM.singleton m1 t2))) + (t1 , Var m2) -> solve (Var m2) t1 + (t1 , t2) -> unless (t1 == t2) $ fail ("Type mismatch:\nexpected: " <> show t1 <> "\n actual: " <> show t2) + + solution m = fmap (m :=) <$> gets (IM.lookup m) + + +mvs :: Foldable t => t Meta -> IS.IntSet +mvs = foldMap IS.singleton + +substAll :: Monad t => IM.IntMap (t Meta) -> t Meta -> t Meta +substAll s a = a >>= \ i -> fromMaybe (pure i) (IM.lookup i s) + + +newtype DomainC m a = DomainC { runDomain :: m a } + deriving (Alternative, Applicative, Functor, Monad, MonadFail) + +instance MonadTrans DomainC where + lift = DomainC + +instance ( Alternative m + , Has (A.Env A.MAddr) sig m + , Has Fresh sig m + , HasLabelled A.Store (A.Store A.MAddr Type) sig m + , Has (State (Set.Set (Type, Type))) sig m + , MonadFail m + ) + => Algebra (A.Dom Type :+: sig) (DomainC m) where + alg hdl sig ctx = case sig of + L (DVar n) -> pure (TypeOf n <$ ctx) + + L (DInt _) -> pure (Int <$ ctx) + + L DUnit -> pure (Unit <$ ctx) + + L (DBool _) -> pure (Bool <$ ctx) + L (DIf c t e) -> do + unify c Bool + hdl (t <$ ctx) <|> hdl (e <$ ctx) + + L (DString _) -> pure (String <$ ctx) + + L (DAbs n b) -> do + addrs <- traverse A.alloc n + args <- traverse (const meta) n + sequenceA_ (zipWith (A..=) addrs args) + ty <- hdl (b args <$ ctx) + pure ((args :->) <$> ty) + L (DApp f a) -> do + args <- traverse (const meta) a + ret <- meta + unify f (args :-> ret) + sequenceA_ (zipWith unify a args) + pure (ret <$ ctx) + + L (_ :>>> t) -> pure (t <$ ctx) + + L (DDie msg) -> fail (show msg) + + R other -> DomainC (alg (runDomain . hdl) other ctx) diff --git a/semantic-analysis/src/Analysis/Blob.hs b/semantic-analysis/src/Analysis/Blob.hs new file mode 100644 index 0000000000..5b8ec638f4 --- /dev/null +++ b/semantic-analysis/src/Analysis/Blob.hs @@ -0,0 +1,49 @@ +{-# LANGUAGE OverloadedStrings #-} +module Analysis.Blob + ( Blob (..) + , fromSource + , blobLanguage + , blobPath + , blobFilePath + , nullBlob + ) where + +import Analysis.File as A +import Analysis.Reference as A +import Data.Aeson +import Source.Language as Language +import Source.Source as Source + +-- | The source, path information, and language of a file read from disk. +data Blob = Blob + { blobSource :: Source -- ^ The UTF-8 encoded source text of the blob. + , blobFile :: File Language -- ^ Path/language information for this blob. + } deriving (Show, Eq) + +instance FromJSON Blob where + parseJSON = withObject "Blob" $ \b -> do + src <- b .: "content" + pth <- b .: "path" + lang <- b .: "language" + let lang' = if knownLanguage lang then lang else Language.forPath pth + pure (fromSource pth lang' src) + + +-- | Create a Blob from a provided path, language, and UTF-8 source. +-- The resulting Blob's span is taken from the 'totalSpan' of the source. +fromSource :: FilePath -> Language -> Source -> Blob +fromSource filepath language source + = Blob source (A.File (A.Reference filepath (totalSpan source)) language) + +blobLanguage :: Blob -> Language +blobLanguage = A.fileBody . blobFile + +blobPath :: Blob -> FilePath +blobPath = A.refPath . A.fileRef . blobFile + +-- | Show FilePath for error or json outputs. +blobFilePath :: Blob -> String +blobFilePath = blobPath + +nullBlob :: Blob -> Bool +nullBlob = Source.null . blobSource diff --git a/semantic-analysis/src/Analysis/Carrier/Env/Monovariant.hs b/semantic-analysis/src/Analysis/Carrier/Env/Monovariant.hs new file mode 100644 index 0000000000..bce844671d --- /dev/null +++ b/semantic-analysis/src/Analysis/Carrier/Env/Monovariant.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Carrier.Env.Monovariant +( -- * Env carrier + EnvC(..) + -- * Env effect +, module Analysis.Effect.Env +) where + +import Analysis.Effect.Env +import Analysis.Name +import Control.Algebra +import qualified Control.Monad.Fail as Fail + +newtype EnvC m a = EnvC { runEnv :: m a } + deriving (Applicative, Functor, Monad, Fail.MonadFail) + +instance Algebra sig m + => Algebra (Env Name :+: sig) (EnvC m) where + alg hdl sig ctx = case sig of + L (Bind _ _ m) -> hdl (m <$ ctx) + L (Lookup name) -> pure (Just name <$ ctx) + R other -> EnvC (alg (runEnv . hdl) other ctx) diff --git a/semantic-analysis/src/Analysis/Carrier/Env/Precise.hs b/semantic-analysis/src/Analysis/Carrier/Env/Precise.hs new file mode 100644 index 0000000000..b36eee6ac5 --- /dev/null +++ b/semantic-analysis/src/Analysis/Carrier/Env/Precise.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Carrier.Env.Precise +( -- * Env carrier + EnvC(..) + -- * Env effect +, module Analysis.Effect.Env +) where + +import Analysis.Effect.Env +import Analysis.Name +import Control.Algebra +import Control.Effect.Reader +import qualified Control.Monad.Fail as Fail +import qualified Data.Map as Map + +type Precise = Int +type PreciseEnv = Map.Map Name Precise + +newtype EnvC m a = EnvC { runEnv :: m a } + deriving (Applicative, Functor, Monad, Fail.MonadFail) + +instance Has (Reader PreciseEnv) sig m + => Algebra (Env Precise :+: sig) (EnvC m) where + alg hdl sig ctx = case sig of + L (Bind name addr m) -> local (Map.insert name addr) (hdl (m <$ ctx)) + L (Lookup name) -> (<$ ctx) <$> asks (Map.lookup name) + R other -> EnvC (alg (runEnv . hdl) other ctx) diff --git a/semantic-analysis/src/Analysis/Carrier/Fail/WithLoc.hs b/semantic-analysis/src/Analysis/Carrier/Fail/WithLoc.hs new file mode 100644 index 0000000000..8ffd0179c8 --- /dev/null +++ b/semantic-analysis/src/Analysis/Carrier/Fail/WithLoc.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Carrier.Fail.WithLoc +( -- * Fail carrier + runFail +, FailC(..) + -- * Fail effect +, module Control.Effect.Fail +) where + +import Analysis.Reference +import Control.Algebra +import Control.Applicative +import Control.Carrier.Error.Either +import Control.Effect.Fail +import Control.Effect.Reader +import Prelude hiding (fail) + +-- Fail carrier + +runFail :: FailC m a -> m (Either (Reference, String) a) +runFail = runError . runFailC + +newtype FailC m a = FailC { runFailC :: ErrorC (Reference, String) m a } + deriving (Alternative, Applicative, Functor, Monad) + +instance Has (Reader Reference) sig m => MonadFail (FailC m) where + fail s = do + ref <- ask + FailC (throwError (ref :: Reference, s)) + +instance Has (Reader Reference) sig m => Algebra (Fail :+: sig) (FailC m) where + alg _ (L (Fail s)) _ = fail s + alg hdl (R other) ctx = FailC (alg (runFailC . hdl) (R other) ctx) diff --git a/semantic-analysis/src/Analysis/Carrier/Statement/State.hs b/semantic-analysis/src/Analysis/Carrier/Statement/State.hs new file mode 100644 index 0000000000..b40eb33f91 --- /dev/null +++ b/semantic-analysis/src/Analysis/Carrier/Statement/State.hs @@ -0,0 +1,43 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Carrier.Statement.State +( -- * Messages + Message(..) + -- * Statement carrier +, runStatement +, StatementC(..) + -- * Statement effect +, module Analysis.Effect.Statement +) where + +import Analysis.Effect.Statement hiding (Import) +import qualified Analysis.Effect.Statement as S +import Control.Algebra +import Control.Carrier.State.Church +import Control.Monad.Fail as Fail +import Data.List.NonEmpty (NonEmpty) +import Data.Text (Text) + +-- Messages + +newtype Message + = Import (NonEmpty Text) + deriving (Eq, Ord, Show) + + +-- Statement carrier + +runStatement :: ([Message] -> a -> m r) -> StatementC m a -> m r +runStatement k (StatementC m) = runState (k . reverse) [] m + +newtype StatementC m a = StatementC { runStatementC :: StateC [Message] m a } + deriving (Applicative, Functor, Monad, Fail.MonadFail) + +instance Algebra sig m => Algebra (S.Statement :+: sig) (StatementC m) where + alg hdl sig ctx = case sig of + L (S.Import ns) -> StatementC ((<$ ctx) <$> modify (Import ns:)) + R other -> StatementC (alg (runStatementC . hdl) (R other) ctx) diff --git a/semantic-analysis/src/Analysis/Carrier/Store/Monovariant.hs b/semantic-analysis/src/Analysis/Carrier/Store/Monovariant.hs new file mode 100644 index 0000000000..acda5a17b2 --- /dev/null +++ b/semantic-analysis/src/Analysis/Carrier/Store/Monovariant.hs @@ -0,0 +1,110 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Carrier.Store.Monovariant +( -- * Store carrier + MAddr(..) +, MStore(..) +, runStoreState +, runStore +, StoreC(..) + -- * Store effect +, module Analysis.Effect.Store + -- * Env carrier +, EnvC(..) + -- * Env effect +, module Analysis.Effect.Env + -- * Running +, runFiles +, runFilesIndependent +) where + +import Analysis.Effect.Env +import Analysis.Effect.Store +import Analysis.File (File) +import Analysis.Name +import Control.Algebra +import Control.Carrier.State.Church +import Control.Effect.Labelled +import Control.Effect.NonDet +import Control.Monad.Fail as Fail +import Data.Map as Map +import Data.Set as Set + +newtype MAddr = MAddr { getMAddr :: Name } + deriving (Eq, Ord, Show) + +newtype MStore value = MStore { getMStore :: Map.Map MAddr (Set.Set value) } + deriving (Eq, Ord, Show) + +instance Ord value => Semigroup (MStore value) where + MStore s1 <> MStore s2 = MStore (Map.unionWith Set.union s1 s2) + +instance Ord value => Monoid (MStore value) where + mempty = MStore Map.empty + + +-- Store carrier + +runStoreState :: Applicative m => StateC (MStore value) m a -> m (MStore value, a) +runStoreState = runState (curry pure) (MStore Map.empty) + +runStore :: Labelled Store (StoreC value) m a -> m a +runStore = runStoreC . runLabelled + +newtype StoreC value m a = StoreC { runStoreC :: m a } + deriving (Alternative, Applicative, Functor, Monad, Fail.MonadFail) + +instance (Has (State (MStore value)) sig m, Alternative m, Ord value) => Algebra (Store MAddr value :+: sig) (StoreC value m) where + alg hdl sig ctx = StoreC $ do + MStore store <- get @(MStore value) + case sig of + L op -> case op of + Alloc name -> let addr = MAddr name in addr <$ ctx <$ put (MStore (Map.insertWith Set.union addr Set.empty store)) + Assign addr value -> ctx <$ put (MStore (Map.insertWith Set.union addr (Set.singleton value) store)) + Fetch addr -> foldMapA ((<$ put (MStore store)) . (<$ ctx)) (Map.findWithDefault Set.empty addr store) + + R other -> alg (runStoreC . hdl) other ctx + + +-- Env carrier + +newtype EnvC value m a = EnvC { runEnv :: m a } + deriving (Applicative, Functor, Monad, Fail.MonadFail) + +instance Has (State (MStore value)) sig m + => Algebra (Env MAddr :+: sig) (EnvC value m) where + alg hdl sig ctx = case sig of + L op -> case op of + Bind _ _ m -> hdl (m <$ ctx) + Lookup n -> do + MStore store <- get @(MStore value) + pure (MAddr n <$ Map.lookup (MAddr n) store <$ ctx) + + R other -> EnvC (alg (runEnv . hdl) other ctx) + + +-- Running + +runFiles + :: Algebra sig m + => (forall sig m . Has (State (MStore value)) sig m => File term -> m (File result)) + -> [File term] + -> m (MStore value, [File result]) +runFiles runFile + = runStoreState + . traverse runFile + +runFilesIndependent + :: Algebra sig m + => (forall sig m . Has (State (MStore value)) sig m => File term -> m (File result)) + -> [File term] + -> m [(MStore value, File result)] +runFilesIndependent runFile + = traverse (runStoreState . runFile) diff --git a/semantic-analysis/src/Analysis/Carrier/Store/Precise.hs b/semantic-analysis/src/Analysis/Carrier/Store/Precise.hs new file mode 100644 index 0000000000..dc457a4c21 --- /dev/null +++ b/semantic-analysis/src/Analysis/Carrier/Store/Precise.hs @@ -0,0 +1,73 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Carrier.Store.Precise +( -- * Store carrier + PAddr(..) +, PStore(..) +, PEnv +, runStore +, StoreC(StoreC) + -- * Store effect +, module Analysis.Effect.Store + -- * Env carrier +, runEnv +, EnvC(..) + -- * Env effect +, module Analysis.Effect.Env +) where + +import Analysis.Effect.Env +import Analysis.Effect.Store +import Analysis.Name +import Control.Algebra +import Control.Carrier.Reader +import Control.Carrier.State.Church +import Control.Effect.Labelled +import Control.Monad.Fail as Fail +import Data.IntMap as IntMap +import Data.Map as Map + +newtype PAddr = PAddr Int + +newtype PStore a = PStore (IntMap.IntMap (Maybe a)) + deriving (Eq, Ord, Monoid, Semigroup, Show) + +type PEnv = Map.Map Name PAddr + + +-- Store carrier + +runStore :: Applicative m => Labelled Store (StoreC val) m a -> m (PStore val, a) +runStore = runState (curry pure) mempty . runStoreC . runLabelled + +newtype StoreC val m a = StoreC { runStoreC :: StateC (PStore val) m a } + deriving (Applicative, Functor, Monad) + +instance Algebra sig m => Algebra (Store PAddr val :+: sig) (StoreC val m) where + alg hdl sig ctx = StoreC $ case sig of + L op -> case op of + Alloc _ -> StateC $ \ k (PStore heap) -> do + let a = maybe 0 ((+ 1) . fst) (IntMap.lookupMax heap) + k (PStore (IntMap.insert a Nothing heap)) (PAddr a <$ ctx) + Assign (PAddr a) v -> ctx <$ modify (\ (PStore heap) -> PStore (IntMap.insert a (Just v) heap)) + Fetch (PAddr a) -> gets (\ (PStore heap) -> maybe (error "unallocated addr") (maybe (error "uninitialized addr") (<$ ctx)) (IntMap.lookup a heap)) + R other -> alg (runStoreC . hdl) (R other) ctx + + +-- Env carrier + +runEnv :: EnvC m a -> m a +runEnv = runReader Map.empty . runEnvC + +newtype EnvC m a = EnvC { runEnvC :: ReaderC PEnv m a } + deriving (Applicative, Functor, Monad, Fail.MonadFail) + +instance Algebra sig m => Algebra (Env PAddr :+: sig) (EnvC m) where + alg hdl sig ctx = EnvC $ case sig of + L (Bind name addr m) -> local (Map.insert name addr) (runEnvC (hdl (m <$ ctx))) + L (Lookup name) -> asks ((<$ ctx) . Map.lookup name) + R other -> alg (runEnvC . hdl) (R other) ctx diff --git a/semantic-analysis/src/Analysis/Data/Snoc.hs b/semantic-analysis/src/Analysis/Data/Snoc.hs new file mode 100644 index 0000000000..eb5dfea701 --- /dev/null +++ b/semantic-analysis/src/Analysis/Data/Snoc.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE DeriveTraversable #-} +module Analysis.Data.Snoc +( Snoc(..) +) where + +data Snoc a = Nil | Snoc a :> a + deriving (Foldable, Functor, Traversable) diff --git a/semantic-analysis/src/Analysis/Effect/Domain.hs b/semantic-analysis/src/Analysis/Effect/Domain.hs new file mode 100644 index 0000000000..0e8064629b --- /dev/null +++ b/semantic-analysis/src/Analysis/Effect/Domain.hs @@ -0,0 +1,111 @@ +{-# LANGUAGE GADTs #-} +{- +TODO + +- machine integer sizes +-} +module Analysis.Effect.Domain +( -- * Variables + dvar + -- * Functions +, dabs +, dapp + -- * Integers +, dint + -- * Unit +, dunit + -- * Booleans +, dtrue +, dfalse +, dbool +, dif + -- * Strings +, dstring + -- * Statements +, (>>>) + -- * Exceptions +, ddie + -- * Domain effect +, Dom(..) +) where + +import Analysis.Functor.Named +import Control.Algebra +import Data.Text (Text) + +-- Variables + +dvar :: Has (Dom val) sig m => Name -> m val +dvar = send . DVar + + +-- Functions + +dabs :: Has (Dom val) sig m => [Name] -> ([val] -> m val) -> m val +dabs n = send . DAbs n + +dapp :: Has (Dom val) sig m => val -> [val] -> m val +dapp f a = send $ DApp f a + + +-- Integers + +dint :: Has (Dom val) sig m => Int -> m val +dint = send . DInt + + +-- Unit + +dunit :: Has (Dom val) sig m => m val +dunit = send DUnit + + +-- Booleans + +dtrue :: Has (Dom val) sig m => m val +dtrue = dbool True + +dfalse :: Has (Dom val) sig m => m val +dfalse = dbool False + +dbool :: Has (Dom val) sig m => Bool -> m val +dbool = send . DBool + +dif :: Has (Dom val) sig m => val -> m val -> m val -> m val +dif c t e = send $ DIf c t e + + +-- Strings + +dstring :: Has (Dom val) sig m => Text -> m val +dstring = send . DString + + +-- Statements + +-- | Combine the results of adjacent statements. +-- +-- This exists to allow e.g. collecting analyses to see the results of earlier statements when processing later ones, without requiring @val@ to be a 'Semigroup'. For example, concrete and typechecking domains would likely ignore the first parameter and return the second, while a domain counting the number of visited instructions would return the sum of both. +(>>>) :: Has (Dom val) sig m => val -> val -> m val +t >>> u = send (t :>>> u) + + +-- Exceptions + +ddie :: Has (Dom val) sig m => val -> m val +ddie = send . DDie + + +-- Domain effect + +data Dom val m k where + DVar :: Name -> Dom val m val + DAbs :: [Name] -> ([val] -> m val) -> Dom val m val + DApp :: val -> [val] -> Dom val m val + DInt :: Int -> Dom val m val + DUnit :: Dom val m val + DBool :: Bool -> Dom val m val + DIf :: val -> m val -> m val -> Dom val m val + DString :: Text -> Dom val m val + (:>>>) :: val -> val -> Dom val m val + DDie :: val -> Dom val m val diff --git a/semantic-analysis/src/Analysis/Effect/Env.hs b/semantic-analysis/src/Analysis/Effect/Env.hs new file mode 100644 index 0000000000..1e902485da --- /dev/null +++ b/semantic-analysis/src/Analysis/Effect/Env.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE GADTs #-} +module Analysis.Effect.Env +( -- * Env effect + bind +, lookupEnv +, Env(..) + -- * Re-exports +, Algebra +, Has +, run +) where + +import Analysis.Name +import Control.Algebra + +bind :: Has (Env addr) sig m => Name -> addr -> m a -> m a +bind name addr m = send (Bind name addr m) + +lookupEnv :: Has (Env addr) sig m => Name -> m (Maybe addr) +lookupEnv name = send (Lookup name) + + +data Env addr m k where + Bind :: Name -> addr -> m a -> Env addr m a + Lookup :: Name -> Env addr m (Maybe addr) diff --git a/semantic-analysis/src/Analysis/Effect/Statement.hs b/semantic-analysis/src/Analysis/Effect/Statement.hs new file mode 100644 index 0000000000..14e4daa6a1 --- /dev/null +++ b/semantic-analysis/src/Analysis/Effect/Statement.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE GADTs #-} +{-# LANGUAGE KindSignatures #-} +{- | +The @'Statement'@ effect is designed to provide instrumentation for source-level interactions we need visibility into which are nevertheless not (currently) modelled by expressions: e.g. statements, declarations, certain directives, etc. + +Currently this is limited to imports, where the value-level semantics are (for many languages) essentially the unit value, but where the effect of bringing an environment and entire subset of the store into scope are essential to track for modular interpretation. +-} +module Analysis.Effect.Statement +( -- * Statement effect + simport +, Statement(..) +) where + +import Control.Algebra +import Data.Kind as K +import Data.List.NonEmpty (NonEmpty) +import Data.Text + +-- Statement effect + +simport :: Has Statement sig m => NonEmpty Text -> m () +simport ns = send (Import ns) + +data Statement (m :: K.Type -> K.Type) k where + Import :: NonEmpty Text -> Statement m () diff --git a/semantic-analysis/src/Analysis/Effect/Store.hs b/semantic-analysis/src/Analysis/Effect/Store.hs new file mode 100644 index 0000000000..d04ca0124a --- /dev/null +++ b/semantic-analysis/src/Analysis/Effect/Store.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE TypeApplications #-} +module Analysis.Effect.Store +( -- * Store effect + alloc +, (.=) +, fetch +, Store(..) + -- * Re-exports +, Algebra +, Has +, run +) where + +import Analysis.Name +import Control.Effect.Labelled +import Data.Kind as K + +-- Store effect + +alloc :: HasLabelled Store (Store addr val) sig m => Name -> m addr +alloc = sendLabelled @Store . Alloc + +(.=) :: HasLabelled Store (Store addr val) sig m => addr -> val -> m () +addr .= val = sendLabelled @Store $ Assign addr val + +infix 2 .= + +fetch :: HasLabelled Store (Store addr val) sig m => addr -> m val +fetch = sendLabelled @Store . Fetch + +data Store addr val (m :: K.Type -> K.Type) k where + Alloc :: Name -> Store addr val m addr + Assign :: addr -> val -> Store addr val m () + Fetch :: addr -> Store addr val m val diff --git a/semantic-analysis/src/Analysis/File.hs b/semantic-analysis/src/Analysis/File.hs new file mode 100644 index 0000000000..e6bc8730d4 --- /dev/null +++ b/semantic-analysis/src/Analysis/File.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE DeriveTraversable #-} +module Analysis.File +( -- * Files + File(..) + -- * Constructors +, fromBody +, fromPath + -- * Eliminators +, fileLanguage +) where + +import qualified Analysis.Reference as A +import Data.Maybe (fromJust, listToMaybe) +import GHC.Stack +import Source.Language as Language +import Source.Span + +-- Files + +data File a = File + { fileRef :: !A.Reference + , fileBody :: !a + } + deriving (Eq, Foldable, Functor, Ord, Show, Traversable) + + +-- Constructors + +fromBody :: HasCallStack => a -> File a +fromBody body = File (A.Reference (srcLocFile srcLoc) (spanFromSrcLoc srcLoc)) body where + srcLoc = snd (fromJust (listToMaybe (getCallStack callStack))) + +fromPath :: FilePath -> File Language +fromPath p = File (A.fromPath p) (Language.forPath p) + + +-- Eliminators + +-- | The language of the provided file, as inferred by 'Language.forPath'. +fileLanguage :: File a -> Language +fileLanguage = Language.forPath . A.refPath . fileRef diff --git a/semantic-analysis/src/Analysis/FlowInsensitive.hs b/semantic-analysis/src/Analysis/FlowInsensitive.hs new file mode 100644 index 0000000000..b794f9a388 --- /dev/null +++ b/semantic-analysis/src/Analysis/FlowInsensitive.hs @@ -0,0 +1,146 @@ +{-# LANGUAGE GeneralisedNewtypeDeriving #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +module Analysis.FlowInsensitive +( -- * Flow-insensitive convergence + convergeTerm +, cacheTerm +, CacheC(..) +, runCache + -- * Kleene least fixed-point theorem +, converge +, convergeBy +, convergeMaybe +, convergeEither + -- * Caches +, Cache(..) +, emptyCache +, lookupCache +, insertCache +, insertsCache +) where + +import Analysis.Carrier.Store.Monovariant +import Control.Algebra +import Control.Carrier.NonDet.Church +import Control.Carrier.Reader +import Control.Carrier.State.Church +import Control.Monad ((<=<)) +import Control.Monad.Fail as Fail +import qualified Data.Map as Map +import Data.Maybe (fromMaybe) +import qualified Data.Set as Set + +convergeTerm + :: forall term value m sig + . ( Has (State (MStore value)) sig m + , Ord term + , Ord value + ) + => (term -> CacheC term value m value) + -> term + -> m (Set.Set value) +convergeTerm eval term = do + heap <- get @(MStore value) + lookupCache term . fst <$> converge (\ (prevCache, _) -> runCache prevCache (eval term)) (emptyCache, heap) + +cacheTerm + :: ( Alternative m + , Has (Reader (Cache term value)) sig m + , Has (State (Cache term value)) sig m + , Ord term + , Ord value + ) + => (term -> m value) + -> (term -> m value) +cacheTerm eval term = do + cached <- gets (lookupCache term) + if Set.null cached then do + results <- asks (lookupCache term) + modify (insertsCache term (results `asTypeOf` cached)) + result <- eval term + result <$ modify (insertCache term result) + else + foldMapA pure cached + + +newtype CacheC term value m a = CacheC (NonDetC (ReaderC (Cache term value) (StateC (Cache term value) m)) a) + deriving (Algebra (NonDet :+: Reader (Cache term value) :+: State (Cache term value) :+: sig), Alternative, Applicative, Functor, Monad, Fail.MonadFail) + +runCache :: (Has (State (MStore value)) sig m, Ord a) => Cache term value -> CacheC term value m a -> m (Cache term value, MStore value) +runCache prevCache (CacheC m) = runState (curry pure) emptyCache (runReader prevCache (runNonDetM Set.singleton m *> get)) + + +-- Kleene least fixed-point theorem + +-- | Iterate a monadic action starting from some initial seed until the results converge. +-- +-- This applies the Kleene fixed-point theorem to finitize a monotone action. cf https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem +converge + :: (Eq a, Monad m) + => (a -> m a) -- ^ A monadic action to perform at each iteration, starting from the result of the previous iteration or from the seed value for the first iteration. + -> a -- ^ An initial seed value to iterate from. + -> m a -- ^ A computation producing the least fixed point (the first value at which the actions converge). +converge = convergeBy (==) + +-- | Iterate a monadic action starting from some initial seed until the results converge according to the passed test. +-- +-- This applies the Kleene fixed-point theorem to finitize a monotone action. cf https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem +convergeBy + :: Monad m + => (a -> a -> Bool) -- ^ A function to use as the equality test to determine convergence. + -> (a -> m a) -- ^ A monadic action to perform at each iteration, starting from the result of the previous iteration or from the seed value for the first iteration. + -> a -- ^ An initial seed value to iterate from. + -> m a -- ^ A computation producing the least fixed point (the first value at which the actions converge). +convergeBy (==) f = convergeMaybe (\ x -> qualify x <$> f x) + where + qualify x x' + | x == x' = Nothing + | otherwise = Just x' + +-- | Iterate a monadic action starting from some initial seed until the results converge. +-- +-- This applies the Kleene fixed-point theorem to finitize a monotone action. cf https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem +convergeMaybe + :: Monad m + => (a -> m (Maybe a)) -- ^ A monadic action to perform at each iteration, starting from the result of the previous iteration or from the seed value for the first iteration. Returns of 'Nothing' end iteration, while 'Just' begins another iteration. + -> a -- ^ An initial seed value to iterate from. + -> m a -- ^ A computation producing the least fixed point (the first value at which the actions converge). +convergeMaybe f = convergeEither (\ x -> maybe (Left x) Right <$> f x) + +-- | Iterate a monadic action starting from some initial seed until the results converge. +-- +-- This applies the Kleene fixed-point theorem to finitize a monotone action. cf https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem +convergeEither + :: Monad m + => (a -> m (Either b a)) -- ^ A monadic action to perform at each iteration, starting from the result of the previous iteration or from the seed value for the first iteration. Returns of 'Left' end iteration, while 'Right' begins another iteration. + -> a -- ^ An initial seed value to iterate from. + -> m b -- ^ A computation producing the least fixed point (the first value at which the actions converge). +convergeEither f = loop + where + loop = either pure loop <=< f + + +-- Caches + +newtype Cache term value = Cache { getCache :: Map.Map term (Set.Set value) } + deriving (Eq, Ord, Show) + +instance (Ord term, Ord value) => Semigroup (Cache term value) where + Cache a <> Cache b = Cache (Map.unionWith (<>) a b) + +instance (Ord term, Ord value) => Monoid (Cache term value) where + mempty = emptyCache + +emptyCache :: Cache term value +emptyCache = Cache Map.empty + +lookupCache :: Ord term => term -> Cache term value -> Set.Set value +lookupCache k (Cache m) = fromMaybe Set.empty (Map.lookup k m) + +insertCache :: (Ord term, Ord value) => term -> value -> Cache term value -> Cache term value +insertCache term value (Cache m) = Cache (Map.insertWith (<>) term (Set.singleton value) m) + +insertsCache :: (Ord term, Ord value) => term -> Set.Set value -> Cache term value -> Cache term value +insertsCache term values (Cache m) = Cache (Map.insertWith (<>) term values m) diff --git a/semantic-analysis/src/Analysis/Functor/Named.hs b/semantic-analysis/src/Analysis/Functor/Named.hs new file mode 100644 index 0000000000..774fcc5830 --- /dev/null +++ b/semantic-analysis/src/Analysis/Functor/Named.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE DeriveFoldable #-} +{-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE DeriveTraversable #-} +module Analysis.Functor.Named +( module Analysis.Name +, Named (..) +, named +, named' +, namedName +, namedValue +) where + + +import Analysis.Name +import Data.Function (on) + +-- | Annotates an @a@ with a 'Name'-provided name, which is ignored for '==' and 'compare'. +data Named a = Named Name a + deriving (Foldable, Functor, Show, Traversable) + +named :: Name -> a -> Named a +named = Named + +named' :: Name -> Named Name +named' u = Named u u + +namedName :: Named a -> Name +namedName (Named n _) = n + +namedValue :: Named a -> a +namedValue (Named _ a) = a + +instance Eq a => Eq (Named a) where + (==) = (==) `on` namedValue + +instance Ord a => Ord (Named a) where + compare = compare `on` namedValue diff --git a/semantic-analysis/src/Analysis/Module.hs b/semantic-analysis/src/Analysis/Module.hs new file mode 100644 index 0000000000..4a4e294e38 --- /dev/null +++ b/semantic-analysis/src/Analysis/Module.hs @@ -0,0 +1,58 @@ +module Analysis.Module +( Module(..) +, moduleBody +, ModuleSet(..) +, fromList +, link +) where + +import Analysis.File +import Analysis.Name +import Analysis.Reference +import Data.Foldable (foldl') +import qualified Data.Map as Map +import qualified Data.Set as Set +import qualified Data.Text as Text +import System.FilePath as Path + +data Module a = Module + { body :: Map.Map Name a -> a + , imports :: Set.Set Name + , exports :: Map.Map Name a + , unknown :: Set.Set Name + } + +instance Show a => Show (Module a) where + showsPrec p (Module b i e u) = showParen (p > 10) (showString "Module" . sp . braces + ( field "body" (b mempty) . comma . sp + . field "imports" i . comma . sp + . field "exports" e . comma . sp + . field "unknown" u)) + where + braces b = showChar '{' . sp . b . sp . showChar '}' + comma = showChar ',' + field n b = showString n . sp . showChar '=' . sp . showsPrec 0 b + sp = showChar ' ' + +moduleBody :: Module a -> a +moduleBody m = body m mempty + + +newtype ModuleSet a = ModuleSet { getModuleSet :: Map.Map Name (Module a) } + deriving (Show) + +instance Semigroup (ModuleSet a) where + m1 <> m2 = ModuleSet ((link m2 <$> getModuleSet m1) <> (link m1 <$> getModuleSet m2)) + +instance Monoid (ModuleSet a) where + mempty = ModuleSet mempty + +fromList :: [File (Module a)] -> ModuleSet a +fromList = ModuleSet . Map.fromList . map (\ (File ref mod) -> (refName ref, mod)) + where + refName (Reference path _) = name (Text.pack (Path.takeBaseName path)) + +link :: ModuleSet a -> Module a -> Module a +link (ModuleSet ms) m = Module body' (imports m Set.\\ Map.keysSet ms) (exports m) unknown' where + (unknown', body') = foldl' (uncurry resolveSymbolsInModule) (unknown m, body m) (Map.restrictKeys ms (imports m)) + resolveSymbolsInModule unknown body m = (unknown Set.\\ Map.keysSet (exports m), body . mappend (Map.restrictKeys (exports m) unknown)) diff --git a/semantic-analysis/src/Analysis/Name.hs b/semantic-analysis/src/Analysis/Name.hs new file mode 100644 index 0000000000..17f4914ccf --- /dev/null +++ b/semantic-analysis/src/Analysis/Name.hs @@ -0,0 +1,93 @@ +{-# LANGUAGE FlexibleContexts #-} +module Analysis.Name +( Name + -- * Constructors +, gensym +, name +, nameI +, formatName +, isGenerated + -- * De Bruijn indices & levels +, Level(..) +, Index(..) + -- ** Conversions +, levelToIndex +, indexToLevel +) where + +import Control.Effect.Fresh +import Data.Aeson +import qualified Data.Char as Char +import Data.Hashable +import Data.String +import Data.Text (Text) +import qualified Data.Text as Text + +-- | The type of variable names. +data Name + = Name Text + | I Int + deriving (Eq, Ord) + +instance IsString Name where + fromString = Name . fromString + +-- | Generate a fresh (unused) name for use in synthesized variables/closures/etc. +gensym :: Has Fresh sig m => m Name +gensym = I <$> fresh + +-- | Construct a 'Name' from a 'Text'. +name :: Text -> Name +name = Name + +isGenerated :: Name -> Bool +isGenerated (I _) = True +isGenerated _ = False + +-- | Construct a 'Name' from an 'Int'. This is suitable for automatic generation, e.g. using a Fresh effect, but should not be used for human-generated names. +nameI :: Int -> Name +nameI = I + +-- | Extract a human-readable 'Text' from a 'Name'. +-- Sample outputs can be found in @Data.Abstract.Name.Spec@. +formatName :: Name -> Text +formatName (Name name) = name +formatName (I i) = Text.pack $ '_' : (alphabet !! a) : replicate n 'ΚΉ' + where alphabet = ['a'..'z'] + (n, a) = i `divMod` length alphabet + +instance Show Name where + showsPrec _ = prettyShowString . Text.unpack . formatName + where prettyShowString str = showChar '"' . foldr ((.) . prettyChar) id str . showChar '"' + prettyChar c + | c `elem` ['\\', '\"'] = Char.showLitChar c + | Char.isPrint c = showChar c + | otherwise = Char.showLitChar c + +instance Hashable Name where + hashWithSalt salt (Name name) = hashWithSalt salt name + hashWithSalt salt (I i) = salt `hashWithSalt` (1 :: Int) `hashWithSalt` i + +instance ToJSON Name where + toJSON = toJSON . formatName + toEncoding = toEncoding . formatName + + +-- De Bruijn indices & levels + +-- | De Bruijn levels. +newtype Level = Level { getLevel :: Int } + deriving (Eq, Ord, Show) + +-- | De Bruijn indicex. +newtype Index = Index { getIndex :: Int } + deriving (Eq, Ord, Show) + + +-- Conversions + +levelToIndex :: Level -> Level -> Index +levelToIndex (Level d) (Level level) = Index (d - level - 1) + +indexToLevel :: Level -> Index -> Level +indexToLevel (Level d) (Index index) = Level (d - index - 1) diff --git a/semantic-analysis/src/Analysis/Project.hs b/semantic-analysis/src/Analysis/Project.hs new file mode 100644 index 0000000000..f8ad535111 --- /dev/null +++ b/semantic-analysis/src/Analysis/Project.hs @@ -0,0 +1,33 @@ +module Analysis.Project + ( Project (..) + , projectExtensions + , projectName + , projectFiles + ) where + +import Prelude hiding (readFile) + +import Analysis.Blob +import Analysis.File +import Data.Text (Text) +import qualified Data.Text as T +import Source.Language +import System.FilePath (takeFileName) + +-- | A 'Project' contains all the information that semantic needs +-- to execute an analysis, diffing, or graphing pass. +data Project = Project + { projectRootDir :: FilePath + , projectBlobs :: [Blob] + , projectLanguage :: Language + , projectExcludeDirs :: [FilePath] + } deriving (Eq, Show) + +projectName :: Project -> Text +projectName = T.pack . takeFileName . projectRootDir + +projectExtensions :: Project -> [String] +projectExtensions = extensionsForLanguage . projectLanguage + +projectFiles :: Project -> [File Language] +projectFiles = fmap blobFile . projectBlobs diff --git a/semantic-analysis/src/Analysis/Reference.hs b/semantic-analysis/src/Analysis/Reference.hs new file mode 100644 index 0000000000..c79bd8ba04 --- /dev/null +++ b/semantic-analysis/src/Analysis/Reference.hs @@ -0,0 +1,22 @@ +module Analysis.Reference +( -- * Reference + Reference(..) + -- * Constructors +, fromPath +) where + +import Source.Span + +-- Reference + +data Reference = Reference + { refPath :: FilePath + , refSpan :: Span + } + deriving (Eq, Ord, Show) + + +-- Constructors + +fromPath :: FilePath -> Reference +fromPath p = Reference p (point (Pos 0 0)) diff --git a/semantic-analysis/src/Analysis/Syntax.hs b/semantic-analysis/src/Analysis/Syntax.hs new file mode 100644 index 0000000000..35c3c4eead --- /dev/null +++ b/semantic-analysis/src/Analysis/Syntax.hs @@ -0,0 +1,53 @@ +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE UndecidableInstances #-} +module Analysis.Syntax +( -- * Syntax + Term(..) +, subterms +, foldTerm +, paraTerm +, mendlerTerm +, mendlerParaTerm +) where + +import qualified Data.Set as Set + +-- Syntax + +-- | (Currently) untyped term representations. +data Term sig v + = Var v + | Term (sig (Term sig v)) + +instance (Eq (sig (Term sig v)), Eq v) => Eq (Term sig v) where + Var v1 == Var v2 = v1 == v2 + Term s1 == Term s2 = s1 == s2 + _ == _ = False + +instance (Ord (sig (Term sig v)), Ord v) => Ord (Term sig v) where + compare (Var v1) (Var v2) = compare v1 v2 + compare (Var _) _ = LT + compare (Term s1) (Term s2) = compare s1 s2 + compare _ _ = GT + + +subterms :: (Ord (sig (Term sig v)), Ord v, Foldable sig) => Term sig v -> Set.Set (Term sig v) +subterms = mendlerParaTerm (Set.singleton . Var) (\ k -> foldMap (uncurry Set.insert . k)) + +foldTerm :: Functor sig => (v -> r) -> (sig r -> r) -> (Term sig v -> r) +foldTerm var sig = mendlerTerm var (\ k -> sig . fmap k) + +paraTerm :: Functor sig => (v -> r) -> (sig (Term sig v, r) -> r) -> (Term sig v -> r) +paraTerm var sig = mendlerParaTerm var (\ k -> sig . fmap k) + +mendlerTerm :: (v -> r) -> (forall r' . (r' -> r) -> sig r'-> r) -> (Term sig v -> r) +mendlerTerm var sig = go + where + go (Var v) = var v + go (Term s) = sig go s + +mendlerParaTerm :: (v -> r) -> (forall r' . (r' -> (Term sig v, r)) -> sig r'-> r) -> (Term sig v -> r) +mendlerParaTerm var sig = go + where + go (Var v) = var v + go (Term s) = sig ((,) <*> go) s diff --git a/semantic-analysis/src/Analysis/Syntax/Python.hs b/semantic-analysis/src/Analysis/Syntax/Python.hs new file mode 100644 index 0000000000..fa0a46f7ed --- /dev/null +++ b/semantic-analysis/src/Analysis/Syntax/Python.hs @@ -0,0 +1,122 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE LambdaCase #-} +-- | This belongs in @semantic-python@ instead of @semantic-analysis@, but for the sake of expedience… +module Analysis.Syntax.Python +( -- * Syntax + Term(..) +, subterms + -- * Abstract interpretation +, eval0 +, eval + -- * Parsing +, parse +) where + +import Analysis.Effect.Domain hiding ((:>>>)) +import qualified Analysis.Effect.Statement as S +import Analysis.Name +import Analysis.Reference +import Analysis.VM +import Control.Effect.Labelled +import Control.Effect.Reader +import Control.Monad (foldM) +import Data.Foldable (for_) +import Data.Function (fix) +import Data.List.NonEmpty (nonEmpty) +import Data.Maybe (mapMaybe) +import qualified Data.Set as Set +import Data.Text (pack) +import qualified Language.Python.Common as Py +import Language.Python.Version3.Parser +import Source.Span (Pos (..), Span (..), point) +import System.FilePath (takeBaseName) + +-- Syntax + +data Term + = Module (Py.Module Py.SrcSpan) + | Statement (Py.Statement Py.SrcSpan) + | Expr (Py.Expr Py.SrcSpan) + deriving (Eq, Ord, Show) + +-- | Non-generic production of the recursive set of subterms. +-- +-- This should be exactly the set of nodes which 'eval' can visit, i.e. it excludes comments, etc. +subterms :: Term -> Set.Set Term +subterms t = Set.insert t $ case t of + Module (Py.Module ss) -> suite ss + Statement (Py.Conditional cts e _) -> foldMap (\ (c, t) -> subterms (Expr c) <> suite t) cts <> suite e + Statement (Py.Raise (Py.RaiseV3 e) _) -> maybe Set.empty (subterms . Expr . fst) e + -- FIXME: Py.RaiseV2 + -- FIXME: whatever the second field is + Statement (Py.StmtExpr e _) -> subterms (Expr e) + Statement (Py.Fun _ _ _ ss _) -> suite ss + -- FIXME: include 'subterms' of any default values + Expr (Py.Call f as _) -> subterms (Expr f) <> foldMap (\case { Py.ArgExpr e _ -> subterms (Expr e) ; _ -> Set.empty }) as + -- FIXME: support keyword args &c. + _ -> Set.empty -- TBD, and terminals + where + suite = foldMap (subterms . Statement) + + +-- Abstract interpretation + +eval0 :: (Has (Env addr) sig m, HasLabelled Store (Store addr val) sig m, Has (Dom val) sig m, Has (Reader Reference) sig m, Has S.Statement sig m, MonadFail m) => Term -> m val +eval0 = fix eval + +eval + :: (Has (Env addr) sig m, HasLabelled Store (Store addr val) sig m, Has (Dom val) sig m, Has (Reader Reference) sig m, Has S.Statement sig m, MonadFail m) + => (Term -> m val) + -> (Term -> m val) +eval eval = \case + Module (Py.Module ss) -> suite ss + Statement (Py.Import is sp) -> setSpan sp $ do + for_ is $ \ Py.ImportItem{ Py.import_item_name = ns } -> case nonEmpty ns of + Nothing -> pure () + Just ss -> S.simport (pack . Py.ident_string <$> ss) + dunit + Statement (Py.Pass sp) -> setSpan sp dunit + Statement (Py.Conditional cts e sp) -> setSpan sp $ foldr (\ (c, t) e -> do + c' <- eval (Expr c) + dif c' (suite t) e) (suite e) cts + Statement (Py.Raise (Py.RaiseV3 e) sp) -> setSpan sp $ case e of + Just (e, _) -> eval (Expr e) >>= ddie -- FIXME: from clause + Nothing -> dunit >>= ddie + -- FIXME: RaiseV2 + -- FIXME: whatever the second field is + Statement (Py.StmtExpr e sp) -> setSpan sp (eval (Expr e)) + Statement (Py.Fun n ps _r ss sp) -> let ps' = mapMaybe (\case { Py.Param n _ _ _ -> Just (ident n) ; _ -> Nothing }) ps in setSpan sp $ letrec (ident n) (dabs ps' (foldr (\ (p, a) m -> let' p a m) (suite ss) . zip ps')) + Expr (Py.Var n sp) -> setSpan sp $ let n' = ident n in lookupEnv n' >>= maybe (dvar n') fetch + Expr (Py.Bool b sp) -> setSpan sp $ dbool b + Expr (Py.Strings ss sp) -> setSpan sp $ dstring (pack (mconcat ss)) + Expr (Py.Call f as sp) -> setSpan sp $ do + f' <- eval (Expr f) + as' <- traverse eval (mapMaybe (\case { Py.ArgExpr e _ -> Just (Expr e) ; _ -> Nothing }) as) + -- FIXME: support keyword args &c. + dapp f' as' + _ -> fail "TBD" + where + setSpan s = case fromSpan s of + Just s -> local (\ r -> r{ refSpan = s }) + _ -> id + fromSpan Py.SpanEmpty = Nothing + fromSpan (Py.SpanPoint _ l c) = Just (point (Pos l c)) + fromSpan (Py.SpanCoLinear _ l c1 c2) = Just (Span (Pos l c1) (Pos l c2)) + fromSpan (Py.SpanMultiLine _ l1 l2 c1 c2) = Just (Span (Pos l1 c1) (Pos l2 c2)) + suite [] = dunit + suite (s:ss) = do + s' <- eval (Statement s) + foldM (\ into each -> do + each' <- eval (Statement each) + into >>> each') s' ss + ident = name . pack . Py.ident_string + + +-- Parsing + +parse :: FilePath -> IO Term +parse path = do + src <- readFile path + case parseModule src (takeBaseName path) of + Left err -> fail (show err) + Right (Py.Module ss, _) -> pure (Module (Py.Module ss)) diff --git a/semantic-analysis/src/Analysis/VM.hs b/semantic-analysis/src/Analysis/VM.hs new file mode 100644 index 0000000000..59c3b9eae2 --- /dev/null +++ b/semantic-analysis/src/Analysis/VM.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE FlexibleContexts #-} +module Analysis.VM +( -- * Macro-expressible syntax + let' +, letrec + -- * Re-exports +, module Analysis.Effect.Env +, module Analysis.Effect.Store +) where + +import Analysis.Effect.Env +import Analysis.Effect.Store +import Analysis.Name +import Control.Effect.Labelled + +-- Macro-expressible syntax + +let' :: (Has (Env addr) sig m, HasLabelled Store (Store addr val) sig m) => Name -> val -> m a -> m a +let' n v m = do + addr <- alloc n + addr .= v + bind n addr m + +letrec :: (Has (Env addr) sig m, HasLabelled Store (Store addr val) sig m) => Name -> m val -> m val +letrec n m = do + addr <- alloc n + v <- bind n addr m + addr .= v + pure v diff --git a/semantic-ast/BUILD.bazel b/semantic-ast/BUILD.bazel new file mode 100644 index 0000000000..daa7dfdfa3 --- /dev/null +++ b/semantic-ast/BUILD.bazel @@ -0,0 +1,98 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_binary", + "haskell_library", +) +load( + "@rules_haskell//haskell:cabal.bzl", + "haskell_cabal_binary", + "haskell_cabal_library", +) +load( + "//:build/common.bzl", + "EXECUTABLE_FLAGS", + "GHC_FLAGS", +) + +haskell_library( + name = "semantic-ast", + srcs = glob(["src/**/*.hs"]), + compiler_flags = GHC_FLAGS + ["-XOverloadedStrings"], + deps = [ + "//:base", + "//:bytestring", + "//:containers", + "//:filepath", + "//:template-haskell", + "//:text", + "//semantic-source", + "@stackage//:Glob", + "@stackage//:aeson", + "@stackage//:aeson-pretty", + "@stackage//:attoparsec", + "@stackage//:bazel-runfiles", + "@stackage//:directory", + "@stackage//:fused-effects", + "@stackage//:hedgehog", + "@stackage//:optparse-applicative", + "@stackage//:pathtype", + "@stackage//:pretty-simple", + "@stackage//:tasty", + "@stackage//:tasty-hedgehog", + "@stackage//:tasty-hunit", + "@stackage//:tree-sitter", + "@stackage//:tree-sitter-python", + "@stackage//:unordered-containers", + ], +) + +all_ts_deps = ["@tree-sitter-{name}".format(name = name) for name in [ + "go", + "java", + "json", + "php", + "python", + "ql", + "ruby", + "rust", + "tsx", + "typescript", +]] + +all_file_deps = ["@tree-sitter-{name}//:src/node-types.json".format(name = name) for name in [ + "go", + "java", + "json", + "php", + "python", + "ql", + "ruby", + "rust", + "tsx", + "typescript", +]] + +haskell_binary( + name = "generate-ast", + srcs = glob(["app/**/*.hs"]), + compiler_flags = GHC_FLAGS + EXECUTABLE_FLAGS + ["-XStrictData"], + data = all_file_deps, + deps = [ + ":semantic-ast", + "//:base", + "//:filepath", + "//:process", + "//:template-haskell", + "//:text", + "//semantic-source", + "@stackage//:bazel-runfiles", + "@stackage//:directory", + "@stackage//:generic-lens", + "@stackage//:lens", + "@stackage//:neat-interpolation", + "@stackage//:optparse-generic", + "@stackage//:tree-sitter", + ] + all_ts_deps, +) diff --git a/semantic-ast/CHANGELOG.md b/semantic-ast/CHANGELOG.md new file mode 100644 index 0000000000..0b9903960a --- /dev/null +++ b/semantic-ast/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for semantic-ast + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/semantic-ast/LICENSE b/semantic-ast/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-ast/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-ast/README.md b/semantic-ast/README.md new file mode 100644 index 0000000000..260a3003b1 --- /dev/null +++ b/semantic-ast/README.md @@ -0,0 +1,17 @@ +# semantic-ast + +This package is concerned with the CodeGen generation of strongly-typed ASTs. + +The provided `semantic-ast` executable is responsible for generating ASTs from language definitions. You can run it like so: + +``` +cabal run semantic-ast -- --language=JSON +``` + +You can also pass `all` to regenerate every language definition: + +``` +cabal run semantic-ast -- --language=all +``` + +[Documentation](https://github.com/github/semantic/blob/master/docs/codegen.md) diff --git a/semantic-core/Setup.hs b/semantic-ast/Setup.hs similarity index 100% rename from semantic-core/Setup.hs rename to semantic-ast/Setup.hs diff --git a/semantic-ast/app/Main.hs b/semantic-ast/app/Main.hs new file mode 100644 index 0000000000..f5b52baf86 --- /dev/null +++ b/semantic-ast/app/Main.hs @@ -0,0 +1,203 @@ +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeSynonymInstances #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} + +module Main (main) where + +import AST.GenerateSyntax +import qualified Bazel.Runfiles as Bazel +import Control.Lens (Traversal', mapped, (%~)) +import Control.Monad +import Data.Foldable +import Data.Generics.Product.Typed (typed) +import Data.Maybe +import Data.Text (Text) +import qualified Data.Text as T +import qualified Data.Text.IO as T +import Foreign +import GHC.Generics (Generic) +import Language.Haskell.TH hiding (JavaScript) +import Language.Haskell.TH.Lens +import NeatInterpolation +import qualified Options.Generic as Opt +import Source.Language +import System.FilePath +import System.Directory +import System.Exit +import System.IO +import System.Process +import Text.Printf +import qualified TreeSitter.Go as Go (tree_sitter_go) +import qualified TreeSitter.JSON as JSON (tree_sitter_json) +import qualified TreeSitter.Java as Java (tree_sitter_java) +import qualified TreeSitter.Language +import qualified TreeSitter.PHP as PHP (tree_sitter_php) +import qualified TreeSitter.Python as Python (tree_sitter_python) +import qualified TreeSitter.QL as CodeQL (tree_sitter_ql) +import qualified TreeSitter.Ruby as Ruby (tree_sitter_ruby) +import qualified TreeSitter.TSX as TSX (tree_sitter_tsx) +import qualified TreeSitter.TypeScript as TypeScript (tree_sitter_typescript) + +-- As a special case, you can pass +data Config = Config {language :: Text, rootdir :: FilePath} + deriving stock (Show, Generic) + deriving anyclass (Opt.ParseRecord) + +-- There are a few cases where the output emitted by TH's 'pprint' doesn't +-- create entirely valid Haskell syntax, because sometimes we get +-- a qualified name on the LHS of a typeclass declaration, which Haskell +-- doesn't like at all. I haven't figured out quite why we get this qualified +-- name, but for now the easiest thing to do is some nested updates with lens. +adjust :: Dec -> Dec +adjust = _InstanceD . typed . mapped %~ (values %~ truncate) . (functions %~ truncate) + where + -- Need to handle functions with no arguments, which are parsed as ValD entities, + -- as well as those with arguments, which are FunD. + values, functions :: Traversal' Dec Name + values = _ValD . typed . _VarP + functions = _FunD . typed + + truncate :: Name -> Name + truncate = mkName . nameBase + +pathForLanguage :: Bazel.Runfiles -> Language -> FilePath +pathForLanguage rf = + let loc = Bazel.rlocation rf + in \case + CodeQL -> loc "tree-sitter-ql/vendor/tree-sitter-ql/src/node-types.json" + Go -> loc "tree-sitter-go/vendor/tree-sitter-go/src/node-types.json" + PHP -> loc "tree-sitter-php/vendor/tree-sitter-php/src/node-types.json" + Python -> loc "tree-sitter-python/vendor/tree-sitter-python/src/node-types.json" + Ruby -> loc "tree-sitter-ruby/vendor/tree-sitter-ruby/src/node-types.json" + TypeScript -> loc "tree-sitter-typescript/vendor/tree-sitter-typescript/typescript/src/node-types.json" + TSX -> loc "tree-sitter-tsx/vendor/tree-sitter-typescript/tsx/src/node-types.json" + JavaScript -> loc "tree-sitter-typescript/vendor/tree-sitter-typescript/typescript/src/node-types.json" + JSX -> loc "tree-sitter-typescript/vendor/tree-sitter-typescript/src/tsx/node-types.json" + Java -> loc "tree-sitter-java/vendor/tree-sitter-java/src/node-types.json" + other -> error ("Couldn't find path for " <> show other) + +targetForLanguage :: Language -> FilePath +targetForLanguage x = + let go lc = printf "semantic-%s/src/Language/%s/AST.hs" (lc :: String) (show x) + in case x of + CodeQL -> go "codeql" + Go -> go "go" + PHP -> go "php" + Python -> go "python" + Ruby -> go "ruby" + TypeScript -> go "typescript" + TSX -> go "tsx" + JavaScript -> go "javascript" + Java -> go "java" + other -> error ("Couldn't find path for " <> show other) + +parserForLanguage :: Language -> Ptr TreeSitter.Language.Language +parserForLanguage = \case + Unknown -> error "Unknown language encountered" + CodeQL -> (CodeQL.tree_sitter_ql) + Go -> Go.tree_sitter_go + Haskell -> error "Haskell backend not implemented yet" + Java -> Java.tree_sitter_java + JavaScript -> TypeScript.tree_sitter_typescript + JSON -> JSON.tree_sitter_json + JSX -> TSX.tree_sitter_tsx + Markdown -> error "Markdown backend deprecated" + PHP -> PHP.tree_sitter_php + Python -> Python.tree_sitter_python + Ruby -> Ruby.tree_sitter_ruby + TypeScript -> TypeScript.tree_sitter_typescript + TSX -> TSX.tree_sitter_tsx + +-- nodeTypesPathForLanguage :: Bazel.Runfiles -> Language -> FilePath +-- nodeTypesPathForLanguage rf = \case +-- CodeQL -> r + +validLanguages :: [Language] +validLanguages = [CodeQL, Go, Java, PHP, Python, Ruby, TypeScript, TSX] + +emit :: FilePath -> Language -> IO () +emit root lang = do + rf <- Bazel.create + let language = languageToText lang + let languageHack = case lang of + CodeQL -> "QL" + _ -> language + let path = pathForLanguage rf lang + decls <- T.pack . pprint . fmap adjust <$> astDeclarationsIO (parserForLanguage lang) path + + let programText = + [trimming| +-- Language definition for $language, generated by ast-generate. Do not edit! +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Language.$language.AST (module Language.$language.AST, getTestCorpusDir) where + +import qualified AST.Parse +import qualified AST.Token +import qualified AST.Traversable1.Class +import qualified AST.Unmarshal +import qualified Data.Foldable +import qualified Data.List as Data.OldList +import qualified Data.Maybe as GHC.Maybe +import qualified Data.Text.Internal +import qualified Data.Traversable +import qualified GHC.Base +import qualified GHC.Generics +import qualified GHC.Records +import qualified GHC.Show +import qualified Prelude as GHC.Classes +import qualified TreeSitter.Node + +import TreeSitter.$languageHack (getTestCorpusDir) + +debugSymbolNames :: [GHC.Base.String] +debugSymbolNames = debugSymbolNames_0 + +$decls + |] + hasOrmolu <- findExecutable "ormolu" + if isNothing hasOrmolu + then do + T.putStrLn programText + hPutStrLn stderr "generate-ast: No `ormolu` executable found, output will look janky." + else do + (path, tf) <- openTempFile "/tmp" "generated.hs" + T.hPutStrLn tf programText + hClose tf + callProcess "ormolu" ["--mode", "inplace", path] + callProcess "cp" [path, root targetForLanguage lang] + +main :: IO () +main = do + Config language root <- Opt.getRecord "generate-ast" + if language == "all" + then traverse_ (emit root) validLanguages + else do + let lang = textToLanguage language + when (lang == Unknown) (die ("Couldn't determine language for " <> T.unpack language)) + emit root lang diff --git a/semantic-ast/semantic-ast.cabal b/semantic-ast/semantic-ast.cabal new file mode 100644 index 0000000000..40d7f81225 --- /dev/null +++ b/semantic-ast/semantic-ast.cabal @@ -0,0 +1,84 @@ +cabal-version: 2.4 +-- Initial package description 'semantic-ast.cabal' generated by 'cabal +-- init'. For further documentation, see +-- http://haskell.org/cabal/users-guide/ + +name: semantic-ast +version: 0.1.0.0 +-- synopsis: +-- description: +-- bug-reports: +license: MIT +license-file: LICENSE +author: The Semantic Authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +extra-source-files: CHANGELOG.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + cpp-options: + -DBAZEL_BUILD=0 + +library + import: haskell + exposed-modules: + AST.Deserialize + AST.Element + AST.GenerateSyntax + AST.Grammar.TH + AST.Marshal.JSON + AST.Parse + AST.Token + AST.Traversable1 + AST.Traversable1.Class + AST.Unmarshal + AST.TestHelpers + System.Path.Fixture + + + -- other-modules: + -- other-extensions: + build-depends: + , aeson >= 1.4.2.0 && < 3 + , attoparsec >= 0.13.2.2 && < 0.15 + , base >= 4.13 && < 5 + , bytestring >= 0.10.8.2 && < 0.13 + , containers ^>= 0.6.2 + , directory ^>= 1.3.3.2 + , filepath ^>= 1.4.1 + , fused-effects ^>= 1.1 + , Glob ^>= 0.10.0 + , semantic-source ^>= 0.2 + , tasty ^>= 1.2.3 + , tasty-hunit ^>= 0.10.0.2 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3.1 + , tree-sitter ^>= 0.9.0.0 + , unordered-containers ^>= 0.2.10 + + hs-source-dirs: src diff --git a/semantic-ast/src/AST/Deserialize.hs b/semantic-ast/src/AST/Deserialize.hs new file mode 100644 index 0000000000..f808f7d9ba --- /dev/null +++ b/semantic-ast/src/AST/Deserialize.hs @@ -0,0 +1,133 @@ +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE DeriveLift #-} + +-- Turn off partial field warnings for Datatype. +{-# OPTIONS_GHC -Wno-partial-fields #-} +module AST.Deserialize +( Datatype (..) +, Field (..) +, Children(..) +, Required (..) +, Type (..) +, DatatypeName (..) +, Named (..) +, Multiple (..) +) where + +import Data.Aeson as Aeson +import Data.Aeson.Types +import Data.Char +import GHC.Generics hiding (Constructor, Datatype) +import Language.Haskell.TH.Syntax (Lift) +import Data.Text (Text, unpack) +import Data.List.NonEmpty (NonEmpty (..)) +import qualified Data.HashMap.Strict as HM +import Data.Maybe (fromMaybe) + +-- Types to deserialize into: +data Datatype + = SumType + { datatypeName :: DatatypeName + , datatypeNameStatus :: Named + , datatypeSubtypes :: NonEmpty Type + } + | ProductType + { datatypeName :: DatatypeName + , datatypeNameStatus :: Named + , datatypeChildren :: Maybe Children + , datatypeFields :: [(String, Field)] + } + | LeafType + { datatypeName :: DatatypeName + , datatypeNameStatus :: Named + } + deriving (Eq, Ord, Show, Generic, ToJSON) + +instance FromJSON Datatype where + parseJSON = withObject "Datatype" $ \v -> do + type' <- v .: "type" + named <- v .: "named" + subtypes <- v .:? "subtypes" + case subtypes of + Nothing -> do + fields <- fmap (fromMaybe HM.empty) (v .:? "fields") + children <- v .:? "children" + if null fields && null children then + pure (LeafType type' named) + else + ProductType type' named children <$> parseKVPairs (HM.toList fields) + Just subtypes -> pure (SumType type' named subtypes) + + +-- | Transforms list of key-value pairs to a Parser +parseKVPairs :: [(Text, Value)] -> Parser [(String, Field)] +parseKVPairs = traverse go + where go :: (Text, Value) -> Parser (String, Field) + go (t,v) = do + v' <- parseJSON v + pure (unpack t, v') + +data Field = MkField + { fieldRequired :: Required + , fieldTypes :: NonEmpty Type + , fieldMultiple :: Multiple + } + deriving (Eq, Ord, Show, Generic, ToJSON) + +instance FromJSON Field where + parseJSON = genericParseJSON customOptions + + +newtype Children = MkChildren Field + deriving (Eq, Ord, Show, Generic) + deriving newtype (ToJSON, FromJSON) + + +data Required = Optional | Required + deriving (Eq, Ord, Show, Generic, ToJSON) + +instance FromJSON Required where + parseJSON = withBool "Required" (\p -> pure (if p then Required else Optional)) + +data Type = MkType + { fieldType :: DatatypeName + , isNamed :: Named + } + deriving (Eq, Ord, Show, Generic, ToJSON) + +instance FromJSON Type where + parseJSON = genericParseJSON customOptions + +newtype DatatypeName = DatatypeName { getDatatypeName :: String } + deriving (Eq, Ord, Show, Generic) + deriving newtype (FromJSON, ToJSON) + +data Named = Anonymous | Named + deriving (Eq, Ord, Show, Generic, ToJSON, Lift) + +instance FromJSON Named where + parseJSON = withBool "Named" (\p -> pure (if p then Named else Anonymous)) + +data Multiple = Single | Multiple + deriving (Eq, Ord, Show, Generic, ToJSON) + +instance FromJSON Multiple where + parseJSON = withBool "Multiple" (\p -> pure (if p then Multiple else Single)) + +customOptions :: Aeson.Options +customOptions = Aeson.defaultOptions + { + fieldLabelModifier = initLower . dropPrefix + , constructorTagModifier = initLower + } + +dropPrefix :: String -> String +dropPrefix = Prelude.dropWhile isLower + +initLower :: String -> String +initLower (c:cs) = toLower c : cs +initLower "" = "" \ No newline at end of file diff --git a/semantic-ast/src/AST/Element.hs b/semantic-ast/src/AST/Element.hs new file mode 100644 index 0000000000..7066c1c24c --- /dev/null +++ b/semantic-ast/src/AST/Element.hs @@ -0,0 +1,91 @@ +{-# LANGUAGE AllowAmbiguousTypes, DataKinds, FlexibleInstances, MultiParamTypeClasses, PatternSynonyms, ScopedTypeVariables, TypeApplications, TypeFamilies, TypeOperators, UndecidableInstances, ViewPatterns #-} +module AST.Element +( Element(..) +, pattern Prj +, pattern EPrj +, (:+:)(..) +) where + +import qualified AST.Parse as Parse +import GHC.Generics ((:+:)(..)) +import GHC.TypeLits (ErrorMessage(..), TypeError) + +-- | Projection of an element out of a tree of sums, particularly suitable for use with highly branching (e.g. balanced) trees. This provides custom type errors when the tree is known statically, rather than provided via a constraint passed on to callers. +class Element sub sup where + -- | Project one element out of a sum type. + prj :: sup a -> Maybe (sub a) + +instance (Element' side sub sup, side ~ Find sub sup) => Element sub sup where + prj = prj' @side + +-- | A pattern synonym to conveniently project out matching elements. +pattern Prj :: Element sub sup => sub a -> sup a +pattern Prj sub <- (prj -> Just sub) + + +-- A pattern synonym that combines matching on @Success@ and @Prj@ +eprj :: Element sub sup => Parse.Err (sup a) -> Maybe (sub a) +eprj (Parse.Success x) = prj x +eprj _ = Nothing + +pattern EPrj :: Element sub sup => sub a -> Parse.Err (sup a) +pattern EPrj sub <- (eprj -> Just sub) + +-- | Where does the element occur in the tree? +data Side = None | Here | L | R + +-- | Find where in a tree an element occurs. +type family Find sub sup :: Side where + Find t t = 'Here + Find t (l :+: r) = Find' 'L t l <> Find' 'R t r + Find _ _ = 'None + +-- | Helper to compute the side an element occurs on. +type family Find' (side :: Side) sub sup :: Side where + Find' s t t = s + Find' s t (l :+: r) = Find' s t l <> Find' s t r + Find' _ _ _ = 'None + +-- | Return the leftmost non-'None' side, or 'None'. +type family (a :: Side) <> (b :: Side) :: Side where + 'None <> b = b + a <> _ = a + +-- | Helper to project elements out of the matching portion of a tree. +class Element' (side :: Side) sub sup where + prj' :: sup a -> Maybe (sub a) + +-- | Membership is reflexive. +instance Element' 'Here t t where + prj' = Just + +-- | Membershp on the left. +instance Element t l + => Element' 'L t (l :+: r) where + prj' (L1 l) = prj l + prj' _ = Nothing + +-- | Membership on the right. +instance Element t r + => Element' 'R t (l :+: r) where + prj' (R1 r) = prj r + prj' _ = Nothing + + +-- | Error cases, with custom type errors. +instance TypeError + ( 'ShowType t ':<>: 'Text " is not in" + ':$$: ShowSum u) + => Element' 'None t u where + prj' _ = Nothing + + +-- | Show a sum tree as a set (for use in type errors). +type family ShowSum t where + ShowSum (l :+: r) = ShowSum' ('Text "{ ") (l :+: r) ':$$: 'Text "}" + ShowSum t = 'Text "{ " ':<>: 'ShowType t ':<>: 'Text " }" + +-- | Helper for formatting & aligning sums nicely with a prefix. +type family ShowSum' p t where + ShowSum' p (l :+: r) = ShowSum' p l ':$$: ShowSum' ('Text ", ") r + ShowSum' p t = p ':<>: 'ShowType t diff --git a/semantic-ast/src/AST/GenerateSyntax.hs b/semantic-ast/src/AST/GenerateSyntax.hs new file mode 100644 index 0000000000..d7f4a1097f --- /dev/null +++ b/semantic-ast/src/AST/GenerateSyntax.hs @@ -0,0 +1,230 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +module AST.GenerateSyntax +( syntaxDatatype +, astDeclarationsForLanguage +, astDeclarationsIO +) where + +import AST.Deserialize + (Children (..), Datatype (..), DatatypeName (..), Field (..), Multiple (..), Named (..), Required (..), Type (..)) +import qualified AST.Parse as Parse +import AST.Token +import AST.Traversable1.Class +import qualified AST.Unmarshal as TS +import Data.Aeson hiding (String) +import Data.Foldable +import Data.List (elemIndices, genericIndex, intercalate) +import Data.List.NonEmpty (NonEmpty (..)) +import Data.Text (Text) +import Foreign.C.String +import Foreign.Ptr +import GHC.Generics hiding (Constructor, Datatype) +import GHC.Records +import Language.Haskell.TH as TH +import Language.Haskell.TH.Syntax as TH +import System.Directory +import System.FilePath.Posix +import qualified TreeSitter.Language as TS +import TreeSitter.Node +import TreeSitter.Symbol (TSSymbol, toHaskellCamelCaseIdentifier, toHaskellPascalCaseIdentifier) + +-- | Derive Haskell datatypes from a language and its @node-types.json@ file. +-- +-- Datatypes will be generated according to the specification in the @node-types.json@ file, with anonymous leaf types defined as synonyms for the 'Token' datatype. +-- +-- Any datatypes among the node types which have already been defined in the module where the splice is run will be skipped, allowing customization of the representation of parts of the tree. Note that this should be used sparingly, as it imposes extra maintenance burden, particularly when the grammar is changed. This may be used to e.g. parse literals into Haskell equivalents (e.g. parsing the textual contents of integer literals into 'Integer's), and may require defining 'TS.UnmarshalAnn' or 'TS.SymbolMatching' instances for (parts of) the custom datatypes, depending on where and how the datatype occurs in the generated tree, in addition to the usual 'Foldable', 'Functor', etc. instances provided for generated datatypes. +astDeclarationsForLanguage :: Ptr TS.Language -> FilePath -> Q [Dec] +astDeclarationsForLanguage language filePath = do + _ <- TS.addDependentFileRelative filePath + currentFilename <- loc_filename <$> location + pwd <- runIO getCurrentDirectory + let invocationRelativePath = takeDirectory (pwd currentFilename) filePath + astDeclarationsRelative lookupTypeName language invocationRelativePath + +astDeclarationsIO :: Ptr TS.Language -> FilePath -> IO [Dec] +astDeclarationsIO lang p = runQ (astDeclarationsRelative (const (pure Nothing)) lang p) + +astDeclarationsRelative :: (String -> Q (Maybe Name)) -> Ptr TS.Language -> FilePath -> Q [Dec] +astDeclarationsRelative lookupName language invocationRelativePath = do + input <- runIO (eitherDecodeFileStrict' invocationRelativePath) >>= either fail pure + allSymbols <- runIO (getAllSymbols language) + debugSymbolNames <- [d| + debugSymbolNames :: [String] + debugSymbolNames = $(listE (map (litE . stringL . debugPrefix) allSymbols)) + |] + mappend debugSymbolNames . concat @[] <$> traverse (syntaxDatatype lookupName language allSymbols) input + +-- Build a list of all symbols +getAllSymbols :: Ptr TS.Language -> IO [(String, Named)] +getAllSymbols language = do + count <- TS.ts_language_symbol_count language + traverse getSymbol [(0 :: TSSymbol) .. fromIntegral (pred count)] + where + getSymbol i = do + cname <- TS.ts_language_symbol_name language i + n <- peekCString cname + t <- TS.ts_language_symbol_type language i + let named = if t == 0 then Named else Anonymous + pure (n, named) + +annParameterName :: Name +annParameterName = mkName "a" + +-- Auto-generate Haskell datatypes for sums, products and leaf types +syntaxDatatype :: (String -> Q (Maybe Name)) -> Ptr TS.Language -> [(String, Named)] -> Datatype -> Q [Dec] +syntaxDatatype lookupType language allSymbols datatype = skipDefined $ do + let traversalInstances = mappend <$> makeStandaloneDerivings (conT name) <*> makeTraversalInstances (conT name) + glue a b c = a : b <> c + name = mkName nameStr + generatedDatatype cons = dataD (cxt []) name [plainTV annParameterName] Nothing cons [deriveStockClause, deriveAnyClassClause] + deriveStockClause = derivClause (Just StockStrategy) [conT ''Generic, conT ''Generic1] + deriveAnyClassClause = derivClause (Just AnyclassStrategy) [ [t| (forall a. Traversable1 a) |] ] + deriveGN = derivClause (Just NewtypeStrategy) [conT ''TS.SymbolMatching] + case datatype of + SumType (DatatypeName _) _ subtypes -> + let types' = fieldTypesToNestedSum subtypes + fieldName = mkName ("get" <> nameStr) + con = recC name [varBangType fieldName (bangType strictness (types' `appT` varT annParameterName))] + hasFieldInstance = makeHasFieldInstance (conT name) (varE fieldName) + newType = newtypeD (cxt []) name [plainTV annParameterName] Nothing con [deriveGN, deriveStockClause, deriveAnyClassClause] + in glue <$> newType <*> hasFieldInstance <*> traversalInstances + ProductType datatypeName named children fields -> + let con = ctorForProductType datatypeName children fields + symbols = symbolMatchingInstance allSymbols name named datatypeName + in glue <$> generatedDatatype [con] <*> symbols <*> traversalInstances + -- Anonymous leaf types are defined as synonyms for the `Token` datatype + LeafType (DatatypeName datatypeName) Anonymous -> do + let tsSymbol = runIO $ withCStringLen datatypeName (\(s, len) -> TS.ts_language_symbol_for_name language s len False) + fmap (pure @[]) (tySynD name [] (conT ''Token `appT` litT (strTyLit datatypeName) `appT` litT (tsSymbol >>= numTyLit . fromIntegral))) + LeafType datatypeName Named -> + let con = ctorForLeafType datatypeName annParameterName + symbols = symbolMatchingInstance allSymbols name Named datatypeName + in glue <$> generatedDatatype [con] <*> symbols <*> traversalInstances + where + -- Skip generating datatypes that have already been defined (overridden) in the module where the splice is running. + skipDefined m = do + isLocal <- lookupType nameStr >>= maybe (pure False) isLocalName + if isLocal then pure [] else m + nameStr = toNameString (datatypeNameStatus datatype) (getDatatypeName (AST.Deserialize.datatypeName datatype)) + +makeStandaloneDerivings :: TypeQ -> Q [Dec] +makeStandaloneDerivings ty = + [d| + deriving instance (Eq a) => Eq ($ty a) + deriving instance (Ord a) => Ord ($ty a) + deriving instance (Show a) => Show ($ty a) + instance TS.Unmarshal ($ty) + |] + +makeTraversalInstances :: TypeQ -> Q [Dec] +makeTraversalInstances ty = + [d| + instance Foldable $ty where + foldMap = foldMapDefault1 + instance Functor $ty where + fmap = fmapDefault1 + instance Traversable $ty where + traverse = traverseDefault1 + |] + +makeHasFieldInstance :: TypeQ -> ExpQ -> Q [Dec] +makeHasFieldInstance ty elim = + [d|instance HasField "ann" ($ty a) a where + getField = TS.gann . $elim |] + +-- | Create TH-generated SymbolMatching instances for sums, products, leaves +symbolMatchingInstance :: [(String, Named)] -> Name -> Named -> DatatypeName -> Q [Dec] +symbolMatchingInstance allSymbols name named (DatatypeName str) = do + let tsSymbols = elemIndices (str, named) allSymbols + names = intercalate ", " $ fmap (debugPrefix . (!!) allSymbols) tsSymbols + [d|instance TS.SymbolMatching $(conT name) where + matchedSymbols _ = $(lift tsSymbols) + showFailure _ node = "expected " <> $(litE (stringL names)) + <> " but got " <> if nodeSymbol node == 65535 then "ERROR" else genericIndex debugSymbolNames (nodeSymbol node) + <> " [" <> show r1 <> ", " <> show c1 <> "] -" + <> " [" <> show r2 <> ", " <> show c2 <> "]" + where TSPoint r1 c1 = nodeStartPoint node + TSPoint r2 c2 = nodeEndPoint node|] + +-- | Prefix symbol names for debugging to disambiguate between Named and Anonymous nodes. +debugPrefix :: (String, Named) -> String +debugPrefix (name, Named) = name +debugPrefix (name, Anonymous) = "_" <> name + +-- | Build Q Constructor for product types (nodes with fields) +ctorForProductType :: DatatypeName -> Maybe Children -> [(String, Field)] -> Q Con +ctorForProductType constructorName children fields = ctorForTypes constructorName lists where + lists = annotation : fieldList <> childList + annotation = ("ann", varT annParameterName) + fieldList = map (fmap (toType)) fields + childList = toList $ fmap toTypeChild children + + inject t = conT ''Parse.Err `appT` t + + toType :: Field -> TypeQ + toType (MkField required fieldTypes mult) = + let ftypes = inject (fieldTypesToNestedSum fieldTypes `appT` varT annParameterName) + in case (required, mult) of + (Required, Multiple) -> appT (conT ''NonEmpty) ftypes + (Required, Single) -> ftypes + (Optional, Multiple) -> appT listT ftypes + (Optional, Single) -> appT (conT ''Maybe) ftypes + + toTypeChild (MkChildren field) = ("extra_children", toType field) + +-- | Build Q Constructor for leaf types (nodes with no fields or subtypes) +ctorForLeafType :: DatatypeName -> Name -> Q Con +ctorForLeafType name annParameterName = ctorForTypes name + [ ("ann", varT annParameterName) -- ann :: a + , ("text", conT ''Text) -- text :: Text + ] + +-- TODO: clarify the paths in ctorForProductType, ctorForLeafType, and ctorForTypes, +-- inserting an appropriate (''f `appT`) thing + +-- | Build Q Constructor for records +ctorForTypes :: DatatypeName -> [(String, Q TH.Type)] -> Q Con +ctorForTypes (DatatypeName constructorName) types = recC (toName Named constructorName) recordFields + where + recordFields = map (uncurry toVarBangType) types + toVarBangType str type' = TH.varBangType (mkName . toHaskellCamelCaseIdentifier $ str) (TH.bangType strictness type') + + +-- | Convert field types to Q types +fieldTypesToNestedSum :: NonEmpty AST.Deserialize.Type -> Q TH.Type +fieldTypesToNestedSum xs = go (toList xs) + where + combine lhs rhs = uInfixT lhs ''(:+:) rhs -- (((((a :+: b) :+: c) :+: d)) :+: e) ((a :+: b) :+: (c :+: d)) + convertToQType (MkType (DatatypeName n) named) = conT (toName named n) + go [x] = convertToQType x + go xs = let (l,r) = splitAt (length xs `div` 2) xs in combine (go l) (go r) + + +-- | Create bang required to build records +strictness :: BangQ +strictness = TH.bang noSourceUnpackedness noSourceStrictness + +-- | Prepend "Anonymous" to named node when false, otherwise use regular toName +toName :: Named -> String -> Name +toName named str = mkName (toNameString named str) + +toNameString :: Named -> String -> String +toNameString named str = prefix named <> toHaskellPascalCaseIdentifier str + where + prefix Anonymous = "Anonymous" + prefix Named = "" + +-- | Get the 'Module', if any, for a given 'Name'. +moduleForName :: Name -> Maybe Module +moduleForName n = Module . PkgName <$> namePackage n <*> (ModName <$> nameModule n) + +-- | Test whether the name is defined in the module where the splice is executed. +isLocalName :: Name -> Q Bool +isLocalName n = (moduleForName n ==) . Just <$> thisModule diff --git a/semantic-ast/src/AST/Grammar/Examples.hs b/semantic-ast/src/AST/Grammar/Examples.hs new file mode 100644 index 0000000000..71e2c352a7 --- /dev/null +++ b/semantic-ast/src/AST/Grammar/Examples.hs @@ -0,0 +1,83 @@ +{-# LANGUAGE DataKinds, DeriveAnyClass, DeriveGeneric, DuplicateRecordFields, TypeOperators #-} +module AST.Grammar.Examples () where + +import Control.Effect.Reader +import Control.Monad.Fail +import qualified Data.ByteString as B +import qualified Data.Text as Text +import qualified Data.Text.Encoding as Text +import GHC.Generics ((:+:), Generic1) +import Numeric (readDec) +import Prelude hiding (fail) +import Source.Range +import AST.Token +import AST.Unmarshal + +-- | An example of a sum-of-products datatype. +newtype Expr a = Expr ((If :+: Block :+: Var :+: Lit :+: Bin) a) + deriving (Generic1, Unmarshal) + +instance SymbolMatching Expr where + matchedSymbols _ = [] + showFailure _ _ = "" + +-- | Product with multiple fields. +data If a = If { ann :: a, condition :: Expr a, consequence :: Expr a, alternative :: Maybe (Expr a) } + deriving (Generic1, Unmarshal) + +instance SymbolMatching If where + matchedSymbols _ = [] + showFailure _ _ = "" + +-- | Single-field product. +data Block a = Block { ann :: a, body :: [Expr a] } + deriving (Generic1, Unmarshal) + +instance SymbolMatching Block where + matchedSymbols _ = [] + showFailure _ _ = "" + +-- | Leaf node. +data Var a = Var { ann :: a, text :: Text.Text } + deriving (Generic1, Unmarshal) + +instance SymbolMatching Var where + matchedSymbols _ = [] + showFailure _ _ = "" + +-- | Custom leaf node. +data Lit a = Lit { ann :: a, lit :: IntegerLit } + deriving (Generic1, Unmarshal) + +instance SymbolMatching Lit where + matchedSymbols _ = [] + showFailure _ _ = "" + +-- | Product with anonymous sum field. +data Bin a = Bin { ann :: a, lhs :: Expr a, op :: (AnonPlus :+: AnonTimes) a, rhs :: Expr a } + deriving (Generic1, Unmarshal) + +instance SymbolMatching Bin where + matchedSymbols _ = [] + showFailure _ _ = "" + +-- | Anonymous leaf node. +type AnonPlus = Token "+" 0 + +-- | Anonymous leaf node. +type AnonTimes = Token "*" 1 + + +newtype IntegerLit = IntegerLit Integer + +instance UnmarshalAnn IntegerLit where + unmarshalAnn node = do + Range start end <- unmarshalAnn node + bytestring <- asks source + let drop = B.drop start + take = B.take (end - start) + slice = take . drop + str = Text.unpack (Text.decodeUtf8 (slice bytestring)) + case readDec str of + (i, _):_ -> pure (IntegerLit i) + _ -> fail ("could not parse '" <> str <> "'") diff --git a/semantic-ast/src/AST/Grammar/TH.hs b/semantic-ast/src/AST/Grammar/TH.hs new file mode 100644 index 0000000000..fb924675f1 --- /dev/null +++ b/semantic-ast/src/AST/Grammar/TH.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE TemplateHaskell #-} +module AST.Grammar.TH +( mkStaticallyKnownRuleGrammarData +) where + +import Data.Ix (Ix) +import Data.List (mapAccumL) +import qualified Data.Set as Set +import Foreign.Ptr +import Language.Haskell.TH +import Language.Haskell.TH.Syntax +import TreeSitter.Language (Language, languageSymbols) +import TreeSitter.Symbol + +-- | TemplateHaskell construction of a datatype for the referenced Language. +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData :: Name -> Ptr Language -> Q [Dec] +mkStaticallyKnownRuleGrammarData name language = do + symbols <- renameDups . map ((,) . fst <*> uncurry symbolToName) . (++ [(Regular, "ParseError")]) <$> runIO (languageSymbols language) + Module _ modName <- thisModule + let mkMatch symbolType str = match (conP (Name (OccName str) (NameQ modName)) []) (normalB (lift symbolType)) [] + datatype <- dataD (pure []) name [] Nothing (flip normalC [] . mkName . snd <$> symbols) + [ derivClause Nothing (map conT [ ''Bounded, ''Enum, ''Eq, ''Ix, ''Ord, ''Show ]) ] + symbolInstance <- [d| + instance Symbol $(conT name) where + symbolType = $(lamCaseE (uncurry mkMatch <$> symbols)) |] + pure (datatype : symbolInstance) + +renameDups :: [(a, String)] -> [(a, String)] +renameDups = snd . mapAccumL go mempty + where go done (ty, name) = let name' = rename name in (Set.insert name' done, (ty, name')) + where rename name | name `Set.member` done = rename (name ++ "'") + | otherwise = name diff --git a/semantic-ast/src/AST/Marshal/JSON.hs b/semantic-ast/src/AST/Marshal/JSON.hs new file mode 100644 index 0000000000..f260448a23 --- /dev/null +++ b/semantic-ast/src/AST/Marshal/JSON.hs @@ -0,0 +1,94 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE ExistentialQuantification #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE TypeSynonymInstances #-} +{-# LANGUAGE UndecidableInstances #-} + +module AST.Marshal.JSON +( MarshalJSON(..) +) where + +import AST.Parse +import Data.Aeson as Aeson hiding (Success) +import Data.Bifunctor (first) +import Data.List.NonEmpty (NonEmpty) +import Data.String (fromString) +import Data.Text (Text, unpack) +import qualified Data.Text as Text +import GHC.Generics + +-- TODO: use toEncoding -- direct serialization to ByteString + +-- Serialize unmarshaled ASTs into JSON representation by auto-deriving Aeson instances generically +class MarshalJSON t where + marshal :: (ToJSON a) => t a -> Value + marshal = object . map (first (fromString . unpack)) . fields [] + fields :: (ToJSON a) => [(Text, Value)] -> t a -> [(Text, Value)] + default fields :: ( Generic1 t, GFields (Rep1 t), ToJSON a) => [(Text, Value)] -> t a -> [(Text, Value)] + fields acc = gfields acc . from1 + +-- Implement the sum case +instance {-# OVERLAPPING #-} (MarshalJSON f, MarshalJSON g) => MarshalJSON (f :+: g) where + fields acc (L1 f) = fields acc f + fields acc (R1 g) = fields acc g + +-- Create MarshalJSON instances for each type constructor +instance (GFields (Rep1 t), Generic1 t) => MarshalJSON t + +-- Stores meta-data for datatypes +instance (GFields f, Datatype c) => GFields (M1 D c f) where + gfields acc x = gfields ((Text.pack "type", String (Text.pack (datatypeName x))): acc) $ unM1 x + +-- Fold over S1 product types and pass the result to Aeson objects +instance GFields fields => GFields (C1 c fields) where + gfields acc x = gfields acc (unM1 x) + +-- Implement base case for products +-- To get a value out of this datum, we define another typeclass: @GValue@ with the method @gvalue@. +instance (GValue p, Selector s) => GFields (S1 s p) where + gfields acc x = (Text.pack (selName x), gvalue (unM1 x)) : acc + +-- Implement inductive case for product case +-- Product datatypes are marshalled to an object with a type field holding the constructor name and a separate field for each selector in the datatype. +instance (GFields f, GFields g) => GFields (f :*: g) where + gfields acc (f :*: g) = gfields (gfields acc g) f + +-- GValue for leaves +instance ToJSON a => GValue (K1 i a) where + gvalue = toJSON . unK1 + +-- Par1 instance +instance GValue Par1 where + gvalue = toJSON . unPar1 + +instance (MarshalJSON t) => GValue (Rec1 t) where + gvalue (Rec1 f) = marshal f + +instance (GValue t) => GValue (Maybe :.: t) where + gvalue (Comp1 (Just t)) = gvalue t + gvalue (Comp1 Nothing) = Null + +instance (GValue t) => GValue ([] :.: t) where + gvalue (Comp1 ts) = toJSON $ map gvalue ts + +instance (GValue t) => GValue (NonEmpty :.: t) where + gvalue (Comp1 ts) = toJSON $ fmap gvalue ts + +instance (GValue t) => GValue (Err :.: t) where + gvalue (Comp1 (Success t)) = gvalue t + gvalue (Comp1 (Fail _)) = Null + +-- GFields operates on product field types: it takes an accumulator, a datatype, and returns a new accumulator value. +class GFields f where + gfields :: ToJSON a => [(Text, Value)] -> f a -> [(Text, Value)] + +-- gvalue is a wrapper that calls to @toJSON@ (for leaf nodes such as @Text@) or recurses via @marshal@ +class GValue f where + gvalue :: (ToJSON a) => f a -> Value diff --git a/semantic-ast/src/AST/Parse.hs b/semantic-ast/src/AST/Parse.hs new file mode 100644 index 0000000000..bb7a8d68c0 --- /dev/null +++ b/semantic-ast/src/AST/Parse.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE KindSignatures #-} + +module AST.Parse +( Err(..) +) where + +import GHC.Generics (Generic, Generic1) + +-- | An AST node representing an Error, showing a parse that's succeeded or failed. +-- +-- Error types are isomorphic to Either String. +-- +-- For example, consider the following: +-- @ +-- data If f a = If { ann :: a, condition :: f (Expr f a), consequence :: f (Stmt f a), alternative :: f (Stmt f a) } +-- @ +-- When the parse fails, the f will be substituted with Err +-- TODO: this could work with AST.Element Prj given the kindedness was adjusted from (*) to (* -> *). +data Err a = Fail String | Success a + deriving (Eq, Foldable, Functor, Generic, Generic1, Ord, Traversable) + +instance Applicative Err where + pure = Success + Fail e <*> _ = Fail e + Success a <*> r = fmap a r + +instance Show a => Show (Err a) where + show (Fail msg) = msg + show (Success a) = show a diff --git a/semantic-ast/src/AST/TestHelpers.hs b/semantic-ast/src/AST/TestHelpers.hs new file mode 100644 index 0000000000..9f82b8f7ef --- /dev/null +++ b/semantic-ast/src/AST/TestHelpers.hs @@ -0,0 +1,83 @@ +{-# LANGUAGE OverloadedStrings #-} +module AST.TestHelpers + ( CorpusExample(..) + , readCorpusFiles + , readCorpusFiles' + , parseCorpusFile + , testCorpus + ) where + +import Control.Applicative +import Control.Monad +import Data.Attoparsec.ByteString.Char8 +import Data.Attoparsec.ByteString.Char8 as Attoparsec +import Data.ByteString (ByteString, readFile) +import Data.ByteString.Char8 (pack, unpack) +import Data.Either +import Data.Functor +import Prelude hiding (takeWhile) +import System.Directory +import System.Exit (exitFailure) +import System.FilePath +import System.FilePath.Glob +import Test.Tasty +import Test.Tasty.HUnit + +testCorpus :: (ByteString -> IO (Either String (t a))) -> FilePath -> IO TestTree +testCorpus parse path = do + xs <- parseCorpusFile path + case xs of + Left e -> print ("Failed to parse corpus: " <> show path <> " " <> "Error: " <> show e) *> exitFailure + Right xs -> testGroup path <$> traverse corpusTestCase xs + where + corpusTestCase (CorpusExample name code) = testCase name . either (errMsg code) pass <$> parse code + pass = const (pure ()) + errMsg code e = assertFailure (e <> "\n``` \n" <> unpack code <> "```") + +-- Depending on whether these tests are invoked via cabal run or cabal test, +-- we might be in a project subdirectory or not, so let's make sure we're +-- in project subdirectories as needed. +findCorpus :: FilePath -> IO FilePath +findCorpus p = do + cwd <- getCurrentDirectory + if takeFileName cwd == "haskell-tree-sitter" + then pure p + else pure (".." p) + +-- The path is expected to be relative to the language project. +readCorpusFiles :: FilePath -> IO [FilePath] +readCorpusFiles parent = do + dir <- findCorpus parent + globDir1 (compile "**/*.txt") dir + +readCorpusFiles' :: FilePath -> IO [FilePath] +readCorpusFiles' = globDir1 (compile "**/*.txt") + +data CorpusExample = CorpusExample { name :: String, code :: ByteString } + deriving (Eq, Show) + +parseCorpusFile :: FilePath -> IO (Either String [CorpusExample]) +parseCorpusFile path = do + c <- Data.ByteString.readFile path + pure $ parseOnly corpusParser c + +corpusParser :: Parser [CorpusExample] +corpusParser = do + xs <- many' exampleParser + void endOfInput + pure xs + +exampleParser :: Parser CorpusExample +exampleParser = do + name <- exampleNameParser + code <- manyTill anyChar outputSepParser + _out <- manyTill anyChar (choice [endOfInput, char '=' $> ()]) + pure (CorpusExample name (pack code)) + where outputSepParser = (Attoparsec.take 3) *> (Attoparsec.char '-') *> endOfLine + +exampleNameParser :: Parser String +exampleNameParser = do + _ <- skipWhile (== '=') *> skipSpace + name <- takeWhile (/= '\n') + _ <- skipSpace *> skipWhile (== '=') *> skipSpace + pure (unpack name) diff --git a/semantic-ast/src/AST/Token.hs b/semantic-ast/src/AST/Token.hs new file mode 100644 index 0000000000..c207c64c79 --- /dev/null +++ b/semantic-ast/src/AST/Token.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE KindSignatures #-} + +module AST.Token +( Token(..) +) where + +import GHC.Generics (Generic, Generic1) +import GHC.TypeLits (Symbol, Nat) + +-- | An AST node representing a token, indexed by its name and numeric value. +-- +-- For convenience, token types are typically used via type synonyms, e.g.: +-- +-- @ +-- type AnonymousPlus = Token "+" 123 +-- @ +newtype Token (symName :: Symbol) (symVal :: Nat) a = Token { ann :: a } + deriving (Eq, Foldable, Functor, Generic, Generic1, Ord, Show, Traversable) diff --git a/semantic-ast/src/AST/Traversable1.hs b/semantic-ast/src/AST/Traversable1.hs new file mode 100644 index 0000000000..1fe4dc0250 --- /dev/null +++ b/semantic-ast/src/AST/Traversable1.hs @@ -0,0 +1,76 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module AST.Traversable1 +( module AST.Traversable1.Class +, for1 +, traverse1_ +, for1_ +, foldMap1 +, Generics(..) +) where + +import AST.Traversable1.Class +import Data.Functor (void) +import Data.Functor.Const +import Data.Monoid (Ap (..)) +import GHC.Generics + +for1 + :: forall c t f a b + . (Traversable1 c t, Applicative f) + => t a + -> (a -> f b) + -> (forall t' . c t' => t' a -> f (t' b)) + -> f (t b) +for1 t f g = traverse1 @c f g t + +traverse1_ + :: forall c t f a a' a'' + . (Traversable1 c t, Applicative f) + => (a -> f a') + -> (forall t' . c t' => t' a -> f a'') + -> t a + -> f () +traverse1_ f g = getAp . foldMap1 @c (Ap . void . f) (Ap . void . g) + +for1_ + :: forall c t f a a' a'' + . (Traversable1 c t, Applicative f) + => t a + -> (a -> f a') + -> (forall t' . c t' => t' a -> f a'') + -> f () +for1_ t f g = getAp $ foldMap1 @c (Ap . void . f) (Ap . void . g) t + +foldMap1 :: forall c t b a . (Traversable1 c t, Monoid b) => (a -> b) -> (forall t' . c t' => t' a -> b) -> t a -> b +foldMap1 f g = getConst . traverse1 @c (Const . f) (Const . g) + + +-- | @'Generics' t@ has a 'Traversable1' instance when @'Rep1' t@ has a 'GTraversable1' instance, making this convenient for applying 'traverse1' to 'Generic1' types lacking 'Traversable1' instances: +-- +-- @ +-- 'getGenerics' '<$>' 'traverse1' f g ('Generics' t) = 'to1' '<$>' 'gtraverse1' f g ('from1' t) +-- @ +-- +-- It further defines its 'Foldable', 'Functor', and 'Traversable' instances using 'Traversable1', making it suitable for deriving with @-XDerivingVia@. +newtype Generics t a = Generics { getGenerics :: t a } + +instance (Generic1 t, GTraversable1 Foldable (Rep1 t)) => Foldable (Generics t) where + foldMap = foldMapDefault1 + +instance (Generic1 t, GTraversable1 Functor (Rep1 t)) => Functor (Generics t) where + fmap = fmapDefault1 + +instance (Generic1 t, GTraversable1 Foldable (Rep1 t), GTraversable1 Functor (Rep1 t), GTraversable1 Traversable (Rep1 t)) => Traversable (Generics t) where + traverse = traverseDefault1 + +instance (Generic1 t, GTraversable1 c (Rep1 t)) => Traversable1 c (Generics t) where + traverse1 f g = fmap (Generics . to1) . gtraverse1 @c f g . from1 . getGenerics diff --git a/semantic-ast/src/AST/Traversable1/Class.hs b/semantic-ast/src/AST/Traversable1/Class.hs new file mode 100644 index 0000000000..6c02a62dfc --- /dev/null +++ b/semantic-ast/src/AST/Traversable1/Class.hs @@ -0,0 +1,100 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +-- | This module defines the 'Traversable1' class and its generic derivation using 'GTraversable1'. Note that any changes to this file will require recompilation of all of the AST modules, which is quite expensive; thus, most additions should be made in "AST.Traversable1" instead, and that that module should not be imported by the AST modules. +module AST.Traversable1.Class +( Traversable1(..) +, foldMapDefault1 +, fmapDefault1 +, traverseDefault1 +, GTraversable1(..) +) where + +import Data.Functor.Const +import Data.Functor.Identity +import GHC.Generics + +-- | Simultaneous traversal of subterms of kind @*@ and @* -> *@ in an 'Applicative' context. +-- +-- 'Traversable1' can express any combination of first- and second-order mapping, folding, and traversal. +-- +-- Note that the @1@ suffix is used in the manner of 'Data.Functor.Classes.Show1' or 'Generic1', rather than 'foldr1'; it’s a higher-order traversal which is simultaneously able to traverse (and alter) annotations. +class Traversable1 c t where + -- | Map annotations of kind @*@ and heterogeneously-typed subterms of kind @* -> *@ under some constraint @c@ into an 'Applicative' context. The constraint is necessary to operate on otherwise universally-quantified subterms, since otherwise there would be insufficient information to inspect them at all. + -- + -- No proxy is provided for the constraint @c@; instead, @-XTypeApplications@ should be used. E.g. here we ignore the annotations and print all the @* -> *@ subterms using 'Show1': + -- + -- @ + -- 'traverse1' \@'Data.Functor.Classes.Show1' 'pure' (\ t -> t '<$' 'putStrLn' ('Data.Functor.Classes.showsPrec1' 0 t "")) + -- @ + -- + -- Note that this traversal is non-recursive: any recursion through subterms must be performed by the second function argument. + traverse1 + :: Applicative f + => (a -> f b) + -> (forall t' . c t' => t' a -> f (t' b)) + -> t a + -> f (t b) + default traverse1 + :: (Applicative f, Generic1 t, GTraversable1 c (Rep1 t)) + => (a -> f b) + -> (forall t' . c t' => t' a -> f (t' b)) + -> t a + -> f (t b) + traverse1 f g = fmap to1 . gtraverse1 @c f g . from1 + + +-- | This function may be used as a value for 'foldMap' in a 'Foldable' instance. +foldMapDefault1 :: (Traversable1 Foldable t, Monoid b) => (a -> b) -> t a -> b +foldMapDefault1 f = getConst . traverse1 @Foldable (Const . f) (Const . foldMap f) + +-- | This function may be used as a value for 'fmap' in a 'Functor' instance. +fmapDefault1 :: Traversable1 Functor t => (a -> b) -> t a -> t b +fmapDefault1 f = runIdentity . traverse1 @Functor (Identity . f) (Identity . fmap f) + +-- | This function may be used as a value for 'traverse' in a 'Traversable' instance. +traverseDefault1 :: (Traversable1 Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) +traverseDefault1 f = traverse1 @Traversable f (traverse f) + + +class GTraversable1 c t where + -- | Generically map annotations and subterms of kind @* -> *@ into an 'Applicative' context. + gtraverse1 + :: Applicative f + => (a -> f b) + -> (forall t' . c t' => t' a -> f (t' b)) + -> t a + -> f (t b) + +instance GTraversable1 c f => GTraversable1 c (M1 i c' f) where + gtraverse1 f g = fmap M1 . gtraverse1 @c f g . unM1 + +instance (GTraversable1 c f, GTraversable1 c g) => GTraversable1 c (f :*: g) where + gtraverse1 f g (l :*: r) = (:*:) <$> gtraverse1 @c f g l <*> gtraverse1 @c f g r + +instance (GTraversable1 c f, GTraversable1 c g) => GTraversable1 c (f :+: g) where + gtraverse1 f g (L1 l) = L1 <$> gtraverse1 @c f g l + gtraverse1 f g (R1 r) = R1 <$> gtraverse1 @c f g r + +instance GTraversable1 c (K1 R t) where + gtraverse1 _ _ (K1 k) = pure (K1 k) + +instance GTraversable1 c Par1 where + gtraverse1 f _ (Par1 a) = Par1 <$> f a + +instance c t => GTraversable1 c (Rec1 t) where + gtraverse1 _ g (Rec1 t) = Rec1 <$> g t + +instance (Traversable f, GTraversable1 c g) => GTraversable1 c (f :.: g) where + gtraverse1 f g = fmap Comp1 . traverse (gtraverse1 @c f g) . unComp1 + +instance GTraversable1 c U1 where + gtraverse1 _ _ _ = pure U1 diff --git a/semantic-ast/src/AST/Unmarshal.hs b/semantic-ast/src/AST/Unmarshal.hs new file mode 100644 index 0000000000..bcd01808a3 --- /dev/null +++ b/semantic-ast/src/AST/Unmarshal.hs @@ -0,0 +1,423 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} + +module AST.Unmarshal +( parseByteString +, UnmarshalState(..) +, UnmarshalError(..) +, FieldName(..) +, Unmarshal(..) +, UnmarshalAnn(..) +, UnmarshalField(..) +, SymbolMatching(..) +, Match(..) +, hoist +, lookupSymbol +, unmarshalNode +, GHasAnn(..) +) where + +import AST.Token as TS +import AST.Parse +import Control.Carrier.Reader +import Control.Exception +import Control.Monad.IO.Class +import Data.ByteString (ByteString) +import qualified Data.ByteString as B +import Data.Coerce +import Data.Foldable (toList) +import Data.Functor.Identity +import qualified Data.IntMap as IntMap +import Data.List.NonEmpty (NonEmpty (..)) +import Data.Proxy +import qualified Data.Text as Text +import Data.Text.Encoding +import Data.Text.Encoding.Error (lenientDecode) +import Foreign.C.String +import Foreign.Marshal.Array +import Foreign.Marshal.Utils +import Foreign.Ptr +import Foreign.Storable +import GHC.Generics +import GHC.Records +import GHC.TypeLits +import Source.Loc +import Source.Span +import TreeSitter.Cursor as TS +import TreeSitter.Language as TS +import TreeSitter.Node as TS +import TreeSitter.Parser as TS +import TreeSitter.Tree as TS + +-- Parse source code and produce AST +parseByteString :: (Unmarshal t, UnmarshalAnn a) => Ptr TS.Language -> ByteString -> IO (Either String (t a)) +parseByteString language bytestring = withParser language $ \ parser -> withParseTree parser bytestring $ \ treePtr -> + if treePtr == nullPtr then + pure (Left "error: didn't get a root node") + else + withRootNode treePtr $ \ rootPtr -> + withCursor (castPtr rootPtr) $ \ cursor -> + (Right <$> runReader (UnmarshalState bytestring cursor) (liftIO (peek rootPtr) >>= unmarshalNode)) + `catch` (pure . Left . getUnmarshalError) + +newtype UnmarshalError = UnmarshalError { getUnmarshalError :: String } + deriving (Show) + +instance Exception UnmarshalError + +data UnmarshalState = UnmarshalState + { source :: {-# UNPACK #-} !ByteString + , cursor :: {-# UNPACK #-} !(Ptr Cursor) + } + +type MatchM = ReaderC UnmarshalState IO + +newtype Match t = Match + { runMatch :: forall a . UnmarshalAnn a => Node -> MatchM (t a) + } + +-- | A church-encoded binary tree with constant-time 'singleton', 'mempty', '<>', and 'fmap', and linear-time 'foldMap'. +newtype B a = B (forall r . (r -> r -> r) -> (a -> r) -> r -> r) + +instance Functor B where + fmap f (B run) = B (\ fork leaf -> run fork (leaf . f)) + {-# INLINE fmap #-} + a <$ B run = B (\ fork leaf -> run fork (leaf . const a)) + {-# INLINE (<$) #-} + +instance Semigroup (B a) where + B l <> B r = B (\ fork leaf nil -> fork (l fork leaf nil) (r fork leaf nil)) + {-# INLINE (<>) #-} + +instance Monoid (B a) where + mempty = B (\ _ _ nil -> nil) + {-# INLINE mempty #-} + +instance Foldable B where + foldMap f (B run) = run (<>) f mempty + {-# INLINE foldMap #-} + +singleton :: a -> B a +singleton a = B (\ _ leaf _ -> leaf a) +{-# INLINE singleton #-} + +hoist :: (forall x . t x -> t' x) -> Match t -> Match t' +hoist f (Match run) = Match (fmap f . run) +{-# INLINE hoist #-} + +lookupSymbol :: TSSymbol -> IntMap.IntMap a -> Maybe a +lookupSymbol sym map = IntMap.lookup (fromIntegral sym) map +{-# INLINE lookupSymbol #-} + +-- | Unmarshal a node +unmarshalNode :: forall t a . + ( UnmarshalAnn a + , Unmarshal t + ) + => Node + -> MatchM (t a) +unmarshalNode node = case lookupSymbol (nodeSymbol node) matchers' of + Just t -> runMatch t node + Nothing -> liftIO . throwIO . UnmarshalError $ showFailure (Proxy @t) node +{-# INLINE unmarshalNode #-} + +-- | Unmarshalling is the process of iterating over tree-sitter’s parse trees using its tree cursor API and producing Haskell ASTs for the relevant nodes. +-- +-- Datatypes which can be constructed from tree-sitter parse trees may use the default definition of 'matchers' providing that they have a suitable 'Generic1' instance. +class SymbolMatching t => Unmarshal t where + matchers' :: IntMap.IntMap (Match t) + matchers' = IntMap.fromList (toList matchers) + + matchers :: B (Int, Match t) + default matchers :: (Generic1 t, GUnmarshal (Rep1 t)) => B (Int, Match t) + matchers = foldMap (singleton . (, match)) (matchedSymbols (Proxy @t)) + where match = Match $ \ node -> do + cursor <- asks cursor + goto cursor (nodeTSNode node) + fmap to1 (gunmarshalNode node) + +instance (Unmarshal f, Unmarshal g) => Unmarshal (f :+: g) where + matchers = fmap (fmap (hoist L1)) matchers <> fmap (fmap (hoist R1)) matchers + +instance (Applicative shape, Unmarshal f) => Unmarshal (shape :.: f) where + matchers = let base = matchers @f in fmap (fmap promote) base + where + promote (Match f) = Match (fmap (fmap (Comp1 . pure)) f) + +instance Unmarshal t => Unmarshal (Rec1 t) where + matchers = coerce (matchers @t) + +instance (KnownNat n, KnownSymbol sym) => Unmarshal (Token sym n) where + matchers = singleton (fromIntegral (natVal (Proxy @n)), Match (fmap Token . unmarshalAnn)) + + +-- | Unmarshal an annotation field. +-- +-- Leaf nodes have 'Text.Text' fields, and leaves, anonymous leaves, and products all have parametric annotation fields. All of these fields are unmarshalled using the metadata of the node, e.g. its start/end bytes, without reference to any child nodes it may contain. +class UnmarshalAnn a where + unmarshalAnn + :: Node + -> MatchM a + +instance UnmarshalAnn () where + unmarshalAnn _ = pure () + +instance UnmarshalAnn Text.Text where + unmarshalAnn node = do + range <- unmarshalAnn node + asks (decodeUtf8With lenientDecode . slice range . source) + +-- | Instance for pairs of annotations +instance (UnmarshalAnn a, UnmarshalAnn b) => UnmarshalAnn (a,b) where + unmarshalAnn node = (,) + <$> unmarshalAnn @a node + <*> unmarshalAnn @b node + +instance UnmarshalAnn Loc where + unmarshalAnn node = Loc + <$> unmarshalAnn @Range node + <*> unmarshalAnn @Span node + +instance UnmarshalAnn Range where + unmarshalAnn node = do + let start = fromIntegral (nodeStartByte node) + end = fromIntegral (nodeEndByte node) + pure (Range start end) + +instance UnmarshalAnn Span where + unmarshalAnn node = do + let spanStart = pointToPos (nodeStartPoint node) + spanEnd = pointToPos (nodeEndPoint node) + pure (Span spanStart spanEnd) + +pointToPos :: TSPoint -> Pos +pointToPos (TSPoint line column) = Pos (fromIntegral line) (fromIntegral column) + + +-- | Optional/repeated fields occurring in product datatypes are wrapped in type constructors, e.g. 'Maybe', '[]', or 'NonEmpty', and thus can unmarshal zero or more nodes for the same field name. +class UnmarshalField t where + unmarshalField + :: ( Unmarshal f + , UnmarshalAnn ann + ) + => String -- ^ datatype name + -> String -- ^ field name + -> [Node] -- ^ nodes + -> MatchM (t (f ann)) + +instance UnmarshalField Err where + unmarshalField _ _ [] = pure $ Fail "No items provided to unmarshalField." + unmarshalField _ _ [x] = Success <$> unmarshalNode x + unmarshalField d f _ = pure $ Fail ("type '" <> d <> "' expected zero or one nodes in field '" <> f <> "' but got multiple") + +instance UnmarshalField Maybe where + unmarshalField _ _ [] = pure Nothing + unmarshalField _ _ [x] = Just <$> unmarshalNode x + unmarshalField d f _ = liftIO . throwIO . UnmarshalError $ "type '" <> d <> "' expected zero or one nodes in field '" <> f <> "' but got multiple" + +instance UnmarshalField Identity where + unmarshalField _ _ [x] = Identity <$> unmarshalNode x + unmarshalField d f _ = liftIO . throwIO . UnmarshalError $ "type '" <> d <> "' expected zero or one nodes in field '" <> f <> "' but got multiple" + +instance UnmarshalField [] where + unmarshalField d f (x:xs) = do + head' <- unmarshalNode x + tail' <- unmarshalField d f xs + pure $ head' : tail' + unmarshalField _ _ [] = pure [] + +instance UnmarshalField NonEmpty where + unmarshalField d f (x:xs) = do + head' <- unmarshalNode x + tail' <- unmarshalField d f xs + pure $ head' :| tail' + unmarshalField d f [] = liftIO . throwIO . UnmarshalError $ "type '" <> d <> "' expected one or more nodes in field '" <> f <> "' but got zero" + +class SymbolMatching (sym :: * -> *) where + matchedSymbols :: Proxy sym -> [Int] + + -- | Provide error message describing the node symbol vs. the symbols this can match + showFailure :: Proxy sym -> Node -> String + +instance SymbolMatching f => SymbolMatching (M1 i c f) where + matchedSymbols _ = matchedSymbols (Proxy @f) + showFailure _ = showFailure (Proxy @f) + +instance SymbolMatching f => SymbolMatching (Rec1 f) where + matchedSymbols _ = matchedSymbols (Proxy @f) + showFailure _ = showFailure (Proxy @f) + +instance (KnownNat n, KnownSymbol sym) => SymbolMatching (Token sym n) where + matchedSymbols _ = [fromIntegral (natVal (Proxy @n))] + showFailure _ _ = "expected " ++ symbolVal (Proxy @sym) + +instance (SymbolMatching f, SymbolMatching g) => SymbolMatching (f :+: g) where + matchedSymbols _ = matchedSymbols (Proxy @f) <> matchedSymbols (Proxy @g) + showFailure _ = sep <$> showFailure (Proxy @f) <*> showFailure (Proxy @g) + +instance SymbolMatching f => SymbolMatching (shape :.: f) where + matchedSymbols _ = matchedSymbols (Proxy @f) + showFailure _ = showFailure (Proxy @f) + +sep :: String -> String -> String +sep a b = a ++ ". " ++ b + +-- | Move the cursor to point at the passed 'TSNode'. +goto :: Ptr Cursor -> TSNode -> MatchM () +goto cursor node = liftIO (with node (ts_tree_cursor_reset_p cursor)) + + +type Fields = [(FieldName, Node)] + +-- | Return the fields remaining in the current branch, represented as 'Map.Map' of 'FieldName's to their corresponding 'Node's. +getFields :: Ptr Cursor -> Node -> MatchM Fields +getFields cursor node + | maxCount == 0 = pure [] + | otherwise = do + nodes <- liftIO . allocaArray maxCount $ \ ptr -> do + actualCount <- ts_tree_cursor_copy_child_nodes cursor ptr + peekArray (fromIntegral actualCount) ptr + traverse (\ node -> (, node) <$> getFieldName node) nodes + where + maxCount = fromIntegral (nodeChildCount node) + getFieldName node + | nodeFieldName node == nullPtr = pure (FieldName "extraChildren") + | otherwise = FieldName . toHaskellCamelCaseIdentifier <$> liftIO (peekCString (nodeFieldName node)) + +lookupField :: FieldName -> Fields -> [Node] +lookupField k = map snd . filter ((== k) . fst) + + +-- | Return a 'ByteString' that contains a slice of the given 'ByteString'. +slice :: Range -> ByteString -> ByteString +slice (Range start end) = take . drop + where drop = B.drop start + take = B.take (end - start) + + +newtype FieldName = FieldName { getFieldName :: String } + deriving (Eq, Ord, Show) + +-- | Generic construction of ASTs from a 'Map.Map' of named fields. +-- +-- Product types (specifically, record types) are constructed by looking up the node for each corresponding field name in the map, moving the cursor to it, and then invoking 'unmarshalNode' to construct the value for that field. Leaf types are constructed as a special case of product types. +-- +-- Sum types are constructed by using the current node’s symbol to select the corresponding constructor deterministically. +class GUnmarshal f where + gunmarshalNode + :: UnmarshalAnn ann + => Node + -> MatchM (f ann) + +instance (Datatype d, GUnmarshalData f) => GUnmarshal (M1 D d f) where + gunmarshalNode = go (gunmarshalNode' (datatypeName @d undefined)) where + go :: (Node -> MatchM (f ann)) -> Node -> MatchM (M1 i c f ann) + go = coerce + +instance (GUnmarshal f, Applicative shape) => GUnmarshal (shape :.: f) where + gunmarshalNode = fmap (Comp1 . pure) . gunmarshalNode @f + +class GUnmarshalData f where + gunmarshalNode' + :: UnmarshalAnn ann + => String + -> Node + -> MatchM (f ann) + +instance GUnmarshalData f => GUnmarshalData (M1 i c f) where + gunmarshalNode' = go gunmarshalNode' where + go :: (String -> Node -> MatchM (f a)) -> String -> Node -> MatchM (M1 i c f a) + go = coerce + +-- For anonymous leaf nodes: +instance GUnmarshalData U1 where + gunmarshalNode' _ _ = pure U1 + +-- For unary products: +instance UnmarshalAnn k => GUnmarshalData (K1 c k) where + gunmarshalNode' _ = go unmarshalAnn where + go :: (Node -> MatchM k) -> Node -> MatchM (K1 c k a) + go = coerce + +-- For anonymous leaf nodes +instance GUnmarshalData Par1 where + gunmarshalNode' _ = go unmarshalAnn where + go :: (Node -> MatchM a) -> Node -> MatchM (Par1 a) + go = coerce + +instance Unmarshal t => GUnmarshalData (Rec1 t) where + gunmarshalNode' _ = go unmarshalNode where + go :: (Node -> MatchM (t a)) -> Node -> MatchM (Rec1 t a) + go = coerce + +-- For product datatypes: +instance (GUnmarshalProduct f, GUnmarshalProduct g) => GUnmarshalData (f :*: g) where + gunmarshalNode' datatypeName node = asks cursor >>= flip getFields node >>= gunmarshalProductNode @(f :*: g) datatypeName node + + +-- | Generically unmarshal products +class GUnmarshalProduct f where + gunmarshalProductNode + :: UnmarshalAnn ann + => String + -> Node + -> Fields + -> MatchM (f ann) + +-- Product structure +instance (GUnmarshalProduct f, GUnmarshalProduct g) => GUnmarshalProduct (f :*: g) where + gunmarshalProductNode datatypeName node fields = (:*:) + <$> gunmarshalProductNode @f datatypeName node fields + <*> gunmarshalProductNode @g datatypeName node fields + +-- Contents of product types (ie., the leaves of the product tree) +instance UnmarshalAnn k => GUnmarshalProduct (M1 S c (K1 i k)) where + gunmarshalProductNode _ node _ = go unmarshalAnn node where + go :: (Node -> MatchM k) -> Node -> MatchM (M1 S c (K1 i k) a) + go = coerce + +instance GUnmarshalProduct (M1 S c Par1) where + gunmarshalProductNode _ node _ = go unmarshalAnn node where + go :: (Node -> MatchM a) -> Node -> MatchM (M1 S c Par1 a) + go = coerce + +instance (UnmarshalField f, Unmarshal g, Selector c) => GUnmarshalProduct (M1 S c (f :.: g)) where + gunmarshalProductNode datatypeName _ = go (unmarshalField datatypeName fieldName . lookupField (FieldName fieldName)) where + go :: (Fields -> MatchM (f (g a))) -> Fields -> MatchM (M1 S c (f :.: g) a) + go = coerce + fieldName = selName @c undefined + +instance (Unmarshal t, Selector c) => GUnmarshalProduct (M1 S c (Rec1 t)) where + gunmarshalProductNode datatypeName _ fields = + case lookupField (FieldName fieldName) fields of + [] -> liftIO . throwIO . UnmarshalError $ "type '" <> datatypeName <> "' expected a node '" <> fieldName <> "' but didn't get one" + [x] -> go unmarshalNode x where + go :: (Node -> MatchM (t a)) -> Node -> MatchM (M1 S c (Rec1 t) a) + go = coerce + _ -> liftIO . throwIO . UnmarshalError $ "type '" <> datatypeName <> "' expected a node but got multiple" + where + fieldName = selName @c undefined + + +class GHasAnn ann t where + gann :: t ann -> ann + +instance GHasAnn ann f => GHasAnn ann (M1 i c f) where + gann = gann . unM1 + +instance (GHasAnn ann l, GHasAnn ann r) => GHasAnn ann (l :+: r) where + gann (L1 l) = gann l + gann (R1 r) = gann r + +instance {-# OVERLAPPABLE #-} HasField "ann" (t ann) ann => GHasAnn ann t where + gann = getField @"ann" diff --git a/semantic-ast/src/System/Path/Fixture.hs b/semantic-ast/src/System/Path/Fixture.hs new file mode 100644 index 0000000000..b332e5aa90 --- /dev/null +++ b/semantic-ast/src/System/Path/Fixture.hs @@ -0,0 +1,60 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE ImplicitParams #-} + +module System.Path.Fixture + ( absRelFile, + HasFixture, + absRelDir, + delay, + create, + ) +where + +import Control.Concurrent +import GHC.Stack +import System.FilePath +import System.IO + +#if BAZEL_BUILD +import qualified Bazel.Runfiles as Bazel + +type HasFixture = + ( ?runfiles :: Bazel.Runfiles, + ?project :: FilePath, + HasCallStack + ) + +create :: IO Bazel.Runfiles +create = Bazel.create + +root :: HasFixture => FilePath +root = Bazel.rlocation ?runfiles "." + +absRelFile :: HasFixture => String -> FilePath +absRelFile x = root "semantic" ?project x + +absRelDir :: HasFixture => String -> FilePath +absRelDir x = root "semantic" ?project x + +#else + +-- building under Cabal +type HasFixture = HasCallStack + +create :: IO () +create = pure () + +absRelFile :: String -> FilePath +absRelFile x = "semantic" x + +absRelDir :: String -> FilePath +absRelDir x = "semantic" x + +#endif + +delay :: String -> IO () +delay s = do + putStrLn s + hFlush stdout + threadDelay 100000000 diff --git a/semantic-codeql/BUILD.bazel b/semantic-codeql/BUILD.bazel new file mode 100644 index 0000000000..54631fb81f --- /dev/null +++ b/semantic-codeql/BUILD.bazel @@ -0,0 +1,19 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "//:build/common.bzl", + "semantic_language_library", + "semantic_language_parsing_test", +) + +semantic_language_library( + name = "semantic-codeql", + srcs = glob(["src/**/*.hs"]), + language = "ql", +) + +semantic_language_parsing_test( + language = "codeql", + semantic_package = "ql", + ts_package = "ql", +) diff --git a/semantic-codeql/LICENSE b/semantic-codeql/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-codeql/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-codeql/README.md b/semantic-codeql/README.md new file mode 100644 index 0000000000..ca08f8804d --- /dev/null +++ b/semantic-codeql/README.md @@ -0,0 +1,3 @@ +# Semantic support for CodeQL + +This package implements `semantic` support for CodeQL. diff --git a/semantic-codeql/Setup.hs b/semantic-codeql/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-codeql/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-codeql/semantic-codeql.cabal b/semantic-codeql/semantic-codeql.cabal new file mode 100644 index 0000000000..b3096ea079 --- /dev/null +++ b/semantic-codeql/semantic-codeql.cabal @@ -0,0 +1,76 @@ +cabal-version: 2.4 + +name: semantic-codeql +version: 0.0.0.0 +synopsis: Semantic support for CodeQL. +description: Semantic support for CodeQL. +homepage: https://github.com/github/semantic/tree/master/semantic-codeql#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + cpp-options: + -DBAZEL_BUILD=0 + +library + import: haskell + exposed-modules: + Language.CodeQL + Language.CodeQL.AST + Language.CodeQL.Grammar + Language.CodeQL.Tags + hs-source-dirs: src + build-depends: + , base >= 4.13 && < 5 + , fused-effects ^>= 1.1 + , semantic-ast + , semantic-proto ^>= 0 + , semantic-source ^>= 0.2 + , semantic-tags ^>= 0.0 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3 + , tree-sitter ^>= 0.9 + , tree-sitter-ql ^>= 0.1.0.2 + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: PreciseTest.hs + build-depends: + , base + , semantic-ast + , semantic-codeql + , tasty diff --git a/semantic-codeql/src/Language/CodeQL.hs b/semantic-codeql/src/Language/CodeQL.hs new file mode 100644 index 0000000000..9457787e3c --- /dev/null +++ b/semantic-codeql/src/Language/CodeQL.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# OPTIONS_GHC -freduction-depth=0 #-} +-- | Semantic functionality for CodeQL programs. +module Language.CodeQL +( Term(..) +, TreeSitter.QL.tree_sitter_ql +) where + +import AST.Marshal.JSON +import qualified AST.Unmarshal as TS +import Data.Proxy +import qualified Language.CodeQL.AST as CodeQL +import qualified Language.CodeQL.Tags as CodeQLTags +import qualified Tags.Tagging.Precise as Tags +import qualified TreeSitter.QL (tree_sitter_ql) + +newtype Term a = Term { getTerm :: CodeQL.Ql a } + deriving MarshalJSON + +instance TS.SymbolMatching Term where + matchedSymbols _ = TS.matchedSymbols (Proxy :: Proxy CodeQL.Ql) + showFailure _ = TS.showFailure (Proxy :: Proxy CodeQL.Ql) + +instance TS.Unmarshal Term where + matchers = fmap (fmap (TS.hoist Term)) TS.matchers + +instance Tags.ToTags Term where + tags src = Tags.runTagging src . CodeQLTags.tags . getTerm diff --git a/semantic-codeql/src/Language/CodeQL/AST.hs b/semantic-codeql/src/Language/CodeQL/AST.hs new file mode 100644 index 0000000000..2ea3fc192d --- /dev/null +++ b/semantic-codeql/src/Language/CodeQL/AST.hs @@ -0,0 +1,6096 @@ +-- Language definition for CodeQL, generated by ast-generate. Do not edit! +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Language.CodeQL.AST (module Language.CodeQL.AST, getTestCorpusDir) where + +import qualified AST.Parse +import qualified AST.Token +import qualified AST.Traversable1.Class +import qualified AST.Unmarshal +import qualified Data.Foldable +import qualified Data.List as Data.OldList +import qualified Data.Maybe as GHC.Maybe +import qualified Data.Text.Internal +import qualified Data.Traversable +import qualified GHC.Base +import qualified GHC.Generics +import qualified GHC.Records +import qualified GHC.Show +import qualified TreeSitter.Node +import TreeSitter.QL (getTestCorpusDir) +import qualified Prelude as GHC.Classes + +debugSymbolNames :: [GHC.Base.String] +debugSymbolNames = debugSymbolNames_0 + +debugSymbolNames_0 :: [GHC.Base.String] +debugSymbolNames_0 = + [ "end", + "_lower_id", + "_module", + "_{", + "_}", + "_;", + "_(", + "_,", + "_)", + "_or", + "_from", + "_where", + "_select", + "_if", + "_then", + "_else", + "_and", + "_implies", + "_|", + "_.", + "_[", + "_]", + "_..", + "_order", + "_by", + "qldoc", + "_::", + "_float", + "_int", + "_string", + "_upper_id", + "_at_lower_id", + "integer", + "float", + "string", + "line_comment", + "block_comment", + "any", + "as", + "asc", + "avg", + "boolean", + "class", + "newtype", + "count", + "date", + "desc", + "exists", + "extends", + "false", + "forall", + "forex", + "import", + "in", + "instanceof", + "max", + "min", + "not", + "none", + "predicate", + "rank", + "result", + "strictcount", + "strictsum", + "strictconcat", + "concat", + "sum", + "super", + "this", + "true", + "lt", + "le", + "eq", + "gt", + "ge", + "underscore", + "minus", + "ne", + "slash", + "star", + "mod", + "plus", + "ql", + "module", + "moduleMember", + "imprt", + "moduleAliasBody", + "predicateAliasBody", + "typeAliasBody", + "classlessPredicate", + "datatype", + "datatypeBranches", + "datatypeBranch", + "select", + "dataclass", + "classMember", + "charpred", + "memberPredicate", + "field", + "_optbody", + "empty", + "body", + "higherOrderTerm", + "special_call", + "prefix_cast", + "unary_expr", + "mul_expr", + "add_expr", + "in_expr", + "comp_term", + "instance_of", + "negation", + "if_term", + "conjunction", + "disjunction", + "implication", + "quantified", + "specialId", + "quantifier", + "_call_arg", + "qualifiedRhs", + "classless_predicate_call", + "qualified_expr", + "super_ref", + "full_aggregate_body", + "expr_aggregate_body", + "aggregate", + "range", + "par_expr", + "_exprOrTerm", + "_primary", + "literal", + "bool", + "variable", + "compop", + "unop", + "mulop", + "addop", + "closure", + "direction", + "varDecl", + "asExprs", + "asExpr", + "orderBys", + "orderBy", + "literalId", + "annotation", + "annotName", + "annotArg", + "moduleName", + "qualModuleExpr", + "importModuleExpr", + "moduleExpr", + "typeLiteral", + "simpleId", + "className", + "dbtype", + "returnType", + "typeExpr", + "predicateName", + "aritylessPredicateExpr", + "predicateExpr", + "varName", + "aggId", + "_ql_repeat1", + "_moduleMember_repeat1", + "_classlessPredicate_repeat1", + "_datatypeBranches_repeat1", + "_dataclass_repeat1", + "_dataclass_repeat2", + "_higherOrderTerm_repeat1", + "_higherOrderTerm_repeat2", + "_aggregate_repeat1", + "_asExprs_repeat1", + "_orderBys_repeat1", + "_annotation_repeat1", + "_qualModuleExpr_repeat1", + "_importModuleExpr_repeat1" + ] + +data AddExpr a = AddExpr + { ann :: a, + left :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + right :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + extraChildren :: (AST.Parse.Err (Addop a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1. + AST.Traversable1.Class.Traversable1 a_1 + ) + +instance AST.Unmarshal.SymbolMatching AddExpr where + matchedSymbols _ = [107] + showFailure _ node_2 = + "expected " + GHC.Base.<> ( "add_expr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_2 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_2) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_3 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_4 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_5 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_6 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_3 + c1_4 = TreeSitter.Node.nodeStartPoint node_2 + TreeSitter.Node.TSPoint + r2_5 + c2_6 = TreeSitter.Node.nodeEndPoint node_2 + +deriving instance GHC.Classes.Eq a_7 => GHC.Classes.Eq (AddExpr a_7) + +deriving instance GHC.Classes.Ord a_8 => GHC.Classes.Ord (AddExpr a_8) + +deriving instance GHC.Show.Show a_9 => GHC.Show.Show (AddExpr a_9) + +instance AST.Unmarshal.Unmarshal AddExpr + +instance Data.Foldable.Foldable AddExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AddExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AddExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Addop a = Addop + { ann :: a, + extraChildren :: (AST.Parse.Err ((Minus GHC.Generics.:+: Plus) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_10. + AST.Traversable1.Class.Traversable1 a_10 + ) + +instance AST.Unmarshal.SymbolMatching Addop where + matchedSymbols _ = [137] + showFailure _ node_11 = + "expected " + GHC.Base.<> ( "addop" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_11 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_11) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_12 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_13 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_14 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_15 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_12 + c1_13 = TreeSitter.Node.nodeStartPoint node_11 + TreeSitter.Node.TSPoint + r2_14 + c2_15 = TreeSitter.Node.nodeEndPoint node_11 + +deriving instance GHC.Classes.Eq a_16 => GHC.Classes.Eq (Addop a_16) + +deriving instance GHC.Classes.Ord a_17 => GHC.Classes.Ord (Addop a_17) + +deriving instance GHC.Show.Show a_18 => GHC.Show.Show (Addop a_18) + +instance AST.Unmarshal.Unmarshal Addop + +instance Data.Foldable.Foldable Addop where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Addop where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Addop where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AggId a = AggId + { ann :: a, + extraChildren :: (AST.Parse.Err ((Any GHC.Generics.:+: Avg GHC.Generics.:+: Concat GHC.Generics.:+: Count GHC.Generics.:+: Max GHC.Generics.:+: Min GHC.Generics.:+: Rank GHC.Generics.:+: Strictconcat GHC.Generics.:+: Strictcount GHC.Generics.:+: Strictsum GHC.Generics.:+: Sum) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_19. + AST.Traversable1.Class.Traversable1 a_19 + ) + +instance AST.Unmarshal.SymbolMatching AggId where + matchedSymbols _ = [163] + showFailure _ node_20 = + "expected " + GHC.Base.<> ( "aggId" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_20 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_20) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_21 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_22 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_23 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_24 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_21 + c1_22 = TreeSitter.Node.nodeStartPoint node_20 + TreeSitter.Node.TSPoint + r2_23 + c2_24 = TreeSitter.Node.nodeEndPoint node_20 + +deriving instance GHC.Classes.Eq a_25 => GHC.Classes.Eq (AggId a_25) + +deriving instance GHC.Classes.Ord a_26 => GHC.Classes.Ord (AggId a_26) + +deriving instance GHC.Show.Show a_27 => GHC.Show.Show (AggId a_27) + +instance AST.Unmarshal.Unmarshal AggId + +instance Data.Foldable.Foldable AggId where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AggId where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AggId where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Aggregate a = Aggregate + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: AggId GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: ExprAggregateBody GHC.Generics.:+: FullAggregateBody GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_28. + AST.Traversable1.Class.Traversable1 a_28 + ) + +instance AST.Unmarshal.SymbolMatching Aggregate where + matchedSymbols _ = [126] + showFailure _ node_29 = + "expected " + GHC.Base.<> ( "aggregate" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_29 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_29) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_30 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_31 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_32 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_33 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_30 + c1_31 = TreeSitter.Node.nodeStartPoint node_29 + TreeSitter.Node.TSPoint + r2_32 + c2_33 = TreeSitter.Node.nodeEndPoint node_29 + +deriving instance GHC.Classes.Eq a_34 => GHC.Classes.Eq (Aggregate a_34) + +deriving instance GHC.Classes.Ord a_35 => GHC.Classes.Ord (Aggregate a_35) + +deriving instance GHC.Show.Show a_36 => GHC.Show.Show (Aggregate a_36) + +instance AST.Unmarshal.Unmarshal Aggregate + +instance Data.Foldable.Foldable Aggregate where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Aggregate where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Aggregate where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AnnotArg a = AnnotArg + { ann :: a, + extraChildren :: (AST.Parse.Err ((Result GHC.Generics.:+: SimpleId GHC.Generics.:+: This) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_37. + AST.Traversable1.Class.Traversable1 a_37 + ) + +instance AST.Unmarshal.SymbolMatching AnnotArg where + matchedSymbols _ = [148] + showFailure _ node_38 = + "expected " + GHC.Base.<> ( "annotArg" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_38 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_38) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_39 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_40 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_41 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_42 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_39 + c1_40 = TreeSitter.Node.nodeStartPoint node_38 + TreeSitter.Node.TSPoint + r2_41 + c2_42 = TreeSitter.Node.nodeEndPoint node_38 + +deriving instance GHC.Classes.Eq a_43 => GHC.Classes.Eq (AnnotArg a_43) + +deriving instance GHC.Classes.Ord a_44 => GHC.Classes.Ord (AnnotArg a_44) + +deriving instance GHC.Show.Show a_45 => GHC.Show.Show (AnnotArg a_45) + +instance AST.Unmarshal.Unmarshal AnnotArg + +instance Data.Foldable.Foldable AnnotArg where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AnnotArg where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AnnotArg where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AnnotName a = AnnotName {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_46. + AST.Traversable1.Class.Traversable1 a_46 + ) + +instance AST.Unmarshal.SymbolMatching AnnotName where + matchedSymbols _ = [147] + showFailure _ node_47 = + "expected " + GHC.Base.<> ( "annotName" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_47 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_47) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_48 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_49 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_50 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_51 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_48 + c1_49 = TreeSitter.Node.nodeStartPoint node_47 + TreeSitter.Node.TSPoint + r2_50 + c2_51 = TreeSitter.Node.nodeEndPoint node_47 + +deriving instance GHC.Classes.Eq a_52 => GHC.Classes.Eq (AnnotName a_52) + +deriving instance GHC.Classes.Ord a_53 => GHC.Classes.Ord (AnnotName a_53) + +deriving instance GHC.Show.Show a_54 => GHC.Show.Show (AnnotName a_54) + +instance AST.Unmarshal.Unmarshal AnnotName + +instance Data.Foldable.Foldable AnnotName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AnnotName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AnnotName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Annotation a = Annotation + { ann :: a, + args :: ([AST.Parse.Err ((AnonymousComma GHC.Generics.:+: AnnotArg) a)]), + name :: (AST.Parse.Err (AnnotName a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_55. + AST.Traversable1.Class.Traversable1 a_55 + ) + +instance AST.Unmarshal.SymbolMatching Annotation where + matchedSymbols _ = [146] + showFailure _ node_56 = + "expected " + GHC.Base.<> ( "annotation" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_56 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_56) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_57 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_58 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_59 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_60 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_57 + c1_58 = TreeSitter.Node.nodeStartPoint node_56 + TreeSitter.Node.TSPoint + r2_59 + c2_60 = TreeSitter.Node.nodeEndPoint node_56 + +deriving instance GHC.Classes.Eq a_61 => GHC.Classes.Eq (Annotation a_61) + +deriving instance GHC.Classes.Ord a_62 => GHC.Classes.Ord (Annotation a_62) + +deriving instance GHC.Show.Show a_63 => GHC.Show.Show (Annotation a_63) + +instance AST.Unmarshal.Unmarshal Annotation + +instance Data.Foldable.Foldable Annotation where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Annotation where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Annotation where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AritylessPredicateExpr a = AritylessPredicateExpr + { ann :: a, + name :: (AST.Parse.Err (LiteralId a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ModuleExpr a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_64. + AST.Traversable1.Class.Traversable1 a_64 + ) + +instance AST.Unmarshal.SymbolMatching AritylessPredicateExpr where + matchedSymbols _ = [160] + showFailure _ node_65 = + "expected " + GHC.Base.<> ( "aritylessPredicateExpr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_65 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_65) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_66 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_67 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_68 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_69 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_66 + c1_67 = TreeSitter.Node.nodeStartPoint node_65 + TreeSitter.Node.TSPoint + r2_68 + c2_69 = TreeSitter.Node.nodeEndPoint node_65 + +deriving instance GHC.Classes.Eq a_70 => GHC.Classes.Eq (AritylessPredicateExpr a_70) + +deriving instance GHC.Classes.Ord a_71 => GHC.Classes.Ord (AritylessPredicateExpr a_71) + +deriving instance GHC.Show.Show a_72 => GHC.Show.Show (AritylessPredicateExpr a_72) + +instance AST.Unmarshal.Unmarshal AritylessPredicateExpr + +instance Data.Foldable.Foldable AritylessPredicateExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AritylessPredicateExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AritylessPredicateExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AsExpr a = AsExpr + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: As GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: VarName GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_73. + AST.Traversable1.Class.Traversable1 a_73 + ) + +instance AST.Unmarshal.SymbolMatching AsExpr where + matchedSymbols _ = [142] + showFailure _ node_74 = + "expected " + GHC.Base.<> ( "asExpr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_74 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_74) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_75 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_76 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_77 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_78 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_75 + c1_76 = TreeSitter.Node.nodeStartPoint node_74 + TreeSitter.Node.TSPoint + r2_77 + c2_78 = TreeSitter.Node.nodeEndPoint node_74 + +deriving instance GHC.Classes.Eq a_79 => GHC.Classes.Eq (AsExpr a_79) + +deriving instance GHC.Classes.Ord a_80 => GHC.Classes.Ord (AsExpr a_80) + +deriving instance GHC.Show.Show a_81 => GHC.Show.Show (AsExpr a_81) + +instance AST.Unmarshal.Unmarshal AsExpr + +instance Data.Foldable.Foldable AsExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AsExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AsExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AsExprs a = AsExprs + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (AsExpr a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_82. + AST.Traversable1.Class.Traversable1 a_82 + ) + +instance AST.Unmarshal.SymbolMatching AsExprs where + matchedSymbols _ = [141] + showFailure _ node_83 = + "expected " + GHC.Base.<> ( "asExprs" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_83 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_83) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_84 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_85 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_86 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_87 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_84 + c1_85 = TreeSitter.Node.nodeStartPoint node_83 + TreeSitter.Node.TSPoint + r2_86 + c2_87 = TreeSitter.Node.nodeEndPoint node_83 + +deriving instance GHC.Classes.Eq a_88 => GHC.Classes.Eq (AsExprs a_88) + +deriving instance GHC.Classes.Ord a_89 => GHC.Classes.Ord (AsExprs a_89) + +deriving instance GHC.Show.Show a_90 => GHC.Show.Show (AsExprs a_90) + +instance AST.Unmarshal.Unmarshal AsExprs + +instance Data.Foldable.Foldable AsExprs where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AsExprs where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AsExprs where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Body a = Body + { ann :: a, + extraChildren :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_91. + AST.Traversable1.Class.Traversable1 a_91 + ) + +instance AST.Unmarshal.SymbolMatching Body where + matchedSymbols _ = [101] + showFailure _ node_92 = + "expected " + GHC.Base.<> ( "body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_92 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_92) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_93 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_94 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_95 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_96 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_93 + c1_94 = TreeSitter.Node.nodeStartPoint node_92 + TreeSitter.Node.TSPoint + r2_95 + c2_96 = TreeSitter.Node.nodeEndPoint node_92 + +deriving instance GHC.Classes.Eq a_97 => GHC.Classes.Eq (Body a_97) + +deriving instance GHC.Classes.Ord a_98 => GHC.Classes.Ord (Body a_98) + +deriving instance GHC.Show.Show a_99 => GHC.Show.Show (Body a_99) + +instance AST.Unmarshal.Unmarshal Body + +instance Data.Foldable.Foldable Body where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Body where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Body where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Bool a = Bool + { ann :: a, + extraChildren :: (AST.Parse.Err ((False GHC.Generics.:+: True) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_100. + AST.Traversable1.Class.Traversable1 a_100 + ) + +instance AST.Unmarshal.SymbolMatching Bool where + matchedSymbols _ = [132] + showFailure _ node_101 = + "expected " + GHC.Base.<> ( "bool" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_101 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_101) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_102 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_103 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_104 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_105 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_102 + c1_103 = TreeSitter.Node.nodeStartPoint node_101 + TreeSitter.Node.TSPoint + r2_104 + c2_105 = TreeSitter.Node.nodeEndPoint node_101 + +deriving instance GHC.Classes.Eq a_106 => GHC.Classes.Eq (Bool a_106) + +deriving instance GHC.Classes.Ord a_107 => GHC.Classes.Ord (Bool a_107) + +deriving instance GHC.Show.Show a_108 => GHC.Show.Show (Bool a_108) + +instance AST.Unmarshal.Unmarshal Bool + +instance Data.Foldable.Foldable Bool where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Bool where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Bool where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Charpred a = Charpred + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClassName GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_109. + AST.Traversable1.Class.Traversable1 a_109 + ) + +instance AST.Unmarshal.SymbolMatching Charpred where + matchedSymbols _ = [96] + showFailure _ node_110 = + "expected " + GHC.Base.<> ( "charpred" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_110 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_110) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_111 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_112 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_113 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_114 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_111 + c1_112 = TreeSitter.Node.nodeStartPoint node_110 + TreeSitter.Node.TSPoint + r2_113 + c2_114 = TreeSitter.Node.nodeEndPoint node_110 + +deriving instance GHC.Classes.Eq a_115 => GHC.Classes.Eq (Charpred a_115) + +deriving instance GHC.Classes.Ord a_116 => GHC.Classes.Ord (Charpred a_116) + +deriving instance GHC.Show.Show a_117 => GHC.Show.Show (Charpred a_117) + +instance AST.Unmarshal.Unmarshal Charpred + +instance Data.Foldable.Foldable Charpred where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Charpred where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Charpred where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassMember a = ClassMember + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Annotation GHC.Generics.:+: Charpred GHC.Generics.:+: Field GHC.Generics.:+: MemberPredicate GHC.Generics.:+: Qldoc) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_118. + AST.Traversable1.Class.Traversable1 a_118 + ) + +instance AST.Unmarshal.SymbolMatching ClassMember where + matchedSymbols _ = [95] + showFailure _ node_119 = + "expected " + GHC.Base.<> ( "classMember" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_119 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_119) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_120 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_121 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_122 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_123 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_120 + c1_121 = TreeSitter.Node.nodeStartPoint node_119 + TreeSitter.Node.TSPoint + r2_122 + c2_123 = TreeSitter.Node.nodeEndPoint node_119 + +deriving instance GHC.Classes.Eq a_124 => GHC.Classes.Eq (ClassMember a_124) + +deriving instance GHC.Classes.Ord a_125 => GHC.Classes.Ord (ClassMember a_125) + +deriving instance GHC.Show.Show a_126 => GHC.Show.Show (ClassMember a_126) + +instance AST.Unmarshal.Unmarshal ClassMember + +instance Data.Foldable.Foldable ClassMember where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassMember where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassMember where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassName a = ClassName {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_127. + AST.Traversable1.Class.Traversable1 a_127 + ) + +instance AST.Unmarshal.SymbolMatching ClassName where + matchedSymbols _ = [155] + showFailure _ node_128 = + "expected " + GHC.Base.<> ( "className" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_128 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_128) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_129 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_130 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_131 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_132 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_129 + c1_130 = TreeSitter.Node.nodeStartPoint node_128 + TreeSitter.Node.TSPoint + r2_131 + c2_132 = TreeSitter.Node.nodeEndPoint node_128 + +deriving instance GHC.Classes.Eq a_133 => GHC.Classes.Eq (ClassName a_133) + +deriving instance GHC.Classes.Ord a_134 => GHC.Classes.Ord (ClassName a_134) + +deriving instance GHC.Show.Show a_135 => GHC.Show.Show (ClassName a_135) + +instance AST.Unmarshal.Unmarshal ClassName + +instance Data.Foldable.Foldable ClassName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClasslessPredicate a = ClasslessPredicate + { ann :: a, + name :: (AST.Parse.Err (PredicateName a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Body GHC.Generics.:+: Empty GHC.Generics.:+: HigherOrderTerm GHC.Generics.:+: PredicateAliasBody GHC.Generics.:+: ReturnType GHC.Generics.:+: VarDecl) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_136. + AST.Traversable1.Class.Traversable1 a_136 + ) + +instance AST.Unmarshal.SymbolMatching ClasslessPredicate where + matchedSymbols _ = [89] + showFailure _ node_137 = + "expected " + GHC.Base.<> ( "classlessPredicate" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_137 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_137) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_138 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_139 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_140 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_141 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_138 + c1_139 = TreeSitter.Node.nodeStartPoint node_137 + TreeSitter.Node.TSPoint + r2_140 + c2_141 = TreeSitter.Node.nodeEndPoint node_137 + +deriving instance GHC.Classes.Eq a_142 => GHC.Classes.Eq (ClasslessPredicate a_142) + +deriving instance GHC.Classes.Ord a_143 => GHC.Classes.Ord (ClasslessPredicate a_143) + +deriving instance GHC.Show.Show a_144 => GHC.Show.Show (ClasslessPredicate a_144) + +instance AST.Unmarshal.Unmarshal ClasslessPredicate + +instance Data.Foldable.Foldable ClasslessPredicate where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClasslessPredicate where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClasslessPredicate where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClasslessPredicateCall a = ClasslessPredicateCall + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: AritylessPredicateExpr GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: Closure GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Underscore GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_145. + AST.Traversable1.Class.Traversable1 a_145 + ) + +instance AST.Unmarshal.SymbolMatching ClasslessPredicateCall where + matchedSymbols _ = [121] + showFailure _ node_146 = + "expected " + GHC.Base.<> ( "classless_predicate_call" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_146 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_146) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_147 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_148 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_149 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_150 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_147 + c1_148 = TreeSitter.Node.nodeStartPoint node_146 + TreeSitter.Node.TSPoint + r2_149 + c2_150 = TreeSitter.Node.nodeEndPoint node_146 + +deriving instance GHC.Classes.Eq a_151 => GHC.Classes.Eq (ClasslessPredicateCall a_151) + +deriving instance GHC.Classes.Ord a_152 => GHC.Classes.Ord (ClasslessPredicateCall a_152) + +deriving instance GHC.Show.Show a_153 => GHC.Show.Show (ClasslessPredicateCall a_153) + +instance AST.Unmarshal.Unmarshal ClasslessPredicateCall + +instance Data.Foldable.Foldable ClasslessPredicateCall where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClasslessPredicateCall where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClasslessPredicateCall where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Closure a = Closure + { ann :: a, + extraChildren :: (AST.Parse.Err ((Plus GHC.Generics.:+: Star) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_154. + AST.Traversable1.Class.Traversable1 a_154 + ) + +instance AST.Unmarshal.SymbolMatching Closure where + matchedSymbols _ = [138] + showFailure _ node_155 = + "expected " + GHC.Base.<> ( "closure" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_155 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_155) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_156 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_157 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_158 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_159 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_156 + c1_157 = TreeSitter.Node.nodeStartPoint node_155 + TreeSitter.Node.TSPoint + r2_158 + c2_159 = TreeSitter.Node.nodeEndPoint node_155 + +deriving instance GHC.Classes.Eq a_160 => GHC.Classes.Eq (Closure a_160) + +deriving instance GHC.Classes.Ord a_161 => GHC.Classes.Ord (Closure a_161) + +deriving instance GHC.Show.Show a_162 => GHC.Show.Show (Closure a_162) + +instance AST.Unmarshal.Unmarshal Closure + +instance Data.Foldable.Foldable Closure where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Closure where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Closure where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CompTerm a = CompTerm + { ann :: a, + left :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + right :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + extraChildren :: (AST.Parse.Err (Compop a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_163. + AST.Traversable1.Class.Traversable1 a_163 + ) + +instance AST.Unmarshal.SymbolMatching CompTerm where + matchedSymbols _ = [109] + showFailure _ node_164 = + "expected " + GHC.Base.<> ( "comp_term" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_164 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_164) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_165 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_166 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_167 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_168 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_165 + c1_166 = TreeSitter.Node.nodeStartPoint node_164 + TreeSitter.Node.TSPoint + r2_167 + c2_168 = TreeSitter.Node.nodeEndPoint node_164 + +deriving instance GHC.Classes.Eq a_169 => GHC.Classes.Eq (CompTerm a_169) + +deriving instance GHC.Classes.Ord a_170 => GHC.Classes.Ord (CompTerm a_170) + +deriving instance GHC.Show.Show a_171 => GHC.Show.Show (CompTerm a_171) + +instance AST.Unmarshal.Unmarshal CompTerm + +instance Data.Foldable.Foldable CompTerm where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CompTerm where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CompTerm where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Compop a = Compop + { ann :: a, + extraChildren :: (AST.Parse.Err ((Eq GHC.Generics.:+: Ge GHC.Generics.:+: Gt GHC.Generics.:+: Le GHC.Generics.:+: Lt GHC.Generics.:+: Ne) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_172. + AST.Traversable1.Class.Traversable1 a_172 + ) + +instance AST.Unmarshal.SymbolMatching Compop where + matchedSymbols _ = [134] + showFailure _ node_173 = + "expected " + GHC.Base.<> ( "compop" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_173 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_173) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_174 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_175 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_176 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_177 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_174 + c1_175 = TreeSitter.Node.nodeStartPoint node_173 + TreeSitter.Node.TSPoint + r2_176 + c2_177 = TreeSitter.Node.nodeEndPoint node_173 + +deriving instance GHC.Classes.Eq a_178 => GHC.Classes.Eq (Compop a_178) + +deriving instance GHC.Classes.Ord a_179 => GHC.Classes.Ord (Compop a_179) + +deriving instance GHC.Show.Show a_180 => GHC.Show.Show (Compop a_180) + +instance AST.Unmarshal.Unmarshal Compop + +instance Data.Foldable.Foldable Compop where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Compop where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Compop where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Conjunction a = Conjunction + { ann :: a, + left :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + right :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_181. + AST.Traversable1.Class.Traversable1 a_181 + ) + +instance AST.Unmarshal.SymbolMatching Conjunction where + matchedSymbols _ = [113] + showFailure _ node_182 = + "expected " + GHC.Base.<> ( "conjunction" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_182 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_182) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_183 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_184 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_185 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_186 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_183 + c1_184 = TreeSitter.Node.nodeStartPoint node_182 + TreeSitter.Node.TSPoint + r2_185 + c2_186 = TreeSitter.Node.nodeEndPoint node_182 + +deriving instance GHC.Classes.Eq a_187 => GHC.Classes.Eq (Conjunction a_187) + +deriving instance GHC.Classes.Ord a_188 => GHC.Classes.Ord (Conjunction a_188) + +deriving instance GHC.Show.Show a_189 => GHC.Show.Show (Conjunction a_189) + +instance AST.Unmarshal.Unmarshal Conjunction + +instance Data.Foldable.Foldable Conjunction where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Conjunction where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Conjunction where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Dataclass a = Dataclass + { ann :: a, + name :: (AST.Parse.Err (ClassName a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Class GHC.Generics.:+: ClassMember GHC.Generics.:+: Extends GHC.Generics.:+: TypeAliasBody GHC.Generics.:+: TypeExpr) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_190. + AST.Traversable1.Class.Traversable1 a_190 + ) + +instance AST.Unmarshal.SymbolMatching Dataclass where + matchedSymbols _ = [94] + showFailure _ node_191 = + "expected " + GHC.Base.<> ( "dataclass" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_191 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_191) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_192 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_193 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_194 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_195 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_192 + c1_193 = TreeSitter.Node.nodeStartPoint node_191 + TreeSitter.Node.TSPoint + r2_194 + c2_195 = TreeSitter.Node.nodeEndPoint node_191 + +deriving instance GHC.Classes.Eq a_196 => GHC.Classes.Eq (Dataclass a_196) + +deriving instance GHC.Classes.Ord a_197 => GHC.Classes.Ord (Dataclass a_197) + +deriving instance GHC.Show.Show a_198 => GHC.Show.Show (Dataclass a_198) + +instance AST.Unmarshal.Unmarshal Dataclass + +instance Data.Foldable.Foldable Dataclass where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Dataclass where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Dataclass where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Datatype a = Datatype + { ann :: a, + name :: (AST.Parse.Err (ClassName a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((DatatypeBranches GHC.Generics.:+: Eq GHC.Generics.:+: Newtype) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_199. + AST.Traversable1.Class.Traversable1 a_199 + ) + +instance AST.Unmarshal.SymbolMatching Datatype where + matchedSymbols _ = [90] + showFailure _ node_200 = + "expected " + GHC.Base.<> ( "datatype" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_200 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_200) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_201 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_202 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_203 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_204 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_201 + c1_202 = TreeSitter.Node.nodeStartPoint node_200 + TreeSitter.Node.TSPoint + r2_203 + c2_204 = TreeSitter.Node.nodeEndPoint node_200 + +deriving instance GHC.Classes.Eq a_205 => GHC.Classes.Eq (Datatype a_205) + +deriving instance GHC.Classes.Ord a_206 => GHC.Classes.Ord (Datatype a_206) + +deriving instance GHC.Show.Show a_207 => GHC.Show.Show (Datatype a_207) + +instance AST.Unmarshal.Unmarshal Datatype + +instance Data.Foldable.Foldable Datatype where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Datatype where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Datatype where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DatatypeBranch a = DatatypeBranch + { ann :: a, + name :: (AST.Parse.Err (ClassName a)), + extraChildren :: ([AST.Parse.Err ((Annotation GHC.Generics.:+: Body GHC.Generics.:+: Qldoc GHC.Generics.:+: VarDecl) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_208. + AST.Traversable1.Class.Traversable1 a_208 + ) + +instance AST.Unmarshal.SymbolMatching DatatypeBranch where + matchedSymbols _ = [92] + showFailure _ node_209 = + "expected " + GHC.Base.<> ( "datatypeBranch" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_209 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_209) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_210 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_211 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_212 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_213 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_210 + c1_211 = TreeSitter.Node.nodeStartPoint node_209 + TreeSitter.Node.TSPoint + r2_212 + c2_213 = TreeSitter.Node.nodeEndPoint node_209 + +deriving instance GHC.Classes.Eq a_214 => GHC.Classes.Eq (DatatypeBranch a_214) + +deriving instance GHC.Classes.Ord a_215 => GHC.Classes.Ord (DatatypeBranch a_215) + +deriving instance GHC.Show.Show a_216 => GHC.Show.Show (DatatypeBranch a_216) + +instance AST.Unmarshal.Unmarshal DatatypeBranch + +instance Data.Foldable.Foldable DatatypeBranch where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DatatypeBranch where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DatatypeBranch where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DatatypeBranches a = DatatypeBranches + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (DatatypeBranch a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_217. + AST.Traversable1.Class.Traversable1 a_217 + ) + +instance AST.Unmarshal.SymbolMatching DatatypeBranches where + matchedSymbols _ = [91] + showFailure _ node_218 = + "expected " + GHC.Base.<> ( "datatypeBranches" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_218 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_218) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_219 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_220 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_221 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_222 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_219 + c1_220 = TreeSitter.Node.nodeStartPoint node_218 + TreeSitter.Node.TSPoint + r2_221 + c2_222 = TreeSitter.Node.nodeEndPoint node_218 + +deriving instance GHC.Classes.Eq a_223 => GHC.Classes.Eq (DatatypeBranches a_223) + +deriving instance GHC.Classes.Ord a_224 => GHC.Classes.Ord (DatatypeBranches a_224) + +deriving instance GHC.Show.Show a_225 => GHC.Show.Show (DatatypeBranches a_225) + +instance AST.Unmarshal.Unmarshal DatatypeBranches + +instance Data.Foldable.Foldable DatatypeBranches where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DatatypeBranches where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DatatypeBranches where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Dbtype a = Dbtype {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_226. + AST.Traversable1.Class.Traversable1 a_226 + ) + +instance AST.Unmarshal.SymbolMatching Dbtype where + matchedSymbols _ = [156] + showFailure _ node_227 = + "expected " + GHC.Base.<> ( "dbtype" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_227 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_227) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_228 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_229 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_230 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_231 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_228 + c1_229 = TreeSitter.Node.nodeStartPoint node_227 + TreeSitter.Node.TSPoint + r2_230 + c2_231 = TreeSitter.Node.nodeEndPoint node_227 + +deriving instance GHC.Classes.Eq a_232 => GHC.Classes.Eq (Dbtype a_232) + +deriving instance GHC.Classes.Ord a_233 => GHC.Classes.Ord (Dbtype a_233) + +deriving instance GHC.Show.Show a_234 => GHC.Show.Show (Dbtype a_234) + +instance AST.Unmarshal.Unmarshal Dbtype + +instance Data.Foldable.Foldable Dbtype where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Dbtype where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Dbtype where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Direction a = Direction + { ann :: a, + extraChildren :: (AST.Parse.Err ((Asc GHC.Generics.:+: Desc) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_235. + AST.Traversable1.Class.Traversable1 a_235 + ) + +instance AST.Unmarshal.SymbolMatching Direction where + matchedSymbols _ = [139] + showFailure _ node_236 = + "expected " + GHC.Base.<> ( "direction" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_236 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_236) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_237 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_238 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_239 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_240 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_237 + c1_238 = TreeSitter.Node.nodeStartPoint node_236 + TreeSitter.Node.TSPoint + r2_239 + c2_240 = TreeSitter.Node.nodeEndPoint node_236 + +deriving instance GHC.Classes.Eq a_241 => GHC.Classes.Eq (Direction a_241) + +deriving instance GHC.Classes.Ord a_242 => GHC.Classes.Ord (Direction a_242) + +deriving instance GHC.Show.Show a_243 => GHC.Show.Show (Direction a_243) + +instance AST.Unmarshal.Unmarshal Direction + +instance Data.Foldable.Foldable Direction where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Direction where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Direction where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Disjunction a = Disjunction + { ann :: a, + left :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + right :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_244. + AST.Traversable1.Class.Traversable1 a_244 + ) + +instance AST.Unmarshal.SymbolMatching Disjunction where + matchedSymbols _ = [114] + showFailure _ node_245 = + "expected " + GHC.Base.<> ( "disjunction" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_245 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_245) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_246 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_247 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_248 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_249 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_246 + c1_247 = TreeSitter.Node.nodeStartPoint node_245 + TreeSitter.Node.TSPoint + r2_248 + c2_249 = TreeSitter.Node.nodeEndPoint node_245 + +deriving instance GHC.Classes.Eq a_250 => GHC.Classes.Eq (Disjunction a_250) + +deriving instance GHC.Classes.Ord a_251 => GHC.Classes.Ord (Disjunction a_251) + +deriving instance GHC.Show.Show a_252 => GHC.Show.Show (Disjunction a_252) + +instance AST.Unmarshal.Unmarshal Disjunction + +instance Data.Foldable.Foldable Disjunction where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Disjunction where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Disjunction where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Empty a = Empty {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_253. + AST.Traversable1.Class.Traversable1 a_253 + ) + +instance AST.Unmarshal.SymbolMatching Empty where + matchedSymbols _ = [100] + showFailure _ node_254 = + "expected " + GHC.Base.<> ( "empty" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_254 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_254) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_255 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_256 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_257 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_258 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_255 + c1_256 = TreeSitter.Node.nodeStartPoint node_254 + TreeSitter.Node.TSPoint + r2_257 + c2_258 = TreeSitter.Node.nodeEndPoint node_254 + +deriving instance GHC.Classes.Eq a_259 => GHC.Classes.Eq (Empty a_259) + +deriving instance GHC.Classes.Ord a_260 => GHC.Classes.Ord (Empty a_260) + +deriving instance GHC.Show.Show a_261 => GHC.Show.Show (Empty a_261) + +instance AST.Unmarshal.Unmarshal Empty + +instance Data.Foldable.Foldable Empty where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Empty where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Empty where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExprAggregateBody a = ExprAggregateBody + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AsExprs GHC.Generics.:+: OrderBys) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_262. + AST.Traversable1.Class.Traversable1 a_262 + ) + +instance AST.Unmarshal.SymbolMatching ExprAggregateBody where + matchedSymbols _ = [125] + showFailure _ node_263 = + "expected " + GHC.Base.<> ( "expr_aggregate_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_263 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_263) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_264 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_265 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_266 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_267 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_264 + c1_265 = TreeSitter.Node.nodeStartPoint node_263 + TreeSitter.Node.TSPoint + r2_266 + c2_267 = TreeSitter.Node.nodeEndPoint node_263 + +deriving instance GHC.Classes.Eq a_268 => GHC.Classes.Eq (ExprAggregateBody a_268) + +deriving instance GHC.Classes.Ord a_269 => GHC.Classes.Ord (ExprAggregateBody a_269) + +deriving instance GHC.Show.Show a_270 => GHC.Show.Show (ExprAggregateBody a_270) + +instance AST.Unmarshal.Unmarshal ExprAggregateBody + +instance Data.Foldable.Foldable ExprAggregateBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExprAggregateBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExprAggregateBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Field a = Field {ann :: a, extraChildren :: (AST.Parse.Err (VarDecl a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_271. + AST.Traversable1.Class.Traversable1 a_271 + ) + +instance AST.Unmarshal.SymbolMatching Field where + matchedSymbols _ = [98] + showFailure _ node_272 = + "expected " + GHC.Base.<> ( "field" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_272 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_272) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_273 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_274 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_275 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_276 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_273 + c1_274 = TreeSitter.Node.nodeStartPoint node_272 + TreeSitter.Node.TSPoint + r2_275 + c2_276 = TreeSitter.Node.nodeEndPoint node_272 + +deriving instance GHC.Classes.Eq a_277 => GHC.Classes.Eq (Field a_277) + +deriving instance GHC.Classes.Ord a_278 => GHC.Classes.Ord (Field a_278) + +deriving instance GHC.Show.Show a_279 => GHC.Show.Show (Field a_279) + +instance AST.Unmarshal.Unmarshal Field + +instance Data.Foldable.Foldable Field where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Field where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Field where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FullAggregateBody a = FullAggregateBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: AsExprs GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: OrderBys GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: VarDecl GHC.Generics.:+: Variable) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_280. + AST.Traversable1.Class.Traversable1 a_280 + ) + +instance AST.Unmarshal.SymbolMatching FullAggregateBody where + matchedSymbols _ = [124] + showFailure _ node_281 = + "expected " + GHC.Base.<> ( "full_aggregate_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_281 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_281) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_282 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_283 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_284 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_285 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_282 + c1_283 = TreeSitter.Node.nodeStartPoint node_281 + TreeSitter.Node.TSPoint + r2_284 + c2_285 = TreeSitter.Node.nodeEndPoint node_281 + +deriving instance GHC.Classes.Eq a_286 => GHC.Classes.Eq (FullAggregateBody a_286) + +deriving instance GHC.Classes.Ord a_287 => GHC.Classes.Ord (FullAggregateBody a_287) + +deriving instance GHC.Show.Show a_288 => GHC.Show.Show (FullAggregateBody a_288) + +instance AST.Unmarshal.Unmarshal FullAggregateBody + +instance Data.Foldable.Foldable FullAggregateBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FullAggregateBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FullAggregateBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data HigherOrderTerm a = HigherOrderTerm + { ann :: a, + name :: (AST.Parse.Err (LiteralId a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: Eq GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PredicateExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Underscore GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_289. + AST.Traversable1.Class.Traversable1 a_289 + ) + +instance AST.Unmarshal.SymbolMatching HigherOrderTerm where + matchedSymbols _ = [102] + showFailure _ node_290 = + "expected " + GHC.Base.<> ( "higherOrderTerm" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_290 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_290) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_291 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_292 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_293 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_294 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_291 + c1_292 = TreeSitter.Node.nodeStartPoint node_290 + TreeSitter.Node.TSPoint + r2_293 + c2_294 = TreeSitter.Node.nodeEndPoint node_290 + +deriving instance GHC.Classes.Eq a_295 => GHC.Classes.Eq (HigherOrderTerm a_295) + +deriving instance GHC.Classes.Ord a_296 => GHC.Classes.Ord (HigherOrderTerm a_296) + +deriving instance GHC.Show.Show a_297 => GHC.Show.Show (HigherOrderTerm a_297) + +instance AST.Unmarshal.Unmarshal HigherOrderTerm + +instance Data.Foldable.Foldable HigherOrderTerm where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor HigherOrderTerm where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable HigherOrderTerm where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IfTerm a = IfTerm + { ann :: a, + first :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + second :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + cond :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_298. + AST.Traversable1.Class.Traversable1 a_298 + ) + +instance AST.Unmarshal.SymbolMatching IfTerm where + matchedSymbols _ = [112] + showFailure _ node_299 = + "expected " + GHC.Base.<> ( "if_term" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_299 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_299) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_300 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_301 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_302 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_303 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_300 + c1_301 = TreeSitter.Node.nodeStartPoint node_299 + TreeSitter.Node.TSPoint + r2_302 + c2_303 = TreeSitter.Node.nodeEndPoint node_299 + +deriving instance GHC.Classes.Eq a_304 => GHC.Classes.Eq (IfTerm a_304) + +deriving instance GHC.Classes.Ord a_305 => GHC.Classes.Ord (IfTerm a_305) + +deriving instance GHC.Show.Show a_306 => GHC.Show.Show (IfTerm a_306) + +instance AST.Unmarshal.Unmarshal IfTerm + +instance Data.Foldable.Foldable IfTerm where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IfTerm where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IfTerm where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Implication a = Implication + { ann :: a, + left :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + right :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_307. + AST.Traversable1.Class.Traversable1 a_307 + ) + +instance AST.Unmarshal.SymbolMatching Implication where + matchedSymbols _ = [115] + showFailure _ node_308 = + "expected " + GHC.Base.<> ( "implication" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_308 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_308) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_309 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_310 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_311 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_312 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_309 + c1_310 = TreeSitter.Node.nodeStartPoint node_308 + TreeSitter.Node.TSPoint + r2_311 + c2_312 = TreeSitter.Node.nodeEndPoint node_308 + +deriving instance GHC.Classes.Eq a_313 => GHC.Classes.Eq (Implication a_313) + +deriving instance GHC.Classes.Ord a_314 => GHC.Classes.Ord (Implication a_314) + +deriving instance GHC.Show.Show a_315 => GHC.Show.Show (Implication a_315) + +instance AST.Unmarshal.Unmarshal Implication + +instance Data.Foldable.Foldable Implication where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Implication where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Implication where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportModuleExpr a = ImportModuleExpr + { ann :: a, + name :: ([AST.Parse.Err (SimpleId a)]), + extraChildren :: (AST.Parse.Err (QualModuleExpr a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_316. + AST.Traversable1.Class.Traversable1 a_316 + ) + +instance AST.Unmarshal.SymbolMatching ImportModuleExpr where + matchedSymbols _ = [151] + showFailure _ node_317 = + "expected " + GHC.Base.<> ( "importModuleExpr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_317 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_317) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_318 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_319 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_320 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_321 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_318 + c1_319 = TreeSitter.Node.nodeStartPoint node_317 + TreeSitter.Node.TSPoint + r2_320 + c2_321 = TreeSitter.Node.nodeEndPoint node_317 + +deriving instance GHC.Classes.Eq a_322 => GHC.Classes.Eq (ImportModuleExpr a_322) + +deriving instance GHC.Classes.Ord a_323 => GHC.Classes.Ord (ImportModuleExpr a_323) + +deriving instance GHC.Show.Show a_324 => GHC.Show.Show (ImportModuleExpr a_324) + +instance AST.Unmarshal.Unmarshal ImportModuleExpr + +instance Data.Foldable.Foldable ImportModuleExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportModuleExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportModuleExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Imprt a = Imprt + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((As GHC.Generics.:+: Import GHC.Generics.:+: ImportModuleExpr GHC.Generics.:+: ModuleName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_325. + AST.Traversable1.Class.Traversable1 a_325 + ) + +instance AST.Unmarshal.SymbolMatching Imprt where + matchedSymbols _ = [85] + showFailure _ node_326 = + "expected " + GHC.Base.<> ( "imprt" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_326 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_326) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_327 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_328 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_329 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_330 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_327 + c1_328 = TreeSitter.Node.nodeStartPoint node_326 + TreeSitter.Node.TSPoint + r2_329 + c2_330 = TreeSitter.Node.nodeEndPoint node_326 + +deriving instance GHC.Classes.Eq a_331 => GHC.Classes.Eq (Imprt a_331) + +deriving instance GHC.Classes.Ord a_332 => GHC.Classes.Ord (Imprt a_332) + +deriving instance GHC.Show.Show a_333 => GHC.Show.Show (Imprt a_333) + +instance AST.Unmarshal.Unmarshal Imprt + +instance Data.Foldable.Foldable Imprt where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Imprt where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Imprt where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InExpr a = InExpr + { ann :: a, + left :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + right :: (AST.Parse.Err (Range a)), + extraChildren :: (AST.Parse.Err (In a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_334. + AST.Traversable1.Class.Traversable1 a_334 + ) + +instance AST.Unmarshal.SymbolMatching InExpr where + matchedSymbols _ = [108] + showFailure _ node_335 = + "expected " + GHC.Base.<> ( "in_expr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_335 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_335) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_336 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_337 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_338 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_339 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_336 + c1_337 = TreeSitter.Node.nodeStartPoint node_335 + TreeSitter.Node.TSPoint + r2_338 + c2_339 = TreeSitter.Node.nodeEndPoint node_335 + +deriving instance GHC.Classes.Eq a_340 => GHC.Classes.Eq (InExpr a_340) + +deriving instance GHC.Classes.Ord a_341 => GHC.Classes.Ord (InExpr a_341) + +deriving instance GHC.Show.Show a_342 => GHC.Show.Show (InExpr a_342) + +instance AST.Unmarshal.Unmarshal InExpr + +instance Data.Foldable.Foldable InExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InstanceOf a = InstanceOf + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Instanceof GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: TypeExpr GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_343. + AST.Traversable1.Class.Traversable1 a_343 + ) + +instance AST.Unmarshal.SymbolMatching InstanceOf where + matchedSymbols _ = [110] + showFailure _ node_344 = + "expected " + GHC.Base.<> ( "instance_of" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_344 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_344) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_345 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_346 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_347 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_348 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_345 + c1_346 = TreeSitter.Node.nodeStartPoint node_344 + TreeSitter.Node.TSPoint + r2_347 + c2_348 = TreeSitter.Node.nodeEndPoint node_344 + +deriving instance GHC.Classes.Eq a_349 => GHC.Classes.Eq (InstanceOf a_349) + +deriving instance GHC.Classes.Ord a_350 => GHC.Classes.Ord (InstanceOf a_350) + +deriving instance GHC.Show.Show a_351 => GHC.Show.Show (InstanceOf a_351) + +instance AST.Unmarshal.Unmarshal InstanceOf + +instance Data.Foldable.Foldable InstanceOf where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InstanceOf where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InstanceOf where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Literal a = Literal + { ann :: a, + extraChildren :: (AST.Parse.Err ((Bool GHC.Generics.:+: Float GHC.Generics.:+: Integer GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_352. + AST.Traversable1.Class.Traversable1 a_352 + ) + +instance AST.Unmarshal.SymbolMatching Literal where + matchedSymbols _ = [131] + showFailure _ node_353 = + "expected " + GHC.Base.<> ( "literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_353 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_353) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_354 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_355 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_356 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_357 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_354 + c1_355 = TreeSitter.Node.nodeStartPoint node_353 + TreeSitter.Node.TSPoint + r2_356 + c2_357 = TreeSitter.Node.nodeEndPoint node_353 + +deriving instance GHC.Classes.Eq a_358 => GHC.Classes.Eq (Literal a_358) + +deriving instance GHC.Classes.Ord a_359 => GHC.Classes.Ord (Literal a_359) + +deriving instance GHC.Show.Show a_360 => GHC.Show.Show (Literal a_360) + +instance AST.Unmarshal.Unmarshal Literal + +instance Data.Foldable.Foldable Literal where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Literal where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Literal where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LiteralId a = LiteralId {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_361. + AST.Traversable1.Class.Traversable1 a_361 + ) + +instance AST.Unmarshal.SymbolMatching LiteralId where + matchedSymbols _ = [145] + showFailure _ node_362 = + "expected " + GHC.Base.<> ( "literalId" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_362 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_362) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_363 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_364 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_365 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_366 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_363 + c1_364 = TreeSitter.Node.nodeStartPoint node_362 + TreeSitter.Node.TSPoint + r2_365 + c2_366 = TreeSitter.Node.nodeEndPoint node_362 + +deriving instance GHC.Classes.Eq a_367 => GHC.Classes.Eq (LiteralId a_367) + +deriving instance GHC.Classes.Ord a_368 => GHC.Classes.Ord (LiteralId a_368) + +deriving instance GHC.Show.Show a_369 => GHC.Show.Show (LiteralId a_369) + +instance AST.Unmarshal.Unmarshal LiteralId + +instance Data.Foldable.Foldable LiteralId where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LiteralId where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LiteralId where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MemberPredicate a = MemberPredicate + { ann :: a, + name :: (AST.Parse.Err (PredicateName a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Body GHC.Generics.:+: Empty GHC.Generics.:+: HigherOrderTerm GHC.Generics.:+: ReturnType GHC.Generics.:+: VarDecl) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_370. + AST.Traversable1.Class.Traversable1 a_370 + ) + +instance AST.Unmarshal.SymbolMatching MemberPredicate where + matchedSymbols _ = [97] + showFailure _ node_371 = + "expected " + GHC.Base.<> ( "memberPredicate" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_371 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_371) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_372 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_373 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_374 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_375 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_372 + c1_373 = TreeSitter.Node.nodeStartPoint node_371 + TreeSitter.Node.TSPoint + r2_374 + c2_375 = TreeSitter.Node.nodeEndPoint node_371 + +deriving instance GHC.Classes.Eq a_376 => GHC.Classes.Eq (MemberPredicate a_376) + +deriving instance GHC.Classes.Ord a_377 => GHC.Classes.Ord (MemberPredicate a_377) + +deriving instance GHC.Show.Show a_378 => GHC.Show.Show (MemberPredicate a_378) + +instance AST.Unmarshal.Unmarshal MemberPredicate + +instance Data.Foldable.Foldable MemberPredicate where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MemberPredicate where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MemberPredicate where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Module a = Module + { ann :: a, + name :: (AST.Parse.Err (ModuleName a)), + extraChildren :: ([AST.Parse.Err ((ModuleAliasBody GHC.Generics.:+: ModuleMember) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_379. + AST.Traversable1.Class.Traversable1 a_379 + ) + +instance AST.Unmarshal.SymbolMatching Module where + matchedSymbols _ = [83] + showFailure _ node_380 = + "expected " + GHC.Base.<> ( "module" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_380 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_380) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_381 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_382 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_383 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_384 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_381 + c1_382 = TreeSitter.Node.nodeStartPoint node_380 + TreeSitter.Node.TSPoint + r2_383 + c2_384 = TreeSitter.Node.nodeEndPoint node_380 + +deriving instance GHC.Classes.Eq a_385 => GHC.Classes.Eq (Module a_385) + +deriving instance GHC.Classes.Ord a_386 => GHC.Classes.Ord (Module a_386) + +deriving instance GHC.Show.Show a_387 => GHC.Show.Show (Module a_387) + +instance AST.Unmarshal.Unmarshal Module + +instance Data.Foldable.Foldable Module where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Module where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Module where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ModuleAliasBody a = ModuleAliasBody + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Eq GHC.Generics.:+: ModuleExpr) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_388. + AST.Traversable1.Class.Traversable1 a_388 + ) + +instance AST.Unmarshal.SymbolMatching ModuleAliasBody where + matchedSymbols _ = [86] + showFailure _ node_389 = + "expected " + GHC.Base.<> ( "moduleAliasBody" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_389 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_389) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_390 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_391 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_392 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_393 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_390 + c1_391 = TreeSitter.Node.nodeStartPoint node_389 + TreeSitter.Node.TSPoint + r2_392 + c2_393 = TreeSitter.Node.nodeEndPoint node_389 + +deriving instance GHC.Classes.Eq a_394 => GHC.Classes.Eq (ModuleAliasBody a_394) + +deriving instance GHC.Classes.Ord a_395 => GHC.Classes.Ord (ModuleAliasBody a_395) + +deriving instance GHC.Show.Show a_396 => GHC.Show.Show (ModuleAliasBody a_396) + +instance AST.Unmarshal.Unmarshal ModuleAliasBody + +instance Data.Foldable.Foldable ModuleAliasBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ModuleAliasBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ModuleAliasBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ModuleExpr a = ModuleExpr + { ann :: a, + name :: (GHC.Maybe.Maybe (AST.Parse.Err (SimpleId a))), + extraChildren :: (AST.Parse.Err ((ModuleExpr GHC.Generics.:+: SimpleId) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_397. + AST.Traversable1.Class.Traversable1 a_397 + ) + +instance AST.Unmarshal.SymbolMatching ModuleExpr where + matchedSymbols _ = [152] + showFailure _ node_398 = + "expected " + GHC.Base.<> ( "moduleExpr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_398 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_398) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_399 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_400 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_401 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_402 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_399 + c1_400 = TreeSitter.Node.nodeStartPoint node_398 + TreeSitter.Node.TSPoint + r2_401 + c2_402 = TreeSitter.Node.nodeEndPoint node_398 + +deriving instance GHC.Classes.Eq a_403 => GHC.Classes.Eq (ModuleExpr a_403) + +deriving instance GHC.Classes.Ord a_404 => GHC.Classes.Ord (ModuleExpr a_404) + +deriving instance GHC.Show.Show a_405 => GHC.Show.Show (ModuleExpr a_405) + +instance AST.Unmarshal.Unmarshal ModuleExpr + +instance Data.Foldable.Foldable ModuleExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ModuleExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ModuleExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ModuleMember a = ModuleMember + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Annotation GHC.Generics.:+: ClasslessPredicate GHC.Generics.:+: Dataclass GHC.Generics.:+: Datatype GHC.Generics.:+: Imprt GHC.Generics.:+: Module GHC.Generics.:+: Qldoc GHC.Generics.:+: Select) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_406. + AST.Traversable1.Class.Traversable1 a_406 + ) + +instance AST.Unmarshal.SymbolMatching ModuleMember where + matchedSymbols _ = [84] + showFailure _ node_407 = + "expected " + GHC.Base.<> ( "moduleMember" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_407 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_407) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_408 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_409 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_410 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_411 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_408 + c1_409 = TreeSitter.Node.nodeStartPoint node_407 + TreeSitter.Node.TSPoint + r2_410 + c2_411 = TreeSitter.Node.nodeEndPoint node_407 + +deriving instance GHC.Classes.Eq a_412 => GHC.Classes.Eq (ModuleMember a_412) + +deriving instance GHC.Classes.Ord a_413 => GHC.Classes.Ord (ModuleMember a_413) + +deriving instance GHC.Show.Show a_414 => GHC.Show.Show (ModuleMember a_414) + +instance AST.Unmarshal.Unmarshal ModuleMember + +instance Data.Foldable.Foldable ModuleMember where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ModuleMember where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ModuleMember where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ModuleName a = ModuleName + { ann :: a, + extraChildren :: (AST.Parse.Err (SimpleId a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_415. + AST.Traversable1.Class.Traversable1 a_415 + ) + +instance AST.Unmarshal.SymbolMatching ModuleName where + matchedSymbols _ = [149] + showFailure _ node_416 = + "expected " + GHC.Base.<> ( "moduleName" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_416 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_416) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_417 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_418 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_419 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_420 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_417 + c1_418 = TreeSitter.Node.nodeStartPoint node_416 + TreeSitter.Node.TSPoint + r2_419 + c2_420 = TreeSitter.Node.nodeEndPoint node_416 + +deriving instance GHC.Classes.Eq a_421 => GHC.Classes.Eq (ModuleName a_421) + +deriving instance GHC.Classes.Ord a_422 => GHC.Classes.Ord (ModuleName a_422) + +deriving instance GHC.Show.Show a_423 => GHC.Show.Show (ModuleName a_423) + +instance AST.Unmarshal.Unmarshal ModuleName + +instance Data.Foldable.Foldable ModuleName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ModuleName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ModuleName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MulExpr a = MulExpr + { ann :: a, + left :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + right :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + extraChildren :: (AST.Parse.Err (Mulop a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_424. + AST.Traversable1.Class.Traversable1 a_424 + ) + +instance AST.Unmarshal.SymbolMatching MulExpr where + matchedSymbols _ = [106] + showFailure _ node_425 = + "expected " + GHC.Base.<> ( "mul_expr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_425 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_425) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_426 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_427 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_428 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_429 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_426 + c1_427 = TreeSitter.Node.nodeStartPoint node_425 + TreeSitter.Node.TSPoint + r2_428 + c2_429 = TreeSitter.Node.nodeEndPoint node_425 + +deriving instance GHC.Classes.Eq a_430 => GHC.Classes.Eq (MulExpr a_430) + +deriving instance GHC.Classes.Ord a_431 => GHC.Classes.Ord (MulExpr a_431) + +deriving instance GHC.Show.Show a_432 => GHC.Show.Show (MulExpr a_432) + +instance AST.Unmarshal.Unmarshal MulExpr + +instance Data.Foldable.Foldable MulExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MulExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MulExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Mulop a = Mulop + { ann :: a, + extraChildren :: (AST.Parse.Err ((Mod GHC.Generics.:+: Slash GHC.Generics.:+: Star) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_433. + AST.Traversable1.Class.Traversable1 a_433 + ) + +instance AST.Unmarshal.SymbolMatching Mulop where + matchedSymbols _ = [136] + showFailure _ node_434 = + "expected " + GHC.Base.<> ( "mulop" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_434 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_434) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_435 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_436 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_437 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_438 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_435 + c1_436 = TreeSitter.Node.nodeStartPoint node_434 + TreeSitter.Node.TSPoint + r2_437 + c2_438 = TreeSitter.Node.nodeEndPoint node_434 + +deriving instance GHC.Classes.Eq a_439 => GHC.Classes.Eq (Mulop a_439) + +deriving instance GHC.Classes.Ord a_440 => GHC.Classes.Ord (Mulop a_440) + +deriving instance GHC.Show.Show a_441 => GHC.Show.Show (Mulop a_441) + +instance AST.Unmarshal.Unmarshal Mulop + +instance Data.Foldable.Foldable Mulop where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Mulop where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Mulop where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Negation a = Negation + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: Not GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_442. + AST.Traversable1.Class.Traversable1 a_442 + ) + +instance AST.Unmarshal.SymbolMatching Negation where + matchedSymbols _ = [111] + showFailure _ node_443 = + "expected " + GHC.Base.<> ( "negation" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_443 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_443) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_444 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_445 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_446 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_447 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_444 + c1_445 = TreeSitter.Node.nodeStartPoint node_443 + TreeSitter.Node.TSPoint + r2_446 + c2_447 = TreeSitter.Node.nodeEndPoint node_443 + +deriving instance GHC.Classes.Eq a_448 => GHC.Classes.Eq (Negation a_448) + +deriving instance GHC.Classes.Ord a_449 => GHC.Classes.Ord (Negation a_449) + +deriving instance GHC.Show.Show a_450 => GHC.Show.Show (Negation a_450) + +instance AST.Unmarshal.Unmarshal Negation + +instance Data.Foldable.Foldable Negation where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Negation where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Negation where + traverse = AST.Traversable1.Class.traverseDefault1 + +data OrderBy a = OrderBy + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Direction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_451. + AST.Traversable1.Class.Traversable1 a_451 + ) + +instance AST.Unmarshal.SymbolMatching OrderBy where + matchedSymbols _ = [144] + showFailure _ node_452 = + "expected " + GHC.Base.<> ( "orderBy" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_452 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_452) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_453 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_454 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_455 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_456 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_453 + c1_454 = TreeSitter.Node.nodeStartPoint node_452 + TreeSitter.Node.TSPoint + r2_455 + c2_456 = TreeSitter.Node.nodeEndPoint node_452 + +deriving instance GHC.Classes.Eq a_457 => GHC.Classes.Eq (OrderBy a_457) + +deriving instance GHC.Classes.Ord a_458 => GHC.Classes.Ord (OrderBy a_458) + +deriving instance GHC.Show.Show a_459 => GHC.Show.Show (OrderBy a_459) + +instance AST.Unmarshal.Unmarshal OrderBy + +instance Data.Foldable.Foldable OrderBy where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor OrderBy where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable OrderBy where + traverse = AST.Traversable1.Class.traverseDefault1 + +data OrderBys a = OrderBys + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (OrderBy a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_460. + AST.Traversable1.Class.Traversable1 a_460 + ) + +instance AST.Unmarshal.SymbolMatching OrderBys where + matchedSymbols _ = [143] + showFailure _ node_461 = + "expected " + GHC.Base.<> ( "orderBys" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_461 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_461) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_462 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_463 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_464 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_465 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_462 + c1_463 = TreeSitter.Node.nodeStartPoint node_461 + TreeSitter.Node.TSPoint + r2_464 + c2_465 = TreeSitter.Node.nodeEndPoint node_461 + +deriving instance GHC.Classes.Eq a_466 => GHC.Classes.Eq (OrderBys a_466) + +deriving instance GHC.Classes.Ord a_467 => GHC.Classes.Ord (OrderBys a_467) + +deriving instance GHC.Show.Show a_468 => GHC.Show.Show (OrderBys a_468) + +instance AST.Unmarshal.Unmarshal OrderBys + +instance Data.Foldable.Foldable OrderBys where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor OrderBys where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable OrderBys where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParExpr a = ParExpr + { ann :: a, + extraChildren :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_469. + AST.Traversable1.Class.Traversable1 a_469 + ) + +instance AST.Unmarshal.SymbolMatching ParExpr where + matchedSymbols _ = [128] + showFailure _ node_470 = + "expected " + GHC.Base.<> ( "par_expr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_470 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_470) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_471 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_472 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_473 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_474 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_471 + c1_472 = TreeSitter.Node.nodeStartPoint node_470 + TreeSitter.Node.TSPoint + r2_473 + c2_474 = TreeSitter.Node.nodeEndPoint node_470 + +deriving instance GHC.Classes.Eq a_475 => GHC.Classes.Eq (ParExpr a_475) + +deriving instance GHC.Classes.Ord a_476 => GHC.Classes.Ord (ParExpr a_476) + +deriving instance GHC.Show.Show a_477 => GHC.Show.Show (ParExpr a_477) + +instance AST.Unmarshal.Unmarshal ParExpr + +instance Data.Foldable.Foldable ParExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PredicateAliasBody a = PredicateAliasBody + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Eq GHC.Generics.:+: PredicateExpr) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_478. + AST.Traversable1.Class.Traversable1 a_478 + ) + +instance AST.Unmarshal.SymbolMatching PredicateAliasBody where + matchedSymbols _ = [87] + showFailure _ node_479 = + "expected " + GHC.Base.<> ( "predicateAliasBody" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_479 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_479) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_480 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_481 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_482 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_483 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_480 + c1_481 = TreeSitter.Node.nodeStartPoint node_479 + TreeSitter.Node.TSPoint + r2_482 + c2_483 = TreeSitter.Node.nodeEndPoint node_479 + +deriving instance GHC.Classes.Eq a_484 => GHC.Classes.Eq (PredicateAliasBody a_484) + +deriving instance GHC.Classes.Ord a_485 => GHC.Classes.Ord (PredicateAliasBody a_485) + +deriving instance GHC.Show.Show a_486 => GHC.Show.Show (PredicateAliasBody a_486) + +instance AST.Unmarshal.Unmarshal PredicateAliasBody + +instance Data.Foldable.Foldable PredicateAliasBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PredicateAliasBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PredicateAliasBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PredicateExpr a = PredicateExpr + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AritylessPredicateExpr GHC.Generics.:+: Integer GHC.Generics.:+: Slash) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_487. + AST.Traversable1.Class.Traversable1 a_487 + ) + +instance AST.Unmarshal.SymbolMatching PredicateExpr where + matchedSymbols _ = [161] + showFailure _ node_488 = + "expected " + GHC.Base.<> ( "predicateExpr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_488 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_488) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_489 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_490 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_491 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_492 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_489 + c1_490 = TreeSitter.Node.nodeStartPoint node_488 + TreeSitter.Node.TSPoint + r2_491 + c2_492 = TreeSitter.Node.nodeEndPoint node_488 + +deriving instance GHC.Classes.Eq a_493 => GHC.Classes.Eq (PredicateExpr a_493) + +deriving instance GHC.Classes.Ord a_494 => GHC.Classes.Ord (PredicateExpr a_494) + +deriving instance GHC.Show.Show a_495 => GHC.Show.Show (PredicateExpr a_495) + +instance AST.Unmarshal.Unmarshal PredicateExpr + +instance Data.Foldable.Foldable PredicateExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PredicateExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PredicateExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PredicateName a = PredicateName {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_496. + AST.Traversable1.Class.Traversable1 a_496 + ) + +instance AST.Unmarshal.SymbolMatching PredicateName where + matchedSymbols _ = [159] + showFailure _ node_497 = + "expected " + GHC.Base.<> ( "predicateName" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_497 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_497) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_498 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_499 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_500 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_501 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_498 + c1_499 = TreeSitter.Node.nodeStartPoint node_497 + TreeSitter.Node.TSPoint + r2_500 + c2_501 = TreeSitter.Node.nodeEndPoint node_497 + +deriving instance GHC.Classes.Eq a_502 => GHC.Classes.Eq (PredicateName a_502) + +deriving instance GHC.Classes.Ord a_503 => GHC.Classes.Ord (PredicateName a_503) + +deriving instance GHC.Show.Show a_504 => GHC.Show.Show (PredicateName a_504) + +instance AST.Unmarshal.Unmarshal PredicateName + +instance Data.Foldable.Foldable PredicateName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PredicateName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PredicateName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PrefixCast a = PrefixCast + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: TypeExpr GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_505. + AST.Traversable1.Class.Traversable1 a_505 + ) + +instance AST.Unmarshal.SymbolMatching PrefixCast where + matchedSymbols _ = [104] + showFailure _ node_506 = + "expected " + GHC.Base.<> ( "prefix_cast" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_506 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_506) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_507 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_508 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_509 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_510 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_507 + c1_508 = TreeSitter.Node.nodeStartPoint node_506 + TreeSitter.Node.TSPoint + r2_509 + c2_510 = TreeSitter.Node.nodeEndPoint node_506 + +deriving instance GHC.Classes.Eq a_511 => GHC.Classes.Eq (PrefixCast a_511) + +deriving instance GHC.Classes.Ord a_512 => GHC.Classes.Ord (PrefixCast a_512) + +deriving instance GHC.Show.Show a_513 => GHC.Show.Show (PrefixCast a_513) + +instance AST.Unmarshal.Unmarshal PrefixCast + +instance Data.Foldable.Foldable PrefixCast where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PrefixCast where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PrefixCast where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Ql a = Ql + { ann :: a, + extraChildren :: ([AST.Parse.Err (ModuleMember a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_514. + AST.Traversable1.Class.Traversable1 a_514 + ) + +instance AST.Unmarshal.SymbolMatching Ql where + matchedSymbols _ = [82] + showFailure _ node_515 = + "expected " + GHC.Base.<> ( "ql" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_515 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_515) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_516 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_517 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_518 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_519 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_516 + c1_517 = TreeSitter.Node.nodeStartPoint node_515 + TreeSitter.Node.TSPoint + r2_518 + c2_519 = TreeSitter.Node.nodeEndPoint node_515 + +deriving instance GHC.Classes.Eq a_520 => GHC.Classes.Eq (Ql a_520) + +deriving instance GHC.Classes.Ord a_521 => GHC.Classes.Ord (Ql a_521) + +deriving instance GHC.Show.Show a_522 => GHC.Show.Show (Ql a_522) + +instance AST.Unmarshal.Unmarshal Ql + +instance Data.Foldable.Foldable Ql where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Ql where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Ql where + traverse = AST.Traversable1.Class.traverseDefault1 + +data QualModuleExpr a = QualModuleExpr + { ann :: a, + name :: (GHC.Base.NonEmpty (AST.Parse.Err (SimpleId a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_523. + AST.Traversable1.Class.Traversable1 a_523 + ) + +instance AST.Unmarshal.SymbolMatching QualModuleExpr where + matchedSymbols _ = [150] + showFailure _ node_524 = + "expected " + GHC.Base.<> ( "qualModuleExpr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_524 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_524) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_525 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_526 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_527 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_528 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_525 + c1_526 = TreeSitter.Node.nodeStartPoint node_524 + TreeSitter.Node.TSPoint + r2_527 + c2_528 = TreeSitter.Node.nodeEndPoint node_524 + +deriving instance GHC.Classes.Eq a_529 => GHC.Classes.Eq (QualModuleExpr a_529) + +deriving instance GHC.Classes.Ord a_530 => GHC.Classes.Ord (QualModuleExpr a_530) + +deriving instance GHC.Show.Show a_531 => GHC.Show.Show (QualModuleExpr a_531) + +instance AST.Unmarshal.Unmarshal QualModuleExpr + +instance Data.Foldable.Foldable QualModuleExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor QualModuleExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable QualModuleExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data QualifiedRhs a = QualifiedRhs + { ann :: a, + name :: (GHC.Maybe.Maybe (AST.Parse.Err (PredicateName a))), + extraChildren :: ([AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: Closure GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: TypeExpr GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Underscore GHC.Generics.:+: Variable) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_532. + AST.Traversable1.Class.Traversable1 a_532 + ) + +instance AST.Unmarshal.SymbolMatching QualifiedRhs where + matchedSymbols _ = [120] + showFailure _ node_533 = + "expected " + GHC.Base.<> ( "qualifiedRhs" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_533 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_533) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_534 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_535 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_536 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_537 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_534 + c1_535 = TreeSitter.Node.nodeStartPoint node_533 + TreeSitter.Node.TSPoint + r2_536 + c2_537 = TreeSitter.Node.nodeEndPoint node_533 + +deriving instance GHC.Classes.Eq a_538 => GHC.Classes.Eq (QualifiedRhs a_538) + +deriving instance GHC.Classes.Ord a_539 => GHC.Classes.Ord (QualifiedRhs a_539) + +deriving instance GHC.Show.Show a_540 => GHC.Show.Show (QualifiedRhs a_540) + +instance AST.Unmarshal.Unmarshal QualifiedRhs + +instance Data.Foldable.Foldable QualifiedRhs where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor QualifiedRhs where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable QualifiedRhs where + traverse = AST.Traversable1.Class.traverseDefault1 + +data QualifiedExpr a = QualifiedExpr + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: Literal GHC.Generics.:+: ParExpr GHC.Generics.:+: QualifiedRhs GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Range GHC.Generics.:+: SuperRef GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_541. + AST.Traversable1.Class.Traversable1 a_541 + ) + +instance AST.Unmarshal.SymbolMatching QualifiedExpr where + matchedSymbols _ = [122] + showFailure _ node_542 = + "expected " + GHC.Base.<> ( "qualified_expr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_542 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_542) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_543 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_544 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_545 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_546 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_543 + c1_544 = TreeSitter.Node.nodeStartPoint node_542 + TreeSitter.Node.TSPoint + r2_545 + c2_546 = TreeSitter.Node.nodeEndPoint node_542 + +deriving instance GHC.Classes.Eq a_547 => GHC.Classes.Eq (QualifiedExpr a_547) + +deriving instance GHC.Classes.Ord a_548 => GHC.Classes.Ord (QualifiedExpr a_548) + +deriving instance GHC.Show.Show a_549 => GHC.Show.Show (QualifiedExpr a_549) + +instance AST.Unmarshal.Unmarshal QualifiedExpr + +instance Data.Foldable.Foldable QualifiedExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor QualifiedExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable QualifiedExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Quantified a = Quantified + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Quantifier GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: VarDecl GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_550. + AST.Traversable1.Class.Traversable1 a_550 + ) + +instance AST.Unmarshal.SymbolMatching Quantified where + matchedSymbols _ = [116] + showFailure _ node_551 = + "expected " + GHC.Base.<> ( "quantified" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_551 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_551) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_552 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_553 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_554 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_555 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_552 + c1_553 = TreeSitter.Node.nodeStartPoint node_551 + TreeSitter.Node.TSPoint + r2_554 + c2_555 = TreeSitter.Node.nodeEndPoint node_551 + +deriving instance GHC.Classes.Eq a_556 => GHC.Classes.Eq (Quantified a_556) + +deriving instance GHC.Classes.Ord a_557 => GHC.Classes.Ord (Quantified a_557) + +deriving instance GHC.Show.Show a_558 => GHC.Show.Show (Quantified a_558) + +instance AST.Unmarshal.Unmarshal Quantified + +instance Data.Foldable.Foldable Quantified where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Quantified where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Quantified where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Quantifier a = Quantifier + { ann :: a, + extraChildren :: (AST.Parse.Err ((Exists GHC.Generics.:+: Forall GHC.Generics.:+: Forex) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_559. + AST.Traversable1.Class.Traversable1 a_559 + ) + +instance AST.Unmarshal.SymbolMatching Quantifier where + matchedSymbols _ = [118] + showFailure _ node_560 = + "expected " + GHC.Base.<> ( "quantifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_560 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_560) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_561 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_562 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_563 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_564 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_561 + c1_562 = TreeSitter.Node.nodeStartPoint node_560 + TreeSitter.Node.TSPoint + r2_563 + c2_564 = TreeSitter.Node.nodeEndPoint node_560 + +deriving instance GHC.Classes.Eq a_565 => GHC.Classes.Eq (Quantifier a_565) + +deriving instance GHC.Classes.Ord a_566 => GHC.Classes.Ord (Quantifier a_566) + +deriving instance GHC.Show.Show a_567 => GHC.Show.Show (Quantifier a_567) + +instance AST.Unmarshal.Unmarshal Quantifier + +instance Data.Foldable.Foldable Quantifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Quantifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Quantifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Range a = Range + { ann :: a, + upper :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)), + lower :: (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Variable) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_568. + AST.Traversable1.Class.Traversable1 a_568 + ) + +instance AST.Unmarshal.SymbolMatching Range where + matchedSymbols _ = [127] + showFailure _ node_569 = + "expected " + GHC.Base.<> ( "range" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_569 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_569) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_570 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_571 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_572 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_573 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_570 + c1_571 = TreeSitter.Node.nodeStartPoint node_569 + TreeSitter.Node.TSPoint + r2_572 + c2_573 = TreeSitter.Node.nodeEndPoint node_569 + +deriving instance GHC.Classes.Eq a_574 => GHC.Classes.Eq (Range a_574) + +deriving instance GHC.Classes.Ord a_575 => GHC.Classes.Ord (Range a_575) + +deriving instance GHC.Show.Show a_576 => GHC.Show.Show (Range a_576) + +instance AST.Unmarshal.Unmarshal Range + +instance Data.Foldable.Foldable Range where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Range where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Range where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ReturnType a = ReturnType + { ann :: a, + extraChildren :: (AST.Parse.Err ((Predicate GHC.Generics.:+: TypeExpr) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_577. + AST.Traversable1.Class.Traversable1 a_577 + ) + +instance AST.Unmarshal.SymbolMatching ReturnType where + matchedSymbols _ = [157] + showFailure _ node_578 = + "expected " + GHC.Base.<> ( "returnType" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_578 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_578) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_579 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_580 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_581 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_582 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_579 + c1_580 = TreeSitter.Node.nodeStartPoint node_578 + TreeSitter.Node.TSPoint + r2_581 + c2_582 = TreeSitter.Node.nodeEndPoint node_578 + +deriving instance GHC.Classes.Eq a_583 => GHC.Classes.Eq (ReturnType a_583) + +deriving instance GHC.Classes.Ord a_584 => GHC.Classes.Ord (ReturnType a_584) + +deriving instance GHC.Show.Show a_585 => GHC.Show.Show (ReturnType a_585) + +instance AST.Unmarshal.Unmarshal ReturnType + +instance Data.Foldable.Foldable ReturnType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ReturnType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ReturnType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Select a = Select + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: AsExprs GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: OrderBys GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: VarDecl GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_586. + AST.Traversable1.Class.Traversable1 a_586 + ) + +instance AST.Unmarshal.SymbolMatching Select where + matchedSymbols _ = [93] + showFailure _ node_587 = + "expected " + GHC.Base.<> ( "select" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_587 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_587) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_588 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_589 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_590 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_591 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_588 + c1_589 = TreeSitter.Node.nodeStartPoint node_587 + TreeSitter.Node.TSPoint + r2_590 + c2_591 = TreeSitter.Node.nodeEndPoint node_587 + +deriving instance GHC.Classes.Eq a_592 => GHC.Classes.Eq (Select a_592) + +deriving instance GHC.Classes.Ord a_593 => GHC.Classes.Ord (Select a_593) + +deriving instance GHC.Show.Show a_594 => GHC.Show.Show (Select a_594) + +instance AST.Unmarshal.Unmarshal Select + +instance Data.Foldable.Foldable Select where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Select where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Select where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SimpleId a = SimpleId {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_595. + AST.Traversable1.Class.Traversable1 a_595 + ) + +instance AST.Unmarshal.SymbolMatching SimpleId where + matchedSymbols _ = [154] + showFailure _ node_596 = + "expected " + GHC.Base.<> ( "simpleId" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_596 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_596) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_597 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_598 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_599 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_600 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_597 + c1_598 = TreeSitter.Node.nodeStartPoint node_596 + TreeSitter.Node.TSPoint + r2_599 + c2_600 = TreeSitter.Node.nodeEndPoint node_596 + +deriving instance GHC.Classes.Eq a_601 => GHC.Classes.Eq (SimpleId a_601) + +deriving instance GHC.Classes.Ord a_602 => GHC.Classes.Ord (SimpleId a_602) + +deriving instance GHC.Show.Show a_603 => GHC.Show.Show (SimpleId a_603) + +instance AST.Unmarshal.Unmarshal SimpleId + +instance Data.Foldable.Foldable SimpleId where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SimpleId where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SimpleId where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SpecialId a = SpecialId {ann :: a, extraChildren :: (AST.Parse.Err (None a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_604. + AST.Traversable1.Class.Traversable1 a_604 + ) + +instance AST.Unmarshal.SymbolMatching SpecialId where + matchedSymbols _ = [117] + showFailure _ node_605 = + "expected " + GHC.Base.<> ( "specialId" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_605 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_605) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_606 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_607 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_608 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_609 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_606 + c1_607 = TreeSitter.Node.nodeStartPoint node_605 + TreeSitter.Node.TSPoint + r2_608 + c2_609 = TreeSitter.Node.nodeEndPoint node_605 + +deriving instance GHC.Classes.Eq a_610 => GHC.Classes.Eq (SpecialId a_610) + +deriving instance GHC.Classes.Ord a_611 => GHC.Classes.Ord (SpecialId a_611) + +deriving instance GHC.Show.Show a_612 => GHC.Show.Show (SpecialId a_612) + +instance AST.Unmarshal.Unmarshal SpecialId + +instance Data.Foldable.Foldable SpecialId where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SpecialId where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SpecialId where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SpecialCall a = SpecialCall + { ann :: a, + extraChildren :: (AST.Parse.Err (SpecialId a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_613. + AST.Traversable1.Class.Traversable1 a_613 + ) + +instance AST.Unmarshal.SymbolMatching SpecialCall where + matchedSymbols _ = [103] + showFailure _ node_614 = + "expected " + GHC.Base.<> ( "special_call" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_614 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_614) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_615 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_616 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_617 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_618 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_615 + c1_616 = TreeSitter.Node.nodeStartPoint node_614 + TreeSitter.Node.TSPoint + r2_617 + c2_618 = TreeSitter.Node.nodeEndPoint node_614 + +deriving instance GHC.Classes.Eq a_619 => GHC.Classes.Eq (SpecialCall a_619) + +deriving instance GHC.Classes.Ord a_620 => GHC.Classes.Ord (SpecialCall a_620) + +deriving instance GHC.Show.Show a_621 => GHC.Show.Show (SpecialCall a_621) + +instance AST.Unmarshal.Unmarshal SpecialCall + +instance Data.Foldable.Foldable SpecialCall where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SpecialCall where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SpecialCall where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SuperRef a = SuperRef + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Super GHC.Generics.:+: TypeExpr) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_622. + AST.Traversable1.Class.Traversable1 a_622 + ) + +instance AST.Unmarshal.SymbolMatching SuperRef where + matchedSymbols _ = [123] + showFailure _ node_623 = + "expected " + GHC.Base.<> ( "super_ref" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_623 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_623) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_624 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_625 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_626 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_627 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_624 + c1_625 = TreeSitter.Node.nodeStartPoint node_623 + TreeSitter.Node.TSPoint + r2_626 + c2_627 = TreeSitter.Node.nodeEndPoint node_623 + +deriving instance GHC.Classes.Eq a_628 => GHC.Classes.Eq (SuperRef a_628) + +deriving instance GHC.Classes.Ord a_629 => GHC.Classes.Ord (SuperRef a_629) + +deriving instance GHC.Show.Show a_630 => GHC.Show.Show (SuperRef a_630) + +instance AST.Unmarshal.Unmarshal SuperRef + +instance Data.Foldable.Foldable SuperRef where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SuperRef where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SuperRef where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeAliasBody a = TypeAliasBody + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Eq GHC.Generics.:+: TypeExpr) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_631. + AST.Traversable1.Class.Traversable1 a_631 + ) + +instance AST.Unmarshal.SymbolMatching TypeAliasBody where + matchedSymbols _ = [88] + showFailure _ node_632 = + "expected " + GHC.Base.<> ( "typeAliasBody" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_632 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_632) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_633 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_634 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_635 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_636 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_633 + c1_634 = TreeSitter.Node.nodeStartPoint node_632 + TreeSitter.Node.TSPoint + r2_635 + c2_636 = TreeSitter.Node.nodeEndPoint node_632 + +deriving instance GHC.Classes.Eq a_637 => GHC.Classes.Eq (TypeAliasBody a_637) + +deriving instance GHC.Classes.Ord a_638 => GHC.Classes.Ord (TypeAliasBody a_638) + +deriving instance GHC.Show.Show a_639 => GHC.Show.Show (TypeAliasBody a_639) + +instance AST.Unmarshal.Unmarshal TypeAliasBody + +instance Data.Foldable.Foldable TypeAliasBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeAliasBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeAliasBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeExpr a = TypeExpr + { ann :: a, + name :: (GHC.Maybe.Maybe (AST.Parse.Err (ClassName a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((ModuleExpr GHC.Generics.:+: TypeLiteral) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_640. + AST.Traversable1.Class.Traversable1 a_640 + ) + +instance AST.Unmarshal.SymbolMatching TypeExpr where + matchedSymbols _ = [158] + showFailure _ node_641 = + "expected " + GHC.Base.<> ( "typeExpr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_641 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_641) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_642 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_643 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_644 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_645 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_642 + c1_643 = TreeSitter.Node.nodeStartPoint node_641 + TreeSitter.Node.TSPoint + r2_644 + c2_645 = TreeSitter.Node.nodeEndPoint node_641 + +deriving instance GHC.Classes.Eq a_646 => GHC.Classes.Eq (TypeExpr a_646) + +deriving instance GHC.Classes.Ord a_647 => GHC.Classes.Ord (TypeExpr a_647) + +deriving instance GHC.Show.Show a_648 => GHC.Show.Show (TypeExpr a_648) + +instance AST.Unmarshal.Unmarshal TypeExpr + +instance Data.Foldable.Foldable TypeExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeLiteral a = TypeLiteral + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((Boolean GHC.Generics.:+: Date GHC.Generics.:+: Dbtype) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_649. + AST.Traversable1.Class.Traversable1 a_649 + ) + +instance AST.Unmarshal.SymbolMatching TypeLiteral where + matchedSymbols _ = [153] + showFailure _ node_650 = + "expected " + GHC.Base.<> ( "typeLiteral" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_650 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_650) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_651 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_652 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_653 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_654 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_651 + c1_652 = TreeSitter.Node.nodeStartPoint node_650 + TreeSitter.Node.TSPoint + r2_653 + c2_654 = TreeSitter.Node.nodeEndPoint node_650 + +deriving instance GHC.Classes.Eq a_655 => GHC.Classes.Eq (TypeLiteral a_655) + +deriving instance GHC.Classes.Ord a_656 => GHC.Classes.Ord (TypeLiteral a_656) + +deriving instance GHC.Show.Show a_657 => GHC.Show.Show (TypeLiteral a_657) + +instance AST.Unmarshal.Unmarshal TypeLiteral + +instance Data.Foldable.Foldable TypeLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnaryExpr a = UnaryExpr + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((AddExpr GHC.Generics.:+: Aggregate GHC.Generics.:+: ClasslessPredicateCall GHC.Generics.:+: CompTerm GHC.Generics.:+: Conjunction GHC.Generics.:+: Disjunction GHC.Generics.:+: IfTerm GHC.Generics.:+: Implication GHC.Generics.:+: InExpr GHC.Generics.:+: InstanceOf GHC.Generics.:+: Literal GHC.Generics.:+: MulExpr GHC.Generics.:+: Negation GHC.Generics.:+: ParExpr GHC.Generics.:+: PrefixCast GHC.Generics.:+: QualifiedExpr GHC.Generics.:+: Quantified GHC.Generics.:+: Range GHC.Generics.:+: SpecialCall GHC.Generics.:+: SuperRef GHC.Generics.:+: UnaryExpr GHC.Generics.:+: Unop GHC.Generics.:+: Variable) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_658. + AST.Traversable1.Class.Traversable1 a_658 + ) + +instance AST.Unmarshal.SymbolMatching UnaryExpr where + matchedSymbols _ = [105] + showFailure _ node_659 = + "expected " + GHC.Base.<> ( "unary_expr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_659 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_659) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_660 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_661 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_662 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_663 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_660 + c1_661 = TreeSitter.Node.nodeStartPoint node_659 + TreeSitter.Node.TSPoint + r2_662 + c2_663 = TreeSitter.Node.nodeEndPoint node_659 + +deriving instance GHC.Classes.Eq a_664 => GHC.Classes.Eq (UnaryExpr a_664) + +deriving instance GHC.Classes.Ord a_665 => GHC.Classes.Ord (UnaryExpr a_665) + +deriving instance GHC.Show.Show a_666 => GHC.Show.Show (UnaryExpr a_666) + +instance AST.Unmarshal.Unmarshal UnaryExpr + +instance Data.Foldable.Foldable UnaryExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnaryExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnaryExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Unop a = Unop + { ann :: a, + extraChildren :: (AST.Parse.Err ((Minus GHC.Generics.:+: Plus) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_667. + AST.Traversable1.Class.Traversable1 a_667 + ) + +instance AST.Unmarshal.SymbolMatching Unop where + matchedSymbols _ = [135] + showFailure _ node_668 = + "expected " + GHC.Base.<> ( "unop" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_668 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_668) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_669 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_670 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_671 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_672 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_669 + c1_670 = TreeSitter.Node.nodeStartPoint node_668 + TreeSitter.Node.TSPoint + r2_671 + c2_672 = TreeSitter.Node.nodeEndPoint node_668 + +deriving instance GHC.Classes.Eq a_673 => GHC.Classes.Eq (Unop a_673) + +deriving instance GHC.Classes.Ord a_674 => GHC.Classes.Ord (Unop a_674) + +deriving instance GHC.Show.Show a_675 => GHC.Show.Show (Unop a_675) + +instance AST.Unmarshal.Unmarshal Unop + +instance Data.Foldable.Foldable Unop where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Unop where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Unop where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VarDecl a = VarDecl + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((TypeExpr GHC.Generics.:+: VarName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_676. + AST.Traversable1.Class.Traversable1 a_676 + ) + +instance AST.Unmarshal.SymbolMatching VarDecl where + matchedSymbols _ = [140] + showFailure _ node_677 = + "expected " + GHC.Base.<> ( "varDecl" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_677 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_677) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_678 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_679 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_680 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_681 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_678 + c1_679 = TreeSitter.Node.nodeStartPoint node_677 + TreeSitter.Node.TSPoint + r2_680 + c2_681 = TreeSitter.Node.nodeEndPoint node_677 + +deriving instance GHC.Classes.Eq a_682 => GHC.Classes.Eq (VarDecl a_682) + +deriving instance GHC.Classes.Ord a_683 => GHC.Classes.Ord (VarDecl a_683) + +deriving instance GHC.Show.Show a_684 => GHC.Show.Show (VarDecl a_684) + +instance AST.Unmarshal.Unmarshal VarDecl + +instance Data.Foldable.Foldable VarDecl where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VarDecl where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VarDecl where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VarName a = VarName {ann :: a, extraChildren :: (AST.Parse.Err (SimpleId a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_685. + AST.Traversable1.Class.Traversable1 a_685 + ) + +instance AST.Unmarshal.SymbolMatching VarName where + matchedSymbols _ = [162] + showFailure _ node_686 = + "expected " + GHC.Base.<> ( "varName" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_686 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_686) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_687 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_688 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_689 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_690 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_687 + c1_688 = TreeSitter.Node.nodeStartPoint node_686 + TreeSitter.Node.TSPoint + r2_689 + c2_690 = TreeSitter.Node.nodeEndPoint node_686 + +deriving instance GHC.Classes.Eq a_691 => GHC.Classes.Eq (VarName a_691) + +deriving instance GHC.Classes.Ord a_692 => GHC.Classes.Ord (VarName a_692) + +deriving instance GHC.Show.Show a_693 => GHC.Show.Show (VarName a_693) + +instance AST.Unmarshal.Unmarshal VarName + +instance Data.Foldable.Foldable VarName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VarName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VarName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Variable a = Variable + { ann :: a, + extraChildren :: (AST.Parse.Err ((Result GHC.Generics.:+: This GHC.Generics.:+: VarName) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_694. + AST.Traversable1.Class.Traversable1 a_694 + ) + +instance AST.Unmarshal.SymbolMatching Variable where + matchedSymbols _ = [133] + showFailure _ node_695 = + "expected " + GHC.Base.<> ( "variable" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_695 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_695) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_696 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_697 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_698 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_699 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_696 + c1_697 = TreeSitter.Node.nodeStartPoint node_695 + TreeSitter.Node.TSPoint + r2_698 + c2_699 = TreeSitter.Node.nodeEndPoint node_695 + +deriving instance GHC.Classes.Eq a_700 => GHC.Classes.Eq (Variable a_700) + +deriving instance GHC.Classes.Ord a_701 => GHC.Classes.Ord (Variable a_701) + +deriving instance GHC.Show.Show a_702 => GHC.Show.Show (Variable a_702) + +instance AST.Unmarshal.Unmarshal Variable + +instance Data.Foldable.Foldable Variable where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Variable where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Variable where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousLParen = AST.Token.Token "(" 6 + +type AnonymousRParen = AST.Token.Token ")" 8 + +type AnonymousComma = AST.Token.Token "," 7 + +type AnonymousDot = AST.Token.Token "." 19 + +type AnonymousDotDot = AST.Token.Token ".." 22 + +type AnonymousColonColon = AST.Token.Token "::" 26 + +type AnonymousSemicolon = AST.Token.Token ";" 5 + +type AnonymousLBracket = AST.Token.Token "[" 20 + +type AnonymousRBracket = AST.Token.Token "]" 21 + +type AnonymousAnd = AST.Token.Token "and" 16 + +data Any a = Any {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_703. + AST.Traversable1.Class.Traversable1 a_703 + ) + +instance AST.Unmarshal.SymbolMatching Any where + matchedSymbols _ = [37] + showFailure _ node_704 = + "expected " + GHC.Base.<> ( "any" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_704 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_704) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_705 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_706 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_707 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_708 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_705 + c1_706 = TreeSitter.Node.nodeStartPoint node_704 + TreeSitter.Node.TSPoint + r2_707 + c2_708 = TreeSitter.Node.nodeEndPoint node_704 + +deriving instance GHC.Classes.Eq a_709 => GHC.Classes.Eq (Any a_709) + +deriving instance GHC.Classes.Ord a_710 => GHC.Classes.Ord (Any a_710) + +deriving instance GHC.Show.Show a_711 => GHC.Show.Show (Any a_711) + +instance AST.Unmarshal.Unmarshal Any + +instance Data.Foldable.Foldable Any where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Any where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Any where + traverse = AST.Traversable1.Class.traverseDefault1 + +data As a = As {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_712. + AST.Traversable1.Class.Traversable1 a_712 + ) + +instance AST.Unmarshal.SymbolMatching As where + matchedSymbols _ = [38] + showFailure _ node_713 = + "expected " + GHC.Base.<> ( "as" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_713 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_713) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_714 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_715 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_716 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_717 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_714 + c1_715 = TreeSitter.Node.nodeStartPoint node_713 + TreeSitter.Node.TSPoint + r2_716 + c2_717 = TreeSitter.Node.nodeEndPoint node_713 + +deriving instance GHC.Classes.Eq a_718 => GHC.Classes.Eq (As a_718) + +deriving instance GHC.Classes.Ord a_719 => GHC.Classes.Ord (As a_719) + +deriving instance GHC.Show.Show a_720 => GHC.Show.Show (As a_720) + +instance AST.Unmarshal.Unmarshal As + +instance Data.Foldable.Foldable As where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor As where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable As where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Asc a = Asc {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_721. + AST.Traversable1.Class.Traversable1 a_721 + ) + +instance AST.Unmarshal.SymbolMatching Asc where + matchedSymbols _ = [39] + showFailure _ node_722 = + "expected " + GHC.Base.<> ( "asc" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_722 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_722) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_723 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_724 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_725 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_726 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_723 + c1_724 = TreeSitter.Node.nodeStartPoint node_722 + TreeSitter.Node.TSPoint + r2_725 + c2_726 = TreeSitter.Node.nodeEndPoint node_722 + +deriving instance GHC.Classes.Eq a_727 => GHC.Classes.Eq (Asc a_727) + +deriving instance GHC.Classes.Ord a_728 => GHC.Classes.Ord (Asc a_728) + +deriving instance GHC.Show.Show a_729 => GHC.Show.Show (Asc a_729) + +instance AST.Unmarshal.Unmarshal Asc + +instance Data.Foldable.Foldable Asc where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Asc where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Asc where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Avg a = Avg {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_730. + AST.Traversable1.Class.Traversable1 a_730 + ) + +instance AST.Unmarshal.SymbolMatching Avg where + matchedSymbols _ = [40] + showFailure _ node_731 = + "expected " + GHC.Base.<> ( "avg" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_731 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_731) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_732 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_733 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_734 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_735 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_732 + c1_733 = TreeSitter.Node.nodeStartPoint node_731 + TreeSitter.Node.TSPoint + r2_734 + c2_735 = TreeSitter.Node.nodeEndPoint node_731 + +deriving instance GHC.Classes.Eq a_736 => GHC.Classes.Eq (Avg a_736) + +deriving instance GHC.Classes.Ord a_737 => GHC.Classes.Ord (Avg a_737) + +deriving instance GHC.Show.Show a_738 => GHC.Show.Show (Avg a_738) + +instance AST.Unmarshal.Unmarshal Avg + +instance Data.Foldable.Foldable Avg where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Avg where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Avg where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Boolean a = Boolean {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_739. + AST.Traversable1.Class.Traversable1 a_739 + ) + +instance AST.Unmarshal.SymbolMatching Boolean where + matchedSymbols _ = [41] + showFailure _ node_740 = + "expected " + GHC.Base.<> ( "boolean" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_740 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_740) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_741 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_742 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_743 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_744 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_741 + c1_742 = TreeSitter.Node.nodeStartPoint node_740 + TreeSitter.Node.TSPoint + r2_743 + c2_744 = TreeSitter.Node.nodeEndPoint node_740 + +deriving instance GHC.Classes.Eq a_745 => GHC.Classes.Eq (Boolean a_745) + +deriving instance GHC.Classes.Ord a_746 => GHC.Classes.Ord (Boolean a_746) + +deriving instance GHC.Show.Show a_747 => GHC.Show.Show (Boolean a_747) + +instance AST.Unmarshal.Unmarshal Boolean + +instance Data.Foldable.Foldable Boolean where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Boolean where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Boolean where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousBy = AST.Token.Token "by" 24 + +data Class a = Class {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_748. + AST.Traversable1.Class.Traversable1 a_748 + ) + +instance AST.Unmarshal.SymbolMatching Class where + matchedSymbols _ = [42] + showFailure _ node_749 = + "expected " + GHC.Base.<> ( "class" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_749 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_749) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_750 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_751 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_752 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_753 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_750 + c1_751 = TreeSitter.Node.nodeStartPoint node_749 + TreeSitter.Node.TSPoint + r2_752 + c2_753 = TreeSitter.Node.nodeEndPoint node_749 + +deriving instance GHC.Classes.Eq a_754 => GHC.Classes.Eq (Class a_754) + +deriving instance GHC.Classes.Ord a_755 => GHC.Classes.Ord (Class a_755) + +deriving instance GHC.Show.Show a_756 => GHC.Show.Show (Class a_756) + +instance AST.Unmarshal.Unmarshal Class + +instance Data.Foldable.Foldable Class where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Class where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Class where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Concat a = Concat {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_757. + AST.Traversable1.Class.Traversable1 a_757 + ) + +instance AST.Unmarshal.SymbolMatching Concat where + matchedSymbols _ = [65] + showFailure _ node_758 = + "expected " + GHC.Base.<> ( "concat" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_758 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_758) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_759 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_760 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_761 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_762 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_759 + c1_760 = TreeSitter.Node.nodeStartPoint node_758 + TreeSitter.Node.TSPoint + r2_761 + c2_762 = TreeSitter.Node.nodeEndPoint node_758 + +deriving instance GHC.Classes.Eq a_763 => GHC.Classes.Eq (Concat a_763) + +deriving instance GHC.Classes.Ord a_764 => GHC.Classes.Ord (Concat a_764) + +deriving instance GHC.Show.Show a_765 => GHC.Show.Show (Concat a_765) + +instance AST.Unmarshal.Unmarshal Concat + +instance Data.Foldable.Foldable Concat where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Concat where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Concat where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Count a = Count {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_766. + AST.Traversable1.Class.Traversable1 a_766 + ) + +instance AST.Unmarshal.SymbolMatching Count where + matchedSymbols _ = [44] + showFailure _ node_767 = + "expected " + GHC.Base.<> ( "count" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_767 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_767) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_768 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_769 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_770 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_771 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_768 + c1_769 = TreeSitter.Node.nodeStartPoint node_767 + TreeSitter.Node.TSPoint + r2_770 + c2_771 = TreeSitter.Node.nodeEndPoint node_767 + +deriving instance GHC.Classes.Eq a_772 => GHC.Classes.Eq (Count a_772) + +deriving instance GHC.Classes.Ord a_773 => GHC.Classes.Ord (Count a_773) + +deriving instance GHC.Show.Show a_774 => GHC.Show.Show (Count a_774) + +instance AST.Unmarshal.Unmarshal Count + +instance Data.Foldable.Foldable Count where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Count where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Count where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Date a = Date {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_775. + AST.Traversable1.Class.Traversable1 a_775 + ) + +instance AST.Unmarshal.SymbolMatching Date where + matchedSymbols _ = [45] + showFailure _ node_776 = + "expected " + GHC.Base.<> ( "date" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_776 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_776) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_777 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_778 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_779 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_780 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_777 + c1_778 = TreeSitter.Node.nodeStartPoint node_776 + TreeSitter.Node.TSPoint + r2_779 + c2_780 = TreeSitter.Node.nodeEndPoint node_776 + +deriving instance GHC.Classes.Eq a_781 => GHC.Classes.Eq (Date a_781) + +deriving instance GHC.Classes.Ord a_782 => GHC.Classes.Ord (Date a_782) + +deriving instance GHC.Show.Show a_783 => GHC.Show.Show (Date a_783) + +instance AST.Unmarshal.Unmarshal Date + +instance Data.Foldable.Foldable Date where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Date where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Date where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Desc a = Desc {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_784. + AST.Traversable1.Class.Traversable1 a_784 + ) + +instance AST.Unmarshal.SymbolMatching Desc where + matchedSymbols _ = [46] + showFailure _ node_785 = + "expected " + GHC.Base.<> ( "desc" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_785 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_785) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_786 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_787 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_788 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_789 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_786 + c1_787 = TreeSitter.Node.nodeStartPoint node_785 + TreeSitter.Node.TSPoint + r2_788 + c2_789 = TreeSitter.Node.nodeEndPoint node_785 + +deriving instance GHC.Classes.Eq a_790 => GHC.Classes.Eq (Desc a_790) + +deriving instance GHC.Classes.Ord a_791 => GHC.Classes.Ord (Desc a_791) + +deriving instance GHC.Show.Show a_792 => GHC.Show.Show (Desc a_792) + +instance AST.Unmarshal.Unmarshal Desc + +instance Data.Foldable.Foldable Desc where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Desc where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Desc where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousElse = AST.Token.Token "else" 15 + +data Eq a = Eq {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_793. + AST.Traversable1.Class.Traversable1 a_793 + ) + +instance AST.Unmarshal.SymbolMatching Eq where + matchedSymbols _ = [72] + showFailure _ node_794 = + "expected " + GHC.Base.<> ( "eq" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_794 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_794) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_795 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_796 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_797 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_798 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_795 + c1_796 = TreeSitter.Node.nodeStartPoint node_794 + TreeSitter.Node.TSPoint + r2_797 + c2_798 = TreeSitter.Node.nodeEndPoint node_794 + +deriving instance GHC.Classes.Eq a_799 => GHC.Classes.Eq (Eq a_799) + +deriving instance GHC.Classes.Ord a_800 => GHC.Classes.Ord (Eq a_800) + +deriving instance GHC.Show.Show a_801 => GHC.Show.Show (Eq a_801) + +instance AST.Unmarshal.Unmarshal Eq + +instance Data.Foldable.Foldable Eq where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Eq where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Eq where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Exists a = Exists {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_802. + AST.Traversable1.Class.Traversable1 a_802 + ) + +instance AST.Unmarshal.SymbolMatching Exists where + matchedSymbols _ = [47] + showFailure _ node_803 = + "expected " + GHC.Base.<> ( "exists" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_803 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_803) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_804 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_805 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_806 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_807 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_804 + c1_805 = TreeSitter.Node.nodeStartPoint node_803 + TreeSitter.Node.TSPoint + r2_806 + c2_807 = TreeSitter.Node.nodeEndPoint node_803 + +deriving instance GHC.Classes.Eq a_808 => GHC.Classes.Eq (Exists a_808) + +deriving instance GHC.Classes.Ord a_809 => GHC.Classes.Ord (Exists a_809) + +deriving instance GHC.Show.Show a_810 => GHC.Show.Show (Exists a_810) + +instance AST.Unmarshal.Unmarshal Exists + +instance Data.Foldable.Foldable Exists where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Exists where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Exists where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Extends a = Extends {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_811. + AST.Traversable1.Class.Traversable1 a_811 + ) + +instance AST.Unmarshal.SymbolMatching Extends where + matchedSymbols _ = [48] + showFailure _ node_812 = + "expected " + GHC.Base.<> ( "extends" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_812 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_812) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_813 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_814 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_815 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_816 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_813 + c1_814 = TreeSitter.Node.nodeStartPoint node_812 + TreeSitter.Node.TSPoint + r2_815 + c2_816 = TreeSitter.Node.nodeEndPoint node_812 + +deriving instance GHC.Classes.Eq a_817 => GHC.Classes.Eq (Extends a_817) + +deriving instance GHC.Classes.Ord a_818 => GHC.Classes.Ord (Extends a_818) + +deriving instance GHC.Show.Show a_819 => GHC.Show.Show (Extends a_819) + +instance AST.Unmarshal.Unmarshal Extends + +instance Data.Foldable.Foldable Extends where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Extends where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Extends where + traverse = AST.Traversable1.Class.traverseDefault1 + +data False a = False {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_820. + AST.Traversable1.Class.Traversable1 a_820 + ) + +instance AST.Unmarshal.SymbolMatching False where + matchedSymbols _ = [49] + showFailure _ node_821 = + "expected " + GHC.Base.<> ( "false" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_821 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_821) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_822 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_823 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_824 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_825 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_822 + c1_823 = TreeSitter.Node.nodeStartPoint node_821 + TreeSitter.Node.TSPoint + r2_824 + c2_825 = TreeSitter.Node.nodeEndPoint node_821 + +deriving instance GHC.Classes.Eq a_826 => GHC.Classes.Eq (False a_826) + +deriving instance GHC.Classes.Ord a_827 => GHC.Classes.Ord (False a_827) + +deriving instance GHC.Show.Show a_828 => GHC.Show.Show (False a_828) + +instance AST.Unmarshal.Unmarshal False + +instance Data.Foldable.Foldable False where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor False where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable False where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFloat = AST.Token.Token "float" 27 + +data Float a = Float {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_829. + AST.Traversable1.Class.Traversable1 a_829 + ) + +instance AST.Unmarshal.SymbolMatching Float where + matchedSymbols _ = [33] + showFailure _ node_830 = + "expected " + GHC.Base.<> ( "float" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_830 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_830) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_831 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_832 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_833 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_834 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_831 + c1_832 = TreeSitter.Node.nodeStartPoint node_830 + TreeSitter.Node.TSPoint + r2_833 + c2_834 = TreeSitter.Node.nodeEndPoint node_830 + +deriving instance GHC.Classes.Eq a_835 => GHC.Classes.Eq (Float a_835) + +deriving instance GHC.Classes.Ord a_836 => GHC.Classes.Ord (Float a_836) + +deriving instance GHC.Show.Show a_837 => GHC.Show.Show (Float a_837) + +instance AST.Unmarshal.Unmarshal Float + +instance Data.Foldable.Foldable Float where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Float where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Float where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Forall a = Forall {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_838. + AST.Traversable1.Class.Traversable1 a_838 + ) + +instance AST.Unmarshal.SymbolMatching Forall where + matchedSymbols _ = [50] + showFailure _ node_839 = + "expected " + GHC.Base.<> ( "forall" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_839 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_839) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_840 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_841 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_842 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_843 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_840 + c1_841 = TreeSitter.Node.nodeStartPoint node_839 + TreeSitter.Node.TSPoint + r2_842 + c2_843 = TreeSitter.Node.nodeEndPoint node_839 + +deriving instance GHC.Classes.Eq a_844 => GHC.Classes.Eq (Forall a_844) + +deriving instance GHC.Classes.Ord a_845 => GHC.Classes.Ord (Forall a_845) + +deriving instance GHC.Show.Show a_846 => GHC.Show.Show (Forall a_846) + +instance AST.Unmarshal.Unmarshal Forall + +instance Data.Foldable.Foldable Forall where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Forall where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Forall where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Forex a = Forex {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_847. + AST.Traversable1.Class.Traversable1 a_847 + ) + +instance AST.Unmarshal.SymbolMatching Forex where + matchedSymbols _ = [51] + showFailure _ node_848 = + "expected " + GHC.Base.<> ( "forex" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_848 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_848) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_849 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_850 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_851 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_852 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_849 + c1_850 = TreeSitter.Node.nodeStartPoint node_848 + TreeSitter.Node.TSPoint + r2_851 + c2_852 = TreeSitter.Node.nodeEndPoint node_848 + +deriving instance GHC.Classes.Eq a_853 => GHC.Classes.Eq (Forex a_853) + +deriving instance GHC.Classes.Ord a_854 => GHC.Classes.Ord (Forex a_854) + +deriving instance GHC.Show.Show a_855 => GHC.Show.Show (Forex a_855) + +instance AST.Unmarshal.Unmarshal Forex + +instance Data.Foldable.Foldable Forex where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Forex where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Forex where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFrom = AST.Token.Token "from" 10 + +data Ge a = Ge {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_856. + AST.Traversable1.Class.Traversable1 a_856 + ) + +instance AST.Unmarshal.SymbolMatching Ge where + matchedSymbols _ = [74] + showFailure _ node_857 = + "expected " + GHC.Base.<> ( "ge" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_857 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_857) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_858 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_859 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_860 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_861 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_858 + c1_859 = TreeSitter.Node.nodeStartPoint node_857 + TreeSitter.Node.TSPoint + r2_860 + c2_861 = TreeSitter.Node.nodeEndPoint node_857 + +deriving instance GHC.Classes.Eq a_862 => GHC.Classes.Eq (Ge a_862) + +deriving instance GHC.Classes.Ord a_863 => GHC.Classes.Ord (Ge a_863) + +deriving instance GHC.Show.Show a_864 => GHC.Show.Show (Ge a_864) + +instance AST.Unmarshal.Unmarshal Ge + +instance Data.Foldable.Foldable Ge where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Ge where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Ge where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Gt a = Gt {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_865. + AST.Traversable1.Class.Traversable1 a_865 + ) + +instance AST.Unmarshal.SymbolMatching Gt where + matchedSymbols _ = [73] + showFailure _ node_866 = + "expected " + GHC.Base.<> ( "gt" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_866 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_866) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_867 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_868 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_869 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_870 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_867 + c1_868 = TreeSitter.Node.nodeStartPoint node_866 + TreeSitter.Node.TSPoint + r2_869 + c2_870 = TreeSitter.Node.nodeEndPoint node_866 + +deriving instance GHC.Classes.Eq a_871 => GHC.Classes.Eq (Gt a_871) + +deriving instance GHC.Classes.Ord a_872 => GHC.Classes.Ord (Gt a_872) + +deriving instance GHC.Show.Show a_873 => GHC.Show.Show (Gt a_873) + +instance AST.Unmarshal.Unmarshal Gt + +instance Data.Foldable.Foldable Gt where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Gt where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Gt where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousIf = AST.Token.Token "if" 13 + +type AnonymousImplies = AST.Token.Token "implies" 17 + +data Import a = Import {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_874. + AST.Traversable1.Class.Traversable1 a_874 + ) + +instance AST.Unmarshal.SymbolMatching Import where + matchedSymbols _ = [52] + showFailure _ node_875 = + "expected " + GHC.Base.<> ( "import" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_875 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_875) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_876 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_877 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_878 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_879 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_876 + c1_877 = TreeSitter.Node.nodeStartPoint node_875 + TreeSitter.Node.TSPoint + r2_878 + c2_879 = TreeSitter.Node.nodeEndPoint node_875 + +deriving instance GHC.Classes.Eq a_880 => GHC.Classes.Eq (Import a_880) + +deriving instance GHC.Classes.Ord a_881 => GHC.Classes.Ord (Import a_881) + +deriving instance GHC.Show.Show a_882 => GHC.Show.Show (Import a_882) + +instance AST.Unmarshal.Unmarshal Import + +instance Data.Foldable.Foldable Import where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Import where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Import where + traverse = AST.Traversable1.Class.traverseDefault1 + +data In a = In {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_883. + AST.Traversable1.Class.Traversable1 a_883 + ) + +instance AST.Unmarshal.SymbolMatching In where + matchedSymbols _ = [53] + showFailure _ node_884 = + "expected " + GHC.Base.<> ( "in" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_884 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_884) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_885 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_886 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_887 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_888 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_885 + c1_886 = TreeSitter.Node.nodeStartPoint node_884 + TreeSitter.Node.TSPoint + r2_887 + c2_888 = TreeSitter.Node.nodeEndPoint node_884 + +deriving instance GHC.Classes.Eq a_889 => GHC.Classes.Eq (In a_889) + +deriving instance GHC.Classes.Ord a_890 => GHC.Classes.Ord (In a_890) + +deriving instance GHC.Show.Show a_891 => GHC.Show.Show (In a_891) + +instance AST.Unmarshal.Unmarshal In + +instance Data.Foldable.Foldable In where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor In where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable In where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Instanceof a = Instanceof {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_892. + AST.Traversable1.Class.Traversable1 a_892 + ) + +instance AST.Unmarshal.SymbolMatching Instanceof where + matchedSymbols _ = [54] + showFailure _ node_893 = + "expected " + GHC.Base.<> ( "instanceof" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_893 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_893) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_894 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_895 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_896 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_897 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_894 + c1_895 = TreeSitter.Node.nodeStartPoint node_893 + TreeSitter.Node.TSPoint + r2_896 + c2_897 = TreeSitter.Node.nodeEndPoint node_893 + +deriving instance GHC.Classes.Eq a_898 => GHC.Classes.Eq (Instanceof a_898) + +deriving instance GHC.Classes.Ord a_899 => GHC.Classes.Ord (Instanceof a_899) + +deriving instance GHC.Show.Show a_900 => GHC.Show.Show (Instanceof a_900) + +instance AST.Unmarshal.Unmarshal Instanceof + +instance Data.Foldable.Foldable Instanceof where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Instanceof where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Instanceof where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousInt = AST.Token.Token "int" 28 + +data Integer a = Integer {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_901. + AST.Traversable1.Class.Traversable1 a_901 + ) + +instance AST.Unmarshal.SymbolMatching Integer where + matchedSymbols _ = [32] + showFailure _ node_902 = + "expected " + GHC.Base.<> ( "integer" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_902 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_902) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_903 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_904 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_905 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_906 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_903 + c1_904 = TreeSitter.Node.nodeStartPoint node_902 + TreeSitter.Node.TSPoint + r2_905 + c2_906 = TreeSitter.Node.nodeEndPoint node_902 + +deriving instance GHC.Classes.Eq a_907 => GHC.Classes.Eq (Integer a_907) + +deriving instance GHC.Classes.Ord a_908 => GHC.Classes.Ord (Integer a_908) + +deriving instance GHC.Show.Show a_909 => GHC.Show.Show (Integer a_909) + +instance AST.Unmarshal.Unmarshal Integer + +instance Data.Foldable.Foldable Integer where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Integer where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Integer where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Le a = Le {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_910. + AST.Traversable1.Class.Traversable1 a_910 + ) + +instance AST.Unmarshal.SymbolMatching Le where + matchedSymbols _ = [71] + showFailure _ node_911 = + "expected " + GHC.Base.<> ( "le" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_911 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_911) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_912 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_913 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_914 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_915 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_912 + c1_913 = TreeSitter.Node.nodeStartPoint node_911 + TreeSitter.Node.TSPoint + r2_914 + c2_915 = TreeSitter.Node.nodeEndPoint node_911 + +deriving instance GHC.Classes.Eq a_916 => GHC.Classes.Eq (Le a_916) + +deriving instance GHC.Classes.Ord a_917 => GHC.Classes.Ord (Le a_917) + +deriving instance GHC.Show.Show a_918 => GHC.Show.Show (Le a_918) + +instance AST.Unmarshal.Unmarshal Le + +instance Data.Foldable.Foldable Le where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Le where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Le where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Lt a = Lt {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_919. + AST.Traversable1.Class.Traversable1 a_919 + ) + +instance AST.Unmarshal.SymbolMatching Lt where + matchedSymbols _ = [70] + showFailure _ node_920 = + "expected " + GHC.Base.<> ( "lt" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_920 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_920) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_921 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_922 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_923 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_924 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_921 + c1_922 = TreeSitter.Node.nodeStartPoint node_920 + TreeSitter.Node.TSPoint + r2_923 + c2_924 = TreeSitter.Node.nodeEndPoint node_920 + +deriving instance GHC.Classes.Eq a_925 => GHC.Classes.Eq (Lt a_925) + +deriving instance GHC.Classes.Ord a_926 => GHC.Classes.Ord (Lt a_926) + +deriving instance GHC.Show.Show a_927 => GHC.Show.Show (Lt a_927) + +instance AST.Unmarshal.Unmarshal Lt + +instance Data.Foldable.Foldable Lt where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Lt where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Lt where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Max a = Max {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_928. + AST.Traversable1.Class.Traversable1 a_928 + ) + +instance AST.Unmarshal.SymbolMatching Max where + matchedSymbols _ = [55] + showFailure _ node_929 = + "expected " + GHC.Base.<> ( "max" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_929 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_929) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_930 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_931 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_932 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_933 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_930 + c1_931 = TreeSitter.Node.nodeStartPoint node_929 + TreeSitter.Node.TSPoint + r2_932 + c2_933 = TreeSitter.Node.nodeEndPoint node_929 + +deriving instance GHC.Classes.Eq a_934 => GHC.Classes.Eq (Max a_934) + +deriving instance GHC.Classes.Ord a_935 => GHC.Classes.Ord (Max a_935) + +deriving instance GHC.Show.Show a_936 => GHC.Show.Show (Max a_936) + +instance AST.Unmarshal.Unmarshal Max + +instance Data.Foldable.Foldable Max where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Max where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Max where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Min a = Min {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_937. + AST.Traversable1.Class.Traversable1 a_937 + ) + +instance AST.Unmarshal.SymbolMatching Min where + matchedSymbols _ = [56] + showFailure _ node_938 = + "expected " + GHC.Base.<> ( "min" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_938 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_938) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_939 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_940 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_941 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_942 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_939 + c1_940 = TreeSitter.Node.nodeStartPoint node_938 + TreeSitter.Node.TSPoint + r2_941 + c2_942 = TreeSitter.Node.nodeEndPoint node_938 + +deriving instance GHC.Classes.Eq a_943 => GHC.Classes.Eq (Min a_943) + +deriving instance GHC.Classes.Ord a_944 => GHC.Classes.Ord (Min a_944) + +deriving instance GHC.Show.Show a_945 => GHC.Show.Show (Min a_945) + +instance AST.Unmarshal.Unmarshal Min + +instance Data.Foldable.Foldable Min where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Min where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Min where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Minus a = Minus {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_946. + AST.Traversable1.Class.Traversable1 a_946 + ) + +instance AST.Unmarshal.SymbolMatching Minus where + matchedSymbols _ = [76] + showFailure _ node_947 = + "expected " + GHC.Base.<> ( "minus" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_947 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_947) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_948 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_949 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_950 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_951 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_948 + c1_949 = TreeSitter.Node.nodeStartPoint node_947 + TreeSitter.Node.TSPoint + r2_950 + c2_951 = TreeSitter.Node.nodeEndPoint node_947 + +deriving instance GHC.Classes.Eq a_952 => GHC.Classes.Eq (Minus a_952) + +deriving instance GHC.Classes.Ord a_953 => GHC.Classes.Ord (Minus a_953) + +deriving instance GHC.Show.Show a_954 => GHC.Show.Show (Minus a_954) + +instance AST.Unmarshal.Unmarshal Minus + +instance Data.Foldable.Foldable Minus where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Minus where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Minus where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Mod a = Mod {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_955. + AST.Traversable1.Class.Traversable1 a_955 + ) + +instance AST.Unmarshal.SymbolMatching Mod where + matchedSymbols _ = [80] + showFailure _ node_956 = + "expected " + GHC.Base.<> ( "mod" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_956 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_956) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_957 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_958 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_959 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_960 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_957 + c1_958 = TreeSitter.Node.nodeStartPoint node_956 + TreeSitter.Node.TSPoint + r2_959 + c2_960 = TreeSitter.Node.nodeEndPoint node_956 + +deriving instance GHC.Classes.Eq a_961 => GHC.Classes.Eq (Mod a_961) + +deriving instance GHC.Classes.Ord a_962 => GHC.Classes.Ord (Mod a_962) + +deriving instance GHC.Show.Show a_963 => GHC.Show.Show (Mod a_963) + +instance AST.Unmarshal.Unmarshal Mod + +instance Data.Foldable.Foldable Mod where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Mod where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Mod where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousModule = AST.Token.Token "module" 2 + +data Ne a = Ne {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_964. + AST.Traversable1.Class.Traversable1 a_964 + ) + +instance AST.Unmarshal.SymbolMatching Ne where + matchedSymbols _ = [77] + showFailure _ node_965 = + "expected " + GHC.Base.<> ( "ne" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_965 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_965) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_966 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_967 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_968 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_969 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_966 + c1_967 = TreeSitter.Node.nodeStartPoint node_965 + TreeSitter.Node.TSPoint + r2_968 + c2_969 = TreeSitter.Node.nodeEndPoint node_965 + +deriving instance GHC.Classes.Eq a_970 => GHC.Classes.Eq (Ne a_970) + +deriving instance GHC.Classes.Ord a_971 => GHC.Classes.Ord (Ne a_971) + +deriving instance GHC.Show.Show a_972 => GHC.Show.Show (Ne a_972) + +instance AST.Unmarshal.Unmarshal Ne + +instance Data.Foldable.Foldable Ne where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Ne where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Ne where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Newtype a = Newtype {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_973. + AST.Traversable1.Class.Traversable1 a_973 + ) + +instance AST.Unmarshal.SymbolMatching Newtype where + matchedSymbols _ = [43] + showFailure _ node_974 = + "expected " + GHC.Base.<> ( "newtype" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_974 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_974) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_975 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_976 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_977 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_978 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_975 + c1_976 = TreeSitter.Node.nodeStartPoint node_974 + TreeSitter.Node.TSPoint + r2_977 + c2_978 = TreeSitter.Node.nodeEndPoint node_974 + +deriving instance GHC.Classes.Eq a_979 => GHC.Classes.Eq (Newtype a_979) + +deriving instance GHC.Classes.Ord a_980 => GHC.Classes.Ord (Newtype a_980) + +deriving instance GHC.Show.Show a_981 => GHC.Show.Show (Newtype a_981) + +instance AST.Unmarshal.Unmarshal Newtype + +instance Data.Foldable.Foldable Newtype where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Newtype where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Newtype where + traverse = AST.Traversable1.Class.traverseDefault1 + +data None a = None {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_982. + AST.Traversable1.Class.Traversable1 a_982 + ) + +instance AST.Unmarshal.SymbolMatching None where + matchedSymbols _ = [58] + showFailure _ node_983 = + "expected " + GHC.Base.<> ( "none" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_983 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_983) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_984 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_985 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_986 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_987 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_984 + c1_985 = TreeSitter.Node.nodeStartPoint node_983 + TreeSitter.Node.TSPoint + r2_986 + c2_987 = TreeSitter.Node.nodeEndPoint node_983 + +deriving instance GHC.Classes.Eq a_988 => GHC.Classes.Eq (None a_988) + +deriving instance GHC.Classes.Ord a_989 => GHC.Classes.Ord (None a_989) + +deriving instance GHC.Show.Show a_990 => GHC.Show.Show (None a_990) + +instance AST.Unmarshal.Unmarshal None + +instance Data.Foldable.Foldable None where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor None where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable None where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Not a = Not {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_991. + AST.Traversable1.Class.Traversable1 a_991 + ) + +instance AST.Unmarshal.SymbolMatching Not where + matchedSymbols _ = [57] + showFailure _ node_992 = + "expected " + GHC.Base.<> ( "not" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_992 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_992) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_993 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_994 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_995 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_996 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_993 + c1_994 = TreeSitter.Node.nodeStartPoint node_992 + TreeSitter.Node.TSPoint + r2_995 + c2_996 = TreeSitter.Node.nodeEndPoint node_992 + +deriving instance GHC.Classes.Eq a_997 => GHC.Classes.Eq (Not a_997) + +deriving instance GHC.Classes.Ord a_998 => GHC.Classes.Ord (Not a_998) + +deriving instance GHC.Show.Show a_999 => GHC.Show.Show (Not a_999) + +instance AST.Unmarshal.Unmarshal Not + +instance Data.Foldable.Foldable Not where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Not where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Not where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousOr = AST.Token.Token "or" 9 + +type AnonymousOrder = AST.Token.Token "order" 23 + +data Plus a = Plus {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1000. + AST.Traversable1.Class.Traversable1 a_1000 + ) + +instance AST.Unmarshal.SymbolMatching Plus where + matchedSymbols _ = [81] + showFailure _ node_1001 = + "expected " + GHC.Base.<> ( "plus" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1001 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1001) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1002 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1003 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1004 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1005 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1002 + c1_1003 = TreeSitter.Node.nodeStartPoint node_1001 + TreeSitter.Node.TSPoint + r2_1004 + c2_1005 = TreeSitter.Node.nodeEndPoint node_1001 + +deriving instance GHC.Classes.Eq a_1006 => GHC.Classes.Eq (Plus a_1006) + +deriving instance GHC.Classes.Ord a_1007 => GHC.Classes.Ord (Plus a_1007) + +deriving instance GHC.Show.Show a_1008 => GHC.Show.Show (Plus a_1008) + +instance AST.Unmarshal.Unmarshal Plus + +instance Data.Foldable.Foldable Plus where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Plus where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Plus where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Predicate a = Predicate {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1009. + AST.Traversable1.Class.Traversable1 a_1009 + ) + +instance AST.Unmarshal.SymbolMatching Predicate where + matchedSymbols _ = [59] + showFailure _ node_1010 = + "expected " + GHC.Base.<> ( "predicate" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1010 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1010) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1011 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1012 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1013 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1014 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1011 + c1_1012 = TreeSitter.Node.nodeStartPoint node_1010 + TreeSitter.Node.TSPoint + r2_1013 + c2_1014 = TreeSitter.Node.nodeEndPoint node_1010 + +deriving instance GHC.Classes.Eq a_1015 => GHC.Classes.Eq (Predicate a_1015) + +deriving instance GHC.Classes.Ord a_1016 => GHC.Classes.Ord (Predicate a_1016) + +deriving instance GHC.Show.Show a_1017 => GHC.Show.Show (Predicate a_1017) + +instance AST.Unmarshal.Unmarshal Predicate + +instance Data.Foldable.Foldable Predicate where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Predicate where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Predicate where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Qldoc a = Qldoc {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1018. + AST.Traversable1.Class.Traversable1 a_1018 + ) + +instance AST.Unmarshal.SymbolMatching Qldoc where + matchedSymbols _ = [25] + showFailure _ node_1019 = + "expected " + GHC.Base.<> ( "qldoc" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1019 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1019) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1020 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1021 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1022 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1023 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1020 + c1_1021 = TreeSitter.Node.nodeStartPoint node_1019 + TreeSitter.Node.TSPoint + r2_1022 + c2_1023 = TreeSitter.Node.nodeEndPoint node_1019 + +deriving instance GHC.Classes.Eq a_1024 => GHC.Classes.Eq (Qldoc a_1024) + +deriving instance GHC.Classes.Ord a_1025 => GHC.Classes.Ord (Qldoc a_1025) + +deriving instance GHC.Show.Show a_1026 => GHC.Show.Show (Qldoc a_1026) + +instance AST.Unmarshal.Unmarshal Qldoc + +instance Data.Foldable.Foldable Qldoc where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Qldoc where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Qldoc where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Rank a = Rank {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1027. + AST.Traversable1.Class.Traversable1 a_1027 + ) + +instance AST.Unmarshal.SymbolMatching Rank where + matchedSymbols _ = [60] + showFailure _ node_1028 = + "expected " + GHC.Base.<> ( "rank" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1028 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1028) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1029 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1030 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1031 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1032 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1029 + c1_1030 = TreeSitter.Node.nodeStartPoint node_1028 + TreeSitter.Node.TSPoint + r2_1031 + c2_1032 = TreeSitter.Node.nodeEndPoint node_1028 + +deriving instance GHC.Classes.Eq a_1033 => GHC.Classes.Eq (Rank a_1033) + +deriving instance GHC.Classes.Ord a_1034 => GHC.Classes.Ord (Rank a_1034) + +deriving instance GHC.Show.Show a_1035 => GHC.Show.Show (Rank a_1035) + +instance AST.Unmarshal.Unmarshal Rank + +instance Data.Foldable.Foldable Rank where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Rank where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Rank where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Result a = Result {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1036. + AST.Traversable1.Class.Traversable1 a_1036 + ) + +instance AST.Unmarshal.SymbolMatching Result where + matchedSymbols _ = [61] + showFailure _ node_1037 = + "expected " + GHC.Base.<> ( "result" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1037 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1037) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1038 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1039 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1040 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1041 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1038 + c1_1039 = TreeSitter.Node.nodeStartPoint node_1037 + TreeSitter.Node.TSPoint + r2_1040 + c2_1041 = TreeSitter.Node.nodeEndPoint node_1037 + +deriving instance GHC.Classes.Eq a_1042 => GHC.Classes.Eq (Result a_1042) + +deriving instance GHC.Classes.Ord a_1043 => GHC.Classes.Ord (Result a_1043) + +deriving instance GHC.Show.Show a_1044 => GHC.Show.Show (Result a_1044) + +instance AST.Unmarshal.Unmarshal Result + +instance Data.Foldable.Foldable Result where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Result where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Result where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousSelect = AST.Token.Token "select" 12 + +data Slash a = Slash {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1045. + AST.Traversable1.Class.Traversable1 a_1045 + ) + +instance AST.Unmarshal.SymbolMatching Slash where + matchedSymbols _ = [78] + showFailure _ node_1046 = + "expected " + GHC.Base.<> ( "slash" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1046 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1046) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1047 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1048 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1049 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1050 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1047 + c1_1048 = TreeSitter.Node.nodeStartPoint node_1046 + TreeSitter.Node.TSPoint + r2_1049 + c2_1050 = TreeSitter.Node.nodeEndPoint node_1046 + +deriving instance GHC.Classes.Eq a_1051 => GHC.Classes.Eq (Slash a_1051) + +deriving instance GHC.Classes.Ord a_1052 => GHC.Classes.Ord (Slash a_1052) + +deriving instance GHC.Show.Show a_1053 => GHC.Show.Show (Slash a_1053) + +instance AST.Unmarshal.Unmarshal Slash + +instance Data.Foldable.Foldable Slash where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Slash where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Slash where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Star a = Star {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1054. + AST.Traversable1.Class.Traversable1 a_1054 + ) + +instance AST.Unmarshal.SymbolMatching Star where + matchedSymbols _ = [79] + showFailure _ node_1055 = + "expected " + GHC.Base.<> ( "star" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1055 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1055) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1056 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1057 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1058 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1059 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1056 + c1_1057 = TreeSitter.Node.nodeStartPoint node_1055 + TreeSitter.Node.TSPoint + r2_1058 + c2_1059 = TreeSitter.Node.nodeEndPoint node_1055 + +deriving instance GHC.Classes.Eq a_1060 => GHC.Classes.Eq (Star a_1060) + +deriving instance GHC.Classes.Ord a_1061 => GHC.Classes.Ord (Star a_1061) + +deriving instance GHC.Show.Show a_1062 => GHC.Show.Show (Star a_1062) + +instance AST.Unmarshal.Unmarshal Star + +instance Data.Foldable.Foldable Star where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Star where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Star where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Strictconcat a = Strictconcat {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1063. + AST.Traversable1.Class.Traversable1 a_1063 + ) + +instance AST.Unmarshal.SymbolMatching Strictconcat where + matchedSymbols _ = [64] + showFailure _ node_1064 = + "expected " + GHC.Base.<> ( "strictconcat" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1064 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1064) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1065 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1066 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1067 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1068 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1065 + c1_1066 = TreeSitter.Node.nodeStartPoint node_1064 + TreeSitter.Node.TSPoint + r2_1067 + c2_1068 = TreeSitter.Node.nodeEndPoint node_1064 + +deriving instance GHC.Classes.Eq a_1069 => GHC.Classes.Eq (Strictconcat a_1069) + +deriving instance GHC.Classes.Ord a_1070 => GHC.Classes.Ord (Strictconcat a_1070) + +deriving instance GHC.Show.Show a_1071 => GHC.Show.Show (Strictconcat a_1071) + +instance AST.Unmarshal.Unmarshal Strictconcat + +instance Data.Foldable.Foldable Strictconcat where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Strictconcat where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Strictconcat where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Strictcount a = Strictcount {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1072. + AST.Traversable1.Class.Traversable1 a_1072 + ) + +instance AST.Unmarshal.SymbolMatching Strictcount where + matchedSymbols _ = [62] + showFailure _ node_1073 = + "expected " + GHC.Base.<> ( "strictcount" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1073 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1073) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1074 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1075 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1076 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1077 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1074 + c1_1075 = TreeSitter.Node.nodeStartPoint node_1073 + TreeSitter.Node.TSPoint + r2_1076 + c2_1077 = TreeSitter.Node.nodeEndPoint node_1073 + +deriving instance GHC.Classes.Eq a_1078 => GHC.Classes.Eq (Strictcount a_1078) + +deriving instance GHC.Classes.Ord a_1079 => GHC.Classes.Ord (Strictcount a_1079) + +deriving instance GHC.Show.Show a_1080 => GHC.Show.Show (Strictcount a_1080) + +instance AST.Unmarshal.Unmarshal Strictcount + +instance Data.Foldable.Foldable Strictcount where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Strictcount where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Strictcount where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Strictsum a = Strictsum {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1081. + AST.Traversable1.Class.Traversable1 a_1081 + ) + +instance AST.Unmarshal.SymbolMatching Strictsum where + matchedSymbols _ = [63] + showFailure _ node_1082 = + "expected " + GHC.Base.<> ( "strictsum" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1082 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1082) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1083 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1084 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1085 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1086 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1083 + c1_1084 = TreeSitter.Node.nodeStartPoint node_1082 + TreeSitter.Node.TSPoint + r2_1085 + c2_1086 = TreeSitter.Node.nodeEndPoint node_1082 + +deriving instance GHC.Classes.Eq a_1087 => GHC.Classes.Eq (Strictsum a_1087) + +deriving instance GHC.Classes.Ord a_1088 => GHC.Classes.Ord (Strictsum a_1088) + +deriving instance GHC.Show.Show a_1089 => GHC.Show.Show (Strictsum a_1089) + +instance AST.Unmarshal.Unmarshal Strictsum + +instance Data.Foldable.Foldable Strictsum where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Strictsum where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Strictsum where + traverse = AST.Traversable1.Class.traverseDefault1 + +data String a = String {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1090. + AST.Traversable1.Class.Traversable1 a_1090 + ) + +instance AST.Unmarshal.SymbolMatching String where + matchedSymbols _ = [34] + showFailure _ node_1091 = + "expected " + GHC.Base.<> ( "string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1091 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1091) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1092 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1093 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1094 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1095 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1092 + c1_1093 = TreeSitter.Node.nodeStartPoint node_1091 + TreeSitter.Node.TSPoint + r2_1094 + c2_1095 = TreeSitter.Node.nodeEndPoint node_1091 + +deriving instance GHC.Classes.Eq a_1096 => GHC.Classes.Eq (String a_1096) + +deriving instance GHC.Classes.Ord a_1097 => GHC.Classes.Ord (String a_1097) + +deriving instance GHC.Show.Show a_1098 => GHC.Show.Show (String a_1098) + +instance AST.Unmarshal.Unmarshal String + +instance Data.Foldable.Foldable String where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor String where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable String where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousString = AST.Token.Token "string" 29 + +data Sum a = Sum {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1099. + AST.Traversable1.Class.Traversable1 a_1099 + ) + +instance AST.Unmarshal.SymbolMatching Sum where + matchedSymbols _ = [66] + showFailure _ node_1100 = + "expected " + GHC.Base.<> ( "sum" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1100 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1100) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1101 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1102 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1103 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1104 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1101 + c1_1102 = TreeSitter.Node.nodeStartPoint node_1100 + TreeSitter.Node.TSPoint + r2_1103 + c2_1104 = TreeSitter.Node.nodeEndPoint node_1100 + +deriving instance GHC.Classes.Eq a_1105 => GHC.Classes.Eq (Sum a_1105) + +deriving instance GHC.Classes.Ord a_1106 => GHC.Classes.Ord (Sum a_1106) + +deriving instance GHC.Show.Show a_1107 => GHC.Show.Show (Sum a_1107) + +instance AST.Unmarshal.Unmarshal Sum + +instance Data.Foldable.Foldable Sum where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Sum where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Sum where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Super a = Super {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1108. + AST.Traversable1.Class.Traversable1 a_1108 + ) + +instance AST.Unmarshal.SymbolMatching Super where + matchedSymbols _ = [67] + showFailure _ node_1109 = + "expected " + GHC.Base.<> ( "super" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1109 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1109) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1110 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1111 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1112 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1113 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1110 + c1_1111 = TreeSitter.Node.nodeStartPoint node_1109 + TreeSitter.Node.TSPoint + r2_1112 + c2_1113 = TreeSitter.Node.nodeEndPoint node_1109 + +deriving instance GHC.Classes.Eq a_1114 => GHC.Classes.Eq (Super a_1114) + +deriving instance GHC.Classes.Ord a_1115 => GHC.Classes.Ord (Super a_1115) + +deriving instance GHC.Show.Show a_1116 => GHC.Show.Show (Super a_1116) + +instance AST.Unmarshal.Unmarshal Super + +instance Data.Foldable.Foldable Super where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Super where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Super where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousThen = AST.Token.Token "then" 14 + +data This a = This {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1117. + AST.Traversable1.Class.Traversable1 a_1117 + ) + +instance AST.Unmarshal.SymbolMatching This where + matchedSymbols _ = [68] + showFailure _ node_1118 = + "expected " + GHC.Base.<> ( "this" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1118 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1118) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1119 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1120 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1121 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1122 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1119 + c1_1120 = TreeSitter.Node.nodeStartPoint node_1118 + TreeSitter.Node.TSPoint + r2_1121 + c2_1122 = TreeSitter.Node.nodeEndPoint node_1118 + +deriving instance GHC.Classes.Eq a_1123 => GHC.Classes.Eq (This a_1123) + +deriving instance GHC.Classes.Ord a_1124 => GHC.Classes.Ord (This a_1124) + +deriving instance GHC.Show.Show a_1125 => GHC.Show.Show (This a_1125) + +instance AST.Unmarshal.Unmarshal This + +instance Data.Foldable.Foldable This where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor This where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable This where + traverse = AST.Traversable1.Class.traverseDefault1 + +data True a = True {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1126. + AST.Traversable1.Class.Traversable1 a_1126 + ) + +instance AST.Unmarshal.SymbolMatching True where + matchedSymbols _ = [69] + showFailure _ node_1127 = + "expected " + GHC.Base.<> ( "true" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1127 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1127) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1128 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1129 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1130 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1131 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1128 + c1_1129 = TreeSitter.Node.nodeStartPoint node_1127 + TreeSitter.Node.TSPoint + r2_1130 + c2_1131 = TreeSitter.Node.nodeEndPoint node_1127 + +deriving instance GHC.Classes.Eq a_1132 => GHC.Classes.Eq (True a_1132) + +deriving instance GHC.Classes.Ord a_1133 => GHC.Classes.Ord (True a_1133) + +deriving instance GHC.Show.Show a_1134 => GHC.Show.Show (True a_1134) + +instance AST.Unmarshal.Unmarshal True + +instance Data.Foldable.Foldable True where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor True where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable True where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Underscore a = Underscore {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1135. + AST.Traversable1.Class.Traversable1 a_1135 + ) + +instance AST.Unmarshal.SymbolMatching Underscore where + matchedSymbols _ = [75] + showFailure _ node_1136 = + "expected " + GHC.Base.<> ( "underscore" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1136 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1136) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1137 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1138 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1139 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1140 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1137 + c1_1138 = TreeSitter.Node.nodeStartPoint node_1136 + TreeSitter.Node.TSPoint + r2_1139 + c2_1140 = TreeSitter.Node.nodeEndPoint node_1136 + +deriving instance GHC.Classes.Eq a_1141 => GHC.Classes.Eq (Underscore a_1141) + +deriving instance GHC.Classes.Ord a_1142 => GHC.Classes.Ord (Underscore a_1142) + +deriving instance GHC.Show.Show a_1143 => GHC.Show.Show (Underscore a_1143) + +instance AST.Unmarshal.Unmarshal Underscore + +instance Data.Foldable.Foldable Underscore where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Underscore where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Underscore where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousWhere = AST.Token.Token "where" 11 + +type AnonymousLBrace = AST.Token.Token "{" 3 + +type AnonymousPipe = AST.Token.Token "|" 18 + +type AnonymousRBrace = AST.Token.Token "}" 4 diff --git a/semantic-codeql/src/Language/CodeQL/Grammar.hs b/semantic-codeql/src/Language/CodeQL/Grammar.hs new file mode 100644 index 0000000000..9cde66d48b --- /dev/null +++ b/semantic-codeql/src/Language/CodeQL/Grammar.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} +module Language.CodeQL.Grammar +( tree_sitter_ql +, Grammar(..) +) where + +import AST.Grammar.TH +import Language.Haskell.TH +import TreeSitter.QL (tree_sitter_ql) + +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData (mkName "Grammar") tree_sitter_ql diff --git a/semantic-codeql/src/Language/CodeQL/Tags.hs b/semantic-codeql/src/Language/CodeQL/Tags.hs new file mode 100644 index 0000000000..5e3cc19f28 --- /dev/null +++ b/semantic-codeql/src/Language/CodeQL/Tags.hs @@ -0,0 +1,259 @@ +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module Language.CodeQL.Tags + ( ToTags (..), + ) +where + +import AST.Element +import qualified AST.Parse as Parse +import AST.Token +import AST.Traversable1 +import Control.Effect.Reader +import Control.Effect.Writer +import Control.Effect.State +import Data.Foldable (for_) +import qualified Language.CodeQL.AST as CodeQL +import Proto.Semantic as P +import Source.Loc +import Source.Source as Source +import qualified Tags.Tagging.Precise as Tags + +class ToTags t where + tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m + ) => + t Loc -> + m () + default tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () + tags = gtags + +instance ToTags (Token sym n) where tags _ = pure () + +instance (ToTags l, ToTags r) => ToTags (l :+: r) where + tags (L1 l) = tags l + tags (R1 r) = tags r + +gtags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () +gtags = traverse1_ @ToTags (const (pure ())) tags + +instance ToTags CodeQL.Module where + tags + t@CodeQL.Module + { ann = Loc {byteRange}, + name = Parse.Success (CodeQL.ModuleName {extraChildren = Parse.Success (CodeQL.SimpleId {text, ann})}) + } = Tags.yield text P.MODULE P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags CodeQL.ClasslessPredicate where + tags + t@CodeQL.ClasslessPredicate + { ann = Loc {byteRange}, + name = Parse.Success (CodeQL.PredicateName {text, ann}) + } = Tags.yield text P.FUNCTION P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags CodeQL.AritylessPredicateExpr where + tags + t@CodeQL.AritylessPredicateExpr + { ann = Loc {byteRange}, + name = Parse.Success (CodeQL.LiteralId {text, ann}) + } = Tags.yield text P.CALL P.REFERENCE ann byteRange >> gtags t + tags _ = pure () + +instance ToTags CodeQL.Dataclass where + tags + t@CodeQL.Dataclass + { ann = Loc {byteRange}, + name = Parse.Success (CodeQL.ClassName {text, ann}) + } = Tags.yield text P.CLASS P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags CodeQL.MemberPredicate where + tags + t@CodeQL.MemberPredicate + { ann = Loc {byteRange}, + name = Parse.Success (CodeQL.PredicateName {text, ann}) + } = Tags.yield text P.METHOD P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags CodeQL.Datatype where + tags + t@CodeQL.Datatype + { ann = Loc {byteRange}, + name = Parse.Success (CodeQL.ClassName {text, ann}) + } = Tags.yield text P.CLASS P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags CodeQL.DatatypeBranch where + tags + t@CodeQL.DatatypeBranch + { ann = Loc {byteRange}, + name = Parse.Success (CodeQL.ClassName {text, ann}) + } = Tags.yield text P.CLASS P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags CodeQL.ClasslessPredicateCall where + tags + CodeQL.ClasslessPredicateCall + { extraChildren + } = for_ extraChildren $ \x -> case x of + EPrj t@CodeQL.AritylessPredicateExpr {} -> tags t + _ -> pure () + +instance ToTags CodeQL.QualifiedRhs where + tags + t@CodeQL.QualifiedRhs + { ann = Loc {byteRange}, + name = expr + } = case expr of + Just (EPrj CodeQL.PredicateName {text, ann}) -> Tags.yield text P.CALL P.REFERENCE ann byteRange >> gtags t + _ -> gtags t + +instance ToTags CodeQL.TypeExpr where + tags + t@CodeQL.TypeExpr + { ann = Loc {byteRange}, + name = expr + } = case expr of + Just (EPrj CodeQL.ClassName {text, ann}) -> Tags.yield text P.TYPE P.REFERENCE ann byteRange >> gtags t + _ -> gtags t + +instance ToTags CodeQL.AddExpr +instance ToTags CodeQL.Addop +instance ToTags CodeQL.AggId +instance ToTags CodeQL.Aggregate +instance ToTags CodeQL.AnnotArg +instance ToTags CodeQL.Annotation +instance ToTags CodeQL.AnnotName +instance ToTags CodeQL.Any +instance ToTags CodeQL.As +instance ToTags CodeQL.Asc +instance ToTags CodeQL.AsExpr +instance ToTags CodeQL.AsExprs +instance ToTags CodeQL.Avg +instance ToTags CodeQL.Body +instance ToTags CodeQL.Bool +instance ToTags CodeQL.Boolean +instance ToTags CodeQL.Charpred +instance ToTags CodeQL.ClassMember +instance ToTags CodeQL.ClassName +instance ToTags CodeQL.Closure +instance ToTags CodeQL.Compop +instance ToTags CodeQL.CompTerm +instance ToTags CodeQL.Concat +instance ToTags CodeQL.Conjunction +instance ToTags CodeQL.Count +instance ToTags CodeQL.Class +instance ToTags CodeQL.DatatypeBranches +instance ToTags CodeQL.Date +instance ToTags CodeQL.Dbtype +instance ToTags CodeQL.Desc +instance ToTags CodeQL.Direction +instance ToTags CodeQL.Disjunction +instance ToTags CodeQL.Empty +instance ToTags CodeQL.Eq +instance ToTags CodeQL.Exists +instance ToTags CodeQL.ExprAggregateBody +instance ToTags CodeQL.Extends +instance ToTags CodeQL.False +instance ToTags CodeQL.Field +instance ToTags CodeQL.Float +instance ToTags CodeQL.Forall +instance ToTags CodeQL.Forex +instance ToTags CodeQL.FullAggregateBody +instance ToTags CodeQL.Ge +instance ToTags CodeQL.Gt +instance ToTags CodeQL.HigherOrderTerm +instance ToTags CodeQL.IfTerm +instance ToTags CodeQL.Implication +instance ToTags CodeQL.Import +instance ToTags CodeQL.ImportModuleExpr +instance ToTags CodeQL.Imprt +instance ToTags CodeQL.In +instance ToTags CodeQL.InExpr +instance ToTags CodeQL.InstanceOf +instance ToTags CodeQL.Instanceof +instance ToTags CodeQL.Integer +instance ToTags CodeQL.Le +instance ToTags CodeQL.Literal +instance ToTags CodeQL.LiteralId +instance ToTags CodeQL.Lt +instance ToTags CodeQL.Max +instance ToTags CodeQL.Mod +instance ToTags CodeQL.ModuleAliasBody +instance ToTags CodeQL.ModuleExpr +instance ToTags CodeQL.ModuleMember +instance ToTags CodeQL.ModuleName +instance ToTags CodeQL.Min +instance ToTags CodeQL.Minus +instance ToTags CodeQL.MulExpr +instance ToTags CodeQL.Mulop +instance ToTags CodeQL.Ne +instance ToTags CodeQL.Negation +instance ToTags CodeQL.Newtype +instance ToTags CodeQL.None +instance ToTags CodeQL.Not +instance ToTags CodeQL.OrderBy +instance ToTags CodeQL.OrderBys +instance ToTags CodeQL.ParExpr +instance ToTags CodeQL.Plus +instance ToTags CodeQL.Predicate +instance ToTags CodeQL.PredicateAliasBody +instance ToTags CodeQL.PredicateExpr +instance ToTags CodeQL.PredicateName +instance ToTags CodeQL.PrefixCast +instance ToTags CodeQL.Ql +instance ToTags CodeQL.Qldoc +instance ToTags CodeQL.QualifiedExpr +instance ToTags CodeQL.QualModuleExpr +instance ToTags CodeQL.Quantified +instance ToTags CodeQL.Quantifier +instance ToTags CodeQL.Range +instance ToTags CodeQL.Rank +instance ToTags CodeQL.Result +instance ToTags CodeQL.ReturnType +instance ToTags CodeQL.Select +instance ToTags CodeQL.SimpleId +instance ToTags CodeQL.Slash +instance ToTags CodeQL.SpecialCall +instance ToTags CodeQL.SpecialId +instance ToTags CodeQL.Star +instance ToTags CodeQL.Strictconcat +instance ToTags CodeQL.Strictcount +instance ToTags CodeQL.Strictsum +instance ToTags CodeQL.String +instance ToTags CodeQL.Sum +instance ToTags CodeQL.Super +instance ToTags CodeQL.SuperRef +instance ToTags CodeQL.This +instance ToTags CodeQL.True +instance ToTags CodeQL.TypeAliasBody +instance ToTags CodeQL.TypeLiteral +instance ToTags CodeQL.UnaryExpr +instance ToTags CodeQL.Underscore +instance ToTags CodeQL.Unop +instance ToTags CodeQL.VarDecl +instance ToTags CodeQL.Variable +instance ToTags CodeQL.VarName diff --git a/semantic-codeql/test/PreciseTest.hs b/semantic-codeql/test/PreciseTest.hs new file mode 100644 index 0000000000..325951759e --- /dev/null +++ b/semantic-codeql/test/PreciseTest.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-unused-imports #-} +module Main (main) where + +import AST.TestHelpers +import AST.Unmarshal +import qualified Language.CodeQL.AST as CodeQL +import Language.CodeQL.Grammar +import qualified System.Path.Fixture as Fixture +import Test.Tasty + +main :: IO () +main = do +#if BAZEL_BUILD + rf <- Fixture.create + let ?project = "external/tree-sitter-ql" + ?runfiles = rf + + let dirs = Fixture.absRelDir "test/corpus" +#else + dirs <- CodeQL.getTestCorpusDir +#endif + let parse = parseByteString @CodeQL.Ql @() tree_sitter_ql + + readCorpusFiles' dirs + >>= traverse (testCorpus parse) + >>= defaultMain . tests + +tests :: [TestTree] -> TestTree +tests = testGroup "tree-sitter-ql corpus tests" diff --git a/semantic-core/README.md b/semantic-core/README.md deleted file mode 100644 index 6ab2b99d8b..0000000000 --- a/semantic-core/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# semantic-core - -Semantic core intermediate language (experimental) - - -## Development - -This project consists of a Haskell package named `semantic-core`. The library’s sources are in [`src`][]. - -Development of `semantic-core` is typically done using `cabal new-build`: - -```shell -cabal new-build # build the library -cabal new-repl # load the package into ghci -cabal new-test # build and run the doctests -``` - -[`src`]: https://github.com/github/semantic/tree/master/semantic-core/src diff --git a/semantic-core/semantic-core.cabal b/semantic-core/semantic-core.cabal deleted file mode 100644 index 05cf971b23..0000000000 --- a/semantic-core/semantic-core.cabal +++ /dev/null @@ -1,80 +0,0 @@ -cabal-version: 2.2 - -name: semantic-core -version: 0.0.0.0 -synopsis: Semantic core intermediate language --- description: -homepage: https://github.com/github/semantic-core --- bug-reports: -license: MIT -license-file: LICENSE -author: Rob Rix -maintainer: robrix@github.com --- copyright: -category: Language -build-type: Simple -extra-source-files: README.md - -tested-with: GHC == 8.6.4 - -library - exposed-modules: Analysis.Concrete - , Analysis.Eval - , Analysis.FlowInsensitive - , Analysis.ImportGraph - , Analysis.ScopeGraph - , Analysis.Typecheck - , Control.Effect.Readline - , Data.Core - , Data.Core.Parser - , Data.Core.Pretty - , Data.File - , Data.Loc - , Data.Name - , Data.Stack - -- other-modules: - -- other-extensions: - build-depends: algebraic-graphs ^>= 0.3 - , base >= 4.12 && < 5 - , containers ^>= 0.6 - , directory ^>= 1.3 - , filepath ^>= 1.4 - , fused-effects ^>= 0.4 - , haskeline ^>= 0.7.5 - , parsers ^>= 0.12.10 - , prettyprinter ^>= 1.2.1 - , prettyprinter-ansi-terminal ^>= 1.1.1 - , recursion-schemes ^>= 5.1 - , semigroupoids ^>= 5.3 - , transformers ^>= 0.5.6 - , trifecta ^>= 2 - , unordered-containers ^>= 0.2.10 - hs-source-dirs: src - default-language: Haskell2010 - ghc-options: -Weverything -Wno-missing-local-signatures -Wno-missing-import-lists -Wno-implicit-prelude -Wno-safe -Wno-unsafe -Wno-name-shadowing -Wno-monomorphism-restriction -Wno-missed-specialisations -Wno-all-missed-specialisations - if (impl(ghc >= 8.6)) - ghc-options: -Wno-star-is-type - -test-suite doctest - type: exitcode-stdio-1.0 - main-is: Doctest.hs - build-depends: base >=4.9 && <4.13 - , doctest >=0.7 && <1.0 - , QuickCheck - , semantic-core - hs-source-dirs: test - default-language: Haskell2010 - -test-suite spec - type: exitcode-stdio-1.0 - main-is: Spec.hs - other-modules: Generators - build-depends: base - , semantic-core - , hedgehog >= 0.6 && <1 - , tasty >= 1.2 && <2 - , tasty-hedgehog >= 0.2 && <1 - , tasty-hunit >= 0.10 && <1 - , trifecta - hs-source-dirs: test - default-language: Haskell2010 diff --git a/semantic-core/src/Analysis/Concrete.hs b/semantic-core/src/Analysis/Concrete.hs deleted file mode 100644 index cb76d3a69d..0000000000 --- a/semantic-core/src/Analysis/Concrete.hs +++ /dev/null @@ -1,211 +0,0 @@ -{-# LANGUAGE FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, LambdaCase, MultiParamTypeClasses, NamedFieldPuns, RecordWildCards, TypeApplications, TypeOperators, UndecidableInstances #-} -module Analysis.Concrete -( Concrete(..) -, concrete -, concreteAnalysis -, heapGraph -, heapValueGraph -, heapAddressGraph -, addressStyle -) where - -import qualified Algebra.Graph as G -import qualified Algebra.Graph.Export.Dot as G -import Analysis.Eval -import Control.Applicative (Alternative (..)) -import Control.Effect -import Control.Effect.Fail -import Control.Effect.Fresh -import Control.Effect.NonDet -import Control.Effect.Reader hiding (Local) -import Control.Effect.State -import Control.Monad ((<=<), guard) -import qualified Data.Core as Core -import Data.File -import Data.Function (fix) -import qualified Data.IntMap as IntMap -import qualified Data.IntSet as IntSet -import Data.Loc -import qualified Data.Map as Map -import Data.Monoid (Alt(..)) -import Data.Name -import Prelude hiding (fail) - -type Precise = Int -type Env = Map.Map Name Precise - -newtype FrameId = FrameId { unFrameId :: Precise } - deriving (Eq, Ord, Show) - -data Concrete - = Closure Loc Name Core.Core Precise - | Unit - | Bool Bool - | String String - | Obj Frame - deriving (Eq, Ord, Show) - -objectFrame :: Concrete -> Maybe Frame -objectFrame (Obj frame) = Just frame -objectFrame _ = Nothing - -data Frame = Frame - { frameEdges :: [(Core.Edge, Precise)] - , frameSlots :: Env - } - deriving (Eq, Ord, Show) - -type Heap = IntMap.IntMap Concrete - - --- | Concrete evaluation of a term to a value. --- --- >>> snd (concrete [File (Loc "bool" emptySpan) (Core.Bool True)]) --- [Right (Bool True)] -concrete :: [File Core.Core] -> (Heap, [File (Either (Loc, String) Concrete)]) -concrete - = run - . runFresh - . runHeap - . traverse runFile - -runFile :: ( Carrier sig m - , Effect sig - , Member Fresh sig - , Member (Reader FrameId) sig - , Member (State Heap) sig - ) - => File Core.Core - -> m (File (Either (Loc, String) Concrete)) -runFile file = traverse run file - where run = runReader (fileLoc file) - . runFailWithLoc - . fix (eval concreteAnalysis) - -concreteAnalysis :: ( Carrier sig m - , Member Fresh sig - , Member (Reader Loc) sig - , Member (Reader FrameId) sig - , Member (State Heap) sig - , MonadFail m - ) - => Analysis Precise Concrete m -concreteAnalysis = Analysis{..} - where alloc _ = fresh - bind name addr = modifyCurrentFrame (updateFrameSlots (Map.insert name addr)) - lookupEnv n = do - FrameId frameAddr <- ask - val <- deref frameAddr - heap <- get - pure (val >>= lookupConcrete heap n) - deref = gets . IntMap.lookup - assign addr value = modify (IntMap.insert addr value) - abstract _ name body = do - loc <- ask - FrameId parentAddr <- ask - pure (Closure loc name body parentAddr) - apply eval (Closure loc name body parentAddr) a = do - frameAddr <- fresh - assign frameAddr (Obj (Frame [(Core.Lexical, parentAddr)] mempty)) - local (const loc) . (frameAddr ...) $ do - addr <- alloc name - assign addr a - bind name addr - eval body - apply _ f _ = fail $ "Cannot coerce " <> show f <> " to function" - unit = pure Unit - bool b = pure (Bool b) - asBool (Bool b) = pure b - asBool v = fail $ "Cannot coerce " <> show v <> " to Bool" - string s = pure (String s) - asString (String s) = pure s - asString v = fail $ "Cannot coerce " <> show v <> " to String" - -- FIXME: differential inheritance (reference fields instead of copying) - -- FIXME: copy non-lexical parents deeply? - frame = do - lexical <- asks unFrameId - pure (Obj (Frame [(Core.Lexical, lexical)] mempty)) - -- FIXME: throw an error - -- FIXME: support dynamic imports - edge e addr = modifyCurrentFrame (\ (Frame ps fs) -> Frame ((e, addr) : ps) fs) - addr ... m = local (const (FrameId addr)) m - - updateFrameSlots f frame = frame { frameSlots = f (frameSlots frame) } - - modifyCurrentFrame f = do - addr <- asks unFrameId - Just (Obj frame) <- deref addr - assign addr (Obj (f frame)) - - -lookupConcrete :: Heap -> Name -> Concrete -> Maybe Precise -lookupConcrete heap name = run . evalState IntSet.empty . runNonDet . inConcrete - where -- look up the name in a concrete value - inConcrete = inFrame <=< maybeA . objectFrame - -- look up the name in a specific 'Frame', with slots taking precedence over parents - inFrame (Frame ps fs) = maybeA (Map.lookup name fs) <|> getAlt (foldMap (Alt . inAddress . snd) ps) - -- look up the name in the value an address points to, if we haven’t already visited it - inAddress addr = do - visited <- get - guard (addr `IntSet.notMember` visited) - -- FIXME: throw an error if we can’t deref @addr@ - val <- maybeA (IntMap.lookup addr heap) - modify (IntSet.insert addr) - inConcrete val - maybeA = maybe empty pure - - -runHeap :: (Carrier sig m, Member Fresh sig) => ReaderC FrameId (StateC Heap m) a -> m (Heap, a) -runHeap m = do - addr <- fresh - runState (IntMap.singleton addr (Obj (Frame [] mempty))) (runReader (FrameId addr) m) - - --- | 'heapGraph', 'heapValueGraph', and 'heapAddressGraph' allow us to conveniently export SVGs of the heap: --- --- > Ξ» let (heap, res) = concrete [ruby] --- > Ξ» writeFile "/Users/rob/Desktop/heap.dot" (export (addressStyle heap) (heapAddressGraph heap)) --- > Ξ» :!dot -Tsvg < ~/Desktop/heap.dot > ~/Desktop/heap.svg -heapGraph :: (Precise -> Concrete -> a) -> (Either Core.Edge Name -> Precise -> G.Graph a) -> Heap -> G.Graph a -heapGraph vertex edge h = foldr (uncurry graph) G.empty (IntMap.toList h) - where graph k v rest = (G.vertex (vertex k v) `G.connect` outgoing v) `G.overlay` rest - outgoing = \case - Unit -> G.empty - Bool _ -> G.empty - String _ -> G.empty - Closure _ _ _ parentAddr -> edge (Left Core.Lexical) parentAddr - Obj frame -> fromFrame frame - fromFrame (Frame es ss) = foldr (G.overlay . uncurry (edge . Left)) (foldr (G.overlay . uncurry (edge . Right)) G.empty (Map.toList ss)) es - -heapValueGraph :: Heap -> G.Graph Concrete -heapValueGraph h = heapGraph (constΒ id) (const fromAddr) h - where fromAddr addr = maybe G.empty G.vertex (IntMap.lookup addr h) - -heapAddressGraph :: Heap -> G.Graph (EdgeType, Precise) -heapAddressGraph = heapGraph (\ addr v -> (Value v, addr)) (fmap G.vertex . (,) . either Edge Slot) - -addressStyle :: Heap -> G.Style (EdgeType, Precise) String -addressStyle heap = (G.defaultStyle vertex) { G.edgeAttributes } - where vertex (_, addr) = maybe (show addr <> " = ?") (((show addr <> " = ") <>) . fromConcrete) (IntMap.lookup addr heap) - edgeAttributes _ (Slot name, _) = ["label" G.:= fromName name] - edgeAttributes _ (Edge Core.Import, _) = ["color" G.:= "blue"] - edgeAttributes _ (Edge Core.Lexical, _) = ["color" G.:= "green"] - edgeAttributes _ _ = [] - fromConcrete = \case - Unit -> "()" - Bool b -> show b - String s -> show s - Closure (Loc p (Span s e)) n _ _ -> "\\\\ " <> fromName n <> " [" <> p <> ":" <> showPos s <> "-" <> showPos e <> "]" - Obj _ -> "{}" - showPos (Pos l c) = show l <> ":" <> show c - fromName (User s) = s - fromName (Gen sym) = fromGensym sym - fromName (Path p) = show p - fromGensym (Root s) = s - fromGensym (ss :/ (s, i)) = fromGensym ss <> "." <> s <> show i - -data EdgeType - = Edge Core.Edge - | Slot Name - | Value Concrete - deriving (Eq, Ord, Show) diff --git a/semantic-core/src/Analysis/Eval.hs b/semantic-core/src/Analysis/Eval.hs deleted file mode 100644 index 4e296e9a32..0000000000 --- a/semantic-core/src/Analysis/Eval.hs +++ /dev/null @@ -1,215 +0,0 @@ -{-# LANGUAGE FlexibleContexts, GeneralizedNewtypeDeriving, LambdaCase, RankNTypes, RecordWildCards #-} -module Analysis.Eval -( eval -, prog1 -, prog2 -, prog3 -, prog4 -, prog5 -, prog6 -, ruby -, Analysis(..) -) where - -import Control.Effect -import Control.Effect.Fail -import Control.Effect.Reader -import Control.Monad ((>=>)) -import Data.Core as Core -import Data.File -import Data.Functor -import Data.Loc -import Data.Maybe (fromJust) -import Data.Name -import GHC.Stack -import Prelude hiding (fail) - -eval :: (Carrier sig m, Member (Reader Loc) sig, MonadFail m) => Analysis address value m -> (Core -> m value) -> Core -> m value -eval Analysis{..} eval = \case - Var n -> lookupEnv' n >>= deref' n - Let n -> alloc n >>= bind n >> unit - a :>> b -> eval a >> eval b - Lam n b -> abstract eval n b - f :$ a -> do - f' <- eval f - a' <- eval a - apply eval f' a' - Unit -> unit - Bool b -> bool b - If c t e -> do - c' <- eval c >>= asBool - if c' then eval t else eval e - String s -> string s - Load p -> do - path <- eval p >>= asString - lookupEnv' (Path path) >>= deref' (Path path) - Edge e a -> ref a >>= edge e >> unit - Frame -> frame - a :. b -> do - a' <- ref a - a' ... eval b - a := b -> do - b' <- eval b - addr <- ref a - b' <$ assign addr b' - Ann loc c -> local (const loc) (eval c) - where freeVariable s = fail ("free variable: " <> s) - uninitialized s = fail ("uninitialized variable: " <> s) - invalidRef s = fail ("invalid ref: " <> s) - - lookupEnv' n = lookupEnv n >>= maybe (freeVariable (show n)) pure - deref' n = deref >=> maybe (uninitialized (show n)) pure - - ref = \case - Var n -> lookupEnv' n - Let n -> do - addr <- alloc n - addr <$ bind n addr - If c t e -> do - c' <- eval c >>= asBool - if c' then ref t else ref e - a :. b -> do - a' <- ref a - a' ... ref b - Ann loc c -> local (const loc) (ref c) - c -> invalidRef (show c) - - -prog1 :: File Core -prog1 = fromBody $ Lam foo - ( Let bar := Var foo - :>> If (Var bar) - (Bool False) - (Bool True)) - where (foo, bar) = (User "foo", User "bar") - -prog2 :: File Core -prog2 = fromBody $ fileBody prog1 :$ Bool True - -prog3 :: File Core -prog3 = fromBody $ lams [foo, bar, quux] - (If (Var quux) - (Var bar) - (Var foo)) - where (foo, bar, quux) = (User "foo", User "bar", User "quux") - -prog4 :: File Core -prog4 = fromBody - $ Let foo := Bool True - :>> If (Var foo) - (Bool True) - (Bool False) - where foo = User "foo" - -prog5 :: File Core -prog5 = fromBody - $ Let (User "mkPoint") := Lam (User "_x") (Lam (User "_y") - ( Let (User "x") := Var (User "_x") - :>> Let (User "y") := Var (User "_y"))) - :>> Let (User "point") := Var (User "mkPoint") :$ Bool True :$ Bool False - :>> Var (User "point") :. Var (User "x") - :>> Var (User "point") :. Var (User "y") := Var (User "point") :. Var (User "x") - -prog6 :: [File Core] -prog6 = - [ File (Loc "dep" (locSpan (fromJust here))) $ block - [ Let (Path "dep") := Frame - , Var (Path "dep") :. block - [ Let (User "var") := Bool True - ] - ] - , File (Loc "main" (locSpan (fromJust here))) $ block - [ Load (Var (Path "dep")) - , Let (User "thing") := Var (Path "dep") :. Var (User "var") - ] - ] - -ruby :: File Core -ruby = fromBody . ann . block $ - [ ann (Let (User "Class") := Frame) - , ann (Var (User "Class") :. - (ann (Let (User "new") := Lam (User "self") (block - [ ann (Let (User "instance") := Frame) - , ann (Var (User "instance") :. Edge Import (Var (User "self"))) - , ann (Var (User "instance") $$ "initialize") - ])))) - - , ann (Let (User "(Object)") := Frame) - , ann (Var (User "(Object)") :. ann (Edge Import (Var (User "Class")))) - , ann (Let (User "Object") := Frame) - , ann (Var (User "Object") :. block - [ ann (Edge Import (Var (User "(Object)"))) - , ann (Let (User "nil?") := Lam (User "_") false) - , ann (Let (User "initialize") := Lam (User "self") (Var (User "self"))) - , ann (Let __semantic_truthy := Lam (User "_") (Bool True)) - ]) - - , ann (Var (User "Class") :. Edge Import (Var (User "Object"))) - - , ann (Let (User "(NilClass)") := Frame) - , ann (Var (User "(NilClass)") :. block - [ ann (Edge Import (Var (User "Class"))) - , ann (Edge Import (Var (User "(Object)"))) - ]) - , ann (Let (User "NilClass") := Frame) - , ann (Var (User "NilClass") :. block - [ ann (Edge Import (Var (User "(NilClass)"))) - , ann (Edge Import (Var (User "Object"))) - , ann (Let (User "nil?") := Lam (User "_") true) - , ann (Let __semantic_truthy := Lam (User "_") (Bool False)) - ]) - - , ann (Let (User "(TrueClass)") := Frame) - , ann (Var (User "(TrueClass)") :. block - [ ann (Edge Import (Var (User "Class"))) - , ann (Edge Import (Var (User "(Object)"))) - ]) - , ann (Let (User "TrueClass") := Frame) - , ann (Var (User "TrueClass") :. block - [ ann (Edge Import (Var (User "(TrueClass)"))) - , ann (Edge Import (Var (User "Object"))) - ]) - - , ann (Let (User "(FalseClass)") := Frame) - , ann (Var (User "(FalseClass)") :. block - [ ann (Edge Import (Var (User "Class"))) - , ann (Edge Import (Var (User "(Object)"))) - ]) - , ann (Let (User "FalseClass") := Frame) - , ann (Var (User "FalseClass") :. block - [ ann (Edge Import (Var (User "(FalseClass)"))) - , ann (Edge Import (Var (User "Object"))) - , ann (Let __semantic_truthy := Lam (User "_") (Bool False)) - ]) - - , ann (Let (User "nil") := Var (User "NilClass") $$ "new") - , ann (Let (User "true") := Var (User "TrueClass") $$ "new") - , ann (Let (User "false") := Var (User "FalseClass") $$ "new") - - , ann (Let (User "require") := Lam (User "path") (Load (Var (User "path")))) - ] - where _nil = Var (User "nil") - true = Var (User "true") - false = Var (User "false") - self $$ method = annWith callStack $ Lam (User "_x") (Var (User "_x") :. Var (User method) :$ Var (User "_x")) :$ self - - __semantic_truthy = User "__semantic_truthy" - - -data Analysis address value m = Analysis - { alloc :: Name -> m address - , bind :: Name -> address -> m () - , lookupEnv :: Name -> m (Maybe address) - , deref :: address -> m (Maybe value) - , assign :: address -> value -> m () - , abstract :: (Core -> m value) -> Name -> Core -> m value - , apply :: (Core -> m value) -> value -> value -> m value - , unit :: m value - , bool :: Bool -> m value - , asBool :: value -> m Bool - , string :: String -> m value -- FIXME: Text - , asString :: value -> m String - , frame :: m value - , edge :: Edge -> address -> m () - , (...) :: forall a . address -> m a -> m a - } diff --git a/semantic-core/src/Analysis/FlowInsensitive.hs b/semantic-core/src/Analysis/FlowInsensitive.hs deleted file mode 100644 index 05e6faaea8..0000000000 --- a/semantic-core/src/Analysis/FlowInsensitive.hs +++ /dev/null @@ -1,91 +0,0 @@ -{-# LANGUAGE FlexibleContexts, ScopedTypeVariables #-} -module Analysis.FlowInsensitive -( Heap -, FrameId(..) -, convergeTerm -, cacheTerm -, runHeap -, foldMapA -) where - -import Control.Effect -import Control.Effect.Fresh -import Control.Effect.NonDet -import Control.Effect.Reader -import Control.Effect.State -import qualified Data.Core as Core -import qualified Data.Map as Map -import Data.Maybe (fromMaybe) -import Data.Monoid (Alt(..)) -import Data.Name -import qualified Data.Set as Set - -type Cache a = Map.Map Core.Core (Set.Set a) -type Heap a = Map.Map Name (Set.Set a) - -newtype FrameId = FrameId { unFrameId :: Name } - deriving (Eq, Ord, Show) - - -convergeTerm :: forall m sig a - . ( Carrier sig m - , Effect sig - , Member Fresh sig - , Member (State (Heap a)) sig - , Ord a - ) - => (Core.Core -> NonDetC (ReaderC (Cache a) (StateC (Cache a) m)) a) - -> Core.Core - -> m (Set.Set a) -convergeTerm eval body = do - heap <- get - (cache, _) <- converge (Map.empty :: Cache a, heap :: Heap a) $ \ (prevCache, _) -> runState Map.empty . runReader prevCache $ do - _ <- resetFresh . runNonDetM Set.singleton $ eval body - get - pure (fromMaybe mempty (Map.lookup body cache)) - -cacheTerm :: forall m sig a - . ( Alternative m - , Carrier sig m - , Member (Reader (Cache a)) sig - , Member (State (Cache a)) sig - , Ord a - ) - => (Core.Core -> m a) - -> (Core.Core -> m a) -cacheTerm eval term = do - cached <- gets (Map.lookup term) - case cached :: Maybe (Set.Set a) of - Just results -> foldMapA pure results - Nothing -> do - results <- asks (fromMaybe mempty . Map.lookup term) - modify (Map.insert term (results :: Set.Set a)) - result <- eval term - result <$ modify (Map.insertWith (<>) term (Set.singleton (result :: a))) - -runHeap :: (Carrier sig m, Member Naming sig) => ReaderC FrameId (StateC (Heap a) m) b -> m (Heap a, b) -runHeap m = do - addr <- Gen <$> gensym "root" - runState (Map.singleton addr Set.empty) (runReader (FrameId addr) m) - --- | Fold a collection by mapping each element onto an 'Alternative' action. -foldMapA :: (Alternative m, Foldable t) => (b -> m a) -> t b -> m a -foldMapA f = getAlt . foldMap (Alt . f) - -runNonDetM :: (Monoid b, Applicative m) => (a -> b) -> NonDetC m a -> m b -runNonDetM f (NonDetC m) = m (fmap . (<>) . f) (pure mempty) - --- | Iterate a monadic action starting from some initial seed until the results converge. --- --- This applies the Kleene fixed-point theorem to finitize a monotone action. cf https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem -converge :: (Eq a, Monad m) - => a -- ^ An initial seed value to iterate from. - -> (a -> m a) -- ^ A monadic action to perform at each iteration, starting from the result of the previous iteration or from the seed value for the first iteration. - -> m a -- ^ A computation producing the least fixed point (the first value at which the actions converge). -converge seed f = loop seed - where loop x = do - x' <- f x - if x' == x then - pure x - else - loop x' diff --git a/semantic-core/src/Analysis/ImportGraph.hs b/semantic-core/src/Analysis/ImportGraph.hs deleted file mode 100644 index 1176f8e904..0000000000 --- a/semantic-core/src/Analysis/ImportGraph.hs +++ /dev/null @@ -1,107 +0,0 @@ -{-# LANGUAGE FlexibleContexts, RecordWildCards #-} -module Analysis.ImportGraph -( ImportGraph -, importGraph -, importGraphAnalysis -) where - -import Analysis.Eval -import Analysis.FlowInsensitive -import Control.Applicative (Alternative(..)) -import Control.Effect -import Control.Effect.Fail -import Control.Effect.Fresh -import Control.Effect.Reader -import Control.Effect.State -import qualified Data.Core as Core -import Data.File -import Data.Foldable (fold) -import Data.Function (fix) -import Data.List.NonEmpty (nonEmpty) -import Data.Loc -import qualified Data.Map as Map -import Data.Name -import qualified Data.Set as Set -import Prelude hiding (fail) - -type ImportGraph = Map.Map FilePath (Set.Set FilePath) - -data Value = Value - { valueSemi :: Semi - , valueGraph :: ImportGraph - } - deriving (Eq, Ord, Show) - -instance Semigroup Value where - Value _ g1 <> Value _ g2 = Value Abstract (Map.unionWith (<>) g1 g2) - -instance Monoid Value where - mempty = Value Abstract mempty - -data Semi - = Closure Loc Name Core.Core Name - -- FIXME: Bound String values. - | String String - | Abstract - deriving (Eq, Ord, Show) - - -importGraph :: [File Core.Core] -> (Heap Value, [File (Either (Loc, String) Value)]) -importGraph - = run - . runFresh - . runNaming (Root "import-graph") - . runHeap - . traverse runFile - -runFile :: ( Carrier sig m - , Effect sig - , Member Fresh sig - , Member (Reader FrameId) sig - , Member (State (Heap Value)) sig - ) - => File Core.Core - -> m (File (Either (Loc, String) Value)) -runFile file = traverse run file - where run = runReader (fileLoc file) - . runFailWithLoc - . fmap fold - . convergeTerm (fix (cacheTerm . eval importGraphAnalysis)) - --- FIXME: decompose into a product domain and two atomic domains -importGraphAnalysis :: ( Alternative m - , Carrier sig m - , Member (Reader FrameId) sig - , Member (Reader Loc) sig - , Member (State (Heap Value)) sig - , MonadFail m - ) - => Analysis Name Value m -importGraphAnalysis = Analysis{..} - where alloc = pure - bind _ _ = pure () - lookupEnv = pure . Just - deref addr = gets (Map.lookup addr) >>= maybe (pure Nothing) (foldMapA (pure . Just)) . nonEmpty . maybe [] Set.toList - assign addr ty = modify (Map.insertWith (<>) addr (Set.singleton ty)) - abstract _ name body = do - loc <- ask - FrameId parentAddr <- ask - pure (Value (Closure loc name body parentAddr) mempty) - apply eval (Value (Closure loc name body _) _) a = local (const loc) $ do - addr <- alloc name - assign addr a - bind name addr - eval body - apply _ f _ = fail $ "Cannot coerce " <> show f <> " to function" - unit = pure mempty - bool _ = pure mempty - asBool _ = pure True <|> pure False - string s = pure (Value (String s) mempty) - asString (Value (String s) _) = pure s - asString _ = pure "" - frame = pure mempty - edge Core.Import (Path to) = do - Loc{locPath=from} <- ask - () <$ pure (Value Abstract (Map.singleton from (Set.singleton to))) - edge _ _ = pure () - _ ... m = m diff --git a/semantic-core/src/Analysis/ScopeGraph.hs b/semantic-core/src/Analysis/ScopeGraph.hs deleted file mode 100644 index 19fa1dcd1c..0000000000 --- a/semantic-core/src/Analysis/ScopeGraph.hs +++ /dev/null @@ -1,15 +0,0 @@ -module Analysis.ScopeGraph -( ScopeGraph -, Entry(..) -) where - -import Data.Loc -import qualified Data.Map as Map -import qualified Data.Set as Set - -data Entry = Entry - { entrySymbol :: String -- FIXME: Text - , entryLoc :: Loc - } - -type ScopeGraph = Map.Map Entry (Set.Set Entry) diff --git a/semantic-core/src/Analysis/Typecheck.hs b/semantic-core/src/Analysis/Typecheck.hs deleted file mode 100644 index 0fd2fe4457..0000000000 --- a/semantic-core/src/Analysis/Typecheck.hs +++ /dev/null @@ -1,256 +0,0 @@ -{-# LANGUAGE DeriveFunctor, FlexibleContexts, FlexibleInstances, LambdaCase, RecordWildCards, ScopedTypeVariables, TypeApplications #-} -module Analysis.Typecheck -( Monotype (..) -, Meta -, Polytype (PForAll, PBool, PFree, PArr) -, Scope -, Analysis.Typecheck.bind -, Analysis.Typecheck.instantiate -, typecheckingFlowInsensitive -, typecheckingAnalysis -) where - -import Analysis.Eval -import Analysis.FlowInsensitive -import Control.Applicative (Alternative (..)) -import Control.Effect -import Control.Effect.Fail -import Control.Effect.Fresh -import Control.Effect.Reader hiding (Local) -import Control.Effect.State -import Control.Monad (unless) -import qualified Data.Core as Core -import Data.File -import Data.Foldable (foldl', for_) -import Data.Function (fix) -import Data.Functor (($>)) -import qualified Data.IntMap as IntMap -import qualified Data.IntSet as IntSet -import Data.List.NonEmpty (nonEmpty) -import Data.Loc -import qualified Data.Map as Map -import Data.Name -import qualified Data.Set as Set -import Prelude hiding (fail) - -data Monotype a - = MBool - | MUnit - | MString - | MMeta a - | MFree Gensym - | MArr (Monotype a) (Monotype a) - | MRecord (Map.Map User (Monotype a)) - deriving (Eq, Functor, Ord, Show) - -type Meta = Int - -data Polytype - = PForAll Scope - | PUnit - | PBool - | PString - | PBound Int - | PFree Gensym - | PArr Polytype Polytype - | PRecord (Map.Map User Polytype) - deriving (Eq, Ord, Show) - -newtype Scope = Scope Polytype - deriving (Eq, Ord, Show) - -forAll :: Gensym -> Polytype -> Polytype -forAll n body = PForAll (Analysis.Typecheck.bind n body) - -forAlls :: Foldable t => t Gensym -> Polytype -> Polytype -forAlls ns body = foldr forAll body ns - -generalize :: (Carrier sig m, Member Naming sig) => Monotype Meta -> m Polytype -generalize ty = namespace "generalize" $ do - root <- gensym "" - pure (forAlls (map ((root :/) . (,) "") (IntSet.toList (mvs ty))) (fold root ty)) - where fold root = \case - MUnit -> PUnit - MBool -> PBool - MString -> PString - MMeta i -> PFree (root :/ ("", i)) - MFree n -> PFree n - MArr a b -> PArr (fold root a) (fold root b) - MRecord fs -> PRecord (fold root <$> fs) - --- | Bind occurrences of a 'Gensym' in a 'Polytype' term, producing a 'Scope' in which the 'Gensym' is bound. -bind :: Gensym -> Polytype -> Scope -bind name = Scope . substIn (\ i n -> if name == n then PBound i else PFree n) (const PBound) - --- | Substitute a 'Polytype' term for the free variable in a given 'Scope', producing a closed 'Polytype' term. -instantiate :: Polytype -> Scope -> Polytype -instantiate image (Scope body) = substIn (const PFree) (\ i j -> if i == j then image else PBound j) body - -substIn :: (Int -> Gensym -> Polytype) - -> (Int -> Int -> Polytype) - -> Polytype - -> Polytype -substIn free bound = go 0 - where go i (PFree name) = free i name - go i (PBound j) = bound i j - go i (PForAll (Scope body)) = PForAll (Scope (go (succ i) body)) - go _ PUnit = PUnit - go _ PBool = PBool - go _ PString = PString - go i (PArr a b) = PArr (go i a) (go i b) - go i (PRecord fs) = PRecord (go i <$> fs) - - -typecheckingFlowInsensitive :: [File Core.Core] -> (Heap (Monotype Meta), [File (Either (Loc, String) Polytype)]) -typecheckingFlowInsensitive - = run - . runFresh - . runNaming (Root "typechecking-flow-insensitive") - . runHeap - . (>>= traverse (traverse (traverse generalize))) - . traverse runFile - -runFile :: ( Carrier sig m - , Effect sig - , Member Fresh sig - , Member (State (Heap (Monotype Meta))) sig - ) - => File Core.Core - -> m (File (Either (Loc, String) (Monotype Meta))) -runFile file = traverse run file - where run - = (\ m -> do - (subst, t) <- m - modify @(Heap (Monotype Meta)) (substAll subst) - pure (substAll subst <$> t)) - . runState (mempty :: Substitution) - . runReader (fileLoc file) - . runFailWithLoc - . (\ m -> do - (cs, t) <- m - t <$ solve cs) - . runState (Set.empty :: Set.Set Constraint) - . (\ m -> do - v <- meta - bs <- m - v <$ for_ bs (unify v)) - . convergeTerm (fix (cacheTerm . eval typecheckingAnalysis)) - -typecheckingAnalysis :: (Alternative m, Carrier sig m, Member Fresh sig, Member (State (Set.Set Constraint)) sig, Member (State (Heap (Monotype Meta))) sig, MonadFail m) => Analysis Name (Monotype Meta) m -typecheckingAnalysis = Analysis{..} - where alloc = pure - bind _ _ = pure () - lookupEnv = pure . Just - deref addr = gets (Map.lookup addr) >>= maybe (pure Nothing) (foldMapA (pure . Just)) . nonEmpty . maybe [] Set.toList - assign addr ty = modify (Map.insertWith (<>) addr (Set.singleton ty)) - abstract eval name body = do - -- FIXME: construct the associated scope - addr <- alloc name - arg <- meta - assign addr arg - ty <- eval body - pure (MArr arg ty) - apply _ f a = do - _A <- meta - _B <- meta - unify (MArr _A _B) f - unify _A a - pure _B - unit = pure MUnit - bool _ = pure MBool - asBool b = unify MBool b >> pure True <|> pure False - string _ = pure MString - asString s = unify MString s *> pure "" - frame = fail "unimplemented" - edge _ _ = pure () - _ ... m = m - - -data Constraint = Monotype Meta :===: Monotype Meta - deriving (Eq, Ord, Show) - -infix 4 :===: - -data Solution - = Int := Monotype Meta - deriving (Eq, Ord, Show) - -infix 5 := - -meta :: (Carrier sig m, Member Fresh sig) => m (Monotype Meta) -meta = MMeta <$> fresh - -unify :: (Carrier sig m, Member (State (Set.Set Constraint)) sig) => Monotype Meta -> Monotype Meta -> m () -unify t1 t2 - | t1 == t2 = pure () - | otherwise = modify (<> Set.singleton (t1 :===: t2)) - -type Substitution = IntMap.IntMap (Monotype Meta) - -solve :: (Carrier sig m, Member (State Substitution) sig, MonadFail m) => Set.Set Constraint -> m () -solve cs = for_ cs solve - where solve = \case - -- FIXME: how do we enforce proper subtyping? row polymorphism or something? - MRecord f1 :===: MRecord f2 -> traverse solve (Map.intersectionWith (:===:) f1 f2) $> () - MArr a1 b1 :===: MArr a2 b2 -> solve (a1 :===: a2) *> solve (b1 :===: b2) - MMeta m1 :===: MMeta m2 | m1 == m2 -> pure () - MMeta m1 :===: t2 -> do - sol <- solution m1 - case sol of - Just (_ := t1) -> solve (t1 :===: t2) - Nothing | m1 `IntSet.member` mvs t2 -> fail ("Occurs check failure: " <> show m1 <> " :===: " <> show t2) - | otherwise -> modify (IntMap.insert m1 t2 . subst (m1 := t2)) - t1 :===: MMeta m2 -> solve (MMeta m2 :===: t1) - t1 :===: t2 -> unless (t1 == t2) $ fail ("Type mismatch:\nexpected: " <> show t1 <> "\n actual: " <> show t2) - - solution m = fmap (m :=) <$> gets (IntMap.lookup m) - -substAll :: Substitutable t => Substitution -> t -> t -substAll s a = foldl' (flip subst) a (map (uncurry (:=)) (IntMap.toList s)) - - -class FreeVariables t where - mvs :: t -> IntSet.IntSet - -instance FreeVariables (Monotype Meta) where - mvs MUnit = mempty - mvs MBool = mempty - mvs MString = mempty - mvs (MArr a b) = mvs a <> mvs b - mvs (MMeta m) = IntSet.singleton m - mvs (MFree _) = mempty - mvs (MRecord fs) = foldMap mvs fs - -instance FreeVariables Constraint where - mvs (t1 :===: t2) = mvs t1 <> mvs t2 - -class Substitutable t where - subst :: Solution -> t -> t - -instance Substitutable (Monotype Meta) where - subst s con = case con of - MUnit -> MUnit - MBool -> MBool - MString -> MString - MArr a b -> MArr (subst s a) (subst s b) - MMeta m' - | m := t <- s - , m == m' -> t - | otherwise -> MMeta m' - MFree n -> MFree n - MRecord fs -> MRecord (subst s <$> fs) - -instance Substitutable Constraint where - subst s (t1 :===: t2) = subst s t1 :===: subst s t2 - -instance Substitutable Solution where - subst s (m := t) = m := subst s t - -instance Substitutable a => Substitutable (IntMap.IntMap a) where - subst s = IntMap.map (subst s) - -instance (Ord a, Substitutable a) => Substitutable (Set.Set a) where - subst s = Set.map (subst s) - -instance Substitutable v => Substitutable (Map.Map k v) where - subst s = fmap (subst s) diff --git a/semantic-core/src/Control/Effect/Readline.hs b/semantic-core/src/Control/Effect/Readline.hs deleted file mode 100644 index b25b4f2856..0000000000 --- a/semantic-core/src/Control/Effect/Readline.hs +++ /dev/null @@ -1,121 +0,0 @@ -{-# LANGUAGE DeriveFunctor, ExistentialQuantification, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, KindSignatures, MultiParamTypeClasses, OverloadedStrings, RankNTypes, StandaloneDeriving, TypeApplications, TypeOperators, UndecidableInstances #-} - -module Control.Effect.Readline -( Readline (..) -, prompt -, print -, println -, askLine -, Line (..) -, increment -, ReadlineC (..) -, runReadline -, runReadlineWithHistory -, TransC (..) -, ControlIOC (..) -, runControlIO -) where - -import Prelude hiding (print) - -import Control.Effect.Carrier -import Control.Effect.Reader -import Control.Effect.Sum -import Control.Monad -import Control.Monad.IO.Class -import Control.Monad.Trans.Class -import Data.Coerce -import Data.Int -import Data.String -import Data.Text.Prettyprint.Doc -import Data.Text.Prettyprint.Doc.Render.Text -import System.Console.Haskeline hiding (Handler, handle) -import System.Directory -import System.FilePath - -data Readline (m :: * -> *) k - = Prompt String (Maybe String -> k) - | forall a . Print (Doc a) k - | AskLine (Line -> k) - -deriving instance Functor (Readline m) - -instance HFunctor Readline where - hmap _ = coerce - -instance Effect Readline where - handle state handler = coerce . fmap (handler . (<$ state)) - -prompt :: (IsString str, Member Readline sig, Carrier sig m) => String -> m (Maybe str) -prompt p = fmap fromString <$> send (Prompt p pure) - -print :: (Pretty a, Carrier sig m, Member Readline sig) => a -> m () -print s = send (Print (pretty s) (pure ())) - -println :: (Pretty a, Carrier sig m, Member Readline sig) => a -> m () -println s = print s >> print @String "\n" - -askLine :: (Carrier sig m, Member Readline sig) => m Line -askLine = send (AskLine pure) - -newtype Line = Line Int64 - -increment :: Line -> Line -increment (Line n) = Line (n + 1) - -newtype ReadlineC m a = ReadlineC { runReadlineC :: ReaderC Line (TransC InputT m) a } - deriving (Applicative, Functor, Monad, MonadIO) - -runReadline :: MonadException m => Prefs -> Settings m -> ReadlineC m a -> m a -runReadline prefs settings = runInputTWithPrefs prefs settings . runTransC . runReader (Line 0) . runReadlineC - -instance (Carrier sig m, Effect sig, MonadException m, MonadIO m) => Carrier (Readline :+: sig) (ReadlineC m) where - eff (L (Prompt prompt k)) = ReadlineC $ do - str <- lift (TransC (getInputLine (cyan <> prompt <> plain))) - local increment (runReadlineC (k str)) - where cyan = "\ESC[1;36m\STX" - plain = "\ESC[0m\STX" - eff (L (Print text k)) = liftIO (putDoc text) *> k - eff (L (AskLine k)) = ReadlineC ask >>= k - eff (R other) = ReadlineC (eff (R (handleCoercible other))) - -runReadlineWithHistory :: MonadException m => ReadlineC m a -> m a -runReadlineWithHistory block = do - homeDir <- liftIO $ getHomeDirectory - prefs <- liftIO $ readPrefs (homeDir ".haskeline") - let settingsDir = homeDir ".local/semantic-core" - settings = Settings - { complete = noCompletion - , historyFile = Just (settingsDir <> "/repl_history") - , autoAddHistory = True - } - liftIO $ createDirectoryIfMissing True settingsDir - - runReadline prefs settings block - --- | Promote a monad transformer into an effect. -newtype TransC t (m :: * -> *) a = TransC { runTransC :: t m a } - deriving (Applicative, Functor, Monad, MonadIO, MonadTrans) - -instance (Carrier sig m, Effect sig, Monad (t m), MonadTrans t) => Carrier sig (TransC t m) where - eff = TransC . join . lift . eff . handle (pure ()) (pure . (runTransC =<<)) - -runControlIO :: (forall x . m x -> IO x) -> ControlIOC m a -> m a -runControlIO handler = runReader (Handler handler) . runControlIOC - --- | This exists to work around the 'MonadException' constraint that haskeline entails. -newtype ControlIOC m a = ControlIOC { runControlIOC :: ReaderC (Handler m) m a } - deriving (Applicative, Functor, Monad, MonadIO) - -newtype Handler m = Handler (forall x . m x -> IO x) - -runHandler :: Handler m -> ControlIOC m a -> IO a -runHandler h@(Handler handler) = handler . runReader h . runControlIOC - -instance Carrier sig m => Carrier sig (ControlIOC m) where - eff op = ControlIOC (eff (R (handleCoercible op))) - -instance (Carrier sig m, MonadIO m) => MonadException (ControlIOC m) where - controlIO f = ControlIOC $ do - handler <- ask - liftIO (f (RunIO (fmap pure . runHandler handler)) >>= runHandler handler) diff --git a/semantic-core/src/Data/Core.hs b/semantic-core/src/Data/Core.hs deleted file mode 100644 index 6cb92dcd9f..0000000000 --- a/semantic-core/src/Data/Core.hs +++ /dev/null @@ -1,98 +0,0 @@ -{-# LANGUAGE DeriveTraversable, FlexibleContexts, LambdaCase, OverloadedStrings, RecordWildCards, TemplateHaskell, TypeFamilies #-} -module Data.Core -( Core(..) -, CoreF(..) -, Edge(..) -, lams -, ($$*) -, unapply -, unapplies -, block -, ann -, annWith -, stripAnnotations -) where - -import Control.Applicative (Alternative (..)) -import Data.Functor.Foldable hiding (ListF(..)) -import Data.Functor.Foldable.TH -import Data.Foldable (foldl') -import Data.Loc -import Data.Name -import Data.Stack -import GHC.Stack - -data Edge = Lexical | Import - deriving (Eq, Ord, Show) - -data Core - = Var Name - | Let Name - -- | Sequencing without binding; analogous to '>>' or '*>'. - | Core :>> Core - | Lam Name Core - -- | Function application; analogous to '$'. - | Core :$ Core - | Unit - | Bool Bool - | If Core Core Core - | String String -- FIXME: Text - -- | Load the specified file (by path). - | Load Core - | Edge Edge Core - -- | Allocation of a new frame. - | Frame - | Core :. Core - -- | Assignment of a value to the reference returned by the lhs. - | Core := Core - | Ann Loc Core - deriving (Eq, Ord, Show) - -infixl 2 :$ -infixr 1 :>> -infix 3 := -infixl 4 :. - -makeBaseFunctor ''Core - -infixl 2 :$$ -infixr 1 :>>$ -infix 3 :=$ -infixl 4 :.$ - -instance Semigroup Core where - (<>) = (:>>) - -lams :: Foldable t => t Name -> Core -> Core -lams names body = foldr Lam body names - --- | Application of a function to a sequence of arguments. -($$*) :: Foldable t => Core -> t Core -> Core -($$*) = foldl' (:$) - -infixl 9 $$* - -unapply :: Alternative m => Core -> m (Core, Core) -unapply (f :$ a) = pure (f, a) -unapply _ = empty - -unapplies :: Core -> (Core, Stack Core) -unapplies core = case unapply core of - Just (f, a) -> (:> a) <$> unapplies f - Nothing -> (core, Nil) - -block :: Foldable t => t Core -> Core -block cs - | null cs = Unit - | otherwise = foldr1 (:>>) cs - -ann :: HasCallStack => Core -> Core -ann = annWith callStack - -annWith :: CallStack -> Core -> Core -annWith callStack c = maybe c (flip Ann c) (stackLoc callStack) - -stripAnnotations :: Core -> Core -stripAnnotations = cata go where - go (AnnF _ item) = item - go item = embed item diff --git a/semantic-core/src/Data/Core/Parser.hs b/semantic-core/src/Data/Core/Parser.hs deleted file mode 100644 index 4e8df75706..0000000000 --- a/semantic-core/src/Data/Core/Parser.hs +++ /dev/null @@ -1,115 +0,0 @@ -module Data.Core.Parser - ( module Text.Trifecta - , core - , lit - , expr - , lvalue - ) where - --- Consult @doc/grammar.md@ for an EBNF grammar. - -import Control.Applicative -import qualified Data.Char as Char -import Data.Core -import Data.Name -import Data.Semigroup -import Data.String -import qualified Text.Parser.Token as Token -import qualified Text.Parser.Token.Highlight as Highlight -import Text.Trifecta hiding (ident) - --- * Identifier styles and derived parsers - -validIdentifierStart :: Char -> Bool -validIdentifierStart c = not (Char.isDigit c) && isSimpleCharacter c - -coreIdents :: TokenParsing m => IdentifierStyle m -coreIdents = Token.IdentifierStyle - { _styleName = "core" - , _styleStart = satisfy validIdentifierStart - , _styleLetter = satisfy isSimpleCharacter - , _styleReserved = reservedNames - , _styleHighlight = Highlight.Identifier - , _styleReservedHighlight = Highlight.ReservedIdentifier - } - -reserved :: (TokenParsing m, Monad m) => String -> m () -reserved = Token.reserve coreIdents - -identifier :: (TokenParsing m, Monad m, IsString s) => m s -identifier = choice [quote, plain] "identifier" where - plain = Token.ident coreIdents - quote = between (string "#{") (symbol "}") (fromString <$> some (noneOf "{}")) - --- * Parsers (corresponding to EBNF) - -core :: (TokenParsing m, Monad m) => m Core -core = expr - -expr :: (TokenParsing m, Monad m) => m Core -expr = atom `chainl1` go where - go = choice [ (:.) <$ dot - , (:$) <$ notFollowedBy dot - ] - -atom :: (TokenParsing m, Monad m) => m Core -atom = choice - [ comp - , ifthenelse - , edge - , lit - , ident - , assign - , parens expr - ] - -comp :: (TokenParsing m, Monad m) => m Core -comp = braces (sconcat <$> sepEndByNonEmpty expr semi) "compound statement" - -ifthenelse :: (TokenParsing m, Monad m) => m Core -ifthenelse = If - <$ reserved "if" <*> core - <* reserved "then" <*> core - <* reserved "else" <*> core - "if-then-else statement" - -assign :: (TokenParsing m, Monad m) => m Core -assign = (:=) <$> try (lvalue <* symbolic '=') <*> core "assignment" - -edge :: (TokenParsing m, Monad m) => m Core -edge = kw <*> expr where kw = choice [ Edge Lexical <$ reserved "lexical" - , Edge Import <$ reserved "import" - , Load <$ reserved "load" - ] - -lvalue :: (TokenParsing m, Monad m) => m Core -lvalue = choice - [ Let <$ reserved "let" <*> name - , ident - , parens expr - ] - --- * Literals - -name :: (TokenParsing m, Monad m) => m Name -name = choice [regular, strpath] "name" where - regular = User <$> identifier - strpath = Path <$> between (symbolic '"') (symbolic '"') (some $ noneOf "\"") - -lit :: (TokenParsing m, Monad m) => m Core -lit = let x `given` n = x <$ reserved n in choice - [ Bool True `given` "#true" - , Bool False `given` "#false" - , Unit `given` "#unit" - , Frame `given` "#frame" - , lambda - ] "literal" - -lambda :: (TokenParsing m, Monad m) => m Core -lambda = Lam <$ lambduh <*> name <* arrow <*> core "lambda" where - lambduh = symbolic 'Ξ»' <|> symbolic '\\' - arrow = symbol "β†’" <|> symbol "->" - -ident :: (Monad m, TokenParsing m) => m Core -ident = Var <$> name "identifier" - diff --git a/semantic-core/src/Data/Core/Pretty.hs b/semantic-core/src/Data/Core/Pretty.hs deleted file mode 100644 index 0229769079..0000000000 --- a/semantic-core/src/Data/Core/Pretty.hs +++ /dev/null @@ -1,130 +0,0 @@ -{-# LANGUAGE FlexibleContexts, LambdaCase, OverloadedStrings, TypeApplications #-} - -module Data.Core.Pretty - ( showCore - , printCore - , showFile - , printFile - , prettyCore - ) where - -import Control.Effect -import Control.Effect.Reader -import Data.Core -import Data.File -import Data.Functor.Foldable -import Data.Name -import Data.Text.Prettyprint.Doc (Pretty (..), annotate, softline, (<+>)) -import qualified Data.Text.Prettyprint.Doc as Pretty -import qualified Data.Text.Prettyprint.Doc.Render.String as Pretty -import qualified Data.Text.Prettyprint.Doc.Render.Terminal as Pretty - -showCore :: Core -> String -showCore = Pretty.renderString . Pretty.layoutSmart Pretty.defaultLayoutOptions . Pretty.unAnnotate . prettyCore Ascii - -printCore :: Core -> IO () -printCore p = Pretty.putDoc (prettyCore Unicode p) *> putStrLn "" - -showFile :: File Core -> String -showFile = showCore . fileBody - -printFile :: File Core -> IO () -printFile = printCore . fileBody - -type AnsiDoc = Pretty.Doc Pretty.AnsiStyle - -keyword, symbol, strlit, primitive :: AnsiDoc -> AnsiDoc -keyword = annotate (Pretty.colorDull Pretty.Cyan) -symbol = annotate (Pretty.color Pretty.Yellow) -strlit = annotate (Pretty.colorDull Pretty.Green) -primitive = keyword . mappend "#" - -type Prec = Int - -data Style = Unicode | Ascii - -lambda, arrow :: (Member (Reader Style) sig, Carrier sig m) => m AnsiDoc -lambda = ask @Style >>= \case - Unicode -> pure $ symbol "Ξ»" - Ascii -> pure $ symbol "\\" -arrow = ask @Style >>= \case - Unicode -> pure $ symbol "β†’" - Ascii -> pure $ symbol "->" - -name :: Name -> AnsiDoc -name = \case - Gen p -> pretty p - Path p -> strlit (Pretty.viaShow p) - User n -> encloseIf (needsQuotation n) (symbol "#{") (symbol "}") (pretty n) - -with :: (Member (Reader Prec) sig, Carrier sig m) => Prec -> m a -> m a -with n = local (const n) - -inParens :: (Member (Reader Prec) sig, Carrier sig m) => Prec -> m AnsiDoc -> m AnsiDoc -inParens amount go = do - prec <- ask - body <- with amount go - pure (encloseIf (amount >= prec) (symbol "(") (symbol ")") body) - -encloseIf :: Monoid m => Bool -> m -> m -> m -> m -encloseIf True l r x = l <> x <> r -encloseIf False _ _ x = x - -prettify :: (Member (Reader Prec) sig, Member (Reader Style) sig, Carrier sig m) - => CoreF (m AnsiDoc) - -> m AnsiDoc -prettify = \case - VarF a -> pure $ name a - LetF a -> pure $ keyword "let" <+> name a - a :>>$ b -> do - prec <- ask @Prec - fore <- with 12 a - aft <- with 12 b - - let open = symbol ("{" <> softline) - close = symbol (softline <> "}") - separator = ";" <> Pretty.line - body = fore <> separator <> aft - - pure . Pretty.align $ encloseIf (12 > prec) open close (Pretty.align body) - - LamF x f -> inParens 11 $ do - body <- f - lam <- lambda - arr <- arrow - pure (lam <> name x <+> arr <+> body) - - FrameF -> pure $ primitive "frame" - UnitF -> pure $ primitive "unit" - BoolF b -> pure $ primitive (if b then "true" else "false") - StringF s -> pure . strlit $ Pretty.viaShow s - - f :$$ x -> inParens 11 $ (<+>) <$> f <*> x - - IfF con tru fal -> do - con' <- "if" `appending` con - tru' <- "then" `appending` tru - fal' <- "else" `appending` fal - pure $ Pretty.sep [con', tru', fal'] - - LoadF p -> "load" `appending` p - EdgeF Lexical n -> "lexical" `appending` n - EdgeF Import n -> "import" `appending` n - item :.$ body -> inParens 5 $ do - f <- item - g <- body - pure (f <> symbol "." <> g) - - lhs :=$ rhs -> inParens 4 $ do - f <- lhs - g <- rhs - pure (f <+> symbol "=" <+> g) - - -- Annotations are not pretty-printed, as it lowers the signal/noise ratio too profoundly. - AnnF _ c -> c - -appending :: Functor f => AnsiDoc -> f AnsiDoc -> f AnsiDoc -appending k item = (keyword k <+>) <$> item - -prettyCore :: Style -> Core -> AnsiDoc -prettyCore s = run . runReader @Prec 0 . runReader s . cata prettify diff --git a/semantic-core/src/Data/File.hs b/semantic-core/src/Data/File.hs deleted file mode 100644 index 84f39781e0..0000000000 --- a/semantic-core/src/Data/File.hs +++ /dev/null @@ -1,18 +0,0 @@ -{-# LANGUAGE DeriveTraversable #-} -module Data.File -( File(..) -, fromBody -) where - -import Data.Loc -import Data.Maybe (fromJust) -import GHC.Stack - -data File a = File - { fileLoc :: !Loc - , fileBody :: !a - } - deriving (Eq, Foldable, Functor, Ord, Show, Traversable) - -fromBody :: HasCallStack => a -> File a -fromBody body = File (fromJust (stackLoc callStack)) body diff --git a/semantic-core/src/Data/Loc.hs b/semantic-core/src/Data/Loc.hs deleted file mode 100644 index f9c3b504f1..0000000000 --- a/semantic-core/src/Data/Loc.hs +++ /dev/null @@ -1,77 +0,0 @@ -{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, OverloadedStrings, RecordWildCards, TypeOperators, UndecidableInstances #-} -module Data.Loc -( Loc(..) -, Span(..) -, emptySpan -, Pos(..) -, here -, stackLoc -, FailWithLocC(..) -, runFailWithLoc -) where - -import Control.Applicative -import Control.Effect.Carrier -import Control.Effect.Error -import Control.Effect.Fail -import Control.Effect.Reader -import Control.Effect.Sum -import Data.Text.Prettyprint.Doc (Pretty (..)) -import GHC.Stack -import Prelude hiding (fail) - -data Loc = Loc - { locPath :: !FilePath - , locSpan :: {-# UNPACK #-} !Span - } - deriving (Eq, Ord, Show) - - -data Span = Span - { spanStart :: {-# UNPACK #-} !Pos - , spanEnd :: {-# UNPACK #-} !Pos - } - deriving (Eq, Ord, Show) - -instance Pretty Span where - pretty (Span s e) = pretty s <> "-" <> pretty e - -emptySpan :: Span -emptySpan = Span (Pos 1 1) (Pos 1 1) - -data Pos = Pos - { posLine :: {-# UNPACK #-} !Int - , posCol :: {-# UNPACK #-} !Int - } - deriving (Eq, Ord, Show) - -instance Pretty Pos where - pretty (Pos l c) = pretty l <> ":" <> pretty c - - -here :: HasCallStack => Maybe Loc -here = stackLoc callStack - -stackLoc :: CallStack -> Maybe Loc -stackLoc cs = case getCallStack cs of - (_, srcLoc):_ -> Just (fromGHCSrcLoc srcLoc) - _ -> Nothing - -fromGHCSrcLoc :: SrcLoc -> Loc -fromGHCSrcLoc SrcLoc{..} = Loc srcLocFile (Span (Pos srcLocStartLine srcLocStartCol) (Pos srcLocEndLine srcLocEndCol)) - - -runFailWithLoc :: FailWithLocC m a -> m (Either (Loc, String) a) -runFailWithLoc = runError . runFailWithLocC - -newtype FailWithLocC m a = FailWithLocC { runFailWithLocC :: ErrorC (Loc, String) m a } - deriving (Alternative, Applicative, Functor, Monad) - -instance (Carrier sig m, Effect sig, Member (Reader Loc) sig) => MonadFail (FailWithLocC m) where - fail s = do - loc <- ask - FailWithLocC (throwError (loc :: Loc, s)) - -instance (Carrier sig m, Effect sig, Member (Reader Loc) sig) => Carrier (Fail :+: sig) (FailWithLocC m) where - eff (L (Fail s)) = fail s - eff (R other) = FailWithLocC (eff (R (handleCoercible other))) diff --git a/semantic-core/src/Data/Name.hs b/semantic-core/src/Data/Name.hs deleted file mode 100644 index ccffcb30c9..0000000000 --- a/semantic-core/src/Data/Name.hs +++ /dev/null @@ -1,124 +0,0 @@ -{-# LANGUAGE DeriveFunctor, ExistentialQuantification, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, LambdaCase, MultiParamTypeClasses, OverloadedLists, OverloadedStrings,StandaloneDeriving, TypeOperators, UndecidableInstances #-} -module Data.Name -( User -, Namespaced -, Name(..) -, reservedNames -, isSimpleCharacter -, needsQuotation -, Gensym(..) -, (//) -, gensym -, namespace -, Naming(..) -, runNaming -, NamingC(..) -) where - -import Control.Applicative -import Control.Effect -import Control.Effect.Carrier -import Control.Effect.Reader -import Control.Effect.State -import Control.Effect.Sum -import Control.Monad.Fail -import Control.Monad.IO.Class -import qualified Data.Char as Char -import Data.HashSet (HashSet) -import qualified Data.HashSet as HashSet -import Data.Text.Prettyprint.Doc (Pretty (..)) -import qualified Data.Text.Prettyprint.Doc as Pretty - --- | User-specified and -relevant names. -type User = String - --- | The type of namespaced actions, i.e. actions occurring within some outer name. --- --- This corresponds to the @Agent@ type synonym described in /I Am Not a Numberβ€”I Am a Free Variable/. -type Namespaced a = Gensym -> a - -data Name - -- | A locally-bound, machine-generatable name. - -- - -- This should be used for locals, function parameters, and similar names which can’t escape their defining scope. - = Gen Gensym - -- | A name provided by a user. - -- - -- This should be used for names which the user provided and which other code (other functions, other modules, other packages) could call, e.g. declaration names. - | User User - -- | A variable name represented as the path to a source file. Used for loading modules at a specific name. - | Path FilePath - deriving (Eq, Ord, Show) - -instance Pretty Name where - pretty = \case - Gen p -> pretty p - User n -> pretty n - Path p -> pretty (show p) - -reservedNames :: HashSet User -reservedNames = [ "#true", "#false", "let", "#frame", "if", "then", "else" - , "lexical", "import", "#unit", "load"] - --- | Returns true if any character would require quotation or if the --- name conflicts with a Core primitive. -needsQuotation :: User -> Bool -needsQuotation u = HashSet.member u reservedNames || any (not . isSimpleCharacter) u - --- | A β€˜simple’ character is, loosely defined, a character that is compatible --- with identifiers in most ASCII-oriented programming languages. This is defined --- as the alphanumeric set plus @$@ and @_@. -isSimpleCharacter :: Char -> Bool -isSimpleCharacter = \case - '$' -> True -- common in JS - '_' -> True - '?' -> True -- common in Ruby - c -> Char.isAlphaNum c - -data Gensym - = Root String - | Gensym :/ (String, Int) - deriving (Eq, Ord, Show) - -instance Pretty Gensym where - pretty = \case - Root s -> pretty s - p :/ (n, x) -> Pretty.hcat [pretty p, "/", pretty n, "^", pretty x] - -(//) :: Gensym -> String -> Gensym -root // s = root :/ (s, 0) - -infixl 6 // - -gensym :: (Carrier sig m, Member Naming sig) => String -> m Gensym -gensym s = send (Gensym s pure) - -namespace :: (Carrier sig m, Member Naming sig) => String -> m a -> m a -namespace s m = send (Namespace s m pure) - - -data Naming m k - = Gensym String (Gensym -> k) - | forall a . Namespace String (m a) (a -> k) - -deriving instance Functor (Naming m) - -instance HFunctor Naming where - hmap _ (Gensym s k) = Gensym s k - hmap f (Namespace s m k) = Namespace s (f m) k - -instance Effect Naming where - handle state handler (Gensym s k) = Gensym s (handler . (<$ state) . k) - handle state handler (Namespace s m k) = Namespace s (handler (m <$ state)) (handler . fmap k) - - -runNaming :: Functor m => Gensym -> NamingC m a -> m a -runNaming root = runReader root . evalState 0 . runNamingC - -newtype NamingC m a = NamingC { runNamingC :: StateC Int (ReaderC Gensym m) a } - deriving (Alternative, Applicative, Functor, Monad, MonadFail, MonadIO) - -instance (Carrier sig m, Effect sig) => Carrier (Naming :+: sig) (NamingC m) where - eff (L (Gensym s k)) = NamingC (StateC (\ i -> (:/ (s, i)) <$> ask >>= runState (succ i) . runNamingC . k)) - eff (L (Namespace s m k)) = NamingC (StateC (\ i -> local (// s) (evalState 0 (runNamingC m)) >>= runState i . runNamingC . k)) - eff (R other) = NamingC (eff (R (R (handleCoercible other)))) diff --git a/semantic-core/src/Data/Stack.hs b/semantic-core/src/Data/Stack.hs deleted file mode 100644 index 71fec9dc25..0000000000 --- a/semantic-core/src/Data/Stack.hs +++ /dev/null @@ -1,18 +0,0 @@ -{-# LANGUAGE DeriveTraversable #-} -module Data.Stack -( Stack(..) -) where - -data Stack a - = Nil - | Stack a :> a - deriving (Eq, Foldable, Functor, Ord, Show, Traversable) - -infixl 4 :> - -instance Semigroup (Stack a) where - xs <> Nil = xs - xs <> (ys :> y) = (xs <> ys) :> y - -instance Monoid (Stack a) where - mempty = Nil diff --git a/semantic-core/test/Doctest.hs b/semantic-core/test/Doctest.hs deleted file mode 100644 index d4f4586570..0000000000 --- a/semantic-core/test/Doctest.hs +++ /dev/null @@ -1,12 +0,0 @@ -module Main -( main -) where - -import System.Environment -import Test.DocTest - -main :: IO () -main = do - args <- getArgs - autogen <- fmap (<> "/build/doctest/autogen") <$> lookupEnv "HASKELL_DIST_DIR" - doctest (maybe id ((:) . ("-i" <>)) autogen ("-isrc" : "--fast" : if null args then ["src"] else args)) diff --git a/semantic-core/test/Generators.hs b/semantic-core/test/Generators.hs deleted file mode 100644 index 72c6e79447..0000000000 --- a/semantic-core/test/Generators.hs +++ /dev/null @@ -1,56 +0,0 @@ -{-# LANGUAGE ScopedTypeVariables #-} - -module Generators - ( literal - , name - , variable - , boolean - , lambda - , apply - , ifthenelse - ) where - -import Prelude hiding (span) - -import Hedgehog hiding (Var) -import qualified Hedgehog.Gen as Gen -import qualified Hedgehog.Range as Range - -import Data.Core -import Data.Name - --- The 'prune' call here ensures that we don't spend all our time just generating --- fresh names for variables, since the length of variable names is not an --- interesting property as they parse regardless. -name :: MonadGen m => m Name -name = Gen.prune (User <$> names) where - names = Gen.string (Range.linear 1 10) Gen.lower - -boolean :: MonadGen m => m Core -boolean = Bool <$> Gen.bool - -variable :: MonadGen m => m Core -variable = Var <$> name - -ifthenelse :: MonadGen m => m Core -> m Core -ifthenelse bod = Gen.subterm3 boolean bod bod If - -apply :: MonadGen m => m Core -> m Core -apply gen = go where - go = Gen.recursive - Gen.choice - [ Gen.subterm2 gen gen (:$)] - [ Gen.subterm2 go go (:$) -- balanced - , Gen.subtermM go (\x -> Lam <$> name <*> pure x) - ] - -lambda :: MonadGen m => m Core -> m Core -lambda bod = do - arg <- name - Gen.subterm bod (Lam arg) - -atoms :: MonadGen m => [m Core] -atoms = [boolean, variable, pure Unit, pure Frame] - -literal :: MonadGen m => m Core -literal = Gen.recursive Gen.choice atoms [lambda literal] diff --git a/semantic-core/test/Spec.hs b/semantic-core/test/Spec.hs deleted file mode 100644 index edc49efb0e..0000000000 --- a/semantic-core/test/Spec.hs +++ /dev/null @@ -1,127 +0,0 @@ -{-# LANGUAGE OverloadedStrings, TypeApplications #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} - -module Main (main) where - -import Data.String -import qualified Text.Trifecta as Trifecta - -import Hedgehog hiding (Var) -import Test.Tasty -import Test.Tasty.Hedgehog -import Test.Tasty.HUnit - -import Data.File -import qualified Generators as Gen -import qualified Analysis.Eval as Eval -import Data.Core -import Data.Core.Pretty -import Data.Core.Parser as Parse -import Data.Name - --- * Helpers - -true, false :: Core -true = Bool True -false = Bool False - -instance IsString Name where fromString = User - -parseEither :: Trifecta.Parser a -> String -> Either String a -parseEither p = Trifecta.foldResult (Left . show . Trifecta._errDoc) Right . Trifecta.parseString (p <* Trifecta.eof) mempty - --- * Parser roundtripping properties. Note that parsing and prettyprinting is generally --- not a roundtrip, because the parser inserts 'Ann' nodes itself. - -prop_roundtrips :: Gen Core -> Property -prop_roundtrips gen = property $ do - input <- forAll gen - tripping input showCore (parseEither (Parse.core <* Trifecta.eof)) - -parserProps :: TestTree -parserProps = testGroup "Parsing: roundtripping" - [ testProperty "literals" $ prop_roundtrips Gen.literal - , testProperty "if/then/else" . prop_roundtrips . Gen.ifthenelse $ Gen.variable - , testProperty "lambda" . prop_roundtrips $ Gen.lambda Gen.literal - , testProperty "function application" . prop_roundtrips $ Gen.apply Gen.variable - ] - --- * Parser specs - -parsesInto :: String -> Core -> Assertion -parsesInto str res = case parseEither Parse.core str of - Right x -> x @?= res - Left m -> assertFailure m - -assert_booleans_parse :: Assertion -assert_booleans_parse = do - parseEither Parse.core "#true" @?= Right true - parseEither Parse.core "#false" @?= Right false - -a, f, g, h :: Core -(a, f, g, h) = (Var "a", Var "f", Var "g", Var "h") - -assert_ifthen_parse :: Assertion -assert_ifthen_parse = "if #true then #true else #false" `parsesInto` (If true true false) - -assert_application_parse :: Assertion -assert_application_parse ="f g" `parsesInto` (f :$ g) - -assert_application_left_associative :: Assertion -assert_application_left_associative = "f g h" `parsesInto` (f :$ g :$ h) - -assert_push_left_associative :: Assertion -assert_push_left_associative = "f.g.h" `parsesInto` (f :. g :. h) - -assert_ascii_lambda_parse :: Assertion -assert_ascii_lambda_parse = "\\a -> a" `parsesInto` Lam "a" a - -assert_unicode_lambda_parse :: Assertion -assert_unicode_lambda_parse = "Ξ»a β†’ a" `parsesInto` Lam "a" a - -assert_quoted_name_parse :: Assertion -assert_quoted_name_parse = "#{(NilClass)}" `parsesInto` Var (User "(NilClass)") - -assert_let_dot_precedence :: Assertion -assert_let_dot_precedence = "let a = f.g.h" `parsesInto` (Let "a" := (f :. g :. h)) - -assert_let_in_push_precedence :: Assertion -assert_let_in_push_precedence = "f.let g = h" `parsesInto` (f :. (Let "g" := h)) - -parserSpecs :: TestTree -parserSpecs = testGroup "Parsing: simple specs" - [ testCase "true/false" assert_booleans_parse - , testCase "if/then/else" assert_ifthen_parse - , testCase "function application" assert_application_parse - , testCase "application is left-associative" assert_application_left_associative - , testCase "dotted push is left-associative" assert_push_left_associative - , testCase "lambda with ASCII syntax" assert_ascii_lambda_parse - , testCase "lambda with unicode syntax" assert_unicode_lambda_parse - , testCase "quoted names" assert_quoted_name_parse - , testCase "let + dot precedence" assert_let_dot_precedence - , testCase "let in push" assert_let_in_push_precedence - ] - -assert_roundtrips :: File Core -> Assertion -assert_roundtrips (File _ core) = parseEither Parse.core (showCore core) @?= Right (stripAnnotations core) - -parserExamples :: TestTree -parserExamples = testGroup "Parsing: Eval.hs examples" - [ testCase "prog1" (assert_roundtrips Eval.prog1) - , testCase "prog2" (assert_roundtrips Eval.prog2) - , testCase "prog3" (assert_roundtrips Eval.prog3) - , testCase "prog4" (assert_roundtrips Eval.prog4) - , testCase "prog6.1" (assert_roundtrips (head Eval.prog6)) - , testCase "prog6.2" (assert_roundtrips (last Eval.prog6)) - , testCase "ruby" (assert_roundtrips Eval.ruby) - ] - -tests :: TestTree -tests = testGroup "semantic-core" - [ parserSpecs - , parserExamples - , parserProps - ] - -main :: IO () -main = defaultMain tests diff --git a/semantic-go/BUILD.bazel b/semantic-go/BUILD.bazel new file mode 100644 index 0000000000..2b93d4b699 --- /dev/null +++ b/semantic-go/BUILD.bazel @@ -0,0 +1,19 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "//:build/common.bzl", + "semantic_language_library", + "semantic_language_parsing_test", +) +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_test", +) + +semantic_language_library( + name = "semantic-go", + srcs = glob(["src/**/*.hs"]), + language = "go", +) + +semantic_language_parsing_test(language = "go") diff --git a/semantic-go/LICENSE b/semantic-go/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-go/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-go/README.md b/semantic-go/README.md new file mode 100644 index 0000000000..3efb7cfb8a --- /dev/null +++ b/semantic-go/README.md @@ -0,0 +1,3 @@ +# Semantic support for Go + +This package implements `semantic` support for Go. diff --git a/semantic-go/Setup.hs b/semantic-go/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-go/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-go/semantic-go.cabal b/semantic-go/semantic-go.cabal new file mode 100644 index 0000000000..bcacc218f8 --- /dev/null +++ b/semantic-go/semantic-go.cabal @@ -0,0 +1,76 @@ +cabal-version: 2.4 + +name: semantic-go +version: 0.0.0.0 +synopsis: Semantic support for Go. +description: Semantic support for Go. +homepage: https://github.com/github/semantic/tree/master/semantic-go#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + cpp-options: + -DBAZEL_BUILD=0 + +library + import: haskell + exposed-modules: + Language.Go + Language.Go.AST + Language.Go.Grammar + Language.Go.Tags + hs-source-dirs: src + build-depends: + , base >= 4.13 && < 5 + , fused-effects ^>= 1.1 + , semantic-ast + , semantic-proto ^>= 0 + , semantic-source ^>= 0.2 + , semantic-tags ^>= 0.0 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3 + , tree-sitter ^>= 0.9 + , tree-sitter-go ^>= 0.5.0.1 + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: PreciseTest.hs + build-depends: + , base + , semantic-ast + , semantic-go + , tasty diff --git a/semantic-go/src/Language/Go.hs b/semantic-go/src/Language/Go.hs new file mode 100644 index 0000000000..634539ed4b --- /dev/null +++ b/semantic-go/src/Language/Go.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +-- | Semantic functionality for Go programs. +module Language.Go +( Term(..) +, Language.Go.Grammar.tree_sitter_go +) where + +import AST.Marshal.JSON +import Data.Proxy +import qualified Language.Go.AST as Go +import qualified Language.Go.Tags as GoTags +import qualified Tags.Tagging.Precise as Tags +import qualified Language.Go.Grammar (tree_sitter_go) +import qualified AST.Unmarshal as TS + +newtype Term a = Term { getTerm :: Go.SourceFile a } + deriving MarshalJSON + +instance TS.SymbolMatching Term where + matchedSymbols _ = TS.matchedSymbols (Proxy :: Proxy Go.SourceFile) + showFailure _ = TS.showFailure (Proxy :: Proxy Go.SourceFile) + +instance TS.Unmarshal Term where + matchers = fmap (fmap (TS.hoist Term)) TS.matchers + +instance Tags.ToTags Term where + tags src = Tags.runTagging src . GoTags.tags . getTerm diff --git a/semantic-go/src/Language/Go/AST.hs b/semantic-go/src/Language/Go/AST.hs new file mode 100644 index 0000000000..4ce65fea16 --- /dev/null +++ b/semantic-go/src/Language/Go/AST.hs @@ -0,0 +1,4900 @@ +-- Language definition for Go, generated by ast-generate. Do not edit! +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Language.Go.AST (module Language.Go.AST, getTestCorpusDir) where + +import qualified AST.Parse +import qualified AST.Token +import qualified AST.Traversable1.Class +import qualified AST.Unmarshal +import qualified Data.Foldable +import qualified Data.List as Data.OldList +import qualified Data.Maybe as GHC.Maybe +import qualified Data.Text.Internal +import qualified Data.Traversable +import qualified GHC.Base +import qualified GHC.Generics +import qualified GHC.Records +import qualified GHC.Show +import TreeSitter.Go (getTestCorpusDir) +import qualified TreeSitter.Node +import qualified Prelude as GHC.Classes + +debugSymbolNames :: [GHC.Base.String] +debugSymbolNames = debugSymbolNames_0 + +debugSymbolNames_0 :: [GHC.Base.String] +debugSymbolNames_0 = + [ "end", + "identifier", + "_\n", + "_;", + "_package", + "_import", + "_.", + "blank_identifier", + "_(", + "_)", + "_const", + "_,", + "_=", + "_var", + "_func", + "_...", + "_type", + "_*", + "_[", + "_]", + "_struct", + "_{", + "_}", + "_interface", + "_map", + "_chan", + "_<-", + "_:=", + "_++", + "_--", + "_*=", + "_/=", + "_%=", + "_<<=", + "_>>=", + "_&=", + "_&^=", + "_+=", + "_-=", + "_|=", + "_^=", + "_:", + "_fallthrough", + "_break", + "_continue", + "_goto", + "_return", + "_go", + "_defer", + "_if", + "_else", + "_for", + "_range", + "_switch", + "_case", + "_default", + "_select", + "identifier", + "identifier", + "_+", + "_-", + "_!", + "_^", + "_&", + "_/", + "_%", + "_<<", + "_>>", + "_&^", + "_|", + "_==", + "_!=", + "_<", + "_<=", + "_>", + "_>=", + "_&&", + "_||", + "raw_string_literal", + "_\"", + "_interpreted_string_literal_token1", + "escape_sequence", + "int_literal", + "float_literal", + "imaginary_literal", + "rune_literal", + "nil", + "true", + "false", + "comment", + "source_file", + "package_clause", + "import_declaration", + "import_spec", + "dot", + "import_spec_list", + "_declaration", + "const_declaration", + "const_spec", + "var_declaration", + "var_spec", + "function_declaration", + "method_declaration", + "parameter_list", + "parameter_declaration", + "variadic_parameter_declaration", + "type_alias", + "type_declaration", + "type_spec", + "expression_list", + "parenthesized_type", + "_simple_type", + "pointer_type", + "array_type", + "implicit_length_array_type", + "slice_type", + "struct_type", + "field_declaration_list", + "field_declaration", + "interface_type", + "method_spec_list", + "method_spec", + "map_type", + "channel_type", + "function_type", + "block", + "_statement_list", + "_statement", + "empty_statement", + "_simple_statement", + "send_statement", + "receive_statement", + "inc_statement", + "dec_statement", + "assignment_statement", + "short_var_declaration", + "labeled_statement", + "labeled_statement", + "fallthrough_statement", + "break_statement", + "continue_statement", + "goto_statement", + "return_statement", + "go_statement", + "defer_statement", + "if_statement", + "for_statement", + "for_clause", + "range_clause", + "expression_switch_statement", + "expression_case", + "default_case", + "type_switch_statement", + "_type_switch_header", + "type_case", + "select_statement", + "communication_case", + "_expression", + "parenthesized_expression", + "call_expression", + "variadic_argument", + "argument_list", + "argument_list", + "selector_expression", + "index_expression", + "slice_expression", + "type_assertion_expression", + "type_conversion_expression", + "composite_literal", + "literal_value", + "keyed_element", + "element", + "func_literal", + "unary_expression", + "binary_expression", + "qualified_type", + "interpreted_string_literal", + "_source_file_repeat1", + "_import_spec_list_repeat1", + "_const_declaration_repeat1", + "_const_spec_repeat1", + "_var_declaration_repeat1", + "_parameter_list_repeat1", + "_type_declaration_repeat1", + "_field_name_list_repeat1", + "_expression_list_repeat1", + "_field_declaration_list_repeat1", + "_method_spec_list_repeat1", + "__statement_list_repeat1", + "_expression_switch_statement_repeat1", + "_type_switch_statement_repeat1", + "_type_case_repeat1", + "_select_statement_repeat1", + "_argument_list_repeat1", + "_literal_value_repeat1", + "_interpreted_string_literal_repeat1", + "field_identifier", + "label_name", + "package_identifier", + "type_identifier" + ] + +newtype Expression a = Expression {getExpression :: ((BinaryExpression GHC.Generics.:+: CallExpression GHC.Generics.:+: CompositeLiteral GHC.Generics.:+: False GHC.Generics.:+: FloatLiteral GHC.Generics.:+: FuncLiteral GHC.Generics.:+: Identifier GHC.Generics.:+: ImaginaryLiteral GHC.Generics.:+: IndexExpression GHC.Generics.:+: IntLiteral GHC.Generics.:+: InterpretedStringLiteral GHC.Generics.:+: Nil GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: RawStringLiteral GHC.Generics.:+: RuneLiteral GHC.Generics.:+: SelectorExpression GHC.Generics.:+: SliceExpression GHC.Generics.:+: True GHC.Generics.:+: TypeAssertionExpression GHC.Generics.:+: TypeConversionExpression GHC.Generics.:+: UnaryExpression) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1. + AST.Traversable1.Class.Traversable1 a_1 + ) + +instance GHC.Records.HasField "ann" (Expression a_2) a_2 where + getField = AST.Unmarshal.gann GHC.Base.. getExpression + +deriving instance GHC.Classes.Eq a_3 => GHC.Classes.Eq (Expression a_3) + +deriving instance GHC.Classes.Ord a_4 => GHC.Classes.Ord (Expression a_4) + +deriving instance GHC.Show.Show a_5 => GHC.Show.Show (Expression a_5) + +instance AST.Unmarshal.Unmarshal Expression + +instance Data.Foldable.Foldable Expression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Expression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Expression where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype SimpleStatement a = SimpleStatement {getSimpleStatement :: ((Expression GHC.Generics.:+: AssignmentStatement GHC.Generics.:+: DecStatement GHC.Generics.:+: IncStatement GHC.Generics.:+: SendStatement GHC.Generics.:+: ShortVarDeclaration) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_6. + AST.Traversable1.Class.Traversable1 a_6 + ) + +instance GHC.Records.HasField "ann" (SimpleStatement a_7) a_7 where + getField = AST.Unmarshal.gann GHC.Base.. getSimpleStatement + +deriving instance GHC.Classes.Eq a_8 => GHC.Classes.Eq (SimpleStatement a_8) + +deriving instance GHC.Classes.Ord a_9 => GHC.Classes.Ord (SimpleStatement a_9) + +deriving instance GHC.Show.Show a_10 => GHC.Show.Show (SimpleStatement a_10) + +instance AST.Unmarshal.Unmarshal SimpleStatement + +instance Data.Foldable.Foldable SimpleStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SimpleStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SimpleStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype SimpleType a = SimpleType {getSimpleType :: ((ArrayType GHC.Generics.:+: ChannelType GHC.Generics.:+: FunctionType GHC.Generics.:+: InterfaceType GHC.Generics.:+: MapType GHC.Generics.:+: PointerType GHC.Generics.:+: QualifiedType GHC.Generics.:+: SliceType GHC.Generics.:+: StructType GHC.Generics.:+: TypeIdentifier) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_11. + AST.Traversable1.Class.Traversable1 a_11 + ) + +instance GHC.Records.HasField "ann" (SimpleType a_12) a_12 where + getField = AST.Unmarshal.gann GHC.Base.. getSimpleType + +deriving instance GHC.Classes.Eq a_13 => GHC.Classes.Eq (SimpleType a_13) + +deriving instance GHC.Classes.Ord a_14 => GHC.Classes.Ord (SimpleType a_14) + +deriving instance GHC.Show.Show a_15 => GHC.Show.Show (SimpleType a_15) + +instance AST.Unmarshal.Unmarshal SimpleType + +instance Data.Foldable.Foldable SimpleType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SimpleType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SimpleType where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Statement a = Statement {getStatement :: ((SimpleStatement GHC.Generics.:+: Block GHC.Generics.:+: BreakStatement GHC.Generics.:+: ConstDeclaration GHC.Generics.:+: ContinueStatement GHC.Generics.:+: DeferStatement GHC.Generics.:+: EmptyStatement GHC.Generics.:+: ExpressionSwitchStatement GHC.Generics.:+: FallthroughStatement GHC.Generics.:+: ForStatement GHC.Generics.:+: GoStatement GHC.Generics.:+: GotoStatement GHC.Generics.:+: IfStatement GHC.Generics.:+: LabeledStatement GHC.Generics.:+: ReturnStatement GHC.Generics.:+: SelectStatement GHC.Generics.:+: TypeDeclaration GHC.Generics.:+: TypeSwitchStatement GHC.Generics.:+: VarDeclaration) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_16. + AST.Traversable1.Class.Traversable1 a_16 + ) + +instance GHC.Records.HasField "ann" (Statement a_17) a_17 where + getField = AST.Unmarshal.gann GHC.Base.. getStatement + +deriving instance GHC.Classes.Eq a_18 => GHC.Classes.Eq (Statement a_18) + +deriving instance GHC.Classes.Ord a_19 => GHC.Classes.Ord (Statement a_19) + +deriving instance GHC.Show.Show a_20 => GHC.Show.Show (Statement a_20) + +instance AST.Unmarshal.Unmarshal Statement + +instance Data.Foldable.Foldable Statement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Statement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Statement where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Type a = Type {getType :: ((SimpleType GHC.Generics.:+: ParenthesizedType) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_21. + AST.Traversable1.Class.Traversable1 a_21 + ) + +instance GHC.Records.HasField "ann" (Type a_22) a_22 where + getField = AST.Unmarshal.gann GHC.Base.. getType + +deriving instance GHC.Classes.Eq a_23 => GHC.Classes.Eq (Type a_23) + +deriving instance GHC.Classes.Ord a_24 => GHC.Classes.Ord (Type a_24) + +deriving instance GHC.Show.Show a_25 => GHC.Show.Show (Type a_25) + +instance AST.Unmarshal.Unmarshal Type + +instance Data.Foldable.Foldable Type where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Type where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Type where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArgumentList a = ArgumentList + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: Type GHC.Generics.:+: VariadicArgument) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_26. + AST.Traversable1.Class.Traversable1 a_26 + ) + +instance AST.Unmarshal.SymbolMatching ArgumentList where + matchedSymbols _ = [161, 162] + showFailure _ node_27 = + "expected " + GHC.Base.<> ( "argument_list, argument_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_27 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_27) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_28 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_29 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_30 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_31 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_28 + c1_29 = TreeSitter.Node.nodeStartPoint node_27 + TreeSitter.Node.TSPoint + r2_30 + c2_31 = TreeSitter.Node.nodeEndPoint node_27 + +deriving instance GHC.Classes.Eq a_32 => GHC.Classes.Eq (ArgumentList a_32) + +deriving instance GHC.Classes.Ord a_33 => GHC.Classes.Ord (ArgumentList a_33) + +deriving instance GHC.Show.Show a_34 => GHC.Show.Show (ArgumentList a_34) + +instance AST.Unmarshal.Unmarshal ArgumentList + +instance Data.Foldable.Foldable ArgumentList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArgumentList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArgumentList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayType a = ArrayType + { ann :: a, + length :: (AST.Parse.Err (Expression a)), + element :: (AST.Parse.Err (Type a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_35. + AST.Traversable1.Class.Traversable1 a_35 + ) + +instance AST.Unmarshal.SymbolMatching ArrayType where + matchedSymbols _ = [113] + showFailure _ node_36 = + "expected " + GHC.Base.<> ( "array_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_36 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_36) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_37 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_38 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_39 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_40 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_37 + c1_38 = TreeSitter.Node.nodeStartPoint node_36 + TreeSitter.Node.TSPoint + r2_39 + c2_40 = TreeSitter.Node.nodeEndPoint node_36 + +deriving instance GHC.Classes.Eq a_41 => GHC.Classes.Eq (ArrayType a_41) + +deriving instance GHC.Classes.Ord a_42 => GHC.Classes.Ord (ArrayType a_42) + +deriving instance GHC.Show.Show a_43 => GHC.Show.Show (ArrayType a_43) + +instance AST.Unmarshal.Unmarshal ArrayType + +instance Data.Foldable.Foldable ArrayType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AssignmentStatement a = AssignmentStatement + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousPercentEqual GHC.Generics.:+: AnonymousAmpersandEqual GHC.Generics.:+: AnonymousAmpersandCaretEqual GHC.Generics.:+: AnonymousStarEqual GHC.Generics.:+: AnonymousPlusEqual GHC.Generics.:+: AnonymousMinusEqual GHC.Generics.:+: AnonymousSlashEqual GHC.Generics.:+: AnonymousLAngleLAngleEqual GHC.Generics.:+: AnonymousEqual GHC.Generics.:+: AnonymousRAngleRAngleEqual GHC.Generics.:+: AnonymousCaretEqual GHC.Generics.:+: AnonymousPipeEqual) a)), + left :: (AST.Parse.Err (ExpressionList a)), + right :: (AST.Parse.Err (ExpressionList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_44. + AST.Traversable1.Class.Traversable1 a_44 + ) + +instance AST.Unmarshal.SymbolMatching AssignmentStatement where + matchedSymbols _ = [134] + showFailure _ node_45 = + "expected " + GHC.Base.<> ( "assignment_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_45 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_45) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_46 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_47 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_48 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_49 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_46 + c1_47 = TreeSitter.Node.nodeStartPoint node_45 + TreeSitter.Node.TSPoint + r2_48 + c2_49 = TreeSitter.Node.nodeEndPoint node_45 + +deriving instance GHC.Classes.Eq a_50 => GHC.Classes.Eq (AssignmentStatement a_50) + +deriving instance GHC.Classes.Ord a_51 => GHC.Classes.Ord (AssignmentStatement a_51) + +deriving instance GHC.Show.Show a_52 => GHC.Show.Show (AssignmentStatement a_52) + +instance AST.Unmarshal.Unmarshal AssignmentStatement + +instance Data.Foldable.Foldable AssignmentStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AssignmentStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AssignmentStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BinaryExpression a = BinaryExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousBangEqual GHC.Generics.:+: AnonymousPercent GHC.Generics.:+: AnonymousAmpersand GHC.Generics.:+: AnonymousAmpersandAmpersand GHC.Generics.:+: AnonymousAmpersandCaret GHC.Generics.:+: AnonymousStar GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousSlash GHC.Generics.:+: AnonymousLAngle GHC.Generics.:+: AnonymousLAngleLAngle GHC.Generics.:+: AnonymousLAngleEqual GHC.Generics.:+: AnonymousEqualEqual GHC.Generics.:+: AnonymousRAngle GHC.Generics.:+: AnonymousRAngleEqual GHC.Generics.:+: AnonymousRAngleRAngle GHC.Generics.:+: AnonymousCaret GHC.Generics.:+: AnonymousPipe GHC.Generics.:+: AnonymousPipePipe) a)), + left :: (AST.Parse.Err (Expression a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_53. + AST.Traversable1.Class.Traversable1 a_53 + ) + +instance AST.Unmarshal.SymbolMatching BinaryExpression where + matchedSymbols _ = [174] + showFailure _ node_54 = + "expected " + GHC.Base.<> ( "binary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_54 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_54) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_55 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_56 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_57 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_58 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_55 + c1_56 = TreeSitter.Node.nodeStartPoint node_54 + TreeSitter.Node.TSPoint + r2_57 + c2_58 = TreeSitter.Node.nodeEndPoint node_54 + +deriving instance GHC.Classes.Eq a_59 => GHC.Classes.Eq (BinaryExpression a_59) + +deriving instance GHC.Classes.Ord a_60 => GHC.Classes.Ord (BinaryExpression a_60) + +deriving instance GHC.Show.Show a_61 => GHC.Show.Show (BinaryExpression a_61) + +instance AST.Unmarshal.Unmarshal BinaryExpression + +instance Data.Foldable.Foldable BinaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BinaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BinaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Block a = Block + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_62. + AST.Traversable1.Class.Traversable1 a_62 + ) + +instance AST.Unmarshal.SymbolMatching Block where + matchedSymbols _ = [125] + showFailure _ node_63 = + "expected " + GHC.Base.<> ( "block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_63 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_63) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_64 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_65 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_66 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_67 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_64 + c1_65 = TreeSitter.Node.nodeStartPoint node_63 + TreeSitter.Node.TSPoint + r2_66 + c2_67 = TreeSitter.Node.nodeEndPoint node_63 + +deriving instance GHC.Classes.Eq a_68 => GHC.Classes.Eq (Block a_68) + +deriving instance GHC.Classes.Ord a_69 => GHC.Classes.Ord (Block a_69) + +deriving instance GHC.Show.Show a_70 => GHC.Show.Show (Block a_70) + +instance AST.Unmarshal.Unmarshal Block + +instance Data.Foldable.Foldable Block where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Block where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Block where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BreakStatement a = BreakStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (LabelName a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_71. + AST.Traversable1.Class.Traversable1 a_71 + ) + +instance AST.Unmarshal.SymbolMatching BreakStatement where + matchedSymbols _ = [139] + showFailure _ node_72 = + "expected " + GHC.Base.<> ( "break_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_72 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_72) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_73 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_74 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_75 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_76 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_73 + c1_74 = TreeSitter.Node.nodeStartPoint node_72 + TreeSitter.Node.TSPoint + r2_75 + c2_76 = TreeSitter.Node.nodeEndPoint node_72 + +deriving instance GHC.Classes.Eq a_77 => GHC.Classes.Eq (BreakStatement a_77) + +deriving instance GHC.Classes.Ord a_78 => GHC.Classes.Ord (BreakStatement a_78) + +deriving instance GHC.Show.Show a_79 => GHC.Show.Show (BreakStatement a_79) + +instance AST.Unmarshal.Unmarshal BreakStatement + +instance Data.Foldable.Foldable BreakStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BreakStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BreakStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CallExpression a = CallExpression + { ann :: a, + function :: (AST.Parse.Err (Expression a)), + arguments :: (AST.Parse.Err (ArgumentList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_80. + AST.Traversable1.Class.Traversable1 a_80 + ) + +instance AST.Unmarshal.SymbolMatching CallExpression where + matchedSymbols _ = [159] + showFailure _ node_81 = + "expected " + GHC.Base.<> ( "call_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_81 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_81) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_82 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_83 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_84 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_85 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_82 + c1_83 = TreeSitter.Node.nodeStartPoint node_81 + TreeSitter.Node.TSPoint + r2_84 + c2_85 = TreeSitter.Node.nodeEndPoint node_81 + +deriving instance GHC.Classes.Eq a_86 => GHC.Classes.Eq (CallExpression a_86) + +deriving instance GHC.Classes.Ord a_87 => GHC.Classes.Ord (CallExpression a_87) + +deriving instance GHC.Show.Show a_88 => GHC.Show.Show (CallExpression a_88) + +instance AST.Unmarshal.Unmarshal CallExpression + +instance Data.Foldable.Foldable CallExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CallExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CallExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ChannelType a = ChannelType {ann :: a, value :: (AST.Parse.Err (Type a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_89. + AST.Traversable1.Class.Traversable1 a_89 + ) + +instance AST.Unmarshal.SymbolMatching ChannelType where + matchedSymbols _ = [123] + showFailure _ node_90 = + "expected " + GHC.Base.<> ( "channel_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_90 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_90) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_91 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_92 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_93 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_94 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_91 + c1_92 = TreeSitter.Node.nodeStartPoint node_90 + TreeSitter.Node.TSPoint + r2_93 + c2_94 = TreeSitter.Node.nodeEndPoint node_90 + +deriving instance GHC.Classes.Eq a_95 => GHC.Classes.Eq (ChannelType a_95) + +deriving instance GHC.Classes.Ord a_96 => GHC.Classes.Ord (ChannelType a_96) + +deriving instance GHC.Show.Show a_97 => GHC.Show.Show (ChannelType a_97) + +instance AST.Unmarshal.Unmarshal ChannelType + +instance Data.Foldable.Foldable ChannelType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ChannelType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ChannelType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CommunicationCase a = CommunicationCase + { ann :: a, + communication :: (AST.Parse.Err ((ReceiveStatement GHC.Generics.:+: SendStatement) a)), + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_98. + AST.Traversable1.Class.Traversable1 a_98 + ) + +instance AST.Unmarshal.SymbolMatching CommunicationCase where + matchedSymbols _ = [156] + showFailure _ node_99 = + "expected " + GHC.Base.<> ( "communication_case" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_99 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_99) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_100 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_101 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_102 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_103 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_100 + c1_101 = TreeSitter.Node.nodeStartPoint node_99 + TreeSitter.Node.TSPoint + r2_102 + c2_103 = TreeSitter.Node.nodeEndPoint node_99 + +deriving instance GHC.Classes.Eq a_104 => GHC.Classes.Eq (CommunicationCase a_104) + +deriving instance GHC.Classes.Ord a_105 => GHC.Classes.Ord (CommunicationCase a_105) + +deriving instance GHC.Show.Show a_106 => GHC.Show.Show (CommunicationCase a_106) + +instance AST.Unmarshal.Unmarshal CommunicationCase + +instance Data.Foldable.Foldable CommunicationCase where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CommunicationCase where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CommunicationCase where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CompositeLiteral a = CompositeLiteral + { ann :: a, + body :: (AST.Parse.Err (LiteralValue a)), + type' :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ImplicitLengthArrayType GHC.Generics.:+: MapType GHC.Generics.:+: QualifiedType GHC.Generics.:+: SliceType GHC.Generics.:+: StructType GHC.Generics.:+: TypeIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_107. + AST.Traversable1.Class.Traversable1 a_107 + ) + +instance AST.Unmarshal.SymbolMatching CompositeLiteral where + matchedSymbols _ = [168] + showFailure _ node_108 = + "expected " + GHC.Base.<> ( "composite_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_108 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_108) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_109 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_110 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_111 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_112 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_109 + c1_110 = TreeSitter.Node.nodeStartPoint node_108 + TreeSitter.Node.TSPoint + r2_111 + c2_112 = TreeSitter.Node.nodeEndPoint node_108 + +deriving instance GHC.Classes.Eq a_113 => GHC.Classes.Eq (CompositeLiteral a_113) + +deriving instance GHC.Classes.Ord a_114 => GHC.Classes.Ord (CompositeLiteral a_114) + +deriving instance GHC.Show.Show a_115 => GHC.Show.Show (CompositeLiteral a_115) + +instance AST.Unmarshal.Unmarshal CompositeLiteral + +instance Data.Foldable.Foldable CompositeLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CompositeLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CompositeLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstDeclaration a = ConstDeclaration + { ann :: a, + extraChildren :: ([AST.Parse.Err (ConstSpec a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_116. + AST.Traversable1.Class.Traversable1 a_116 + ) + +instance AST.Unmarshal.SymbolMatching ConstDeclaration where + matchedSymbols _ = [97] + showFailure _ node_117 = + "expected " + GHC.Base.<> ( "const_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_117 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_117) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_118 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_119 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_120 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_121 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_118 + c1_119 = TreeSitter.Node.nodeStartPoint node_117 + TreeSitter.Node.TSPoint + r2_120 + c2_121 = TreeSitter.Node.nodeEndPoint node_117 + +deriving instance GHC.Classes.Eq a_122 => GHC.Classes.Eq (ConstDeclaration a_122) + +deriving instance GHC.Classes.Ord a_123 => GHC.Classes.Ord (ConstDeclaration a_123) + +deriving instance GHC.Show.Show a_124 => GHC.Show.Show (ConstDeclaration a_124) + +instance AST.Unmarshal.Unmarshal ConstDeclaration + +instance Data.Foldable.Foldable ConstDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstSpec a = ConstSpec + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (ExpressionList a))), + name :: (GHC.Base.NonEmpty (AST.Parse.Err ((AnonymousComma GHC.Generics.:+: Identifier) a))), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (Type a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_125. + AST.Traversable1.Class.Traversable1 a_125 + ) + +instance AST.Unmarshal.SymbolMatching ConstSpec where + matchedSymbols _ = [98] + showFailure _ node_126 = + "expected " + GHC.Base.<> ( "const_spec" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_126 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_126) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_127 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_128 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_129 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_130 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_127 + c1_128 = TreeSitter.Node.nodeStartPoint node_126 + TreeSitter.Node.TSPoint + r2_129 + c2_130 = TreeSitter.Node.nodeEndPoint node_126 + +deriving instance GHC.Classes.Eq a_131 => GHC.Classes.Eq (ConstSpec a_131) + +deriving instance GHC.Classes.Ord a_132 => GHC.Classes.Ord (ConstSpec a_132) + +deriving instance GHC.Show.Show a_133 => GHC.Show.Show (ConstSpec a_133) + +instance AST.Unmarshal.Unmarshal ConstSpec + +instance Data.Foldable.Foldable ConstSpec where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstSpec where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstSpec where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ContinueStatement a = ContinueStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (LabelName a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_134. + AST.Traversable1.Class.Traversable1 a_134 + ) + +instance AST.Unmarshal.SymbolMatching ContinueStatement where + matchedSymbols _ = [140] + showFailure _ node_135 = + "expected " + GHC.Base.<> ( "continue_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_135 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_135) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_136 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_137 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_138 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_139 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_136 + c1_137 = TreeSitter.Node.nodeStartPoint node_135 + TreeSitter.Node.TSPoint + r2_138 + c2_139 = TreeSitter.Node.nodeEndPoint node_135 + +deriving instance GHC.Classes.Eq a_140 => GHC.Classes.Eq (ContinueStatement a_140) + +deriving instance GHC.Classes.Ord a_141 => GHC.Classes.Ord (ContinueStatement a_141) + +deriving instance GHC.Show.Show a_142 => GHC.Show.Show (ContinueStatement a_142) + +instance AST.Unmarshal.Unmarshal ContinueStatement + +instance Data.Foldable.Foldable ContinueStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ContinueStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ContinueStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DecStatement a = DecStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_143. + AST.Traversable1.Class.Traversable1 a_143 + ) + +instance AST.Unmarshal.SymbolMatching DecStatement where + matchedSymbols _ = [133] + showFailure _ node_144 = + "expected " + GHC.Base.<> ( "dec_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_144 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_144) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_145 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_146 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_147 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_148 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_145 + c1_146 = TreeSitter.Node.nodeStartPoint node_144 + TreeSitter.Node.TSPoint + r2_147 + c2_148 = TreeSitter.Node.nodeEndPoint node_144 + +deriving instance GHC.Classes.Eq a_149 => GHC.Classes.Eq (DecStatement a_149) + +deriving instance GHC.Classes.Ord a_150 => GHC.Classes.Ord (DecStatement a_150) + +deriving instance GHC.Show.Show a_151 => GHC.Show.Show (DecStatement a_151) + +instance AST.Unmarshal.Unmarshal DecStatement + +instance Data.Foldable.Foldable DecStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DecStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DecStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DefaultCase a = DefaultCase + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_152. + AST.Traversable1.Class.Traversable1 a_152 + ) + +instance AST.Unmarshal.SymbolMatching DefaultCase where + matchedSymbols _ = [151] + showFailure _ node_153 = + "expected " + GHC.Base.<> ( "default_case" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_153 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_153) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_154 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_155 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_156 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_157 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_154 + c1_155 = TreeSitter.Node.nodeStartPoint node_153 + TreeSitter.Node.TSPoint + r2_156 + c2_157 = TreeSitter.Node.nodeEndPoint node_153 + +deriving instance GHC.Classes.Eq a_158 => GHC.Classes.Eq (DefaultCase a_158) + +deriving instance GHC.Classes.Ord a_159 => GHC.Classes.Ord (DefaultCase a_159) + +deriving instance GHC.Show.Show a_160 => GHC.Show.Show (DefaultCase a_160) + +instance AST.Unmarshal.Unmarshal DefaultCase + +instance Data.Foldable.Foldable DefaultCase where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DefaultCase where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DefaultCase where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DeferStatement a = DeferStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_161. + AST.Traversable1.Class.Traversable1 a_161 + ) + +instance AST.Unmarshal.SymbolMatching DeferStatement where + matchedSymbols _ = [144] + showFailure _ node_162 = + "expected " + GHC.Base.<> ( "defer_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_162 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_162) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_163 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_164 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_165 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_166 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_163 + c1_164 = TreeSitter.Node.nodeStartPoint node_162 + TreeSitter.Node.TSPoint + r2_165 + c2_166 = TreeSitter.Node.nodeEndPoint node_162 + +deriving instance GHC.Classes.Eq a_167 => GHC.Classes.Eq (DeferStatement a_167) + +deriving instance GHC.Classes.Ord a_168 => GHC.Classes.Ord (DeferStatement a_168) + +deriving instance GHC.Show.Show a_169 => GHC.Show.Show (DeferStatement a_169) + +instance AST.Unmarshal.Unmarshal DeferStatement + +instance Data.Foldable.Foldable DeferStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DeferStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DeferStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Dot a = Dot {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_170. + AST.Traversable1.Class.Traversable1 a_170 + ) + +instance AST.Unmarshal.SymbolMatching Dot where + matchedSymbols _ = [94] + showFailure _ node_171 = + "expected " + GHC.Base.<> ( "dot" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_171 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_171) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_172 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_173 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_174 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_175 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_172 + c1_173 = TreeSitter.Node.nodeStartPoint node_171 + TreeSitter.Node.TSPoint + r2_174 + c2_175 = TreeSitter.Node.nodeEndPoint node_171 + +deriving instance GHC.Classes.Eq a_176 => GHC.Classes.Eq (Dot a_176) + +deriving instance GHC.Classes.Ord a_177 => GHC.Classes.Ord (Dot a_177) + +deriving instance GHC.Show.Show a_178 => GHC.Show.Show (Dot a_178) + +instance AST.Unmarshal.Unmarshal Dot + +instance Data.Foldable.Foldable Dot where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Dot where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Dot where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Element a = Element + { ann :: a, + extraChildren :: (AST.Parse.Err ((Expression GHC.Generics.:+: LiteralValue) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_179. + AST.Traversable1.Class.Traversable1 a_179 + ) + +instance AST.Unmarshal.SymbolMatching Element where + matchedSymbols _ = [171] + showFailure _ node_180 = + "expected " + GHC.Base.<> ( "element" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_180 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_180) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_181 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_182 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_183 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_184 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_181 + c1_182 = TreeSitter.Node.nodeStartPoint node_180 + TreeSitter.Node.TSPoint + r2_183 + c2_184 = TreeSitter.Node.nodeEndPoint node_180 + +deriving instance GHC.Classes.Eq a_185 => GHC.Classes.Eq (Element a_185) + +deriving instance GHC.Classes.Ord a_186 => GHC.Classes.Ord (Element a_186) + +deriving instance GHC.Show.Show a_187 => GHC.Show.Show (Element a_187) + +instance AST.Unmarshal.Unmarshal Element + +instance Data.Foldable.Foldable Element where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Element where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Element where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EmptyStatement a = EmptyStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_188. + AST.Traversable1.Class.Traversable1 a_188 + ) + +instance AST.Unmarshal.SymbolMatching EmptyStatement where + matchedSymbols _ = [128] + showFailure _ node_189 = + "expected " + GHC.Base.<> ( "empty_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_189 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_189) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_190 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_191 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_192 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_193 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_190 + c1_191 = TreeSitter.Node.nodeStartPoint node_189 + TreeSitter.Node.TSPoint + r2_192 + c2_193 = TreeSitter.Node.nodeEndPoint node_189 + +deriving instance GHC.Classes.Eq a_194 => GHC.Classes.Eq (EmptyStatement a_194) + +deriving instance GHC.Classes.Ord a_195 => GHC.Classes.Ord (EmptyStatement a_195) + +deriving instance GHC.Show.Show a_196 => GHC.Show.Show (EmptyStatement a_196) + +instance AST.Unmarshal.Unmarshal EmptyStatement + +instance Data.Foldable.Foldable EmptyStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EmptyStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EmptyStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExpressionCase a = ExpressionCase + { ann :: a, + value :: (AST.Parse.Err (ExpressionList a)), + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_197. + AST.Traversable1.Class.Traversable1 a_197 + ) + +instance AST.Unmarshal.SymbolMatching ExpressionCase where + matchedSymbols _ = [150] + showFailure _ node_198 = + "expected " + GHC.Base.<> ( "expression_case" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_198 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_198) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_199 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_200 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_201 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_202 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_199 + c1_200 = TreeSitter.Node.nodeStartPoint node_198 + TreeSitter.Node.TSPoint + r2_201 + c2_202 = TreeSitter.Node.nodeEndPoint node_198 + +deriving instance GHC.Classes.Eq a_203 => GHC.Classes.Eq (ExpressionCase a_203) + +deriving instance GHC.Classes.Ord a_204 => GHC.Classes.Ord (ExpressionCase a_204) + +deriving instance GHC.Show.Show a_205 => GHC.Show.Show (ExpressionCase a_205) + +instance AST.Unmarshal.Unmarshal ExpressionCase + +instance Data.Foldable.Foldable ExpressionCase where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExpressionCase where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExpressionCase where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExpressionList a = ExpressionList + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_206. + AST.Traversable1.Class.Traversable1 a_206 + ) + +instance AST.Unmarshal.SymbolMatching ExpressionList where + matchedSymbols _ = [109] + showFailure _ node_207 = + "expected " + GHC.Base.<> ( "expression_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_207 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_207) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_208 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_209 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_210 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_211 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_208 + c1_209 = TreeSitter.Node.nodeStartPoint node_207 + TreeSitter.Node.TSPoint + r2_210 + c2_211 = TreeSitter.Node.nodeEndPoint node_207 + +deriving instance GHC.Classes.Eq a_212 => GHC.Classes.Eq (ExpressionList a_212) + +deriving instance GHC.Classes.Ord a_213 => GHC.Classes.Ord (ExpressionList a_213) + +deriving instance GHC.Show.Show a_214 => GHC.Show.Show (ExpressionList a_214) + +instance AST.Unmarshal.Unmarshal ExpressionList + +instance Data.Foldable.Foldable ExpressionList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExpressionList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExpressionList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExpressionSwitchStatement a = ExpressionSwitchStatement + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + initializer :: (GHC.Maybe.Maybe (AST.Parse.Err (SimpleStatement a))), + extraChildren :: ([AST.Parse.Err ((DefaultCase GHC.Generics.:+: ExpressionCase) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_215. + AST.Traversable1.Class.Traversable1 a_215 + ) + +instance AST.Unmarshal.SymbolMatching ExpressionSwitchStatement where + matchedSymbols _ = [149] + showFailure _ node_216 = + "expected " + GHC.Base.<> ( "expression_switch_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_216 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_216) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_217 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_218 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_219 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_220 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_217 + c1_218 = TreeSitter.Node.nodeStartPoint node_216 + TreeSitter.Node.TSPoint + r2_219 + c2_220 = TreeSitter.Node.nodeEndPoint node_216 + +deriving instance GHC.Classes.Eq a_221 => GHC.Classes.Eq (ExpressionSwitchStatement a_221) + +deriving instance GHC.Classes.Ord a_222 => GHC.Classes.Ord (ExpressionSwitchStatement a_222) + +deriving instance GHC.Show.Show a_223 => GHC.Show.Show (ExpressionSwitchStatement a_223) + +instance AST.Unmarshal.Unmarshal ExpressionSwitchStatement + +instance Data.Foldable.Foldable ExpressionSwitchStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExpressionSwitchStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExpressionSwitchStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FallthroughStatement a = FallthroughStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_224. + AST.Traversable1.Class.Traversable1 a_224 + ) + +instance AST.Unmarshal.SymbolMatching FallthroughStatement where + matchedSymbols _ = [138] + showFailure _ node_225 = + "expected " + GHC.Base.<> ( "fallthrough_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_225 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_225) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_226 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_227 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_228 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_229 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_226 + c1_227 = TreeSitter.Node.nodeStartPoint node_225 + TreeSitter.Node.TSPoint + r2_228 + c2_229 = TreeSitter.Node.nodeEndPoint node_225 + +deriving instance GHC.Classes.Eq a_230 => GHC.Classes.Eq (FallthroughStatement a_230) + +deriving instance GHC.Classes.Ord a_231 => GHC.Classes.Ord (FallthroughStatement a_231) + +deriving instance GHC.Show.Show a_232 => GHC.Show.Show (FallthroughStatement a_232) + +instance AST.Unmarshal.Unmarshal FallthroughStatement + +instance Data.Foldable.Foldable FallthroughStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FallthroughStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FallthroughStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FieldDeclaration a = FieldDeclaration + { ann :: a, + tag :: (GHC.Maybe.Maybe (AST.Parse.Err ((InterpretedStringLiteral GHC.Generics.:+: RawStringLiteral) a))), + name :: ([AST.Parse.Err ((AnonymousComma GHC.Generics.:+: FieldIdentifier) a)]), + type' :: (AST.Parse.Err ((Type GHC.Generics.:+: QualifiedType GHC.Generics.:+: TypeIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_233. + AST.Traversable1.Class.Traversable1 a_233 + ) + +instance AST.Unmarshal.SymbolMatching FieldDeclaration where + matchedSymbols _ = [118] + showFailure _ node_234 = + "expected " + GHC.Base.<> ( "field_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_234 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_234) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_235 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_236 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_237 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_238 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_235 + c1_236 = TreeSitter.Node.nodeStartPoint node_234 + TreeSitter.Node.TSPoint + r2_237 + c2_238 = TreeSitter.Node.nodeEndPoint node_234 + +deriving instance GHC.Classes.Eq a_239 => GHC.Classes.Eq (FieldDeclaration a_239) + +deriving instance GHC.Classes.Ord a_240 => GHC.Classes.Ord (FieldDeclaration a_240) + +deriving instance GHC.Show.Show a_241 => GHC.Show.Show (FieldDeclaration a_241) + +instance AST.Unmarshal.Unmarshal FieldDeclaration + +instance Data.Foldable.Foldable FieldDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FieldDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FieldDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FieldDeclarationList a = FieldDeclarationList + { ann :: a, + extraChildren :: ([AST.Parse.Err (FieldDeclaration a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_242. + AST.Traversable1.Class.Traversable1 a_242 + ) + +instance AST.Unmarshal.SymbolMatching FieldDeclarationList where + matchedSymbols _ = [117] + showFailure _ node_243 = + "expected " + GHC.Base.<> ( "field_declaration_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_243 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_243) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_244 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_245 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_246 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_247 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_244 + c1_245 = TreeSitter.Node.nodeStartPoint node_243 + TreeSitter.Node.TSPoint + r2_246 + c2_247 = TreeSitter.Node.nodeEndPoint node_243 + +deriving instance GHC.Classes.Eq a_248 => GHC.Classes.Eq (FieldDeclarationList a_248) + +deriving instance GHC.Classes.Ord a_249 => GHC.Classes.Ord (FieldDeclarationList a_249) + +deriving instance GHC.Show.Show a_250 => GHC.Show.Show (FieldDeclarationList a_250) + +instance AST.Unmarshal.Unmarshal FieldDeclarationList + +instance Data.Foldable.Foldable FieldDeclarationList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FieldDeclarationList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FieldDeclarationList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForClause a = ForClause + { ann :: a, + initializer :: (GHC.Maybe.Maybe (AST.Parse.Err (SimpleStatement a))), + condition :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + update :: (GHC.Maybe.Maybe (AST.Parse.Err (SimpleStatement a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_251. + AST.Traversable1.Class.Traversable1 a_251 + ) + +instance AST.Unmarshal.SymbolMatching ForClause where + matchedSymbols _ = [147] + showFailure _ node_252 = + "expected " + GHC.Base.<> ( "for_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_252 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_252) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_253 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_254 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_255 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_256 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_253 + c1_254 = TreeSitter.Node.nodeStartPoint node_252 + TreeSitter.Node.TSPoint + r2_255 + c2_256 = TreeSitter.Node.nodeEndPoint node_252 + +deriving instance GHC.Classes.Eq a_257 => GHC.Classes.Eq (ForClause a_257) + +deriving instance GHC.Classes.Ord a_258 => GHC.Classes.Ord (ForClause a_258) + +deriving instance GHC.Show.Show a_259 => GHC.Show.Show (ForClause a_259) + +instance AST.Unmarshal.Unmarshal ForClause + +instance Data.Foldable.Foldable ForClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForStatement a = ForStatement + { ann :: a, + body :: (AST.Parse.Err (Block a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: ForClause GHC.Generics.:+: RangeClause) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_260. + AST.Traversable1.Class.Traversable1 a_260 + ) + +instance AST.Unmarshal.SymbolMatching ForStatement where + matchedSymbols _ = [146] + showFailure _ node_261 = + "expected " + GHC.Base.<> ( "for_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_261 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_261) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_262 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_263 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_264 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_265 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_262 + c1_263 = TreeSitter.Node.nodeStartPoint node_261 + TreeSitter.Node.TSPoint + r2_264 + c2_265 = TreeSitter.Node.nodeEndPoint node_261 + +deriving instance GHC.Classes.Eq a_266 => GHC.Classes.Eq (ForStatement a_266) + +deriving instance GHC.Classes.Ord a_267 => GHC.Classes.Ord (ForStatement a_267) + +deriving instance GHC.Show.Show a_268 => GHC.Show.Show (ForStatement a_268) + +instance AST.Unmarshal.Unmarshal ForStatement + +instance Data.Foldable.Foldable ForStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FuncLiteral a = FuncLiteral + { ann :: a, + body :: (AST.Parse.Err (Block a)), + result :: (GHC.Maybe.Maybe (AST.Parse.Err ((SimpleType GHC.Generics.:+: ParameterList) a))), + parameters :: (AST.Parse.Err (ParameterList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_269. + AST.Traversable1.Class.Traversable1 a_269 + ) + +instance AST.Unmarshal.SymbolMatching FuncLiteral where + matchedSymbols _ = [172] + showFailure _ node_270 = + "expected " + GHC.Base.<> ( "func_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_270 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_270) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_271 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_272 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_273 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_274 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_271 + c1_272 = TreeSitter.Node.nodeStartPoint node_270 + TreeSitter.Node.TSPoint + r2_273 + c2_274 = TreeSitter.Node.nodeEndPoint node_270 + +deriving instance GHC.Classes.Eq a_275 => GHC.Classes.Eq (FuncLiteral a_275) + +deriving instance GHC.Classes.Ord a_276 => GHC.Classes.Ord (FuncLiteral a_276) + +deriving instance GHC.Show.Show a_277 => GHC.Show.Show (FuncLiteral a_277) + +instance AST.Unmarshal.Unmarshal FuncLiteral + +instance Data.Foldable.Foldable FuncLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FuncLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FuncLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionDeclaration a = FunctionDeclaration + { ann :: a, + body :: (GHC.Maybe.Maybe (AST.Parse.Err (Block a))), + result :: (GHC.Maybe.Maybe (AST.Parse.Err ((SimpleType GHC.Generics.:+: ParameterList) a))), + name :: (AST.Parse.Err (Identifier a)), + parameters :: (AST.Parse.Err (ParameterList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_278. + AST.Traversable1.Class.Traversable1 a_278 + ) + +instance AST.Unmarshal.SymbolMatching FunctionDeclaration where + matchedSymbols _ = [101] + showFailure _ node_279 = + "expected " + GHC.Base.<> ( "function_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_279 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_279) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_280 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_281 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_282 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_283 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_280 + c1_281 = TreeSitter.Node.nodeStartPoint node_279 + TreeSitter.Node.TSPoint + r2_282 + c2_283 = TreeSitter.Node.nodeEndPoint node_279 + +deriving instance GHC.Classes.Eq a_284 => GHC.Classes.Eq (FunctionDeclaration a_284) + +deriving instance GHC.Classes.Ord a_285 => GHC.Classes.Ord (FunctionDeclaration a_285) + +deriving instance GHC.Show.Show a_286 => GHC.Show.Show (FunctionDeclaration a_286) + +instance AST.Unmarshal.Unmarshal FunctionDeclaration + +instance Data.Foldable.Foldable FunctionDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionType a = FunctionType + { ann :: a, + result :: (GHC.Maybe.Maybe (AST.Parse.Err ((SimpleType GHC.Generics.:+: ParameterList) a))), + parameters :: (AST.Parse.Err (ParameterList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_287. + AST.Traversable1.Class.Traversable1 a_287 + ) + +instance AST.Unmarshal.SymbolMatching FunctionType where + matchedSymbols _ = [124] + showFailure _ node_288 = + "expected " + GHC.Base.<> ( "function_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_288 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_288) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_289 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_290 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_291 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_292 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_289 + c1_290 = TreeSitter.Node.nodeStartPoint node_288 + TreeSitter.Node.TSPoint + r2_291 + c2_292 = TreeSitter.Node.nodeEndPoint node_288 + +deriving instance GHC.Classes.Eq a_293 => GHC.Classes.Eq (FunctionType a_293) + +deriving instance GHC.Classes.Ord a_294 => GHC.Classes.Ord (FunctionType a_294) + +deriving instance GHC.Show.Show a_295 => GHC.Show.Show (FunctionType a_295) + +instance AST.Unmarshal.Unmarshal FunctionType + +instance Data.Foldable.Foldable FunctionType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GoStatement a = GoStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_296. + AST.Traversable1.Class.Traversable1 a_296 + ) + +instance AST.Unmarshal.SymbolMatching GoStatement where + matchedSymbols _ = [143] + showFailure _ node_297 = + "expected " + GHC.Base.<> ( "go_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_297 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_297) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_298 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_299 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_300 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_301 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_298 + c1_299 = TreeSitter.Node.nodeStartPoint node_297 + TreeSitter.Node.TSPoint + r2_300 + c2_301 = TreeSitter.Node.nodeEndPoint node_297 + +deriving instance GHC.Classes.Eq a_302 => GHC.Classes.Eq (GoStatement a_302) + +deriving instance GHC.Classes.Ord a_303 => GHC.Classes.Ord (GoStatement a_303) + +deriving instance GHC.Show.Show a_304 => GHC.Show.Show (GoStatement a_304) + +instance AST.Unmarshal.Unmarshal GoStatement + +instance Data.Foldable.Foldable GoStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GoStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GoStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GotoStatement a = GotoStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (LabelName a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_305. + AST.Traversable1.Class.Traversable1 a_305 + ) + +instance AST.Unmarshal.SymbolMatching GotoStatement where + matchedSymbols _ = [141] + showFailure _ node_306 = + "expected " + GHC.Base.<> ( "goto_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_306 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_306) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_307 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_308 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_309 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_310 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_307 + c1_308 = TreeSitter.Node.nodeStartPoint node_306 + TreeSitter.Node.TSPoint + r2_309 + c2_310 = TreeSitter.Node.nodeEndPoint node_306 + +deriving instance GHC.Classes.Eq a_311 => GHC.Classes.Eq (GotoStatement a_311) + +deriving instance GHC.Classes.Ord a_312 => GHC.Classes.Ord (GotoStatement a_312) + +deriving instance GHC.Show.Show a_313 => GHC.Show.Show (GotoStatement a_313) + +instance AST.Unmarshal.Unmarshal GotoStatement + +instance Data.Foldable.Foldable GotoStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GotoStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GotoStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IfStatement a = IfStatement + { ann :: a, + alternative :: (GHC.Maybe.Maybe (AST.Parse.Err ((Block GHC.Generics.:+: IfStatement) a))), + initializer :: (GHC.Maybe.Maybe (AST.Parse.Err (SimpleStatement a))), + consequence :: (AST.Parse.Err (Block a)), + condition :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_314. + AST.Traversable1.Class.Traversable1 a_314 + ) + +instance AST.Unmarshal.SymbolMatching IfStatement where + matchedSymbols _ = [145] + showFailure _ node_315 = + "expected " + GHC.Base.<> ( "if_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_315 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_315) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_316 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_317 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_318 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_319 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_316 + c1_317 = TreeSitter.Node.nodeStartPoint node_315 + TreeSitter.Node.TSPoint + r2_318 + c2_319 = TreeSitter.Node.nodeEndPoint node_315 + +deriving instance GHC.Classes.Eq a_320 => GHC.Classes.Eq (IfStatement a_320) + +deriving instance GHC.Classes.Ord a_321 => GHC.Classes.Ord (IfStatement a_321) + +deriving instance GHC.Show.Show a_322 => GHC.Show.Show (IfStatement a_322) + +instance AST.Unmarshal.Unmarshal IfStatement + +instance Data.Foldable.Foldable IfStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IfStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IfStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImplicitLengthArrayType a = ImplicitLengthArrayType + { ann :: a, + element :: (AST.Parse.Err (Type a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_323. + AST.Traversable1.Class.Traversable1 a_323 + ) + +instance AST.Unmarshal.SymbolMatching ImplicitLengthArrayType where + matchedSymbols _ = [114] + showFailure _ node_324 = + "expected " + GHC.Base.<> ( "implicit_length_array_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_324 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_324) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_325 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_326 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_327 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_328 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_325 + c1_326 = TreeSitter.Node.nodeStartPoint node_324 + TreeSitter.Node.TSPoint + r2_327 + c2_328 = TreeSitter.Node.nodeEndPoint node_324 + +deriving instance GHC.Classes.Eq a_329 => GHC.Classes.Eq (ImplicitLengthArrayType a_329) + +deriving instance GHC.Classes.Ord a_330 => GHC.Classes.Ord (ImplicitLengthArrayType a_330) + +deriving instance GHC.Show.Show a_331 => GHC.Show.Show (ImplicitLengthArrayType a_331) + +instance AST.Unmarshal.Unmarshal ImplicitLengthArrayType + +instance Data.Foldable.Foldable ImplicitLengthArrayType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImplicitLengthArrayType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImplicitLengthArrayType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportDeclaration a = ImportDeclaration + { ann :: a, + extraChildren :: (AST.Parse.Err ((ImportSpec GHC.Generics.:+: ImportSpecList) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_332. + AST.Traversable1.Class.Traversable1 a_332 + ) + +instance AST.Unmarshal.SymbolMatching ImportDeclaration where + matchedSymbols _ = [92] + showFailure _ node_333 = + "expected " + GHC.Base.<> ( "import_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_333 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_333) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_334 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_335 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_336 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_337 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_334 + c1_335 = TreeSitter.Node.nodeStartPoint node_333 + TreeSitter.Node.TSPoint + r2_336 + c2_337 = TreeSitter.Node.nodeEndPoint node_333 + +deriving instance GHC.Classes.Eq a_338 => GHC.Classes.Eq (ImportDeclaration a_338) + +deriving instance GHC.Classes.Ord a_339 => GHC.Classes.Ord (ImportDeclaration a_339) + +deriving instance GHC.Show.Show a_340 => GHC.Show.Show (ImportDeclaration a_340) + +instance AST.Unmarshal.Unmarshal ImportDeclaration + +instance Data.Foldable.Foldable ImportDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportSpec a = ImportSpec + { ann :: a, + path :: (AST.Parse.Err ((InterpretedStringLiteral GHC.Generics.:+: RawStringLiteral) a)), + name :: (GHC.Maybe.Maybe (AST.Parse.Err ((BlankIdentifier GHC.Generics.:+: Dot GHC.Generics.:+: PackageIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_341. + AST.Traversable1.Class.Traversable1 a_341 + ) + +instance AST.Unmarshal.SymbolMatching ImportSpec where + matchedSymbols _ = [93] + showFailure _ node_342 = + "expected " + GHC.Base.<> ( "import_spec" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_342 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_342) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_343 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_344 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_345 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_346 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_343 + c1_344 = TreeSitter.Node.nodeStartPoint node_342 + TreeSitter.Node.TSPoint + r2_345 + c2_346 = TreeSitter.Node.nodeEndPoint node_342 + +deriving instance GHC.Classes.Eq a_347 => GHC.Classes.Eq (ImportSpec a_347) + +deriving instance GHC.Classes.Ord a_348 => GHC.Classes.Ord (ImportSpec a_348) + +deriving instance GHC.Show.Show a_349 => GHC.Show.Show (ImportSpec a_349) + +instance AST.Unmarshal.Unmarshal ImportSpec + +instance Data.Foldable.Foldable ImportSpec where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportSpec where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportSpec where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportSpecList a = ImportSpecList + { ann :: a, + extraChildren :: ([AST.Parse.Err (ImportSpec a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_350. + AST.Traversable1.Class.Traversable1 a_350 + ) + +instance AST.Unmarshal.SymbolMatching ImportSpecList where + matchedSymbols _ = [95] + showFailure _ node_351 = + "expected " + GHC.Base.<> ( "import_spec_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_351 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_351) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_352 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_353 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_354 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_355 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_352 + c1_353 = TreeSitter.Node.nodeStartPoint node_351 + TreeSitter.Node.TSPoint + r2_354 + c2_355 = TreeSitter.Node.nodeEndPoint node_351 + +deriving instance GHC.Classes.Eq a_356 => GHC.Classes.Eq (ImportSpecList a_356) + +deriving instance GHC.Classes.Ord a_357 => GHC.Classes.Ord (ImportSpecList a_357) + +deriving instance GHC.Show.Show a_358 => GHC.Show.Show (ImportSpecList a_358) + +instance AST.Unmarshal.Unmarshal ImportSpecList + +instance Data.Foldable.Foldable ImportSpecList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportSpecList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportSpecList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IncStatement a = IncStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_359. + AST.Traversable1.Class.Traversable1 a_359 + ) + +instance AST.Unmarshal.SymbolMatching IncStatement where + matchedSymbols _ = [132] + showFailure _ node_360 = + "expected " + GHC.Base.<> ( "inc_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_360 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_360) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_361 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_362 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_363 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_364 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_361 + c1_362 = TreeSitter.Node.nodeStartPoint node_360 + TreeSitter.Node.TSPoint + r2_363 + c2_364 = TreeSitter.Node.nodeEndPoint node_360 + +deriving instance GHC.Classes.Eq a_365 => GHC.Classes.Eq (IncStatement a_365) + +deriving instance GHC.Classes.Ord a_366 => GHC.Classes.Ord (IncStatement a_366) + +deriving instance GHC.Show.Show a_367 => GHC.Show.Show (IncStatement a_367) + +instance AST.Unmarshal.Unmarshal IncStatement + +instance Data.Foldable.Foldable IncStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IncStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IncStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IndexExpression a = IndexExpression + { ann :: a, + operand :: (AST.Parse.Err (Expression a)), + index :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_368. + AST.Traversable1.Class.Traversable1 a_368 + ) + +instance AST.Unmarshal.SymbolMatching IndexExpression where + matchedSymbols _ = [164] + showFailure _ node_369 = + "expected " + GHC.Base.<> ( "index_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_369 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_369) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_370 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_371 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_372 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_373 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_370 + c1_371 = TreeSitter.Node.nodeStartPoint node_369 + TreeSitter.Node.TSPoint + r2_372 + c2_373 = TreeSitter.Node.nodeEndPoint node_369 + +deriving instance GHC.Classes.Eq a_374 => GHC.Classes.Eq (IndexExpression a_374) + +deriving instance GHC.Classes.Ord a_375 => GHC.Classes.Ord (IndexExpression a_375) + +deriving instance GHC.Show.Show a_376 => GHC.Show.Show (IndexExpression a_376) + +instance AST.Unmarshal.Unmarshal IndexExpression + +instance Data.Foldable.Foldable IndexExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IndexExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IndexExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InterfaceType a = InterfaceType + { ann :: a, + extraChildren :: (AST.Parse.Err (MethodSpecList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_377. + AST.Traversable1.Class.Traversable1 a_377 + ) + +instance AST.Unmarshal.SymbolMatching InterfaceType where + matchedSymbols _ = [119] + showFailure _ node_378 = + "expected " + GHC.Base.<> ( "interface_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_378 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_378) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_379 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_380 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_381 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_382 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_379 + c1_380 = TreeSitter.Node.nodeStartPoint node_378 + TreeSitter.Node.TSPoint + r2_381 + c2_382 = TreeSitter.Node.nodeEndPoint node_378 + +deriving instance GHC.Classes.Eq a_383 => GHC.Classes.Eq (InterfaceType a_383) + +deriving instance GHC.Classes.Ord a_384 => GHC.Classes.Ord (InterfaceType a_384) + +deriving instance GHC.Show.Show a_385 => GHC.Show.Show (InterfaceType a_385) + +instance AST.Unmarshal.Unmarshal InterfaceType + +instance Data.Foldable.Foldable InterfaceType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InterfaceType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InterfaceType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InterpretedStringLiteral a = InterpretedStringLiteral + { ann :: a, + extraChildren :: ([AST.Parse.Err (EscapeSequence a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_386. + AST.Traversable1.Class.Traversable1 a_386 + ) + +instance AST.Unmarshal.SymbolMatching InterpretedStringLiteral where + matchedSymbols _ = [176] + showFailure _ node_387 = + "expected " + GHC.Base.<> ( "interpreted_string_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_387 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_387) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_388 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_389 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_390 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_391 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_388 + c1_389 = TreeSitter.Node.nodeStartPoint node_387 + TreeSitter.Node.TSPoint + r2_390 + c2_391 = TreeSitter.Node.nodeEndPoint node_387 + +deriving instance GHC.Classes.Eq a_392 => GHC.Classes.Eq (InterpretedStringLiteral a_392) + +deriving instance GHC.Classes.Ord a_393 => GHC.Classes.Ord (InterpretedStringLiteral a_393) + +deriving instance GHC.Show.Show a_394 => GHC.Show.Show (InterpretedStringLiteral a_394) + +instance AST.Unmarshal.Unmarshal InterpretedStringLiteral + +instance Data.Foldable.Foldable InterpretedStringLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InterpretedStringLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InterpretedStringLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data KeyedElement a = KeyedElement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: FieldIdentifier GHC.Generics.:+: LiteralValue) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_395. + AST.Traversable1.Class.Traversable1 a_395 + ) + +instance AST.Unmarshal.SymbolMatching KeyedElement where + matchedSymbols _ = [170] + showFailure _ node_396 = + "expected " + GHC.Base.<> ( "keyed_element" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_396 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_396) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_397 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_398 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_399 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_400 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_397 + c1_398 = TreeSitter.Node.nodeStartPoint node_396 + TreeSitter.Node.TSPoint + r2_399 + c2_400 = TreeSitter.Node.nodeEndPoint node_396 + +deriving instance GHC.Classes.Eq a_401 => GHC.Classes.Eq (KeyedElement a_401) + +deriving instance GHC.Classes.Ord a_402 => GHC.Classes.Ord (KeyedElement a_402) + +deriving instance GHC.Show.Show a_403 => GHC.Show.Show (KeyedElement a_403) + +instance AST.Unmarshal.Unmarshal KeyedElement + +instance Data.Foldable.Foldable KeyedElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor KeyedElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable KeyedElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LabeledStatement a = LabeledStatement + { ann :: a, + label :: (AST.Parse.Err (LabelName a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Statement a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_404. + AST.Traversable1.Class.Traversable1 a_404 + ) + +instance AST.Unmarshal.SymbolMatching LabeledStatement where + matchedSymbols _ = [136, 137] + showFailure _ node_405 = + "expected " + GHC.Base.<> ( "labeled_statement, labeled_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_405 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_405) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_406 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_407 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_408 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_409 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_406 + c1_407 = TreeSitter.Node.nodeStartPoint node_405 + TreeSitter.Node.TSPoint + r2_408 + c2_409 = TreeSitter.Node.nodeEndPoint node_405 + +deriving instance GHC.Classes.Eq a_410 => GHC.Classes.Eq (LabeledStatement a_410) + +deriving instance GHC.Classes.Ord a_411 => GHC.Classes.Ord (LabeledStatement a_411) + +deriving instance GHC.Show.Show a_412 => GHC.Show.Show (LabeledStatement a_412) + +instance AST.Unmarshal.Unmarshal LabeledStatement + +instance Data.Foldable.Foldable LabeledStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LabeledStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LabeledStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LiteralValue a = LiteralValue + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Element GHC.Generics.:+: KeyedElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_413. + AST.Traversable1.Class.Traversable1 a_413 + ) + +instance AST.Unmarshal.SymbolMatching LiteralValue where + matchedSymbols _ = [169] + showFailure _ node_414 = + "expected " + GHC.Base.<> ( "literal_value" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_414 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_414) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_415 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_416 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_417 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_418 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_415 + c1_416 = TreeSitter.Node.nodeStartPoint node_414 + TreeSitter.Node.TSPoint + r2_417 + c2_418 = TreeSitter.Node.nodeEndPoint node_414 + +deriving instance GHC.Classes.Eq a_419 => GHC.Classes.Eq (LiteralValue a_419) + +deriving instance GHC.Classes.Ord a_420 => GHC.Classes.Ord (LiteralValue a_420) + +deriving instance GHC.Show.Show a_421 => GHC.Show.Show (LiteralValue a_421) + +instance AST.Unmarshal.Unmarshal LiteralValue + +instance Data.Foldable.Foldable LiteralValue where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LiteralValue where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LiteralValue where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MapType a = MapType + { ann :: a, + value :: (AST.Parse.Err (Type a)), + key :: (AST.Parse.Err (Type a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_422. + AST.Traversable1.Class.Traversable1 a_422 + ) + +instance AST.Unmarshal.SymbolMatching MapType where + matchedSymbols _ = [122] + showFailure _ node_423 = + "expected " + GHC.Base.<> ( "map_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_423 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_423) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_424 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_425 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_426 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_427 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_424 + c1_425 = TreeSitter.Node.nodeStartPoint node_423 + TreeSitter.Node.TSPoint + r2_426 + c2_427 = TreeSitter.Node.nodeEndPoint node_423 + +deriving instance GHC.Classes.Eq a_428 => GHC.Classes.Eq (MapType a_428) + +deriving instance GHC.Classes.Ord a_429 => GHC.Classes.Ord (MapType a_429) + +deriving instance GHC.Show.Show a_430 => GHC.Show.Show (MapType a_430) + +instance AST.Unmarshal.Unmarshal MapType + +instance Data.Foldable.Foldable MapType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MapType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MapType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodDeclaration a = MethodDeclaration + { ann :: a, + body :: (GHC.Maybe.Maybe (AST.Parse.Err (Block a))), + result :: (GHC.Maybe.Maybe (AST.Parse.Err ((SimpleType GHC.Generics.:+: ParameterList) a))), + receiver :: (AST.Parse.Err (ParameterList a)), + name :: (AST.Parse.Err (FieldIdentifier a)), + parameters :: (AST.Parse.Err (ParameterList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_431. + AST.Traversable1.Class.Traversable1 a_431 + ) + +instance AST.Unmarshal.SymbolMatching MethodDeclaration where + matchedSymbols _ = [102] + showFailure _ node_432 = + "expected " + GHC.Base.<> ( "method_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_432 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_432) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_433 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_434 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_435 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_436 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_433 + c1_434 = TreeSitter.Node.nodeStartPoint node_432 + TreeSitter.Node.TSPoint + r2_435 + c2_436 = TreeSitter.Node.nodeEndPoint node_432 + +deriving instance GHC.Classes.Eq a_437 => GHC.Classes.Eq (MethodDeclaration a_437) + +deriving instance GHC.Classes.Ord a_438 => GHC.Classes.Ord (MethodDeclaration a_438) + +deriving instance GHC.Show.Show a_439 => GHC.Show.Show (MethodDeclaration a_439) + +instance AST.Unmarshal.Unmarshal MethodDeclaration + +instance Data.Foldable.Foldable MethodDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodSpec a = MethodSpec + { ann :: a, + result :: (GHC.Maybe.Maybe (AST.Parse.Err ((SimpleType GHC.Generics.:+: ParameterList) a))), + name :: (AST.Parse.Err (FieldIdentifier a)), + parameters :: (AST.Parse.Err (ParameterList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_440. + AST.Traversable1.Class.Traversable1 a_440 + ) + +instance AST.Unmarshal.SymbolMatching MethodSpec where + matchedSymbols _ = [121] + showFailure _ node_441 = + "expected " + GHC.Base.<> ( "method_spec" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_441 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_441) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_442 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_443 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_444 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_445 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_442 + c1_443 = TreeSitter.Node.nodeStartPoint node_441 + TreeSitter.Node.TSPoint + r2_444 + c2_445 = TreeSitter.Node.nodeEndPoint node_441 + +deriving instance GHC.Classes.Eq a_446 => GHC.Classes.Eq (MethodSpec a_446) + +deriving instance GHC.Classes.Ord a_447 => GHC.Classes.Ord (MethodSpec a_447) + +deriving instance GHC.Show.Show a_448 => GHC.Show.Show (MethodSpec a_448) + +instance AST.Unmarshal.Unmarshal MethodSpec + +instance Data.Foldable.Foldable MethodSpec where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodSpec where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodSpec where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodSpecList a = MethodSpecList + { ann :: a, + extraChildren :: ([AST.Parse.Err ((MethodSpec GHC.Generics.:+: QualifiedType GHC.Generics.:+: TypeIdentifier) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_449. + AST.Traversable1.Class.Traversable1 a_449 + ) + +instance AST.Unmarshal.SymbolMatching MethodSpecList where + matchedSymbols _ = [120] + showFailure _ node_450 = + "expected " + GHC.Base.<> ( "method_spec_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_450 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_450) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_451 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_452 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_453 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_454 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_451 + c1_452 = TreeSitter.Node.nodeStartPoint node_450 + TreeSitter.Node.TSPoint + r2_453 + c2_454 = TreeSitter.Node.nodeEndPoint node_450 + +deriving instance GHC.Classes.Eq a_455 => GHC.Classes.Eq (MethodSpecList a_455) + +deriving instance GHC.Classes.Ord a_456 => GHC.Classes.Ord (MethodSpecList a_456) + +deriving instance GHC.Show.Show a_457 => GHC.Show.Show (MethodSpecList a_457) + +instance AST.Unmarshal.Unmarshal MethodSpecList + +instance Data.Foldable.Foldable MethodSpecList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodSpecList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodSpecList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PackageClause a = PackageClause + { ann :: a, + extraChildren :: (AST.Parse.Err (PackageIdentifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_458. + AST.Traversable1.Class.Traversable1 a_458 + ) + +instance AST.Unmarshal.SymbolMatching PackageClause where + matchedSymbols _ = [91] + showFailure _ node_459 = + "expected " + GHC.Base.<> ( "package_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_459 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_459) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_460 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_461 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_462 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_463 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_460 + c1_461 = TreeSitter.Node.nodeStartPoint node_459 + TreeSitter.Node.TSPoint + r2_462 + c2_463 = TreeSitter.Node.nodeEndPoint node_459 + +deriving instance GHC.Classes.Eq a_464 => GHC.Classes.Eq (PackageClause a_464) + +deriving instance GHC.Classes.Ord a_465 => GHC.Classes.Ord (PackageClause a_465) + +deriving instance GHC.Show.Show a_466 => GHC.Show.Show (PackageClause a_466) + +instance AST.Unmarshal.Unmarshal PackageClause + +instance Data.Foldable.Foldable PackageClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PackageClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PackageClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParameterDeclaration a = ParameterDeclaration + { ann :: a, + name :: ([AST.Parse.Err ((AnonymousComma GHC.Generics.:+: Identifier) a)]), + type' :: (AST.Parse.Err (Type a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_467. + AST.Traversable1.Class.Traversable1 a_467 + ) + +instance AST.Unmarshal.SymbolMatching ParameterDeclaration where + matchedSymbols _ = [104] + showFailure _ node_468 = + "expected " + GHC.Base.<> ( "parameter_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_468 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_468) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_469 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_470 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_471 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_472 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_469 + c1_470 = TreeSitter.Node.nodeStartPoint node_468 + TreeSitter.Node.TSPoint + r2_471 + c2_472 = TreeSitter.Node.nodeEndPoint node_468 + +deriving instance GHC.Classes.Eq a_473 => GHC.Classes.Eq (ParameterDeclaration a_473) + +deriving instance GHC.Classes.Ord a_474 => GHC.Classes.Ord (ParameterDeclaration a_474) + +deriving instance GHC.Show.Show a_475 => GHC.Show.Show (ParameterDeclaration a_475) + +instance AST.Unmarshal.Unmarshal ParameterDeclaration + +instance Data.Foldable.Foldable ParameterDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParameterDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParameterDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParameterList a = ParameterList + { ann :: a, + extraChildren :: ([AST.Parse.Err ((ParameterDeclaration GHC.Generics.:+: VariadicParameterDeclaration) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_476. + AST.Traversable1.Class.Traversable1 a_476 + ) + +instance AST.Unmarshal.SymbolMatching ParameterList where + matchedSymbols _ = [103] + showFailure _ node_477 = + "expected " + GHC.Base.<> ( "parameter_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_477 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_477) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_478 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_479 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_480 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_481 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_478 + c1_479 = TreeSitter.Node.nodeStartPoint node_477 + TreeSitter.Node.TSPoint + r2_480 + c2_481 = TreeSitter.Node.nodeEndPoint node_477 + +deriving instance GHC.Classes.Eq a_482 => GHC.Classes.Eq (ParameterList a_482) + +deriving instance GHC.Classes.Ord a_483 => GHC.Classes.Ord (ParameterList a_483) + +deriving instance GHC.Show.Show a_484 => GHC.Show.Show (ParameterList a_484) + +instance AST.Unmarshal.Unmarshal ParameterList + +instance Data.Foldable.Foldable ParameterList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParameterList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParameterList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParenthesizedExpression a = ParenthesizedExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_485. + AST.Traversable1.Class.Traversable1 a_485 + ) + +instance AST.Unmarshal.SymbolMatching ParenthesizedExpression where + matchedSymbols _ = [158] + showFailure _ node_486 = + "expected " + GHC.Base.<> ( "parenthesized_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_486 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_486) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_487 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_488 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_489 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_490 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_487 + c1_488 = TreeSitter.Node.nodeStartPoint node_486 + TreeSitter.Node.TSPoint + r2_489 + c2_490 = TreeSitter.Node.nodeEndPoint node_486 + +deriving instance GHC.Classes.Eq a_491 => GHC.Classes.Eq (ParenthesizedExpression a_491) + +deriving instance GHC.Classes.Ord a_492 => GHC.Classes.Ord (ParenthesizedExpression a_492) + +deriving instance GHC.Show.Show a_493 => GHC.Show.Show (ParenthesizedExpression a_493) + +instance AST.Unmarshal.Unmarshal ParenthesizedExpression + +instance Data.Foldable.Foldable ParenthesizedExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParenthesizedExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParenthesizedExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParenthesizedType a = ParenthesizedType + { ann :: a, + extraChildren :: (AST.Parse.Err (Type a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_494. + AST.Traversable1.Class.Traversable1 a_494 + ) + +instance AST.Unmarshal.SymbolMatching ParenthesizedType where + matchedSymbols _ = [110] + showFailure _ node_495 = + "expected " + GHC.Base.<> ( "parenthesized_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_495 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_495) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_496 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_497 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_498 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_499 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_496 + c1_497 = TreeSitter.Node.nodeStartPoint node_495 + TreeSitter.Node.TSPoint + r2_498 + c2_499 = TreeSitter.Node.nodeEndPoint node_495 + +deriving instance GHC.Classes.Eq a_500 => GHC.Classes.Eq (ParenthesizedType a_500) + +deriving instance GHC.Classes.Ord a_501 => GHC.Classes.Ord (ParenthesizedType a_501) + +deriving instance GHC.Show.Show a_502 => GHC.Show.Show (ParenthesizedType a_502) + +instance AST.Unmarshal.Unmarshal ParenthesizedType + +instance Data.Foldable.Foldable ParenthesizedType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParenthesizedType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParenthesizedType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PointerType a = PointerType {ann :: a, extraChildren :: (AST.Parse.Err (Type a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_503. + AST.Traversable1.Class.Traversable1 a_503 + ) + +instance AST.Unmarshal.SymbolMatching PointerType where + matchedSymbols _ = [112] + showFailure _ node_504 = + "expected " + GHC.Base.<> ( "pointer_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_504 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_504) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_505 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_506 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_507 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_508 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_505 + c1_506 = TreeSitter.Node.nodeStartPoint node_504 + TreeSitter.Node.TSPoint + r2_507 + c2_508 = TreeSitter.Node.nodeEndPoint node_504 + +deriving instance GHC.Classes.Eq a_509 => GHC.Classes.Eq (PointerType a_509) + +deriving instance GHC.Classes.Ord a_510 => GHC.Classes.Ord (PointerType a_510) + +deriving instance GHC.Show.Show a_511 => GHC.Show.Show (PointerType a_511) + +instance AST.Unmarshal.Unmarshal PointerType + +instance Data.Foldable.Foldable PointerType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PointerType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PointerType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data QualifiedType a = QualifiedType + { ann :: a, + name :: (AST.Parse.Err (TypeIdentifier a)), + package :: (AST.Parse.Err (PackageIdentifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_512. + AST.Traversable1.Class.Traversable1 a_512 + ) + +instance AST.Unmarshal.SymbolMatching QualifiedType where + matchedSymbols _ = [175] + showFailure _ node_513 = + "expected " + GHC.Base.<> ( "qualified_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_513 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_513) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_514 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_515 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_516 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_517 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_514 + c1_515 = TreeSitter.Node.nodeStartPoint node_513 + TreeSitter.Node.TSPoint + r2_516 + c2_517 = TreeSitter.Node.nodeEndPoint node_513 + +deriving instance GHC.Classes.Eq a_518 => GHC.Classes.Eq (QualifiedType a_518) + +deriving instance GHC.Classes.Ord a_519 => GHC.Classes.Ord (QualifiedType a_519) + +deriving instance GHC.Show.Show a_520 => GHC.Show.Show (QualifiedType a_520) + +instance AST.Unmarshal.Unmarshal QualifiedType + +instance Data.Foldable.Foldable QualifiedType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor QualifiedType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable QualifiedType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RangeClause a = RangeClause + { ann :: a, + left :: (GHC.Maybe.Maybe (AST.Parse.Err (ExpressionList a))), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_521. + AST.Traversable1.Class.Traversable1 a_521 + ) + +instance AST.Unmarshal.SymbolMatching RangeClause where + matchedSymbols _ = [148] + showFailure _ node_522 = + "expected " + GHC.Base.<> ( "range_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_522 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_522) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_523 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_524 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_525 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_526 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_523 + c1_524 = TreeSitter.Node.nodeStartPoint node_522 + TreeSitter.Node.TSPoint + r2_525 + c2_526 = TreeSitter.Node.nodeEndPoint node_522 + +deriving instance GHC.Classes.Eq a_527 => GHC.Classes.Eq (RangeClause a_527) + +deriving instance GHC.Classes.Ord a_528 => GHC.Classes.Ord (RangeClause a_528) + +deriving instance GHC.Show.Show a_529 => GHC.Show.Show (RangeClause a_529) + +instance AST.Unmarshal.Unmarshal RangeClause + +instance Data.Foldable.Foldable RangeClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RangeClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RangeClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ReceiveStatement a = ReceiveStatement + { ann :: a, + left :: (GHC.Maybe.Maybe (AST.Parse.Err (ExpressionList a))), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_530. + AST.Traversable1.Class.Traversable1 a_530 + ) + +instance AST.Unmarshal.SymbolMatching ReceiveStatement where + matchedSymbols _ = [131] + showFailure _ node_531 = + "expected " + GHC.Base.<> ( "receive_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_531 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_531) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_532 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_533 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_534 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_535 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_532 + c1_533 = TreeSitter.Node.nodeStartPoint node_531 + TreeSitter.Node.TSPoint + r2_534 + c2_535 = TreeSitter.Node.nodeEndPoint node_531 + +deriving instance GHC.Classes.Eq a_536 => GHC.Classes.Eq (ReceiveStatement a_536) + +deriving instance GHC.Classes.Ord a_537 => GHC.Classes.Ord (ReceiveStatement a_537) + +deriving instance GHC.Show.Show a_538 => GHC.Show.Show (ReceiveStatement a_538) + +instance AST.Unmarshal.Unmarshal ReceiveStatement + +instance Data.Foldable.Foldable ReceiveStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ReceiveStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ReceiveStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ReturnStatement a = ReturnStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ExpressionList a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_539. + AST.Traversable1.Class.Traversable1 a_539 + ) + +instance AST.Unmarshal.SymbolMatching ReturnStatement where + matchedSymbols _ = [142] + showFailure _ node_540 = + "expected " + GHC.Base.<> ( "return_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_540 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_540) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_541 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_542 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_543 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_544 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_541 + c1_542 = TreeSitter.Node.nodeStartPoint node_540 + TreeSitter.Node.TSPoint + r2_543 + c2_544 = TreeSitter.Node.nodeEndPoint node_540 + +deriving instance GHC.Classes.Eq a_545 => GHC.Classes.Eq (ReturnStatement a_545) + +deriving instance GHC.Classes.Ord a_546 => GHC.Classes.Ord (ReturnStatement a_546) + +deriving instance GHC.Show.Show a_547 => GHC.Show.Show (ReturnStatement a_547) + +instance AST.Unmarshal.Unmarshal ReturnStatement + +instance Data.Foldable.Foldable ReturnStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ReturnStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ReturnStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SelectStatement a = SelectStatement + { ann :: a, + extraChildren :: ([AST.Parse.Err ((CommunicationCase GHC.Generics.:+: DefaultCase) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_548. + AST.Traversable1.Class.Traversable1 a_548 + ) + +instance AST.Unmarshal.SymbolMatching SelectStatement where + matchedSymbols _ = [155] + showFailure _ node_549 = + "expected " + GHC.Base.<> ( "select_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_549 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_549) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_550 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_551 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_552 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_553 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_550 + c1_551 = TreeSitter.Node.nodeStartPoint node_549 + TreeSitter.Node.TSPoint + r2_552 + c2_553 = TreeSitter.Node.nodeEndPoint node_549 + +deriving instance GHC.Classes.Eq a_554 => GHC.Classes.Eq (SelectStatement a_554) + +deriving instance GHC.Classes.Ord a_555 => GHC.Classes.Ord (SelectStatement a_555) + +deriving instance GHC.Show.Show a_556 => GHC.Show.Show (SelectStatement a_556) + +instance AST.Unmarshal.Unmarshal SelectStatement + +instance Data.Foldable.Foldable SelectStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SelectStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SelectStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SelectorExpression a = SelectorExpression + { ann :: a, + field :: (AST.Parse.Err (FieldIdentifier a)), + operand :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_557. + AST.Traversable1.Class.Traversable1 a_557 + ) + +instance AST.Unmarshal.SymbolMatching SelectorExpression where + matchedSymbols _ = [163] + showFailure _ node_558 = + "expected " + GHC.Base.<> ( "selector_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_558 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_558) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_559 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_560 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_561 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_562 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_559 + c1_560 = TreeSitter.Node.nodeStartPoint node_558 + TreeSitter.Node.TSPoint + r2_561 + c2_562 = TreeSitter.Node.nodeEndPoint node_558 + +deriving instance GHC.Classes.Eq a_563 => GHC.Classes.Eq (SelectorExpression a_563) + +deriving instance GHC.Classes.Ord a_564 => GHC.Classes.Ord (SelectorExpression a_564) + +deriving instance GHC.Show.Show a_565 => GHC.Show.Show (SelectorExpression a_565) + +instance AST.Unmarshal.Unmarshal SelectorExpression + +instance Data.Foldable.Foldable SelectorExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SelectorExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SelectorExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SendStatement a = SendStatement + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + channel :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_566. + AST.Traversable1.Class.Traversable1 a_566 + ) + +instance AST.Unmarshal.SymbolMatching SendStatement where + matchedSymbols _ = [130] + showFailure _ node_567 = + "expected " + GHC.Base.<> ( "send_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_567 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_567) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_568 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_569 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_570 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_571 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_568 + c1_569 = TreeSitter.Node.nodeStartPoint node_567 + TreeSitter.Node.TSPoint + r2_570 + c2_571 = TreeSitter.Node.nodeEndPoint node_567 + +deriving instance GHC.Classes.Eq a_572 => GHC.Classes.Eq (SendStatement a_572) + +deriving instance GHC.Classes.Ord a_573 => GHC.Classes.Ord (SendStatement a_573) + +deriving instance GHC.Show.Show a_574 => GHC.Show.Show (SendStatement a_574) + +instance AST.Unmarshal.Unmarshal SendStatement + +instance Data.Foldable.Foldable SendStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SendStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SendStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ShortVarDeclaration a = ShortVarDeclaration + { ann :: a, + left :: (AST.Parse.Err (ExpressionList a)), + right :: (AST.Parse.Err (ExpressionList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_575. + AST.Traversable1.Class.Traversable1 a_575 + ) + +instance AST.Unmarshal.SymbolMatching ShortVarDeclaration where + matchedSymbols _ = [135] + showFailure _ node_576 = + "expected " + GHC.Base.<> ( "short_var_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_576 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_576) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_577 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_578 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_579 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_580 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_577 + c1_578 = TreeSitter.Node.nodeStartPoint node_576 + TreeSitter.Node.TSPoint + r2_579 + c2_580 = TreeSitter.Node.nodeEndPoint node_576 + +deriving instance GHC.Classes.Eq a_581 => GHC.Classes.Eq (ShortVarDeclaration a_581) + +deriving instance GHC.Classes.Ord a_582 => GHC.Classes.Ord (ShortVarDeclaration a_582) + +deriving instance GHC.Show.Show a_583 => GHC.Show.Show (ShortVarDeclaration a_583) + +instance AST.Unmarshal.Unmarshal ShortVarDeclaration + +instance Data.Foldable.Foldable ShortVarDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ShortVarDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ShortVarDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SliceExpression a = SliceExpression + { ann :: a, + start :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + capacity :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + end :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + operand :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_584. + AST.Traversable1.Class.Traversable1 a_584 + ) + +instance AST.Unmarshal.SymbolMatching SliceExpression where + matchedSymbols _ = [165] + showFailure _ node_585 = + "expected " + GHC.Base.<> ( "slice_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_585 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_585) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_586 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_587 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_588 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_589 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_586 + c1_587 = TreeSitter.Node.nodeStartPoint node_585 + TreeSitter.Node.TSPoint + r2_588 + c2_589 = TreeSitter.Node.nodeEndPoint node_585 + +deriving instance GHC.Classes.Eq a_590 => GHC.Classes.Eq (SliceExpression a_590) + +deriving instance GHC.Classes.Ord a_591 => GHC.Classes.Ord (SliceExpression a_591) + +deriving instance GHC.Show.Show a_592 => GHC.Show.Show (SliceExpression a_592) + +instance AST.Unmarshal.Unmarshal SliceExpression + +instance Data.Foldable.Foldable SliceExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SliceExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SliceExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SliceType a = SliceType {ann :: a, element :: (AST.Parse.Err (Type a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_593. + AST.Traversable1.Class.Traversable1 a_593 + ) + +instance AST.Unmarshal.SymbolMatching SliceType where + matchedSymbols _ = [115] + showFailure _ node_594 = + "expected " + GHC.Base.<> ( "slice_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_594 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_594) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_595 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_596 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_597 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_598 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_595 + c1_596 = TreeSitter.Node.nodeStartPoint node_594 + TreeSitter.Node.TSPoint + r2_597 + c2_598 = TreeSitter.Node.nodeEndPoint node_594 + +deriving instance GHC.Classes.Eq a_599 => GHC.Classes.Eq (SliceType a_599) + +deriving instance GHC.Classes.Ord a_600 => GHC.Classes.Ord (SliceType a_600) + +deriving instance GHC.Show.Show a_601 => GHC.Show.Show (SliceType a_601) + +instance AST.Unmarshal.Unmarshal SliceType + +instance Data.Foldable.Foldable SliceType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SliceType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SliceType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SourceFile a = SourceFile + { ann :: a, + extraChildren :: ([AST.Parse.Err ((ConstDeclaration GHC.Generics.:+: FunctionDeclaration GHC.Generics.:+: ImportDeclaration GHC.Generics.:+: MethodDeclaration GHC.Generics.:+: PackageClause GHC.Generics.:+: TypeDeclaration GHC.Generics.:+: VarDeclaration) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_602. + AST.Traversable1.Class.Traversable1 a_602 + ) + +instance AST.Unmarshal.SymbolMatching SourceFile where + matchedSymbols _ = [90] + showFailure _ node_603 = + "expected " + GHC.Base.<> ( "source_file" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_603 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_603) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_604 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_605 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_606 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_607 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_604 + c1_605 = TreeSitter.Node.nodeStartPoint node_603 + TreeSitter.Node.TSPoint + r2_606 + c2_607 = TreeSitter.Node.nodeEndPoint node_603 + +deriving instance GHC.Classes.Eq a_608 => GHC.Classes.Eq (SourceFile a_608) + +deriving instance GHC.Classes.Ord a_609 => GHC.Classes.Ord (SourceFile a_609) + +deriving instance GHC.Show.Show a_610 => GHC.Show.Show (SourceFile a_610) + +instance AST.Unmarshal.Unmarshal SourceFile + +instance Data.Foldable.Foldable SourceFile where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SourceFile where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SourceFile where + traverse = AST.Traversable1.Class.traverseDefault1 + +data StructType a = StructType + { ann :: a, + extraChildren :: (AST.Parse.Err (FieldDeclarationList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_611. + AST.Traversable1.Class.Traversable1 a_611 + ) + +instance AST.Unmarshal.SymbolMatching StructType where + matchedSymbols _ = [116] + showFailure _ node_612 = + "expected " + GHC.Base.<> ( "struct_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_612 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_612) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_613 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_614 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_615 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_616 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_613 + c1_614 = TreeSitter.Node.nodeStartPoint node_612 + TreeSitter.Node.TSPoint + r2_615 + c2_616 = TreeSitter.Node.nodeEndPoint node_612 + +deriving instance GHC.Classes.Eq a_617 => GHC.Classes.Eq (StructType a_617) + +deriving instance GHC.Classes.Ord a_618 => GHC.Classes.Ord (StructType a_618) + +deriving instance GHC.Show.Show a_619 => GHC.Show.Show (StructType a_619) + +instance AST.Unmarshal.Unmarshal StructType + +instance Data.Foldable.Foldable StructType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StructType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StructType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeAlias a = TypeAlias + { ann :: a, + name :: (AST.Parse.Err (TypeIdentifier a)), + type' :: (AST.Parse.Err (Type a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_620. + AST.Traversable1.Class.Traversable1 a_620 + ) + +instance AST.Unmarshal.SymbolMatching TypeAlias where + matchedSymbols _ = [106] + showFailure _ node_621 = + "expected " + GHC.Base.<> ( "type_alias" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_621 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_621) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_622 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_623 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_624 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_625 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_622 + c1_623 = TreeSitter.Node.nodeStartPoint node_621 + TreeSitter.Node.TSPoint + r2_624 + c2_625 = TreeSitter.Node.nodeEndPoint node_621 + +deriving instance GHC.Classes.Eq a_626 => GHC.Classes.Eq (TypeAlias a_626) + +deriving instance GHC.Classes.Ord a_627 => GHC.Classes.Ord (TypeAlias a_627) + +deriving instance GHC.Show.Show a_628 => GHC.Show.Show (TypeAlias a_628) + +instance AST.Unmarshal.Unmarshal TypeAlias + +instance Data.Foldable.Foldable TypeAlias where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeAlias where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeAlias where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeAssertionExpression a = TypeAssertionExpression + { ann :: a, + type' :: (AST.Parse.Err (Type a)), + operand :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_629. + AST.Traversable1.Class.Traversable1 a_629 + ) + +instance AST.Unmarshal.SymbolMatching TypeAssertionExpression where + matchedSymbols _ = [166] + showFailure _ node_630 = + "expected " + GHC.Base.<> ( "type_assertion_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_630 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_630) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_631 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_632 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_633 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_634 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_631 + c1_632 = TreeSitter.Node.nodeStartPoint node_630 + TreeSitter.Node.TSPoint + r2_633 + c2_634 = TreeSitter.Node.nodeEndPoint node_630 + +deriving instance GHC.Classes.Eq a_635 => GHC.Classes.Eq (TypeAssertionExpression a_635) + +deriving instance GHC.Classes.Ord a_636 => GHC.Classes.Ord (TypeAssertionExpression a_636) + +deriving instance GHC.Show.Show a_637 => GHC.Show.Show (TypeAssertionExpression a_637) + +instance AST.Unmarshal.Unmarshal TypeAssertionExpression + +instance Data.Foldable.Foldable TypeAssertionExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeAssertionExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeAssertionExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeCase a = TypeCase + { ann :: a, + type' :: (GHC.Base.NonEmpty (AST.Parse.Err ((AnonymousComma GHC.Generics.:+: Type) a))), + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_638. + AST.Traversable1.Class.Traversable1 a_638 + ) + +instance AST.Unmarshal.SymbolMatching TypeCase where + matchedSymbols _ = [154] + showFailure _ node_639 = + "expected " + GHC.Base.<> ( "type_case" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_639 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_639) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_640 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_641 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_642 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_643 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_640 + c1_641 = TreeSitter.Node.nodeStartPoint node_639 + TreeSitter.Node.TSPoint + r2_642 + c2_643 = TreeSitter.Node.nodeEndPoint node_639 + +deriving instance GHC.Classes.Eq a_644 => GHC.Classes.Eq (TypeCase a_644) + +deriving instance GHC.Classes.Ord a_645 => GHC.Classes.Ord (TypeCase a_645) + +deriving instance GHC.Show.Show a_646 => GHC.Show.Show (TypeCase a_646) + +instance AST.Unmarshal.Unmarshal TypeCase + +instance Data.Foldable.Foldable TypeCase where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeCase where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeCase where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeConversionExpression a = TypeConversionExpression + { ann :: a, + type' :: (AST.Parse.Err (Type a)), + operand :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_647. + AST.Traversable1.Class.Traversable1 a_647 + ) + +instance AST.Unmarshal.SymbolMatching TypeConversionExpression where + matchedSymbols _ = [167] + showFailure _ node_648 = + "expected " + GHC.Base.<> ( "type_conversion_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_648 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_648) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_649 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_650 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_651 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_652 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_649 + c1_650 = TreeSitter.Node.nodeStartPoint node_648 + TreeSitter.Node.TSPoint + r2_651 + c2_652 = TreeSitter.Node.nodeEndPoint node_648 + +deriving instance GHC.Classes.Eq a_653 => GHC.Classes.Eq (TypeConversionExpression a_653) + +deriving instance GHC.Classes.Ord a_654 => GHC.Classes.Ord (TypeConversionExpression a_654) + +deriving instance GHC.Show.Show a_655 => GHC.Show.Show (TypeConversionExpression a_655) + +instance AST.Unmarshal.Unmarshal TypeConversionExpression + +instance Data.Foldable.Foldable TypeConversionExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeConversionExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeConversionExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeDeclaration a = TypeDeclaration + { ann :: a, + extraChildren :: ([AST.Parse.Err ((TypeAlias GHC.Generics.:+: TypeSpec) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_656. + AST.Traversable1.Class.Traversable1 a_656 + ) + +instance AST.Unmarshal.SymbolMatching TypeDeclaration where + matchedSymbols _ = [107] + showFailure _ node_657 = + "expected " + GHC.Base.<> ( "type_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_657 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_657) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_658 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_659 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_660 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_661 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_658 + c1_659 = TreeSitter.Node.nodeStartPoint node_657 + TreeSitter.Node.TSPoint + r2_660 + c2_661 = TreeSitter.Node.nodeEndPoint node_657 + +deriving instance GHC.Classes.Eq a_662 => GHC.Classes.Eq (TypeDeclaration a_662) + +deriving instance GHC.Classes.Ord a_663 => GHC.Classes.Ord (TypeDeclaration a_663) + +deriving instance GHC.Show.Show a_664 => GHC.Show.Show (TypeDeclaration a_664) + +instance AST.Unmarshal.Unmarshal TypeDeclaration + +instance Data.Foldable.Foldable TypeDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeSpec a = TypeSpec + { ann :: a, + name :: (AST.Parse.Err (TypeIdentifier a)), + type' :: (AST.Parse.Err (Type a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_665. + AST.Traversable1.Class.Traversable1 a_665 + ) + +instance AST.Unmarshal.SymbolMatching TypeSpec where + matchedSymbols _ = [108] + showFailure _ node_666 = + "expected " + GHC.Base.<> ( "type_spec" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_666 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_666) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_667 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_668 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_669 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_670 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_667 + c1_668 = TreeSitter.Node.nodeStartPoint node_666 + TreeSitter.Node.TSPoint + r2_669 + c2_670 = TreeSitter.Node.nodeEndPoint node_666 + +deriving instance GHC.Classes.Eq a_671 => GHC.Classes.Eq (TypeSpec a_671) + +deriving instance GHC.Classes.Ord a_672 => GHC.Classes.Ord (TypeSpec a_672) + +deriving instance GHC.Show.Show a_673 => GHC.Show.Show (TypeSpec a_673) + +instance AST.Unmarshal.Unmarshal TypeSpec + +instance Data.Foldable.Foldable TypeSpec where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeSpec where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeSpec where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeSwitchStatement a = TypeSwitchStatement + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + alias :: (GHC.Maybe.Maybe (AST.Parse.Err (ExpressionList a))), + initializer :: (GHC.Maybe.Maybe (AST.Parse.Err (SimpleStatement a))), + extraChildren :: ([AST.Parse.Err ((DefaultCase GHC.Generics.:+: TypeCase) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_674. + AST.Traversable1.Class.Traversable1 a_674 + ) + +instance AST.Unmarshal.SymbolMatching TypeSwitchStatement where + matchedSymbols _ = [152] + showFailure _ node_675 = + "expected " + GHC.Base.<> ( "type_switch_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_675 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_675) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_676 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_677 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_678 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_679 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_676 + c1_677 = TreeSitter.Node.nodeStartPoint node_675 + TreeSitter.Node.TSPoint + r2_678 + c2_679 = TreeSitter.Node.nodeEndPoint node_675 + +deriving instance GHC.Classes.Eq a_680 => GHC.Classes.Eq (TypeSwitchStatement a_680) + +deriving instance GHC.Classes.Ord a_681 => GHC.Classes.Ord (TypeSwitchStatement a_681) + +deriving instance GHC.Show.Show a_682 => GHC.Show.Show (TypeSwitchStatement a_682) + +instance AST.Unmarshal.Unmarshal TypeSwitchStatement + +instance Data.Foldable.Foldable TypeSwitchStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeSwitchStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeSwitchStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnaryExpression a = UnaryExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousBang GHC.Generics.:+: AnonymousAmpersand GHC.Generics.:+: AnonymousStar GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousLAngleMinus GHC.Generics.:+: AnonymousCaret) a)), + operand :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_683. + AST.Traversable1.Class.Traversable1 a_683 + ) + +instance AST.Unmarshal.SymbolMatching UnaryExpression where + matchedSymbols _ = [173] + showFailure _ node_684 = + "expected " + GHC.Base.<> ( "unary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_684 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_684) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_685 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_686 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_687 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_688 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_685 + c1_686 = TreeSitter.Node.nodeStartPoint node_684 + TreeSitter.Node.TSPoint + r2_687 + c2_688 = TreeSitter.Node.nodeEndPoint node_684 + +deriving instance GHC.Classes.Eq a_689 => GHC.Classes.Eq (UnaryExpression a_689) + +deriving instance GHC.Classes.Ord a_690 => GHC.Classes.Ord (UnaryExpression a_690) + +deriving instance GHC.Show.Show a_691 => GHC.Show.Show (UnaryExpression a_691) + +instance AST.Unmarshal.Unmarshal UnaryExpression + +instance Data.Foldable.Foldable UnaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VarDeclaration a = VarDeclaration + { ann :: a, + extraChildren :: ([AST.Parse.Err (VarSpec a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_692. + AST.Traversable1.Class.Traversable1 a_692 + ) + +instance AST.Unmarshal.SymbolMatching VarDeclaration where + matchedSymbols _ = [99] + showFailure _ node_693 = + "expected " + GHC.Base.<> ( "var_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_693 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_693) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_694 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_695 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_696 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_697 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_694 + c1_695 = TreeSitter.Node.nodeStartPoint node_693 + TreeSitter.Node.TSPoint + r2_696 + c2_697 = TreeSitter.Node.nodeEndPoint node_693 + +deriving instance GHC.Classes.Eq a_698 => GHC.Classes.Eq (VarDeclaration a_698) + +deriving instance GHC.Classes.Ord a_699 => GHC.Classes.Ord (VarDeclaration a_699) + +deriving instance GHC.Show.Show a_700 => GHC.Show.Show (VarDeclaration a_700) + +instance AST.Unmarshal.Unmarshal VarDeclaration + +instance Data.Foldable.Foldable VarDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VarDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VarDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VarSpec a = VarSpec + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (ExpressionList a))), + name :: (GHC.Base.NonEmpty (AST.Parse.Err ((AnonymousComma GHC.Generics.:+: Identifier) a))), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (Type a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_701. + AST.Traversable1.Class.Traversable1 a_701 + ) + +instance AST.Unmarshal.SymbolMatching VarSpec where + matchedSymbols _ = [100] + showFailure _ node_702 = + "expected " + GHC.Base.<> ( "var_spec" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_702 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_702) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_703 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_704 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_705 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_706 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_703 + c1_704 = TreeSitter.Node.nodeStartPoint node_702 + TreeSitter.Node.TSPoint + r2_705 + c2_706 = TreeSitter.Node.nodeEndPoint node_702 + +deriving instance GHC.Classes.Eq a_707 => GHC.Classes.Eq (VarSpec a_707) + +deriving instance GHC.Classes.Ord a_708 => GHC.Classes.Ord (VarSpec a_708) + +deriving instance GHC.Show.Show a_709 => GHC.Show.Show (VarSpec a_709) + +instance AST.Unmarshal.Unmarshal VarSpec + +instance Data.Foldable.Foldable VarSpec where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VarSpec where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VarSpec where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VariadicArgument a = VariadicArgument + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_710. + AST.Traversable1.Class.Traversable1 a_710 + ) + +instance AST.Unmarshal.SymbolMatching VariadicArgument where + matchedSymbols _ = [160] + showFailure _ node_711 = + "expected " + GHC.Base.<> ( "variadic_argument" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_711 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_711) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_712 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_713 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_714 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_715 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_712 + c1_713 = TreeSitter.Node.nodeStartPoint node_711 + TreeSitter.Node.TSPoint + r2_714 + c2_715 = TreeSitter.Node.nodeEndPoint node_711 + +deriving instance GHC.Classes.Eq a_716 => GHC.Classes.Eq (VariadicArgument a_716) + +deriving instance GHC.Classes.Ord a_717 => GHC.Classes.Ord (VariadicArgument a_717) + +deriving instance GHC.Show.Show a_718 => GHC.Show.Show (VariadicArgument a_718) + +instance AST.Unmarshal.Unmarshal VariadicArgument + +instance Data.Foldable.Foldable VariadicArgument where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VariadicArgument where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VariadicArgument where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VariadicParameterDeclaration a = VariadicParameterDeclaration + { ann :: a, + name :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))), + type' :: (AST.Parse.Err (Type a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_719. + AST.Traversable1.Class.Traversable1 a_719 + ) + +instance AST.Unmarshal.SymbolMatching VariadicParameterDeclaration where + matchedSymbols _ = [105] + showFailure _ node_720 = + "expected " + GHC.Base.<> ( "variadic_parameter_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_720 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_720) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_721 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_722 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_723 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_724 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_721 + c1_722 = TreeSitter.Node.nodeStartPoint node_720 + TreeSitter.Node.TSPoint + r2_723 + c2_724 = TreeSitter.Node.nodeEndPoint node_720 + +deriving instance GHC.Classes.Eq a_725 => GHC.Classes.Eq (VariadicParameterDeclaration a_725) + +deriving instance GHC.Classes.Ord a_726 => GHC.Classes.Ord (VariadicParameterDeclaration a_726) + +deriving instance GHC.Show.Show a_727 => GHC.Show.Show (VariadicParameterDeclaration a_727) + +instance AST.Unmarshal.Unmarshal VariadicParameterDeclaration + +instance Data.Foldable.Foldable VariadicParameterDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VariadicParameterDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VariadicParameterDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousLF = AST.Token.Token "\n" 2 + +type AnonymousBang = AST.Token.Token "!" 61 + +type AnonymousBangEqual = AST.Token.Token "!=" 71 + +type AnonymousDQuote = AST.Token.Token "\"" 79 + +type AnonymousPercent = AST.Token.Token "%" 65 + +type AnonymousPercentEqual = AST.Token.Token "%=" 32 + +type AnonymousAmpersand = AST.Token.Token "&" 63 + +type AnonymousAmpersandAmpersand = AST.Token.Token "&&" 76 + +type AnonymousAmpersandEqual = AST.Token.Token "&=" 35 + +type AnonymousAmpersandCaret = AST.Token.Token "&^" 68 + +type AnonymousAmpersandCaretEqual = AST.Token.Token "&^=" 36 + +type AnonymousLParen = AST.Token.Token "(" 8 + +type AnonymousRParen = AST.Token.Token ")" 9 + +type AnonymousStar = AST.Token.Token "*" 17 + +type AnonymousStarEqual = AST.Token.Token "*=" 30 + +type AnonymousPlus = AST.Token.Token "+" 59 + +type AnonymousPlusPlus = AST.Token.Token "++" 28 + +type AnonymousPlusEqual = AST.Token.Token "+=" 37 + +type AnonymousComma = AST.Token.Token "," 11 + +type AnonymousMinus = AST.Token.Token "-" 60 + +type AnonymousMinusMinus = AST.Token.Token "--" 29 + +type AnonymousMinusEqual = AST.Token.Token "-=" 38 + +type AnonymousDot = AST.Token.Token "." 6 + +type AnonymousDotDotDot = AST.Token.Token "..." 15 + +type AnonymousSlash = AST.Token.Token "/" 64 + +type AnonymousSlashEqual = AST.Token.Token "/=" 31 + +type AnonymousColon = AST.Token.Token ":" 41 + +type AnonymousColonEqual = AST.Token.Token ":=" 27 + +type AnonymousSemicolon = AST.Token.Token ";" 3 + +type AnonymousLAngle = AST.Token.Token "<" 72 + +type AnonymousLAngleMinus = AST.Token.Token "<-" 26 + +type AnonymousLAngleLAngle = AST.Token.Token "<<" 66 + +type AnonymousLAngleLAngleEqual = AST.Token.Token "<<=" 33 + +type AnonymousLAngleEqual = AST.Token.Token "<=" 73 + +type AnonymousEqual = AST.Token.Token "=" 12 + +type AnonymousEqualEqual = AST.Token.Token "==" 70 + +type AnonymousRAngle = AST.Token.Token ">" 74 + +type AnonymousRAngleEqual = AST.Token.Token ">=" 75 + +type AnonymousRAngleRAngle = AST.Token.Token ">>" 67 + +type AnonymousRAngleRAngleEqual = AST.Token.Token ">>=" 34 + +type AnonymousLBracket = AST.Token.Token "[" 18 + +type AnonymousRBracket = AST.Token.Token "]" 19 + +type AnonymousCaret = AST.Token.Token "^" 62 + +type AnonymousCaretEqual = AST.Token.Token "^=" 40 + +data BlankIdentifier a = BlankIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_728. + AST.Traversable1.Class.Traversable1 a_728 + ) + +instance AST.Unmarshal.SymbolMatching BlankIdentifier where + matchedSymbols _ = [7] + showFailure _ node_729 = + "expected " + GHC.Base.<> ( "blank_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_729 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_729) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_730 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_731 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_732 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_733 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_730 + c1_731 = TreeSitter.Node.nodeStartPoint node_729 + TreeSitter.Node.TSPoint + r2_732 + c2_733 = TreeSitter.Node.nodeEndPoint node_729 + +deriving instance GHC.Classes.Eq a_734 => GHC.Classes.Eq (BlankIdentifier a_734) + +deriving instance GHC.Classes.Ord a_735 => GHC.Classes.Ord (BlankIdentifier a_735) + +deriving instance GHC.Show.Show a_736 => GHC.Show.Show (BlankIdentifier a_736) + +instance AST.Unmarshal.Unmarshal BlankIdentifier + +instance Data.Foldable.Foldable BlankIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BlankIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BlankIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousBreak = AST.Token.Token "break" 43 + +type AnonymousCase = AST.Token.Token "case" 54 + +type AnonymousChan = AST.Token.Token "chan" 25 + +type AnonymousConst = AST.Token.Token "const" 10 + +type AnonymousContinue = AST.Token.Token "continue" 44 + +type AnonymousDefault = AST.Token.Token "default" 55 + +type AnonymousDefer = AST.Token.Token "defer" 48 + +type AnonymousElse = AST.Token.Token "else" 50 + +data EscapeSequence a = EscapeSequence {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_737. + AST.Traversable1.Class.Traversable1 a_737 + ) + +instance AST.Unmarshal.SymbolMatching EscapeSequence where + matchedSymbols _ = [81] + showFailure _ node_738 = + "expected " + GHC.Base.<> ( "escape_sequence" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_738 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_738) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_739 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_740 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_741 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_742 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_739 + c1_740 = TreeSitter.Node.nodeStartPoint node_738 + TreeSitter.Node.TSPoint + r2_741 + c2_742 = TreeSitter.Node.nodeEndPoint node_738 + +deriving instance GHC.Classes.Eq a_743 => GHC.Classes.Eq (EscapeSequence a_743) + +deriving instance GHC.Classes.Ord a_744 => GHC.Classes.Ord (EscapeSequence a_744) + +deriving instance GHC.Show.Show a_745 => GHC.Show.Show (EscapeSequence a_745) + +instance AST.Unmarshal.Unmarshal EscapeSequence + +instance Data.Foldable.Foldable EscapeSequence where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EscapeSequence where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EscapeSequence where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFallthrough = AST.Token.Token "fallthrough" 42 + +data False a = False {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_746. + AST.Traversable1.Class.Traversable1 a_746 + ) + +instance AST.Unmarshal.SymbolMatching False where + matchedSymbols _ = [88] + showFailure _ node_747 = + "expected " + GHC.Base.<> ( "false" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_747 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_747) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_748 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_749 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_750 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_751 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_748 + c1_749 = TreeSitter.Node.nodeStartPoint node_747 + TreeSitter.Node.TSPoint + r2_750 + c2_751 = TreeSitter.Node.nodeEndPoint node_747 + +deriving instance GHC.Classes.Eq a_752 => GHC.Classes.Eq (False a_752) + +deriving instance GHC.Classes.Ord a_753 => GHC.Classes.Ord (False a_753) + +deriving instance GHC.Show.Show a_754 => GHC.Show.Show (False a_754) + +instance AST.Unmarshal.Unmarshal False + +instance Data.Foldable.Foldable False where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor False where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable False where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FieldIdentifier a = FieldIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_755. + AST.Traversable1.Class.Traversable1 a_755 + ) + +instance AST.Unmarshal.SymbolMatching FieldIdentifier where + matchedSymbols _ = [196] + showFailure _ node_756 = + "expected " + GHC.Base.<> ( "field_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_756 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_756) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_757 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_758 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_759 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_760 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_757 + c1_758 = TreeSitter.Node.nodeStartPoint node_756 + TreeSitter.Node.TSPoint + r2_759 + c2_760 = TreeSitter.Node.nodeEndPoint node_756 + +deriving instance GHC.Classes.Eq a_761 => GHC.Classes.Eq (FieldIdentifier a_761) + +deriving instance GHC.Classes.Ord a_762 => GHC.Classes.Ord (FieldIdentifier a_762) + +deriving instance GHC.Show.Show a_763 => GHC.Show.Show (FieldIdentifier a_763) + +instance AST.Unmarshal.Unmarshal FieldIdentifier + +instance Data.Foldable.Foldable FieldIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FieldIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FieldIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FloatLiteral a = FloatLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_764. + AST.Traversable1.Class.Traversable1 a_764 + ) + +instance AST.Unmarshal.SymbolMatching FloatLiteral where + matchedSymbols _ = [83] + showFailure _ node_765 = + "expected " + GHC.Base.<> ( "float_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_765 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_765) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_766 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_767 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_768 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_769 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_766 + c1_767 = TreeSitter.Node.nodeStartPoint node_765 + TreeSitter.Node.TSPoint + r2_768 + c2_769 = TreeSitter.Node.nodeEndPoint node_765 + +deriving instance GHC.Classes.Eq a_770 => GHC.Classes.Eq (FloatLiteral a_770) + +deriving instance GHC.Classes.Ord a_771 => GHC.Classes.Ord (FloatLiteral a_771) + +deriving instance GHC.Show.Show a_772 => GHC.Show.Show (FloatLiteral a_772) + +instance AST.Unmarshal.Unmarshal FloatLiteral + +instance Data.Foldable.Foldable FloatLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FloatLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FloatLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFor = AST.Token.Token "for" 51 + +type AnonymousFunc = AST.Token.Token "func" 14 + +type AnonymousGo = AST.Token.Token "go" 47 + +type AnonymousGoto = AST.Token.Token "goto" 45 + +data Identifier a = Identifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_773. + AST.Traversable1.Class.Traversable1 a_773 + ) + +instance AST.Unmarshal.SymbolMatching Identifier where + matchedSymbols _ = [1, 57, 58] + showFailure _ node_774 = + "expected " + GHC.Base.<> ( "identifier, identifier, identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_774 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_774) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_775 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_776 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_777 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_778 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_775 + c1_776 = TreeSitter.Node.nodeStartPoint node_774 + TreeSitter.Node.TSPoint + r2_777 + c2_778 = TreeSitter.Node.nodeEndPoint node_774 + +deriving instance GHC.Classes.Eq a_779 => GHC.Classes.Eq (Identifier a_779) + +deriving instance GHC.Classes.Ord a_780 => GHC.Classes.Ord (Identifier a_780) + +deriving instance GHC.Show.Show a_781 => GHC.Show.Show (Identifier a_781) + +instance AST.Unmarshal.Unmarshal Identifier + +instance Data.Foldable.Foldable Identifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Identifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Identifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousIf = AST.Token.Token "if" 49 + +data ImaginaryLiteral a = ImaginaryLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_782. + AST.Traversable1.Class.Traversable1 a_782 + ) + +instance AST.Unmarshal.SymbolMatching ImaginaryLiteral where + matchedSymbols _ = [84] + showFailure _ node_783 = + "expected " + GHC.Base.<> ( "imaginary_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_783 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_783) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_784 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_785 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_786 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_787 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_784 + c1_785 = TreeSitter.Node.nodeStartPoint node_783 + TreeSitter.Node.TSPoint + r2_786 + c2_787 = TreeSitter.Node.nodeEndPoint node_783 + +deriving instance GHC.Classes.Eq a_788 => GHC.Classes.Eq (ImaginaryLiteral a_788) + +deriving instance GHC.Classes.Ord a_789 => GHC.Classes.Ord (ImaginaryLiteral a_789) + +deriving instance GHC.Show.Show a_790 => GHC.Show.Show (ImaginaryLiteral a_790) + +instance AST.Unmarshal.Unmarshal ImaginaryLiteral + +instance Data.Foldable.Foldable ImaginaryLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImaginaryLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImaginaryLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousImport = AST.Token.Token "import" 5 + +data IntLiteral a = IntLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_791. + AST.Traversable1.Class.Traversable1 a_791 + ) + +instance AST.Unmarshal.SymbolMatching IntLiteral where + matchedSymbols _ = [82] + showFailure _ node_792 = + "expected " + GHC.Base.<> ( "int_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_792 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_792) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_793 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_794 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_795 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_796 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_793 + c1_794 = TreeSitter.Node.nodeStartPoint node_792 + TreeSitter.Node.TSPoint + r2_795 + c2_796 = TreeSitter.Node.nodeEndPoint node_792 + +deriving instance GHC.Classes.Eq a_797 => GHC.Classes.Eq (IntLiteral a_797) + +deriving instance GHC.Classes.Ord a_798 => GHC.Classes.Ord (IntLiteral a_798) + +deriving instance GHC.Show.Show a_799 => GHC.Show.Show (IntLiteral a_799) + +instance AST.Unmarshal.Unmarshal IntLiteral + +instance Data.Foldable.Foldable IntLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IntLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IntLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousInterface = AST.Token.Token "interface" 23 + +data LabelName a = LabelName {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_800. + AST.Traversable1.Class.Traversable1 a_800 + ) + +instance AST.Unmarshal.SymbolMatching LabelName where + matchedSymbols _ = [197] + showFailure _ node_801 = + "expected " + GHC.Base.<> ( "label_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_801 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_801) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_802 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_803 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_804 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_805 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_802 + c1_803 = TreeSitter.Node.nodeStartPoint node_801 + TreeSitter.Node.TSPoint + r2_804 + c2_805 = TreeSitter.Node.nodeEndPoint node_801 + +deriving instance GHC.Classes.Eq a_806 => GHC.Classes.Eq (LabelName a_806) + +deriving instance GHC.Classes.Ord a_807 => GHC.Classes.Ord (LabelName a_807) + +deriving instance GHC.Show.Show a_808 => GHC.Show.Show (LabelName a_808) + +instance AST.Unmarshal.Unmarshal LabelName + +instance Data.Foldable.Foldable LabelName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LabelName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LabelName where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousMap = AST.Token.Token "map" 24 + +data Nil a = Nil {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_809. + AST.Traversable1.Class.Traversable1 a_809 + ) + +instance AST.Unmarshal.SymbolMatching Nil where + matchedSymbols _ = [86] + showFailure _ node_810 = + "expected " + GHC.Base.<> ( "nil" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_810 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_810) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_811 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_812 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_813 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_814 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_811 + c1_812 = TreeSitter.Node.nodeStartPoint node_810 + TreeSitter.Node.TSPoint + r2_813 + c2_814 = TreeSitter.Node.nodeEndPoint node_810 + +deriving instance GHC.Classes.Eq a_815 => GHC.Classes.Eq (Nil a_815) + +deriving instance GHC.Classes.Ord a_816 => GHC.Classes.Ord (Nil a_816) + +deriving instance GHC.Show.Show a_817 => GHC.Show.Show (Nil a_817) + +instance AST.Unmarshal.Unmarshal Nil + +instance Data.Foldable.Foldable Nil where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Nil where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Nil where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousPackage = AST.Token.Token "package" 4 + +data PackageIdentifier a = PackageIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_818. + AST.Traversable1.Class.Traversable1 a_818 + ) + +instance AST.Unmarshal.SymbolMatching PackageIdentifier where + matchedSymbols _ = [198] + showFailure _ node_819 = + "expected " + GHC.Base.<> ( "package_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_819 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_819) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_820 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_821 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_822 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_823 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_820 + c1_821 = TreeSitter.Node.nodeStartPoint node_819 + TreeSitter.Node.TSPoint + r2_822 + c2_823 = TreeSitter.Node.nodeEndPoint node_819 + +deriving instance GHC.Classes.Eq a_824 => GHC.Classes.Eq (PackageIdentifier a_824) + +deriving instance GHC.Classes.Ord a_825 => GHC.Classes.Ord (PackageIdentifier a_825) + +deriving instance GHC.Show.Show a_826 => GHC.Show.Show (PackageIdentifier a_826) + +instance AST.Unmarshal.Unmarshal PackageIdentifier + +instance Data.Foldable.Foldable PackageIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PackageIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PackageIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousRange = AST.Token.Token "range" 52 + +data RawStringLiteral a = RawStringLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_827. + AST.Traversable1.Class.Traversable1 a_827 + ) + +instance AST.Unmarshal.SymbolMatching RawStringLiteral where + matchedSymbols _ = [78] + showFailure _ node_828 = + "expected " + GHC.Base.<> ( "raw_string_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_828 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_828) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_829 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_830 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_831 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_832 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_829 + c1_830 = TreeSitter.Node.nodeStartPoint node_828 + TreeSitter.Node.TSPoint + r2_831 + c2_832 = TreeSitter.Node.nodeEndPoint node_828 + +deriving instance GHC.Classes.Eq a_833 => GHC.Classes.Eq (RawStringLiteral a_833) + +deriving instance GHC.Classes.Ord a_834 => GHC.Classes.Ord (RawStringLiteral a_834) + +deriving instance GHC.Show.Show a_835 => GHC.Show.Show (RawStringLiteral a_835) + +instance AST.Unmarshal.Unmarshal RawStringLiteral + +instance Data.Foldable.Foldable RawStringLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RawStringLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RawStringLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousReturn = AST.Token.Token "return" 46 + +data RuneLiteral a = RuneLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_836. + AST.Traversable1.Class.Traversable1 a_836 + ) + +instance AST.Unmarshal.SymbolMatching RuneLiteral where + matchedSymbols _ = [85] + showFailure _ node_837 = + "expected " + GHC.Base.<> ( "rune_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_837 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_837) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_838 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_839 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_840 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_841 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_838 + c1_839 = TreeSitter.Node.nodeStartPoint node_837 + TreeSitter.Node.TSPoint + r2_840 + c2_841 = TreeSitter.Node.nodeEndPoint node_837 + +deriving instance GHC.Classes.Eq a_842 => GHC.Classes.Eq (RuneLiteral a_842) + +deriving instance GHC.Classes.Ord a_843 => GHC.Classes.Ord (RuneLiteral a_843) + +deriving instance GHC.Show.Show a_844 => GHC.Show.Show (RuneLiteral a_844) + +instance AST.Unmarshal.Unmarshal RuneLiteral + +instance Data.Foldable.Foldable RuneLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RuneLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RuneLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousSelect = AST.Token.Token "select" 56 + +type AnonymousStruct = AST.Token.Token "struct" 20 + +type AnonymousSwitch = AST.Token.Token "switch" 53 + +data True a = True {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_845. + AST.Traversable1.Class.Traversable1 a_845 + ) + +instance AST.Unmarshal.SymbolMatching True where + matchedSymbols _ = [87] + showFailure _ node_846 = + "expected " + GHC.Base.<> ( "true" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_846 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_846) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_847 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_848 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_849 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_850 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_847 + c1_848 = TreeSitter.Node.nodeStartPoint node_846 + TreeSitter.Node.TSPoint + r2_849 + c2_850 = TreeSitter.Node.nodeEndPoint node_846 + +deriving instance GHC.Classes.Eq a_851 => GHC.Classes.Eq (True a_851) + +deriving instance GHC.Classes.Ord a_852 => GHC.Classes.Ord (True a_852) + +deriving instance GHC.Show.Show a_853 => GHC.Show.Show (True a_853) + +instance AST.Unmarshal.Unmarshal True + +instance Data.Foldable.Foldable True where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor True where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable True where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousType = AST.Token.Token "type" 16 + +data TypeIdentifier a = TypeIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_854. + AST.Traversable1.Class.Traversable1 a_854 + ) + +instance AST.Unmarshal.SymbolMatching TypeIdentifier where + matchedSymbols _ = [199] + showFailure _ node_855 = + "expected " + GHC.Base.<> ( "type_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_855 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_855) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_856 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_857 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_858 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_859 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_856 + c1_857 = TreeSitter.Node.nodeStartPoint node_855 + TreeSitter.Node.TSPoint + r2_858 + c2_859 = TreeSitter.Node.nodeEndPoint node_855 + +deriving instance GHC.Classes.Eq a_860 => GHC.Classes.Eq (TypeIdentifier a_860) + +deriving instance GHC.Classes.Ord a_861 => GHC.Classes.Ord (TypeIdentifier a_861) + +deriving instance GHC.Show.Show a_862 => GHC.Show.Show (TypeIdentifier a_862) + +instance AST.Unmarshal.Unmarshal TypeIdentifier + +instance Data.Foldable.Foldable TypeIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousVar = AST.Token.Token "var" 13 + +type AnonymousLBrace = AST.Token.Token "{" 21 + +type AnonymousPipe = AST.Token.Token "|" 69 + +type AnonymousPipeEqual = AST.Token.Token "|=" 39 + +type AnonymousPipePipe = AST.Token.Token "||" 77 + +type AnonymousRBrace = AST.Token.Token "}" 22 diff --git a/semantic-go/src/Language/Go/Grammar.hs b/semantic-go/src/Language/Go/Grammar.hs new file mode 100644 index 0000000000..d5c5ae92a1 --- /dev/null +++ b/semantic-go/src/Language/Go/Grammar.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} +module Language.Go.Grammar +( tree_sitter_go +, Grammar(..) +) where + +import AST.Grammar.TH +import Language.Haskell.TH +import TreeSitter.Go (tree_sitter_go) + +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData (mkName "Grammar") tree_sitter_go diff --git a/semantic-go/src/Language/Go/Tags.hs b/semantic-go/src/Language/Go/Tags.hs new file mode 100644 index 0000000000..3b3dadf101 --- /dev/null +++ b/semantic-go/src/Language/Go/Tags.hs @@ -0,0 +1,190 @@ +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module Language.Go.Tags + ( ToTags (..), + ) +where + +import AST.Element +import qualified AST.Parse as Parse +import AST.Token +import AST.Traversable1 +import Control.Effect.Reader +import Control.Effect.Writer +import Control.Effect.State +import qualified Language.Go.AST as Go +import Proto.Semantic as P +import Source.Loc +import Source.Source as Source +import qualified Tags.Tagging.Precise as Tags + +class ToTags t where + tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m + ) => + t Loc -> + m () + default tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () + tags = gtags + +instance ToTags Go.FunctionDeclaration where + tags + t@Go.FunctionDeclaration + { ann = Loc {byteRange}, + name = Parse.Success (Go.Identifier {text, ann}) + } = Tags.yield text P.FUNCTION P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags Go.MethodDeclaration where + tags + t@Go.MethodDeclaration + { ann = Loc {byteRange}, + name = Parse.Success (Go.FieldIdentifier {text, ann}) + } = Tags.yield text P.METHOD P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags Go.CallExpression where + tags + t@Go.CallExpression + { ann = Loc {byteRange}, + function = Parse.Success (Go.Expression expr) + } = match expr + where + match expr = case expr of + Prj Go.SelectorExpression {field = Parse.Success (Go.FieldIdentifier {text, ann})} -> yield text ann + Prj Go.Identifier {text, ann} -> yield text ann + Prj Go.CallExpression {function = Parse.Success (Go.Expression e)} -> match e + Prj Go.ParenthesizedExpression {extraChildren = Parse.Success (Go.Expression e)} -> match e + _ -> gtags t + yield name loc = Tags.yield name P.CALL P.REFERENCE loc byteRange >> gtags t + tags _ = pure () + +instance (ToTags l, ToTags r) => ToTags (l :+: r) where + tags (L1 l) = tags l + tags (R1 r) = tags r + +instance ToTags (Token sym n) where tags _ = pure () + +gtags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () +gtags = traverse1_ @ToTags (const (pure ())) tags + + +instance ToTags Go.ArgumentList +instance ToTags Go.ArrayType +instance ToTags Go.AssignmentStatement +instance ToTags Go.BinaryExpression +instance ToTags Go.BlankIdentifier +instance ToTags Go.Block +instance ToTags Go.BreakStatement +-- instance ToTags Go.CallExpression +instance ToTags Go.ChannelType +instance ToTags Go.CommunicationCase +instance ToTags Go.CompositeLiteral +instance ToTags Go.ConstDeclaration +instance ToTags Go.ConstSpec +instance ToTags Go.ContinueStatement +instance ToTags Go.DecStatement +instance ToTags Go.DefaultCase +instance ToTags Go.DeferStatement +instance ToTags Go.Dot +instance ToTags Go.Element +instance ToTags Go.EmptyStatement +instance ToTags Go.EscapeSequence +instance ToTags Go.Expression +instance ToTags Go.ExpressionCase +instance ToTags Go.ExpressionList +instance ToTags Go.ExpressionSwitchStatement +instance ToTags Go.FallthroughStatement +instance ToTags Go.False +instance ToTags Go.FieldDeclaration +instance ToTags Go.FieldDeclarationList +instance ToTags Go.FieldIdentifier +instance ToTags Go.FloatLiteral +instance ToTags Go.ForClause +instance ToTags Go.ForStatement +instance ToTags Go.FuncLiteral +-- instance ToTags Go.FunctionDeclaration +instance ToTags Go.FunctionType +instance ToTags Go.GoStatement +instance ToTags Go.GotoStatement +instance ToTags Go.Identifier +instance ToTags Go.IfStatement +instance ToTags Go.ImaginaryLiteral +instance ToTags Go.ImplicitLengthArrayType +instance ToTags Go.ImportDeclaration +instance ToTags Go.ImportSpec +instance ToTags Go.ImportSpecList +instance ToTags Go.IncStatement +instance ToTags Go.IndexExpression +instance ToTags Go.IntLiteral +instance ToTags Go.InterfaceType +instance ToTags Go.InterpretedStringLiteral +instance ToTags Go.KeyedElement +instance ToTags Go.LabelName +instance ToTags Go.LabeledStatement +instance ToTags Go.LiteralValue +instance ToTags Go.MapType +-- instance ToTags Go.MethodDeclaration +instance ToTags Go.MethodSpec +instance ToTags Go.MethodSpecList +instance ToTags Go.Nil +instance ToTags Go.PackageClause +instance ToTags Go.PackageIdentifier +instance ToTags Go.ParameterDeclaration +instance ToTags Go.ParameterList +instance ToTags Go.ParenthesizedExpression +instance ToTags Go.ParenthesizedType +instance ToTags Go.PointerType +instance ToTags Go.QualifiedType +instance ToTags Go.RangeClause +instance ToTags Go.RawStringLiteral +instance ToTags Go.ReceiveStatement +instance ToTags Go.ReturnStatement +instance ToTags Go.RuneLiteral +instance ToTags Go.SelectStatement +instance ToTags Go.SelectorExpression +instance ToTags Go.SendStatement +instance ToTags Go.ShortVarDeclaration +instance ToTags Go.SimpleStatement +instance ToTags Go.SimpleType +instance ToTags Go.SliceExpression +instance ToTags Go.SliceType +instance ToTags Go.SourceFile +instance ToTags Go.Statement +instance ToTags Go.StructType +instance ToTags Go.True +instance ToTags Go.Type +instance ToTags Go.TypeAlias +instance ToTags Go.TypeAssertionExpression +instance ToTags Go.TypeCase +instance ToTags Go.TypeConversionExpression +instance ToTags Go.TypeDeclaration +instance ToTags Go.TypeIdentifier +instance ToTags Go.TypeSpec +instance ToTags Go.TypeSwitchStatement +instance ToTags Go.UnaryExpression +instance ToTags Go.VarDeclaration +instance ToTags Go.VarSpec +instance ToTags Go.VariadicArgument +instance ToTags Go.VariadicParameterDeclaration diff --git a/semantic-go/test/PreciseTest.hs b/semantic-go/test/PreciseTest.hs new file mode 100644 index 0000000000..df853d3445 --- /dev/null +++ b/semantic-go/test/PreciseTest.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-unused-imports #-} +module Main (main) where + + +import AST.TestHelpers +import AST.Unmarshal +import qualified Language.Go.AST as Go +import Language.Go.Grammar +import qualified System.Path.Fixture as Fixture +import Test.Tasty + +main :: IO () +main = do +#if BAZEL_BUILD + rf <- Fixture.create + let ?project = "external/tree-sitter-go" + ?runfiles = rf + let dirs = Fixture.absRelDir "corpus" +#else + dirs <- Go.getTestCorpusDir +#endif + + readCorpusFiles' dirs + >>= traverse (testCorpus parse) + >>= defaultMain . tests + where parse = parseByteString @Go.SourceFile @() tree_sitter_go + +tests :: [TestTree] -> TestTree +tests = testGroup "tree-sitter-go corpus tests" diff --git a/semantic-java/BUILD.bazel b/semantic-java/BUILD.bazel new file mode 100644 index 0000000000..f3a3133c8f --- /dev/null +++ b/semantic-java/BUILD.bazel @@ -0,0 +1,15 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "//:build/common.bzl", + "semantic_language_library", + "semantic_language_parsing_test", +) + +semantic_language_library( + name = "semantic-java", + srcs = glob(["src/**/*.hs"]), + language = "java", +) + +semantic_language_parsing_test(language = "java") diff --git a/semantic-java/LICENSE b/semantic-java/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-java/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-java/README.md b/semantic-java/README.md new file mode 100644 index 0000000000..0afe8b94fe --- /dev/null +++ b/semantic-java/README.md @@ -0,0 +1,18 @@ +# semantic-java + +Semantic support for Java. + + +## Development + +This project consists of a Haskell package named `semantic-java`. The library’s sources are in [`src`][]. + +Development of `semantic-java` is typically done using `cabal v2-build`: + +```shell +cabal v2-build # build the library +cabal v2-repl # load the package into ghci +cabal v2-test # build and run the doctests +``` + +[`src`]: https://github.com/github/semantic/tree/master/semantic-java/src diff --git a/semantic-java/Setup.hs b/semantic-java/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-java/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-java/semantic-java.cabal b/semantic-java/semantic-java.cabal new file mode 100644 index 0000000000..235e662f8a --- /dev/null +++ b/semantic-java/semantic-java.cabal @@ -0,0 +1,77 @@ +cabal-version: 2.4 + +name: semantic-java +version: 0.0.0.0 +synopsis: Semantic support for Java +description: Semantic support for Java. +homepage: https://github.com/github/semantic/tree/master/semantic-java#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + cpp-options: + -DBAZEL_BUILD=0 + +library + import: haskell + exposed-modules: + Language.Java + Language.Java.AST + Language.Java.Grammar + Language.Java.Tags + hs-source-dirs: src + build-depends: + , base >= 4.13 && < 5 + , fused-effects ^>= 1.1 + , semantic-ast + , semantic-proto ^>= 0 + , semantic-source ^>= 0.2 + , semantic-tags ^>= 0.0 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3 + , tree-sitter ^>= 0.9 + , tree-sitter-java ^>= 0.7.0.1 + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: PreciseTest.hs + build-depends: + , base + , semantic-ast + , semantic-java + , tasty + , tree-sitter-java ^>= 0.7.0.1 diff --git a/semantic-java/src/Language/Java.hs b/semantic-java/src/Language/Java.hs new file mode 100644 index 0000000000..3f4964019d --- /dev/null +++ b/semantic-java/src/Language/Java.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +-- | Semantic functionality for Java programs. +module Language.Java +( Term(..) +, Language.Java.Grammar.tree_sitter_java +) where + +import AST.Marshal.JSON +import Data.Proxy +import qualified Language.Java.AST as Java +import qualified Language.Java.Tags as JavaTags +import qualified Tags.Tagging.Precise as Tags +import qualified Language.Java.Grammar (tree_sitter_java) +import qualified AST.Unmarshal as TS + +newtype Term a = Term { getTerm :: Java.Program a } + deriving MarshalJSON + +instance TS.SymbolMatching Term where + matchedSymbols _ = TS.matchedSymbols (Proxy :: Proxy Java.Program) + showFailure _ = TS.showFailure (Proxy :: Proxy Java.Program) + +instance TS.Unmarshal Term where + matchers = fmap (fmap (TS.hoist Term)) TS.matchers + +instance Tags.ToTags Term where + tags src = Tags.runTagging src . JavaTags.tags . getTerm diff --git a/semantic-java/src/Language/Java/AST.hs b/semantic-java/src/Language/Java/AST.hs new file mode 100644 index 0000000000..eaa9016a23 --- /dev/null +++ b/semantic-java/src/Language/Java/AST.hs @@ -0,0 +1,6422 @@ +-- Language definition for Java, generated by ast-generate. Do not edit! +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Language.Java.AST (module Language.Java.AST, getTestCorpusDir) where + +import qualified AST.Parse +import qualified AST.Token +import qualified AST.Traversable1.Class +import qualified AST.Unmarshal +import qualified Data.Foldable +import qualified Data.List as Data.OldList +import qualified Data.Maybe as GHC.Maybe +import qualified Data.Text.Internal +import qualified Data.Traversable +import qualified GHC.Base +import qualified GHC.Generics +import qualified GHC.Records +import qualified GHC.Show +import TreeSitter.Java (getTestCorpusDir) +import qualified TreeSitter.Node +import qualified Prelude as GHC.Classes + +debugSymbolNames :: [GHC.Base.String] +debugSymbolNames = debugSymbolNames_0 + +debugSymbolNames_0 :: [GHC.Base.String] +debugSymbolNames_0 = + [ "end", + "identifier", + "decimal_integer_literal", + "hex_integer_literal", + "octal_integer_literal", + "binary_integer_literal", + "decimal_floating_point_literal", + "hex_floating_point_literal", + "true", + "false", + "character_literal", + "string_literal", + "null_literal", + "_(", + "_&", + "_)", + "_=", + "_+=", + "_-=", + "_*=", + "_/=", + "_&=", + "_|=", + "_^=", + "_%=", + "_<<=", + "_>>=", + "_>>>=", + "_>", + "_<", + "_==", + "_>=", + "_<=", + "_!=", + "_&&", + "_||", + "_+", + "_-", + "_*", + "_/", + "_|", + "_^", + "_%", + "_<<", + "_>>", + "_>>>", + "_instanceof", + "_->", + "_,", + "_?", + "_:", + "_!", + "_~", + "_++", + "_--", + "_new", + "_[", + "_]", + "_.", + "_class", + "_::", + "_extends", + "_;", + "_{", + "_}", + "_assert", + "_switch", + "_case", + "_default", + "_do", + "_while", + "_break", + "_continue", + "_return", + "_synchronized", + "_throw", + "_try", + "_catch", + "_finally", + "_if", + "_else", + "_for", + "_@", + "_open", + "_module", + "_requires", + "_exports", + "_to", + "_opens", + "_uses", + "_provides", + "_with", + "_transitive", + "_static", + "_package", + "_import", + "_enum", + "_public", + "_protected", + "_private", + "_abstract", + "_final", + "_strictfp", + "_native", + "_transient", + "_volatile", + "_implements", + "_@interface", + "_interface", + "_byte", + "_short", + "_int", + "_long", + "_char", + "_float", + "_double", + "boolean_type", + "void_type", + "_...", + "_throws", + "this", + "super", + "comment", + "program", + "_literal", + "_expression", + "cast_expression", + "assignment_expression", + "binary_expression", + "instanceof_expression", + "lambda_expression", + "inferred_parameters", + "ternary_expression", + "unary_expression", + "update_expression", + "_primary", + "array_creation_expression", + "dimensions_expr", + "parenthesized_expression", + "class_literal", + "object_creation_expression", + "_unqualified_object_creation_expression", + "field_access", + "array_access", + "method_invocation", + "argument_list", + "method_reference", + "type_arguments", + "wildcard", + "_wildcard_bounds", + "dimensions", + "_statement", + "block", + "expression_statement", + "labeled_statement", + "assert_statement", + "switch_statement", + "switch_block", + "switch_label", + "do_statement", + "break_statement", + "continue_statement", + "return_statement", + "synchronized_statement", + "throw_statement", + "try_statement", + "catch_clause", + "catch_formal_parameter", + "catch_type", + "finally_clause", + "try_with_resources_statement", + "resource_specification", + "resource", + "if_statement", + "while_statement", + "for_statement", + "for_init", + "enhanced_for_statement", + "_annotation", + "marker_annotation", + "annotation", + "annotation_argument_list", + "element_value_pair", + "_element_value", + "element_value_array_initializer", + "_declaration", + "module_declaration", + "module_directive", + "requires_modifier", + "module_name", + "package_declaration", + "import_declaration", + "asterisk", + "enum_declaration", + "enum_body", + "enum_body_declarations", + "enum_constant", + "class_declaration", + "modifiers", + "type_parameters", + "type_parameter", + "type_bound", + "superclass", + "super_interfaces", + "interface_type_list", + "class_body", + "static_initializer", + "constructor_declaration", + "_constructor_declarator", + "constructor_body", + "explicit_constructor_invocation", + "scoped_identifier", + "field_declaration", + "annotation_type_declaration", + "annotation_type_body", + "annotation_type_element_declaration", + "_default_value", + "interface_declaration", + "extends_interfaces", + "interface_body", + "constant_declaration", + "_variable_declarator_list", + "variable_declarator", + "_variable_declarator_id", + "array_initializer", + "_type", + "_unannotated_type", + "annotated_type", + "scoped_type_identifier", + "generic_type", + "array_type", + "integral_type", + "floating_point_type", + "_method_header", + "_method_declarator", + "formal_parameters", + "formal_parameter", + "receiver_parameter", + "spread_parameter", + "throws", + "local_variable_declaration_statement", + "local_variable_declaration", + "method_declaration", + "_program_repeat1", + "_cast_expression_repeat1", + "_inferred_parameters_repeat1", + "_array_creation_expression_repeat1", + "_dimensions_expr_repeat1", + "_class_literal_repeat1", + "_argument_list_repeat1", + "_type_arguments_repeat1", + "_dimensions_repeat1", + "_switch_block_repeat1", + "_try_statement_repeat1", + "_catch_type_repeat1", + "_resource_specification_repeat1", + "_annotation_argument_list_repeat1", + "_element_value_array_initializer_repeat1", + "_module_declaration_repeat1", + "_module_directive_repeat1", + "_module_directive_repeat2", + "_module_directive_repeat3", + "_import_declaration_repeat1", + "_enum_body_repeat1", + "_enum_body_declarations_repeat1", + "_modifiers_repeat1", + "_type_parameters_repeat1", + "_type_bound_repeat1", + "_interface_type_list_repeat1", + "_annotation_type_body_repeat1", + "_interface_body_repeat1", + "__variable_declarator_list_repeat1", + "_array_initializer_repeat1", + "_formal_parameters_repeat1", + "type_identifier" + ] + +newtype Declaration a = Declaration {getDeclaration :: ((AnnotationTypeDeclaration GHC.Generics.:+: ClassDeclaration GHC.Generics.:+: EnumDeclaration GHC.Generics.:+: ImportDeclaration GHC.Generics.:+: InterfaceDeclaration GHC.Generics.:+: ModuleDeclaration GHC.Generics.:+: PackageDeclaration) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1. + AST.Traversable1.Class.Traversable1 a_1 + ) + +instance GHC.Records.HasField "ann" (Declaration a_2) a_2 where + getField = AST.Unmarshal.gann GHC.Base.. getDeclaration + +deriving instance GHC.Classes.Eq a_3 => GHC.Classes.Eq (Declaration a_3) + +deriving instance GHC.Classes.Ord a_4 => GHC.Classes.Ord (Declaration a_4) + +deriving instance GHC.Show.Show a_5 => GHC.Show.Show (Declaration a_5) + +instance AST.Unmarshal.Unmarshal Declaration + +instance Data.Foldable.Foldable Declaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Declaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Declaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Expression a = Expression {getExpression :: ((Primary GHC.Generics.:+: AssignmentExpression GHC.Generics.:+: BinaryExpression GHC.Generics.:+: CastExpression GHC.Generics.:+: Identifier GHC.Generics.:+: InstanceofExpression GHC.Generics.:+: LambdaExpression GHC.Generics.:+: ScopedIdentifier GHC.Generics.:+: TernaryExpression GHC.Generics.:+: UnaryExpression GHC.Generics.:+: UpdateExpression) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_6. + AST.Traversable1.Class.Traversable1 a_6 + ) + +instance GHC.Records.HasField "ann" (Expression a_7) a_7 where + getField = AST.Unmarshal.gann GHC.Base.. getExpression + +deriving instance GHC.Classes.Eq a_8 => GHC.Classes.Eq (Expression a_8) + +deriving instance GHC.Classes.Ord a_9 => GHC.Classes.Ord (Expression a_9) + +deriving instance GHC.Show.Show a_10 => GHC.Show.Show (Expression a_10) + +instance AST.Unmarshal.Unmarshal Expression + +instance Data.Foldable.Foldable Expression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Expression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Expression where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Literal a = Literal {getLiteral :: ((BinaryIntegerLiteral GHC.Generics.:+: CharacterLiteral GHC.Generics.:+: DecimalFloatingPointLiteral GHC.Generics.:+: DecimalIntegerLiteral GHC.Generics.:+: False GHC.Generics.:+: HexFloatingPointLiteral GHC.Generics.:+: HexIntegerLiteral GHC.Generics.:+: NullLiteral GHC.Generics.:+: OctalIntegerLiteral GHC.Generics.:+: StringLiteral GHC.Generics.:+: True) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_11. + AST.Traversable1.Class.Traversable1 a_11 + ) + +instance GHC.Records.HasField "ann" (Literal a_12) a_12 where + getField = AST.Unmarshal.gann GHC.Base.. getLiteral + +deriving instance GHC.Classes.Eq a_13 => GHC.Classes.Eq (Literal a_13) + +deriving instance GHC.Classes.Ord a_14 => GHC.Classes.Ord (Literal a_14) + +deriving instance GHC.Show.Show a_15 => GHC.Show.Show (Literal a_15) + +instance AST.Unmarshal.Unmarshal Literal + +instance Data.Foldable.Foldable Literal where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Literal where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Literal where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Primary a = Primary {getPrimary :: ((Literal GHC.Generics.:+: ArrayAccess GHC.Generics.:+: ArrayCreationExpression GHC.Generics.:+: ClassLiteral GHC.Generics.:+: FieldAccess GHC.Generics.:+: MethodInvocation GHC.Generics.:+: MethodReference GHC.Generics.:+: ObjectCreationExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: This) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_16. + AST.Traversable1.Class.Traversable1 a_16 + ) + +instance GHC.Records.HasField "ann" (Primary a_17) a_17 where + getField = AST.Unmarshal.gann GHC.Base.. getPrimary + +deriving instance GHC.Classes.Eq a_18 => GHC.Classes.Eq (Primary a_18) + +deriving instance GHC.Classes.Ord a_19 => GHC.Classes.Ord (Primary a_19) + +deriving instance GHC.Show.Show a_20 => GHC.Show.Show (Primary a_20) + +instance AST.Unmarshal.Unmarshal Primary + +instance Data.Foldable.Foldable Primary where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Primary where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Primary where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype SimpleType a = SimpleType {getSimpleType :: ((BooleanType GHC.Generics.:+: FloatingPointType GHC.Generics.:+: GenericType GHC.Generics.:+: IntegralType GHC.Generics.:+: ScopedTypeIdentifier GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: VoidType) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_21. + AST.Traversable1.Class.Traversable1 a_21 + ) + +instance GHC.Records.HasField "ann" (SimpleType a_22) a_22 where + getField = AST.Unmarshal.gann GHC.Base.. getSimpleType + +deriving instance GHC.Classes.Eq a_23 => GHC.Classes.Eq (SimpleType a_23) + +deriving instance GHC.Classes.Ord a_24 => GHC.Classes.Ord (SimpleType a_24) + +deriving instance GHC.Show.Show a_25 => GHC.Show.Show (SimpleType a_25) + +instance AST.Unmarshal.Unmarshal SimpleType + +instance Data.Foldable.Foldable SimpleType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SimpleType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SimpleType where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Statement a = Statement {getStatement :: ((AnonymousSemicolon GHC.Generics.:+: Declaration GHC.Generics.:+: AssertStatement GHC.Generics.:+: Block GHC.Generics.:+: BreakStatement GHC.Generics.:+: ContinueStatement GHC.Generics.:+: DoStatement GHC.Generics.:+: EnhancedForStatement GHC.Generics.:+: ExpressionStatement GHC.Generics.:+: ForStatement GHC.Generics.:+: IfStatement GHC.Generics.:+: LabeledStatement GHC.Generics.:+: LocalVariableDeclarationStatement GHC.Generics.:+: ReturnStatement GHC.Generics.:+: SwitchStatement GHC.Generics.:+: SynchronizedStatement GHC.Generics.:+: ThrowStatement GHC.Generics.:+: TryStatement GHC.Generics.:+: TryWithResourcesStatement GHC.Generics.:+: WhileStatement) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_26. + AST.Traversable1.Class.Traversable1 a_26 + ) + +instance GHC.Records.HasField "ann" (Statement a_27) a_27 where + getField = AST.Unmarshal.gann GHC.Base.. getStatement + +deriving instance GHC.Classes.Eq a_28 => GHC.Classes.Eq (Statement a_28) + +deriving instance GHC.Classes.Ord a_29 => GHC.Classes.Ord (Statement a_29) + +deriving instance GHC.Show.Show a_30 => GHC.Show.Show (Statement a_30) + +instance AST.Unmarshal.Unmarshal Statement + +instance Data.Foldable.Foldable Statement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Statement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Statement where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Type a = Type {getType :: ((UnannotatedType GHC.Generics.:+: AnnotatedType) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_31. + AST.Traversable1.Class.Traversable1 a_31 + ) + +instance GHC.Records.HasField "ann" (Type a_32) a_32 where + getField = AST.Unmarshal.gann GHC.Base.. getType + +deriving instance GHC.Classes.Eq a_33 => GHC.Classes.Eq (Type a_33) + +deriving instance GHC.Classes.Ord a_34 => GHC.Classes.Ord (Type a_34) + +deriving instance GHC.Show.Show a_35 => GHC.Show.Show (Type a_35) + +instance AST.Unmarshal.Unmarshal Type + +instance Data.Foldable.Foldable Type where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Type where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Type where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype UnannotatedType a = UnannotatedType {getUnannotatedType :: ((SimpleType GHC.Generics.:+: ArrayType) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_36. + AST.Traversable1.Class.Traversable1 a_36 + ) + +instance GHC.Records.HasField "ann" (UnannotatedType a_37) a_37 where + getField = AST.Unmarshal.gann GHC.Base.. getUnannotatedType + +deriving instance GHC.Classes.Eq a_38 => GHC.Classes.Eq (UnannotatedType a_38) + +deriving instance GHC.Classes.Ord a_39 => GHC.Classes.Ord (UnannotatedType a_39) + +deriving instance GHC.Show.Show a_40 => GHC.Show.Show (UnannotatedType a_40) + +instance AST.Unmarshal.Unmarshal UnannotatedType + +instance Data.Foldable.Foldable UnannotatedType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnannotatedType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnannotatedType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AnnotatedType a = AnnotatedType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((UnannotatedType GHC.Generics.:+: Annotation GHC.Generics.:+: MarkerAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_41. + AST.Traversable1.Class.Traversable1 a_41 + ) + +instance AST.Unmarshal.SymbolMatching AnnotatedType where + matchedSymbols _ = [227] + showFailure _ node_42 = + "expected " + GHC.Base.<> ( "annotated_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_42 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_42) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_43 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_44 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_45 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_46 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_43 + c1_44 = TreeSitter.Node.nodeStartPoint node_42 + TreeSitter.Node.TSPoint + r2_45 + c2_46 = TreeSitter.Node.nodeEndPoint node_42 + +deriving instance GHC.Classes.Eq a_47 => GHC.Classes.Eq (AnnotatedType a_47) + +deriving instance GHC.Classes.Ord a_48 => GHC.Classes.Ord (AnnotatedType a_48) + +deriving instance GHC.Show.Show a_49 => GHC.Show.Show (AnnotatedType a_49) + +instance AST.Unmarshal.Unmarshal AnnotatedType + +instance Data.Foldable.Foldable AnnotatedType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AnnotatedType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AnnotatedType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Annotation a = Annotation + { ann :: a, + arguments :: (AST.Parse.Err (AnnotationArgumentList a)), + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: ScopedIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_50. + AST.Traversable1.Class.Traversable1 a_50 + ) + +instance AST.Unmarshal.SymbolMatching Annotation where + matchedSymbols _ = [180] + showFailure _ node_51 = + "expected " + GHC.Base.<> ( "annotation" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_51 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_51) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_52 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_53 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_54 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_55 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_52 + c1_53 = TreeSitter.Node.nodeStartPoint node_51 + TreeSitter.Node.TSPoint + r2_54 + c2_55 = TreeSitter.Node.nodeEndPoint node_51 + +deriving instance GHC.Classes.Eq a_56 => GHC.Classes.Eq (Annotation a_56) + +deriving instance GHC.Classes.Ord a_57 => GHC.Classes.Ord (Annotation a_57) + +deriving instance GHC.Show.Show a_58 => GHC.Show.Show (Annotation a_58) + +instance AST.Unmarshal.Unmarshal Annotation + +instance Data.Foldable.Foldable Annotation where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Annotation where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Annotation where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AnnotationArgumentList a = AnnotationArgumentList + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: Annotation GHC.Generics.:+: ElementValueArrayInitializer GHC.Generics.:+: ElementValuePair GHC.Generics.:+: MarkerAnnotation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_59. + AST.Traversable1.Class.Traversable1 a_59 + ) + +instance AST.Unmarshal.SymbolMatching AnnotationArgumentList where + matchedSymbols _ = [181] + showFailure _ node_60 = + "expected " + GHC.Base.<> ( "annotation_argument_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_60 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_60) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_61 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_62 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_63 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_64 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_61 + c1_62 = TreeSitter.Node.nodeStartPoint node_60 + TreeSitter.Node.TSPoint + r2_63 + c2_64 = TreeSitter.Node.nodeEndPoint node_60 + +deriving instance GHC.Classes.Eq a_65 => GHC.Classes.Eq (AnnotationArgumentList a_65) + +deriving instance GHC.Classes.Ord a_66 => GHC.Classes.Ord (AnnotationArgumentList a_66) + +deriving instance GHC.Show.Show a_67 => GHC.Show.Show (AnnotationArgumentList a_67) + +instance AST.Unmarshal.Unmarshal AnnotationArgumentList + +instance Data.Foldable.Foldable AnnotationArgumentList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AnnotationArgumentList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AnnotationArgumentList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AnnotationTypeBody a = AnnotationTypeBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AnnotationTypeDeclaration GHC.Generics.:+: AnnotationTypeElementDeclaration GHC.Generics.:+: ClassDeclaration GHC.Generics.:+: ConstantDeclaration GHC.Generics.:+: InterfaceDeclaration) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_68. + AST.Traversable1.Class.Traversable1 a_68 + ) + +instance AST.Unmarshal.SymbolMatching AnnotationTypeBody where + matchedSymbols _ = [214] + showFailure _ node_69 = + "expected " + GHC.Base.<> ( "annotation_type_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_69 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_69) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_70 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_71 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_72 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_73 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_70 + c1_71 = TreeSitter.Node.nodeStartPoint node_69 + TreeSitter.Node.TSPoint + r2_72 + c2_73 = TreeSitter.Node.nodeEndPoint node_69 + +deriving instance GHC.Classes.Eq a_74 => GHC.Classes.Eq (AnnotationTypeBody a_74) + +deriving instance GHC.Classes.Ord a_75 => GHC.Classes.Ord (AnnotationTypeBody a_75) + +deriving instance GHC.Show.Show a_76 => GHC.Show.Show (AnnotationTypeBody a_76) + +instance AST.Unmarshal.Unmarshal AnnotationTypeBody + +instance Data.Foldable.Foldable AnnotationTypeBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AnnotationTypeBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AnnotationTypeBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AnnotationTypeDeclaration a = AnnotationTypeDeclaration + { ann :: a, + body :: (AST.Parse.Err (AnnotationTypeBody a)), + name :: (AST.Parse.Err (Identifier a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Modifiers a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_77. + AST.Traversable1.Class.Traversable1 a_77 + ) + +instance AST.Unmarshal.SymbolMatching AnnotationTypeDeclaration where + matchedSymbols _ = [213] + showFailure _ node_78 = + "expected " + GHC.Base.<> ( "annotation_type_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_78 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_78) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_79 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_80 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_81 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_82 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_79 + c1_80 = TreeSitter.Node.nodeStartPoint node_78 + TreeSitter.Node.TSPoint + r2_81 + c2_82 = TreeSitter.Node.nodeEndPoint node_78 + +deriving instance GHC.Classes.Eq a_83 => GHC.Classes.Eq (AnnotationTypeDeclaration a_83) + +deriving instance GHC.Classes.Ord a_84 => GHC.Classes.Ord (AnnotationTypeDeclaration a_84) + +deriving instance GHC.Show.Show a_85 => GHC.Show.Show (AnnotationTypeDeclaration a_85) + +instance AST.Unmarshal.Unmarshal AnnotationTypeDeclaration + +instance Data.Foldable.Foldable AnnotationTypeDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AnnotationTypeDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AnnotationTypeDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AnnotationTypeElementDeclaration a = AnnotationTypeElementDeclaration + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: Annotation GHC.Generics.:+: ElementValueArrayInitializer GHC.Generics.:+: MarkerAnnotation) a))), + name :: (AST.Parse.Err (Identifier a)), + type' :: (AST.Parse.Err (UnannotatedType a)), + dimensions :: (GHC.Maybe.Maybe (AST.Parse.Err (Dimensions a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Modifiers a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_86. + AST.Traversable1.Class.Traversable1 a_86 + ) + +instance AST.Unmarshal.SymbolMatching AnnotationTypeElementDeclaration where + matchedSymbols _ = [215] + showFailure _ node_87 = + "expected " + GHC.Base.<> ( "annotation_type_element_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_87 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_87) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_88 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_89 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_90 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_91 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_88 + c1_89 = TreeSitter.Node.nodeStartPoint node_87 + TreeSitter.Node.TSPoint + r2_90 + c2_91 = TreeSitter.Node.nodeEndPoint node_87 + +deriving instance GHC.Classes.Eq a_92 => GHC.Classes.Eq (AnnotationTypeElementDeclaration a_92) + +deriving instance GHC.Classes.Ord a_93 => GHC.Classes.Ord (AnnotationTypeElementDeclaration a_93) + +deriving instance GHC.Show.Show a_94 => GHC.Show.Show (AnnotationTypeElementDeclaration a_94) + +instance AST.Unmarshal.Unmarshal AnnotationTypeElementDeclaration + +instance Data.Foldable.Foldable AnnotationTypeElementDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AnnotationTypeElementDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AnnotationTypeElementDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArgumentList a = ArgumentList + { ann :: a, + extraChildren :: ([AST.Parse.Err (Expression a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_95. + AST.Traversable1.Class.Traversable1 a_95 + ) + +instance AST.Unmarshal.SymbolMatching ArgumentList where + matchedSymbols _ = [145] + showFailure _ node_96 = + "expected " + GHC.Base.<> ( "argument_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_96 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_96) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_97 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_98 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_99 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_100 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_97 + c1_98 = TreeSitter.Node.nodeStartPoint node_96 + TreeSitter.Node.TSPoint + r2_99 + c2_100 = TreeSitter.Node.nodeEndPoint node_96 + +deriving instance GHC.Classes.Eq a_101 => GHC.Classes.Eq (ArgumentList a_101) + +deriving instance GHC.Classes.Ord a_102 => GHC.Classes.Ord (ArgumentList a_102) + +deriving instance GHC.Show.Show a_103 => GHC.Show.Show (ArgumentList a_103) + +instance AST.Unmarshal.Unmarshal ArgumentList + +instance Data.Foldable.Foldable ArgumentList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArgumentList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArgumentList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayAccess a = ArrayAccess + { ann :: a, + array :: (AST.Parse.Err ((Primary GHC.Generics.:+: Identifier GHC.Generics.:+: ScopedIdentifier) a)), + index :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_104. + AST.Traversable1.Class.Traversable1 a_104 + ) + +instance AST.Unmarshal.SymbolMatching ArrayAccess where + matchedSymbols _ = [143] + showFailure _ node_105 = + "expected " + GHC.Base.<> ( "array_access" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_105 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_105) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_106 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_107 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_108 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_109 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_106 + c1_107 = TreeSitter.Node.nodeStartPoint node_105 + TreeSitter.Node.TSPoint + r2_108 + c2_109 = TreeSitter.Node.nodeEndPoint node_105 + +deriving instance GHC.Classes.Eq a_110 => GHC.Classes.Eq (ArrayAccess a_110) + +deriving instance GHC.Classes.Ord a_111 => GHC.Classes.Ord (ArrayAccess a_111) + +deriving instance GHC.Show.Show a_112 => GHC.Show.Show (ArrayAccess a_112) + +instance AST.Unmarshal.Unmarshal ArrayAccess + +instance Data.Foldable.Foldable ArrayAccess where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayAccess where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayAccess where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayCreationExpression a = ArrayCreationExpression + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (ArrayInitializer a))), + type' :: (AST.Parse.Err (SimpleType a)), + dimensions :: (GHC.Base.NonEmpty (AST.Parse.Err ((Dimensions GHC.Generics.:+: DimensionsExpr) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_113. + AST.Traversable1.Class.Traversable1 a_113 + ) + +instance AST.Unmarshal.SymbolMatching ArrayCreationExpression where + matchedSymbols _ = [136] + showFailure _ node_114 = + "expected " + GHC.Base.<> ( "array_creation_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_114 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_114) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_115 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_116 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_117 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_118 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_115 + c1_116 = TreeSitter.Node.nodeStartPoint node_114 + TreeSitter.Node.TSPoint + r2_117 + c2_118 = TreeSitter.Node.nodeEndPoint node_114 + +deriving instance GHC.Classes.Eq a_119 => GHC.Classes.Eq (ArrayCreationExpression a_119) + +deriving instance GHC.Classes.Ord a_120 => GHC.Classes.Ord (ArrayCreationExpression a_120) + +deriving instance GHC.Show.Show a_121 => GHC.Show.Show (ArrayCreationExpression a_121) + +instance AST.Unmarshal.Unmarshal ArrayCreationExpression + +instance Data.Foldable.Foldable ArrayCreationExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayCreationExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayCreationExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayInitializer a = ArrayInitializer + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: ArrayInitializer) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_122. + AST.Traversable1.Class.Traversable1 a_122 + ) + +instance AST.Unmarshal.SymbolMatching ArrayInitializer where + matchedSymbols _ = [224] + showFailure _ node_123 = + "expected " + GHC.Base.<> ( "array_initializer" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_123 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_123) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_124 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_125 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_126 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_127 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_124 + c1_125 = TreeSitter.Node.nodeStartPoint node_123 + TreeSitter.Node.TSPoint + r2_126 + c2_127 = TreeSitter.Node.nodeEndPoint node_123 + +deriving instance GHC.Classes.Eq a_128 => GHC.Classes.Eq (ArrayInitializer a_128) + +deriving instance GHC.Classes.Ord a_129 => GHC.Classes.Ord (ArrayInitializer a_129) + +deriving instance GHC.Show.Show a_130 => GHC.Show.Show (ArrayInitializer a_130) + +instance AST.Unmarshal.Unmarshal ArrayInitializer + +instance Data.Foldable.Foldable ArrayInitializer where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayInitializer where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayInitializer where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayType a = ArrayType + { ann :: a, + dimensions :: (AST.Parse.Err (Dimensions a)), + element :: (AST.Parse.Err (UnannotatedType a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_131. + AST.Traversable1.Class.Traversable1 a_131 + ) + +instance AST.Unmarshal.SymbolMatching ArrayType where + matchedSymbols _ = [230] + showFailure _ node_132 = + "expected " + GHC.Base.<> ( "array_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_132 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_132) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_133 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_134 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_135 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_136 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_133 + c1_134 = TreeSitter.Node.nodeStartPoint node_132 + TreeSitter.Node.TSPoint + r2_135 + c2_136 = TreeSitter.Node.nodeEndPoint node_132 + +deriving instance GHC.Classes.Eq a_137 => GHC.Classes.Eq (ArrayType a_137) + +deriving instance GHC.Classes.Ord a_138 => GHC.Classes.Ord (ArrayType a_138) + +deriving instance GHC.Show.Show a_139 => GHC.Show.Show (ArrayType a_139) + +instance AST.Unmarshal.Unmarshal ArrayType + +instance Data.Foldable.Foldable ArrayType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AssertStatement a = AssertStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_140. + AST.Traversable1.Class.Traversable1 a_140 + ) + +instance AST.Unmarshal.SymbolMatching AssertStatement where + matchedSymbols _ = [155] + showFailure _ node_141 = + "expected " + GHC.Base.<> ( "assert_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_141 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_141) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_142 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_143 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_144 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_145 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_142 + c1_143 = TreeSitter.Node.nodeStartPoint node_141 + TreeSitter.Node.TSPoint + r2_144 + c2_145 = TreeSitter.Node.nodeEndPoint node_141 + +deriving instance GHC.Classes.Eq a_146 => GHC.Classes.Eq (AssertStatement a_146) + +deriving instance GHC.Classes.Ord a_147 => GHC.Classes.Ord (AssertStatement a_147) + +deriving instance GHC.Show.Show a_148 => GHC.Show.Show (AssertStatement a_148) + +instance AST.Unmarshal.Unmarshal AssertStatement + +instance Data.Foldable.Foldable AssertStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AssertStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AssertStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AssignmentExpression a = AssignmentExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousPercentEqual GHC.Generics.:+: AnonymousAmpersandEqual GHC.Generics.:+: AnonymousStarEqual GHC.Generics.:+: AnonymousPlusEqual GHC.Generics.:+: AnonymousMinusEqual GHC.Generics.:+: AnonymousSlashEqual GHC.Generics.:+: AnonymousLAngleLAngleEqual GHC.Generics.:+: AnonymousEqual GHC.Generics.:+: AnonymousRAngleRAngleEqual GHC.Generics.:+: AnonymousRAngleRAngleRAngleEqual GHC.Generics.:+: AnonymousCaretEqual GHC.Generics.:+: AnonymousPipeEqual) a)), + left :: (AST.Parse.Err ((ArrayAccess GHC.Generics.:+: FieldAccess GHC.Generics.:+: Identifier GHC.Generics.:+: ScopedIdentifier) a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_149. + AST.Traversable1.Class.Traversable1 a_149 + ) + +instance AST.Unmarshal.SymbolMatching AssignmentExpression where + matchedSymbols _ = [127] + showFailure _ node_150 = + "expected " + GHC.Base.<> ( "assignment_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_150 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_150) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_151 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_152 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_153 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_154 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_151 + c1_152 = TreeSitter.Node.nodeStartPoint node_150 + TreeSitter.Node.TSPoint + r2_153 + c2_154 = TreeSitter.Node.nodeEndPoint node_150 + +deriving instance GHC.Classes.Eq a_155 => GHC.Classes.Eq (AssignmentExpression a_155) + +deriving instance GHC.Classes.Ord a_156 => GHC.Classes.Ord (AssignmentExpression a_156) + +deriving instance GHC.Show.Show a_157 => GHC.Show.Show (AssignmentExpression a_157) + +instance AST.Unmarshal.Unmarshal AssignmentExpression + +instance Data.Foldable.Foldable AssignmentExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AssignmentExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AssignmentExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Asterisk a = Asterisk {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_158. + AST.Traversable1.Class.Traversable1 a_158 + ) + +instance AST.Unmarshal.SymbolMatching Asterisk where + matchedSymbols _ = [192] + showFailure _ node_159 = + "expected " + GHC.Base.<> ( "asterisk" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_159 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_159) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_160 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_161 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_162 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_163 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_160 + c1_161 = TreeSitter.Node.nodeStartPoint node_159 + TreeSitter.Node.TSPoint + r2_162 + c2_163 = TreeSitter.Node.nodeEndPoint node_159 + +deriving instance GHC.Classes.Eq a_164 => GHC.Classes.Eq (Asterisk a_164) + +deriving instance GHC.Classes.Ord a_165 => GHC.Classes.Ord (Asterisk a_165) + +deriving instance GHC.Show.Show a_166 => GHC.Show.Show (Asterisk a_166) + +instance AST.Unmarshal.Unmarshal Asterisk + +instance Data.Foldable.Foldable Asterisk where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Asterisk where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Asterisk where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BinaryExpression a = BinaryExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousBangEqual GHC.Generics.:+: AnonymousPercent GHC.Generics.:+: AnonymousAmpersand GHC.Generics.:+: AnonymousAmpersandAmpersand GHC.Generics.:+: AnonymousStar GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousSlash GHC.Generics.:+: AnonymousLAngle GHC.Generics.:+: AnonymousLAngleLAngle GHC.Generics.:+: AnonymousLAngleEqual GHC.Generics.:+: AnonymousEqualEqual GHC.Generics.:+: AnonymousRAngle GHC.Generics.:+: AnonymousRAngleEqual GHC.Generics.:+: AnonymousRAngleRAngle GHC.Generics.:+: AnonymousRAngleRAngleRAngle GHC.Generics.:+: AnonymousCaret GHC.Generics.:+: AnonymousPipe GHC.Generics.:+: AnonymousPipePipe) a)), + left :: (AST.Parse.Err (Expression a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_167. + AST.Traversable1.Class.Traversable1 a_167 + ) + +instance AST.Unmarshal.SymbolMatching BinaryExpression where + matchedSymbols _ = [128] + showFailure _ node_168 = + "expected " + GHC.Base.<> ( "binary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_168 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_168) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_169 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_170 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_171 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_172 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_169 + c1_170 = TreeSitter.Node.nodeStartPoint node_168 + TreeSitter.Node.TSPoint + r2_171 + c2_172 = TreeSitter.Node.nodeEndPoint node_168 + +deriving instance GHC.Classes.Eq a_173 => GHC.Classes.Eq (BinaryExpression a_173) + +deriving instance GHC.Classes.Ord a_174 => GHC.Classes.Ord (BinaryExpression a_174) + +deriving instance GHC.Show.Show a_175 => GHC.Show.Show (BinaryExpression a_175) + +instance AST.Unmarshal.Unmarshal BinaryExpression + +instance Data.Foldable.Foldable BinaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BinaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BinaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Block a = Block + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_176. + AST.Traversable1.Class.Traversable1 a_176 + ) + +instance AST.Unmarshal.SymbolMatching Block where + matchedSymbols _ = [152] + showFailure _ node_177 = + "expected " + GHC.Base.<> ( "block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_177 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_177) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_178 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_179 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_180 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_181 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_178 + c1_179 = TreeSitter.Node.nodeStartPoint node_177 + TreeSitter.Node.TSPoint + r2_180 + c2_181 = TreeSitter.Node.nodeEndPoint node_177 + +deriving instance GHC.Classes.Eq a_182 => GHC.Classes.Eq (Block a_182) + +deriving instance GHC.Classes.Ord a_183 => GHC.Classes.Ord (Block a_183) + +deriving instance GHC.Show.Show a_184 => GHC.Show.Show (Block a_184) + +instance AST.Unmarshal.Unmarshal Block + +instance Data.Foldable.Foldable Block where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Block where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Block where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BreakStatement a = BreakStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_185. + AST.Traversable1.Class.Traversable1 a_185 + ) + +instance AST.Unmarshal.SymbolMatching BreakStatement where + matchedSymbols _ = [160] + showFailure _ node_186 = + "expected " + GHC.Base.<> ( "break_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_186 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_186) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_187 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_188 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_189 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_190 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_187 + c1_188 = TreeSitter.Node.nodeStartPoint node_186 + TreeSitter.Node.TSPoint + r2_189 + c2_190 = TreeSitter.Node.nodeEndPoint node_186 + +deriving instance GHC.Classes.Eq a_191 => GHC.Classes.Eq (BreakStatement a_191) + +deriving instance GHC.Classes.Ord a_192 => GHC.Classes.Ord (BreakStatement a_192) + +deriving instance GHC.Show.Show a_193 => GHC.Show.Show (BreakStatement a_193) + +instance AST.Unmarshal.Unmarshal BreakStatement + +instance Data.Foldable.Foldable BreakStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BreakStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BreakStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CastExpression a = CastExpression + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + type' :: (GHC.Base.NonEmpty (AST.Parse.Err (Type a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_194. + AST.Traversable1.Class.Traversable1 a_194 + ) + +instance AST.Unmarshal.SymbolMatching CastExpression where + matchedSymbols _ = [126] + showFailure _ node_195 = + "expected " + GHC.Base.<> ( "cast_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_195 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_195) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_196 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_197 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_198 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_199 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_196 + c1_197 = TreeSitter.Node.nodeStartPoint node_195 + TreeSitter.Node.TSPoint + r2_198 + c2_199 = TreeSitter.Node.nodeEndPoint node_195 + +deriving instance GHC.Classes.Eq a_200 => GHC.Classes.Eq (CastExpression a_200) + +deriving instance GHC.Classes.Ord a_201 => GHC.Classes.Ord (CastExpression a_201) + +deriving instance GHC.Show.Show a_202 => GHC.Show.Show (CastExpression a_202) + +instance AST.Unmarshal.Unmarshal CastExpression + +instance Data.Foldable.Foldable CastExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CastExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CastExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CatchClause a = CatchClause + { ann :: a, + body :: (AST.Parse.Err (Block a)), + extraChildren :: (AST.Parse.Err (CatchFormalParameter a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_203. + AST.Traversable1.Class.Traversable1 a_203 + ) + +instance AST.Unmarshal.SymbolMatching CatchClause where + matchedSymbols _ = [166] + showFailure _ node_204 = + "expected " + GHC.Base.<> ( "catch_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_204 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_204) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_205 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_206 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_207 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_208 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_205 + c1_206 = TreeSitter.Node.nodeStartPoint node_204 + TreeSitter.Node.TSPoint + r2_207 + c2_208 = TreeSitter.Node.nodeEndPoint node_204 + +deriving instance GHC.Classes.Eq a_209 => GHC.Classes.Eq (CatchClause a_209) + +deriving instance GHC.Classes.Ord a_210 => GHC.Classes.Ord (CatchClause a_210) + +deriving instance GHC.Show.Show a_211 => GHC.Show.Show (CatchClause a_211) + +instance AST.Unmarshal.Unmarshal CatchClause + +instance Data.Foldable.Foldable CatchClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CatchClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CatchClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CatchFormalParameter a = CatchFormalParameter + { ann :: a, + name :: (AST.Parse.Err (Identifier a)), + dimensions :: (GHC.Maybe.Maybe (AST.Parse.Err (Dimensions a))), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((CatchType GHC.Generics.:+: Modifiers) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_212. + AST.Traversable1.Class.Traversable1 a_212 + ) + +instance AST.Unmarshal.SymbolMatching CatchFormalParameter where + matchedSymbols _ = [167] + showFailure _ node_213 = + "expected " + GHC.Base.<> ( "catch_formal_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_213 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_213) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_214 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_215 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_216 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_217 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_214 + c1_215 = TreeSitter.Node.nodeStartPoint node_213 + TreeSitter.Node.TSPoint + r2_216 + c2_217 = TreeSitter.Node.nodeEndPoint node_213 + +deriving instance GHC.Classes.Eq a_218 => GHC.Classes.Eq (CatchFormalParameter a_218) + +deriving instance GHC.Classes.Ord a_219 => GHC.Classes.Ord (CatchFormalParameter a_219) + +deriving instance GHC.Show.Show a_220 => GHC.Show.Show (CatchFormalParameter a_220) + +instance AST.Unmarshal.Unmarshal CatchFormalParameter + +instance Data.Foldable.Foldable CatchFormalParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CatchFormalParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CatchFormalParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CatchType a = CatchType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (UnannotatedType a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_221. + AST.Traversable1.Class.Traversable1 a_221 + ) + +instance AST.Unmarshal.SymbolMatching CatchType where + matchedSymbols _ = [168] + showFailure _ node_222 = + "expected " + GHC.Base.<> ( "catch_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_222 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_222) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_223 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_224 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_225 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_226 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_223 + c1_224 = TreeSitter.Node.nodeStartPoint node_222 + TreeSitter.Node.TSPoint + r2_225 + c2_226 = TreeSitter.Node.nodeEndPoint node_222 + +deriving instance GHC.Classes.Eq a_227 => GHC.Classes.Eq (CatchType a_227) + +deriving instance GHC.Classes.Ord a_228 => GHC.Classes.Ord (CatchType a_228) + +deriving instance GHC.Show.Show a_229 => GHC.Show.Show (CatchType a_229) + +instance AST.Unmarshal.Unmarshal CatchType + +instance Data.Foldable.Foldable CatchType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CatchType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CatchType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassBody a = ClassBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AnnotationTypeDeclaration GHC.Generics.:+: Block GHC.Generics.:+: ClassDeclaration GHC.Generics.:+: ConstructorDeclaration GHC.Generics.:+: EnumDeclaration GHC.Generics.:+: FieldDeclaration GHC.Generics.:+: InterfaceDeclaration GHC.Generics.:+: MethodDeclaration GHC.Generics.:+: StaticInitializer) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_230. + AST.Traversable1.Class.Traversable1 a_230 + ) + +instance AST.Unmarshal.SymbolMatching ClassBody where + matchedSymbols _ = [205] + showFailure _ node_231 = + "expected " + GHC.Base.<> ( "class_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_231 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_231) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_232 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_233 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_234 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_235 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_232 + c1_233 = TreeSitter.Node.nodeStartPoint node_231 + TreeSitter.Node.TSPoint + r2_234 + c2_235 = TreeSitter.Node.nodeEndPoint node_231 + +deriving instance GHC.Classes.Eq a_236 => GHC.Classes.Eq (ClassBody a_236) + +deriving instance GHC.Classes.Ord a_237 => GHC.Classes.Ord (ClassBody a_237) + +deriving instance GHC.Show.Show a_238 => GHC.Show.Show (ClassBody a_238) + +instance AST.Unmarshal.Unmarshal ClassBody + +instance Data.Foldable.Foldable ClassBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassDeclaration a = ClassDeclaration + { ann :: a, + body :: (AST.Parse.Err (ClassBody a)), + interfaces :: (GHC.Maybe.Maybe (AST.Parse.Err (SuperInterfaces a))), + name :: (AST.Parse.Err (Identifier a)), + superclass :: (GHC.Maybe.Maybe (AST.Parse.Err (Superclass a))), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Modifiers a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_239. + AST.Traversable1.Class.Traversable1 a_239 + ) + +instance AST.Unmarshal.SymbolMatching ClassDeclaration where + matchedSymbols _ = [197] + showFailure _ node_240 = + "expected " + GHC.Base.<> ( "class_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_240 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_240) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_241 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_242 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_243 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_244 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_241 + c1_242 = TreeSitter.Node.nodeStartPoint node_240 + TreeSitter.Node.TSPoint + r2_243 + c2_244 = TreeSitter.Node.nodeEndPoint node_240 + +deriving instance GHC.Classes.Eq a_245 => GHC.Classes.Eq (ClassDeclaration a_245) + +deriving instance GHC.Classes.Ord a_246 => GHC.Classes.Ord (ClassDeclaration a_246) + +deriving instance GHC.Show.Show a_247 => GHC.Show.Show (ClassDeclaration a_247) + +instance AST.Unmarshal.Unmarshal ClassDeclaration + +instance Data.Foldable.Foldable ClassDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassLiteral a = ClassLiteral + { ann :: a, + extraChildren :: (AST.Parse.Err ((BooleanType GHC.Generics.:+: FloatingPointType GHC.Generics.:+: Identifier GHC.Generics.:+: IntegralType GHC.Generics.:+: ScopedIdentifier GHC.Generics.:+: VoidType) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_248. + AST.Traversable1.Class.Traversable1 a_248 + ) + +instance AST.Unmarshal.SymbolMatching ClassLiteral where + matchedSymbols _ = [139] + showFailure _ node_249 = + "expected " + GHC.Base.<> ( "class_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_249 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_249) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_250 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_251 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_252 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_253 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_250 + c1_251 = TreeSitter.Node.nodeStartPoint node_249 + TreeSitter.Node.TSPoint + r2_252 + c2_253 = TreeSitter.Node.nodeEndPoint node_249 + +deriving instance GHC.Classes.Eq a_254 => GHC.Classes.Eq (ClassLiteral a_254) + +deriving instance GHC.Classes.Ord a_255 => GHC.Classes.Ord (ClassLiteral a_255) + +deriving instance GHC.Show.Show a_256 => GHC.Show.Show (ClassLiteral a_256) + +instance AST.Unmarshal.Unmarshal ClassLiteral + +instance Data.Foldable.Foldable ClassLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstantDeclaration a = ConstantDeclaration + { ann :: a, + declarator :: (GHC.Base.NonEmpty (AST.Parse.Err (VariableDeclarator a))), + type' :: (AST.Parse.Err (UnannotatedType a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Modifiers a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_257. + AST.Traversable1.Class.Traversable1 a_257 + ) + +instance AST.Unmarshal.SymbolMatching ConstantDeclaration where + matchedSymbols _ = [220] + showFailure _ node_258 = + "expected " + GHC.Base.<> ( "constant_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_258 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_258) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_259 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_260 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_261 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_262 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_259 + c1_260 = TreeSitter.Node.nodeStartPoint node_258 + TreeSitter.Node.TSPoint + r2_261 + c2_262 = TreeSitter.Node.nodeEndPoint node_258 + +deriving instance GHC.Classes.Eq a_263 => GHC.Classes.Eq (ConstantDeclaration a_263) + +deriving instance GHC.Classes.Ord a_264 => GHC.Classes.Ord (ConstantDeclaration a_264) + +deriving instance GHC.Show.Show a_265 => GHC.Show.Show (ConstantDeclaration a_265) + +instance AST.Unmarshal.Unmarshal ConstantDeclaration + +instance Data.Foldable.Foldable ConstantDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstantDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstantDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstructorBody a = ConstructorBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: ExplicitConstructorInvocation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_266. + AST.Traversable1.Class.Traversable1 a_266 + ) + +instance AST.Unmarshal.SymbolMatching ConstructorBody where + matchedSymbols _ = [209] + showFailure _ node_267 = + "expected " + GHC.Base.<> ( "constructor_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_267 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_267) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_268 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_269 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_270 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_271 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_268 + c1_269 = TreeSitter.Node.nodeStartPoint node_267 + TreeSitter.Node.TSPoint + r2_270 + c2_271 = TreeSitter.Node.nodeEndPoint node_267 + +deriving instance GHC.Classes.Eq a_272 => GHC.Classes.Eq (ConstructorBody a_272) + +deriving instance GHC.Classes.Ord a_273 => GHC.Classes.Ord (ConstructorBody a_273) + +deriving instance GHC.Show.Show a_274 => GHC.Show.Show (ConstructorBody a_274) + +instance AST.Unmarshal.Unmarshal ConstructorBody + +instance Data.Foldable.Foldable ConstructorBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstructorBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstructorBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstructorDeclaration a = ConstructorDeclaration + { ann :: a, + body :: (AST.Parse.Err (ConstructorBody a)), + typeParamaters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + name :: (AST.Parse.Err (Identifier a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + extraChildren :: ([AST.Parse.Err ((Modifiers GHC.Generics.:+: Throws) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_275. + AST.Traversable1.Class.Traversable1 a_275 + ) + +instance AST.Unmarshal.SymbolMatching ConstructorDeclaration where + matchedSymbols _ = [207] + showFailure _ node_276 = + "expected " + GHC.Base.<> ( "constructor_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_276 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_276) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_277 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_278 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_279 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_280 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_277 + c1_278 = TreeSitter.Node.nodeStartPoint node_276 + TreeSitter.Node.TSPoint + r2_279 + c2_280 = TreeSitter.Node.nodeEndPoint node_276 + +deriving instance GHC.Classes.Eq a_281 => GHC.Classes.Eq (ConstructorDeclaration a_281) + +deriving instance GHC.Classes.Ord a_282 => GHC.Classes.Ord (ConstructorDeclaration a_282) + +deriving instance GHC.Show.Show a_283 => GHC.Show.Show (ConstructorDeclaration a_283) + +instance AST.Unmarshal.Unmarshal ConstructorDeclaration + +instance Data.Foldable.Foldable ConstructorDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstructorDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstructorDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ContinueStatement a = ContinueStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_284. + AST.Traversable1.Class.Traversable1 a_284 + ) + +instance AST.Unmarshal.SymbolMatching ContinueStatement where + matchedSymbols _ = [161] + showFailure _ node_285 = + "expected " + GHC.Base.<> ( "continue_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_285 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_285) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_286 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_287 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_288 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_289 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_286 + c1_287 = TreeSitter.Node.nodeStartPoint node_285 + TreeSitter.Node.TSPoint + r2_288 + c2_289 = TreeSitter.Node.nodeEndPoint node_285 + +deriving instance GHC.Classes.Eq a_290 => GHC.Classes.Eq (ContinueStatement a_290) + +deriving instance GHC.Classes.Ord a_291 => GHC.Classes.Ord (ContinueStatement a_291) + +deriving instance GHC.Show.Show a_292 => GHC.Show.Show (ContinueStatement a_292) + +instance AST.Unmarshal.Unmarshal ContinueStatement + +instance Data.Foldable.Foldable ContinueStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ContinueStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ContinueStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Dimensions a = Dimensions + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Annotation GHC.Generics.:+: MarkerAnnotation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_293. + AST.Traversable1.Class.Traversable1 a_293 + ) + +instance AST.Unmarshal.SymbolMatching Dimensions where + matchedSymbols _ = [150] + showFailure _ node_294 = + "expected " + GHC.Base.<> ( "dimensions" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_294 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_294) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_295 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_296 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_297 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_298 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_295 + c1_296 = TreeSitter.Node.nodeStartPoint node_294 + TreeSitter.Node.TSPoint + r2_297 + c2_298 = TreeSitter.Node.nodeEndPoint node_294 + +deriving instance GHC.Classes.Eq a_299 => GHC.Classes.Eq (Dimensions a_299) + +deriving instance GHC.Classes.Ord a_300 => GHC.Classes.Ord (Dimensions a_300) + +deriving instance GHC.Show.Show a_301 => GHC.Show.Show (Dimensions a_301) + +instance AST.Unmarshal.Unmarshal Dimensions + +instance Data.Foldable.Foldable Dimensions where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Dimensions where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Dimensions where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DimensionsExpr a = DimensionsExpr + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: Annotation GHC.Generics.:+: MarkerAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_302. + AST.Traversable1.Class.Traversable1 a_302 + ) + +instance AST.Unmarshal.SymbolMatching DimensionsExpr where + matchedSymbols _ = [137] + showFailure _ node_303 = + "expected " + GHC.Base.<> ( "dimensions_expr" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_303 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_303) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_304 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_305 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_306 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_307 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_304 + c1_305 = TreeSitter.Node.nodeStartPoint node_303 + TreeSitter.Node.TSPoint + r2_306 + c2_307 = TreeSitter.Node.nodeEndPoint node_303 + +deriving instance GHC.Classes.Eq a_308 => GHC.Classes.Eq (DimensionsExpr a_308) + +deriving instance GHC.Classes.Ord a_309 => GHC.Classes.Ord (DimensionsExpr a_309) + +deriving instance GHC.Show.Show a_310 => GHC.Show.Show (DimensionsExpr a_310) + +instance AST.Unmarshal.Unmarshal DimensionsExpr + +instance Data.Foldable.Foldable DimensionsExpr where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DimensionsExpr where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DimensionsExpr where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DoStatement a = DoStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: Statement) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_311. + AST.Traversable1.Class.Traversable1 a_311 + ) + +instance AST.Unmarshal.SymbolMatching DoStatement where + matchedSymbols _ = [159] + showFailure _ node_312 = + "expected " + GHC.Base.<> ( "do_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_312 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_312) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_313 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_314 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_315 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_316 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_313 + c1_314 = TreeSitter.Node.nodeStartPoint node_312 + TreeSitter.Node.TSPoint + r2_315 + c2_316 = TreeSitter.Node.nodeEndPoint node_312 + +deriving instance GHC.Classes.Eq a_317 => GHC.Classes.Eq (DoStatement a_317) + +deriving instance GHC.Classes.Ord a_318 => GHC.Classes.Ord (DoStatement a_318) + +deriving instance GHC.Show.Show a_319 => GHC.Show.Show (DoStatement a_319) + +instance AST.Unmarshal.Unmarshal DoStatement + +instance Data.Foldable.Foldable DoStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DoStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DoStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ElementValueArrayInitializer a = ElementValueArrayInitializer + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: Annotation GHC.Generics.:+: ElementValueArrayInitializer GHC.Generics.:+: MarkerAnnotation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_320. + AST.Traversable1.Class.Traversable1 a_320 + ) + +instance AST.Unmarshal.SymbolMatching ElementValueArrayInitializer where + matchedSymbols _ = [184] + showFailure _ node_321 = + "expected " + GHC.Base.<> ( "element_value_array_initializer" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_321 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_321) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_322 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_323 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_324 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_325 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_322 + c1_323 = TreeSitter.Node.nodeStartPoint node_321 + TreeSitter.Node.TSPoint + r2_324 + c2_325 = TreeSitter.Node.nodeEndPoint node_321 + +deriving instance GHC.Classes.Eq a_326 => GHC.Classes.Eq (ElementValueArrayInitializer a_326) + +deriving instance GHC.Classes.Ord a_327 => GHC.Classes.Ord (ElementValueArrayInitializer a_327) + +deriving instance GHC.Show.Show a_328 => GHC.Show.Show (ElementValueArrayInitializer a_328) + +instance AST.Unmarshal.Unmarshal ElementValueArrayInitializer + +instance Data.Foldable.Foldable ElementValueArrayInitializer where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ElementValueArrayInitializer where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ElementValueArrayInitializer where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ElementValuePair a = ElementValuePair + { ann :: a, + value :: (AST.Parse.Err ((Expression GHC.Generics.:+: Annotation GHC.Generics.:+: ElementValueArrayInitializer GHC.Generics.:+: MarkerAnnotation) a)), + key :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_329. + AST.Traversable1.Class.Traversable1 a_329 + ) + +instance AST.Unmarshal.SymbolMatching ElementValuePair where + matchedSymbols _ = [182] + showFailure _ node_330 = + "expected " + GHC.Base.<> ( "element_value_pair" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_330 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_330) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_331 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_332 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_333 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_334 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_331 + c1_332 = TreeSitter.Node.nodeStartPoint node_330 + TreeSitter.Node.TSPoint + r2_333 + c2_334 = TreeSitter.Node.nodeEndPoint node_330 + +deriving instance GHC.Classes.Eq a_335 => GHC.Classes.Eq (ElementValuePair a_335) + +deriving instance GHC.Classes.Ord a_336 => GHC.Classes.Ord (ElementValuePair a_336) + +deriving instance GHC.Show.Show a_337 => GHC.Show.Show (ElementValuePair a_337) + +instance AST.Unmarshal.Unmarshal ElementValuePair + +instance Data.Foldable.Foldable ElementValuePair where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ElementValuePair where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ElementValuePair where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnhancedForStatement a = EnhancedForStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + value :: (AST.Parse.Err (Expression a)), + name :: (AST.Parse.Err (Identifier a)), + type' :: (AST.Parse.Err (UnannotatedType a)), + dimensions :: (GHC.Maybe.Maybe (AST.Parse.Err (Dimensions a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Modifiers a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_338. + AST.Traversable1.Class.Traversable1 a_338 + ) + +instance AST.Unmarshal.SymbolMatching EnhancedForStatement where + matchedSymbols _ = [177] + showFailure _ node_339 = + "expected " + GHC.Base.<> ( "enhanced_for_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_339 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_339) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_340 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_341 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_342 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_343 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_340 + c1_341 = TreeSitter.Node.nodeStartPoint node_339 + TreeSitter.Node.TSPoint + r2_342 + c2_343 = TreeSitter.Node.nodeEndPoint node_339 + +deriving instance GHC.Classes.Eq a_344 => GHC.Classes.Eq (EnhancedForStatement a_344) + +deriving instance GHC.Classes.Ord a_345 => GHC.Classes.Ord (EnhancedForStatement a_345) + +deriving instance GHC.Show.Show a_346 => GHC.Show.Show (EnhancedForStatement a_346) + +instance AST.Unmarshal.Unmarshal EnhancedForStatement + +instance Data.Foldable.Foldable EnhancedForStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnhancedForStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnhancedForStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnumBody a = EnumBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((EnumBodyDeclarations GHC.Generics.:+: EnumConstant) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_347. + AST.Traversable1.Class.Traversable1 a_347 + ) + +instance AST.Unmarshal.SymbolMatching EnumBody where + matchedSymbols _ = [194] + showFailure _ node_348 = + "expected " + GHC.Base.<> ( "enum_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_348 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_348) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_349 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_350 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_351 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_352 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_349 + c1_350 = TreeSitter.Node.nodeStartPoint node_348 + TreeSitter.Node.TSPoint + r2_351 + c2_352 = TreeSitter.Node.nodeEndPoint node_348 + +deriving instance GHC.Classes.Eq a_353 => GHC.Classes.Eq (EnumBody a_353) + +deriving instance GHC.Classes.Ord a_354 => GHC.Classes.Ord (EnumBody a_354) + +deriving instance GHC.Show.Show a_355 => GHC.Show.Show (EnumBody a_355) + +instance AST.Unmarshal.Unmarshal EnumBody + +instance Data.Foldable.Foldable EnumBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnumBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnumBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnumBodyDeclarations a = EnumBodyDeclarations + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AnnotationTypeDeclaration GHC.Generics.:+: Block GHC.Generics.:+: ClassDeclaration GHC.Generics.:+: ConstructorDeclaration GHC.Generics.:+: EnumDeclaration GHC.Generics.:+: FieldDeclaration GHC.Generics.:+: InterfaceDeclaration GHC.Generics.:+: MethodDeclaration GHC.Generics.:+: StaticInitializer) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_356. + AST.Traversable1.Class.Traversable1 a_356 + ) + +instance AST.Unmarshal.SymbolMatching EnumBodyDeclarations where + matchedSymbols _ = [195] + showFailure _ node_357 = + "expected " + GHC.Base.<> ( "enum_body_declarations" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_357 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_357) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_358 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_359 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_360 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_361 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_358 + c1_359 = TreeSitter.Node.nodeStartPoint node_357 + TreeSitter.Node.TSPoint + r2_360 + c2_361 = TreeSitter.Node.nodeEndPoint node_357 + +deriving instance GHC.Classes.Eq a_362 => GHC.Classes.Eq (EnumBodyDeclarations a_362) + +deriving instance GHC.Classes.Ord a_363 => GHC.Classes.Ord (EnumBodyDeclarations a_363) + +deriving instance GHC.Show.Show a_364 => GHC.Show.Show (EnumBodyDeclarations a_364) + +instance AST.Unmarshal.Unmarshal EnumBodyDeclarations + +instance Data.Foldable.Foldable EnumBodyDeclarations where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnumBodyDeclarations where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnumBodyDeclarations where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnumConstant a = EnumConstant + { ann :: a, + body :: (GHC.Maybe.Maybe (AST.Parse.Err (ClassBody a))), + arguments :: (GHC.Maybe.Maybe (AST.Parse.Err (ArgumentList a))), + name :: (AST.Parse.Err (Identifier a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Modifiers a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_365. + AST.Traversable1.Class.Traversable1 a_365 + ) + +instance AST.Unmarshal.SymbolMatching EnumConstant where + matchedSymbols _ = [196] + showFailure _ node_366 = + "expected " + GHC.Base.<> ( "enum_constant" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_366 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_366) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_367 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_368 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_369 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_370 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_367 + c1_368 = TreeSitter.Node.nodeStartPoint node_366 + TreeSitter.Node.TSPoint + r2_369 + c2_370 = TreeSitter.Node.nodeEndPoint node_366 + +deriving instance GHC.Classes.Eq a_371 => GHC.Classes.Eq (EnumConstant a_371) + +deriving instance GHC.Classes.Ord a_372 => GHC.Classes.Ord (EnumConstant a_372) + +deriving instance GHC.Show.Show a_373 => GHC.Show.Show (EnumConstant a_373) + +instance AST.Unmarshal.Unmarshal EnumConstant + +instance Data.Foldable.Foldable EnumConstant where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnumConstant where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnumConstant where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnumDeclaration a = EnumDeclaration + { ann :: a, + body :: (AST.Parse.Err (EnumBody a)), + interfaces :: (GHC.Maybe.Maybe (AST.Parse.Err (SuperInterfaces a))), + name :: (AST.Parse.Err (Identifier a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Modifiers a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_374. + AST.Traversable1.Class.Traversable1 a_374 + ) + +instance AST.Unmarshal.SymbolMatching EnumDeclaration where + matchedSymbols _ = [193] + showFailure _ node_375 = + "expected " + GHC.Base.<> ( "enum_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_375 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_375) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_376 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_377 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_378 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_379 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_376 + c1_377 = TreeSitter.Node.nodeStartPoint node_375 + TreeSitter.Node.TSPoint + r2_378 + c2_379 = TreeSitter.Node.nodeEndPoint node_375 + +deriving instance GHC.Classes.Eq a_380 => GHC.Classes.Eq (EnumDeclaration a_380) + +deriving instance GHC.Classes.Ord a_381 => GHC.Classes.Ord (EnumDeclaration a_381) + +deriving instance GHC.Show.Show a_382 => GHC.Show.Show (EnumDeclaration a_382) + +instance AST.Unmarshal.Unmarshal EnumDeclaration + +instance Data.Foldable.Foldable EnumDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnumDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnumDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExplicitConstructorInvocation a = ExplicitConstructorInvocation + { ann :: a, + arguments :: (AST.Parse.Err (ArgumentList a)), + typeArguments :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeArguments a))), + object :: (GHC.Maybe.Maybe (AST.Parse.Err ((Primary GHC.Generics.:+: Identifier GHC.Generics.:+: ScopedIdentifier) a))), + constructor :: (AST.Parse.Err ((Super GHC.Generics.:+: This) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_383. + AST.Traversable1.Class.Traversable1 a_383 + ) + +instance AST.Unmarshal.SymbolMatching ExplicitConstructorInvocation where + matchedSymbols _ = [210] + showFailure _ node_384 = + "expected " + GHC.Base.<> ( "explicit_constructor_invocation" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_384 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_384) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_385 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_386 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_387 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_388 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_385 + c1_386 = TreeSitter.Node.nodeStartPoint node_384 + TreeSitter.Node.TSPoint + r2_387 + c2_388 = TreeSitter.Node.nodeEndPoint node_384 + +deriving instance GHC.Classes.Eq a_389 => GHC.Classes.Eq (ExplicitConstructorInvocation a_389) + +deriving instance GHC.Classes.Ord a_390 => GHC.Classes.Ord (ExplicitConstructorInvocation a_390) + +deriving instance GHC.Show.Show a_391 => GHC.Show.Show (ExplicitConstructorInvocation a_391) + +instance AST.Unmarshal.Unmarshal ExplicitConstructorInvocation + +instance Data.Foldable.Foldable ExplicitConstructorInvocation where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExplicitConstructorInvocation where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExplicitConstructorInvocation where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExpressionStatement a = ExpressionStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_392. + AST.Traversable1.Class.Traversable1 a_392 + ) + +instance AST.Unmarshal.SymbolMatching ExpressionStatement where + matchedSymbols _ = [153] + showFailure _ node_393 = + "expected " + GHC.Base.<> ( "expression_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_393 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_393) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_394 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_395 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_396 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_397 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_394 + c1_395 = TreeSitter.Node.nodeStartPoint node_393 + TreeSitter.Node.TSPoint + r2_396 + c2_397 = TreeSitter.Node.nodeEndPoint node_393 + +deriving instance GHC.Classes.Eq a_398 => GHC.Classes.Eq (ExpressionStatement a_398) + +deriving instance GHC.Classes.Ord a_399 => GHC.Classes.Ord (ExpressionStatement a_399) + +deriving instance GHC.Show.Show a_400 => GHC.Show.Show (ExpressionStatement a_400) + +instance AST.Unmarshal.Unmarshal ExpressionStatement + +instance Data.Foldable.Foldable ExpressionStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExpressionStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExpressionStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExtendsInterfaces a = ExtendsInterfaces + { ann :: a, + extraChildren :: (AST.Parse.Err (InterfaceTypeList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_401. + AST.Traversable1.Class.Traversable1 a_401 + ) + +instance AST.Unmarshal.SymbolMatching ExtendsInterfaces where + matchedSymbols _ = [218] + showFailure _ node_402 = + "expected " + GHC.Base.<> ( "extends_interfaces" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_402 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_402) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_403 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_404 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_405 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_406 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_403 + c1_404 = TreeSitter.Node.nodeStartPoint node_402 + TreeSitter.Node.TSPoint + r2_405 + c2_406 = TreeSitter.Node.nodeEndPoint node_402 + +deriving instance GHC.Classes.Eq a_407 => GHC.Classes.Eq (ExtendsInterfaces a_407) + +deriving instance GHC.Classes.Ord a_408 => GHC.Classes.Ord (ExtendsInterfaces a_408) + +deriving instance GHC.Show.Show a_409 => GHC.Show.Show (ExtendsInterfaces a_409) + +instance AST.Unmarshal.Unmarshal ExtendsInterfaces + +instance Data.Foldable.Foldable ExtendsInterfaces where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExtendsInterfaces where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExtendsInterfaces where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FieldAccess a = FieldAccess + { ann :: a, + field :: (AST.Parse.Err ((Identifier GHC.Generics.:+: This) a)), + object :: (AST.Parse.Err ((Primary GHC.Generics.:+: Identifier GHC.Generics.:+: ScopedIdentifier GHC.Generics.:+: Super) a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Super a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_410. + AST.Traversable1.Class.Traversable1 a_410 + ) + +instance AST.Unmarshal.SymbolMatching FieldAccess where + matchedSymbols _ = [142] + showFailure _ node_411 = + "expected " + GHC.Base.<> ( "field_access" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_411 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_411) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_412 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_413 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_414 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_415 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_412 + c1_413 = TreeSitter.Node.nodeStartPoint node_411 + TreeSitter.Node.TSPoint + r2_414 + c2_415 = TreeSitter.Node.nodeEndPoint node_411 + +deriving instance GHC.Classes.Eq a_416 => GHC.Classes.Eq (FieldAccess a_416) + +deriving instance GHC.Classes.Ord a_417 => GHC.Classes.Ord (FieldAccess a_417) + +deriving instance GHC.Show.Show a_418 => GHC.Show.Show (FieldAccess a_418) + +instance AST.Unmarshal.Unmarshal FieldAccess + +instance Data.Foldable.Foldable FieldAccess where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FieldAccess where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FieldAccess where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FieldDeclaration a = FieldDeclaration + { ann :: a, + declarator :: (GHC.Base.NonEmpty (AST.Parse.Err (VariableDeclarator a))), + type' :: (AST.Parse.Err (UnannotatedType a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Modifiers a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_419. + AST.Traversable1.Class.Traversable1 a_419 + ) + +instance AST.Unmarshal.SymbolMatching FieldDeclaration where + matchedSymbols _ = [212] + showFailure _ node_420 = + "expected " + GHC.Base.<> ( "field_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_420 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_420) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_421 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_422 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_423 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_424 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_421 + c1_422 = TreeSitter.Node.nodeStartPoint node_420 + TreeSitter.Node.TSPoint + r2_423 + c2_424 = TreeSitter.Node.nodeEndPoint node_420 + +deriving instance GHC.Classes.Eq a_425 => GHC.Classes.Eq (FieldDeclaration a_425) + +deriving instance GHC.Classes.Ord a_426 => GHC.Classes.Ord (FieldDeclaration a_426) + +deriving instance GHC.Show.Show a_427 => GHC.Show.Show (FieldDeclaration a_427) + +instance AST.Unmarshal.Unmarshal FieldDeclaration + +instance Data.Foldable.Foldable FieldDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FieldDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FieldDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FinallyClause a = FinallyClause + { ann :: a, + extraChildren :: (AST.Parse.Err (Block a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_428. + AST.Traversable1.Class.Traversable1 a_428 + ) + +instance AST.Unmarshal.SymbolMatching FinallyClause where + matchedSymbols _ = [169] + showFailure _ node_429 = + "expected " + GHC.Base.<> ( "finally_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_429 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_429) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_430 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_431 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_432 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_433 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_430 + c1_431 = TreeSitter.Node.nodeStartPoint node_429 + TreeSitter.Node.TSPoint + r2_432 + c2_433 = TreeSitter.Node.nodeEndPoint node_429 + +deriving instance GHC.Classes.Eq a_434 => GHC.Classes.Eq (FinallyClause a_434) + +deriving instance GHC.Classes.Ord a_435 => GHC.Classes.Ord (FinallyClause a_435) + +deriving instance GHC.Show.Show a_436 => GHC.Show.Show (FinallyClause a_436) + +instance AST.Unmarshal.Unmarshal FinallyClause + +instance Data.Foldable.Foldable FinallyClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FinallyClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FinallyClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FloatingPointType a = FloatingPointType {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_437. + AST.Traversable1.Class.Traversable1 a_437 + ) + +instance AST.Unmarshal.SymbolMatching FloatingPointType where + matchedSymbols _ = [232] + showFailure _ node_438 = + "expected " + GHC.Base.<> ( "floating_point_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_438 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_438) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_439 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_440 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_441 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_442 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_439 + c1_440 = TreeSitter.Node.nodeStartPoint node_438 + TreeSitter.Node.TSPoint + r2_441 + c2_442 = TreeSitter.Node.nodeEndPoint node_438 + +deriving instance GHC.Classes.Eq a_443 => GHC.Classes.Eq (FloatingPointType a_443) + +deriving instance GHC.Classes.Ord a_444 => GHC.Classes.Ord (FloatingPointType a_444) + +deriving instance GHC.Show.Show a_445 => GHC.Show.Show (FloatingPointType a_445) + +instance AST.Unmarshal.Unmarshal FloatingPointType + +instance Data.Foldable.Foldable FloatingPointType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FloatingPointType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FloatingPointType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForInit a = ForInit + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: LocalVariableDeclaration) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_446. + AST.Traversable1.Class.Traversable1 a_446 + ) + +instance AST.Unmarshal.SymbolMatching ForInit where + matchedSymbols _ = [176] + showFailure _ node_447 = + "expected " + GHC.Base.<> ( "for_init" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_447 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_447) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_448 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_449 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_450 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_451 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_448 + c1_449 = TreeSitter.Node.nodeStartPoint node_447 + TreeSitter.Node.TSPoint + r2_450 + c2_451 = TreeSitter.Node.nodeEndPoint node_447 + +deriving instance GHC.Classes.Eq a_452 => GHC.Classes.Eq (ForInit a_452) + +deriving instance GHC.Classes.Ord a_453 => GHC.Classes.Ord (ForInit a_453) + +deriving instance GHC.Show.Show a_454 => GHC.Show.Show (ForInit a_454) + +instance AST.Unmarshal.Unmarshal ForInit + +instance Data.Foldable.Foldable ForInit where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForInit where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForInit where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForStatement a = ForStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: Statement GHC.Generics.:+: ForInit) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_455. + AST.Traversable1.Class.Traversable1 a_455 + ) + +instance AST.Unmarshal.SymbolMatching ForStatement where + matchedSymbols _ = [175] + showFailure _ node_456 = + "expected " + GHC.Base.<> ( "for_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_456 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_456) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_457 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_458 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_459 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_460 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_457 + c1_458 = TreeSitter.Node.nodeStartPoint node_456 + TreeSitter.Node.TSPoint + r2_459 + c2_460 = TreeSitter.Node.nodeEndPoint node_456 + +deriving instance GHC.Classes.Eq a_461 => GHC.Classes.Eq (ForStatement a_461) + +deriving instance GHC.Classes.Ord a_462 => GHC.Classes.Ord (ForStatement a_462) + +deriving instance GHC.Show.Show a_463 => GHC.Show.Show (ForStatement a_463) + +instance AST.Unmarshal.Unmarshal ForStatement + +instance Data.Foldable.Foldable ForStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FormalParameter a = FormalParameter + { ann :: a, + name :: (AST.Parse.Err (Identifier a)), + type' :: (AST.Parse.Err (UnannotatedType a)), + dimensions :: (GHC.Maybe.Maybe (AST.Parse.Err (Dimensions a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Modifiers a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_464. + AST.Traversable1.Class.Traversable1 a_464 + ) + +instance AST.Unmarshal.SymbolMatching FormalParameter where + matchedSymbols _ = [236] + showFailure _ node_465 = + "expected " + GHC.Base.<> ( "formal_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_465 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_465) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_466 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_467 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_468 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_469 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_466 + c1_467 = TreeSitter.Node.nodeStartPoint node_465 + TreeSitter.Node.TSPoint + r2_468 + c2_469 = TreeSitter.Node.nodeEndPoint node_465 + +deriving instance GHC.Classes.Eq a_470 => GHC.Classes.Eq (FormalParameter a_470) + +deriving instance GHC.Classes.Ord a_471 => GHC.Classes.Ord (FormalParameter a_471) + +deriving instance GHC.Show.Show a_472 => GHC.Show.Show (FormalParameter a_472) + +instance AST.Unmarshal.Unmarshal FormalParameter + +instance Data.Foldable.Foldable FormalParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FormalParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FormalParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FormalParameters a = FormalParameters + { ann :: a, + extraChildren :: ([AST.Parse.Err ((FormalParameter GHC.Generics.:+: ReceiverParameter GHC.Generics.:+: SpreadParameter) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_473. + AST.Traversable1.Class.Traversable1 a_473 + ) + +instance AST.Unmarshal.SymbolMatching FormalParameters where + matchedSymbols _ = [235] + showFailure _ node_474 = + "expected " + GHC.Base.<> ( "formal_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_474 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_474) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_475 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_476 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_477 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_478 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_475 + c1_476 = TreeSitter.Node.nodeStartPoint node_474 + TreeSitter.Node.TSPoint + r2_477 + c2_478 = TreeSitter.Node.nodeEndPoint node_474 + +deriving instance GHC.Classes.Eq a_479 => GHC.Classes.Eq (FormalParameters a_479) + +deriving instance GHC.Classes.Ord a_480 => GHC.Classes.Ord (FormalParameters a_480) + +deriving instance GHC.Show.Show a_481 => GHC.Show.Show (FormalParameters a_481) + +instance AST.Unmarshal.Unmarshal FormalParameters + +instance Data.Foldable.Foldable FormalParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FormalParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FormalParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GenericType a = GenericType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ScopedTypeIdentifier GHC.Generics.:+: TypeArguments GHC.Generics.:+: TypeIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_482. + AST.Traversable1.Class.Traversable1 a_482 + ) + +instance AST.Unmarshal.SymbolMatching GenericType where + matchedSymbols _ = [229] + showFailure _ node_483 = + "expected " + GHC.Base.<> ( "generic_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_483 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_483) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_484 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_485 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_486 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_487 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_484 + c1_485 = TreeSitter.Node.nodeStartPoint node_483 + TreeSitter.Node.TSPoint + r2_486 + c2_487 = TreeSitter.Node.nodeEndPoint node_483 + +deriving instance GHC.Classes.Eq a_488 => GHC.Classes.Eq (GenericType a_488) + +deriving instance GHC.Classes.Ord a_489 => GHC.Classes.Ord (GenericType a_489) + +deriving instance GHC.Show.Show a_490 => GHC.Show.Show (GenericType a_490) + +instance AST.Unmarshal.Unmarshal GenericType + +instance Data.Foldable.Foldable GenericType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GenericType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GenericType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IfStatement a = IfStatement + { ann :: a, + alternative :: (GHC.Maybe.Maybe (AST.Parse.Err (Statement a))), + consequence :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_491. + AST.Traversable1.Class.Traversable1 a_491 + ) + +instance AST.Unmarshal.SymbolMatching IfStatement where + matchedSymbols _ = [173] + showFailure _ node_492 = + "expected " + GHC.Base.<> ( "if_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_492 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_492) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_493 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_494 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_495 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_496 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_493 + c1_494 = TreeSitter.Node.nodeStartPoint node_492 + TreeSitter.Node.TSPoint + r2_495 + c2_496 = TreeSitter.Node.nodeEndPoint node_492 + +deriving instance GHC.Classes.Eq a_497 => GHC.Classes.Eq (IfStatement a_497) + +deriving instance GHC.Classes.Ord a_498 => GHC.Classes.Ord (IfStatement a_498) + +deriving instance GHC.Show.Show a_499 => GHC.Show.Show (IfStatement a_499) + +instance AST.Unmarshal.Unmarshal IfStatement + +instance Data.Foldable.Foldable IfStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IfStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IfStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportDeclaration a = ImportDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Asterisk GHC.Generics.:+: Identifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_500. + AST.Traversable1.Class.Traversable1 a_500 + ) + +instance AST.Unmarshal.SymbolMatching ImportDeclaration where + matchedSymbols _ = [191] + showFailure _ node_501 = + "expected " + GHC.Base.<> ( "import_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_501 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_501) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_502 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_503 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_504 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_505 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_502 + c1_503 = TreeSitter.Node.nodeStartPoint node_501 + TreeSitter.Node.TSPoint + r2_504 + c2_505 = TreeSitter.Node.nodeEndPoint node_501 + +deriving instance GHC.Classes.Eq a_506 => GHC.Classes.Eq (ImportDeclaration a_506) + +deriving instance GHC.Classes.Ord a_507 => GHC.Classes.Ord (ImportDeclaration a_507) + +deriving instance GHC.Show.Show a_508 => GHC.Show.Show (ImportDeclaration a_508) + +instance AST.Unmarshal.Unmarshal ImportDeclaration + +instance Data.Foldable.Foldable ImportDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InferredParameters a = InferredParameters + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_509. + AST.Traversable1.Class.Traversable1 a_509 + ) + +instance AST.Unmarshal.SymbolMatching InferredParameters where + matchedSymbols _ = [131] + showFailure _ node_510 = + "expected " + GHC.Base.<> ( "inferred_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_510 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_510) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_511 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_512 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_513 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_514 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_511 + c1_512 = TreeSitter.Node.nodeStartPoint node_510 + TreeSitter.Node.TSPoint + r2_513 + c2_514 = TreeSitter.Node.nodeEndPoint node_510 + +deriving instance GHC.Classes.Eq a_515 => GHC.Classes.Eq (InferredParameters a_515) + +deriving instance GHC.Classes.Ord a_516 => GHC.Classes.Ord (InferredParameters a_516) + +deriving instance GHC.Show.Show a_517 => GHC.Show.Show (InferredParameters a_517) + +instance AST.Unmarshal.Unmarshal InferredParameters + +instance Data.Foldable.Foldable InferredParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InferredParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InferredParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InstanceofExpression a = InstanceofExpression + { ann :: a, + left :: (AST.Parse.Err (Expression a)), + right :: (AST.Parse.Err (Type a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_518. + AST.Traversable1.Class.Traversable1 a_518 + ) + +instance AST.Unmarshal.SymbolMatching InstanceofExpression where + matchedSymbols _ = [129] + showFailure _ node_519 = + "expected " + GHC.Base.<> ( "instanceof_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_519 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_519) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_520 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_521 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_522 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_523 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_520 + c1_521 = TreeSitter.Node.nodeStartPoint node_519 + TreeSitter.Node.TSPoint + r2_522 + c2_523 = TreeSitter.Node.nodeEndPoint node_519 + +deriving instance GHC.Classes.Eq a_524 => GHC.Classes.Eq (InstanceofExpression a_524) + +deriving instance GHC.Classes.Ord a_525 => GHC.Classes.Ord (InstanceofExpression a_525) + +deriving instance GHC.Show.Show a_526 => GHC.Show.Show (InstanceofExpression a_526) + +instance AST.Unmarshal.Unmarshal InstanceofExpression + +instance Data.Foldable.Foldable InstanceofExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InstanceofExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InstanceofExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IntegralType a = IntegralType {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_527. + AST.Traversable1.Class.Traversable1 a_527 + ) + +instance AST.Unmarshal.SymbolMatching IntegralType where + matchedSymbols _ = [231] + showFailure _ node_528 = + "expected " + GHC.Base.<> ( "integral_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_528 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_528) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_529 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_530 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_531 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_532 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_529 + c1_530 = TreeSitter.Node.nodeStartPoint node_528 + TreeSitter.Node.TSPoint + r2_531 + c2_532 = TreeSitter.Node.nodeEndPoint node_528 + +deriving instance GHC.Classes.Eq a_533 => GHC.Classes.Eq (IntegralType a_533) + +deriving instance GHC.Classes.Ord a_534 => GHC.Classes.Ord (IntegralType a_534) + +deriving instance GHC.Show.Show a_535 => GHC.Show.Show (IntegralType a_535) + +instance AST.Unmarshal.Unmarshal IntegralType + +instance Data.Foldable.Foldable IntegralType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IntegralType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IntegralType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InterfaceBody a = InterfaceBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AnnotationTypeDeclaration GHC.Generics.:+: ClassDeclaration GHC.Generics.:+: ConstantDeclaration GHC.Generics.:+: EnumDeclaration GHC.Generics.:+: InterfaceDeclaration GHC.Generics.:+: MethodDeclaration) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_536. + AST.Traversable1.Class.Traversable1 a_536 + ) + +instance AST.Unmarshal.SymbolMatching InterfaceBody where + matchedSymbols _ = [219] + showFailure _ node_537 = + "expected " + GHC.Base.<> ( "interface_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_537 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_537) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_538 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_539 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_540 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_541 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_538 + c1_539 = TreeSitter.Node.nodeStartPoint node_537 + TreeSitter.Node.TSPoint + r2_540 + c2_541 = TreeSitter.Node.nodeEndPoint node_537 + +deriving instance GHC.Classes.Eq a_542 => GHC.Classes.Eq (InterfaceBody a_542) + +deriving instance GHC.Classes.Ord a_543 => GHC.Classes.Ord (InterfaceBody a_543) + +deriving instance GHC.Show.Show a_544 => GHC.Show.Show (InterfaceBody a_544) + +instance AST.Unmarshal.Unmarshal InterfaceBody + +instance Data.Foldable.Foldable InterfaceBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InterfaceBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InterfaceBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InterfaceDeclaration a = InterfaceDeclaration + { ann :: a, + body :: (AST.Parse.Err (InterfaceBody a)), + name :: (AST.Parse.Err (Identifier a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: ([AST.Parse.Err ((ExtendsInterfaces GHC.Generics.:+: Modifiers) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_545. + AST.Traversable1.Class.Traversable1 a_545 + ) + +instance AST.Unmarshal.SymbolMatching InterfaceDeclaration where + matchedSymbols _ = [217] + showFailure _ node_546 = + "expected " + GHC.Base.<> ( "interface_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_546 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_546) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_547 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_548 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_549 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_550 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_547 + c1_548 = TreeSitter.Node.nodeStartPoint node_546 + TreeSitter.Node.TSPoint + r2_549 + c2_550 = TreeSitter.Node.nodeEndPoint node_546 + +deriving instance GHC.Classes.Eq a_551 => GHC.Classes.Eq (InterfaceDeclaration a_551) + +deriving instance GHC.Classes.Ord a_552 => GHC.Classes.Ord (InterfaceDeclaration a_552) + +deriving instance GHC.Show.Show a_553 => GHC.Show.Show (InterfaceDeclaration a_553) + +instance AST.Unmarshal.Unmarshal InterfaceDeclaration + +instance Data.Foldable.Foldable InterfaceDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InterfaceDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InterfaceDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InterfaceTypeList a = InterfaceTypeList + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Type a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_554. + AST.Traversable1.Class.Traversable1 a_554 + ) + +instance AST.Unmarshal.SymbolMatching InterfaceTypeList where + matchedSymbols _ = [204] + showFailure _ node_555 = + "expected " + GHC.Base.<> ( "interface_type_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_555 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_555) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_556 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_557 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_558 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_559 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_556 + c1_557 = TreeSitter.Node.nodeStartPoint node_555 + TreeSitter.Node.TSPoint + r2_558 + c2_559 = TreeSitter.Node.nodeEndPoint node_555 + +deriving instance GHC.Classes.Eq a_560 => GHC.Classes.Eq (InterfaceTypeList a_560) + +deriving instance GHC.Classes.Ord a_561 => GHC.Classes.Ord (InterfaceTypeList a_561) + +deriving instance GHC.Show.Show a_562 => GHC.Show.Show (InterfaceTypeList a_562) + +instance AST.Unmarshal.Unmarshal InterfaceTypeList + +instance Data.Foldable.Foldable InterfaceTypeList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InterfaceTypeList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InterfaceTypeList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LabeledStatement a = LabeledStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Statement GHC.Generics.:+: Identifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_563. + AST.Traversable1.Class.Traversable1 a_563 + ) + +instance AST.Unmarshal.SymbolMatching LabeledStatement where + matchedSymbols _ = [154] + showFailure _ node_564 = + "expected " + GHC.Base.<> ( "labeled_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_564 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_564) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_565 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_566 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_567 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_568 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_565 + c1_566 = TreeSitter.Node.nodeStartPoint node_564 + TreeSitter.Node.TSPoint + r2_567 + c2_568 = TreeSitter.Node.nodeEndPoint node_564 + +deriving instance GHC.Classes.Eq a_569 => GHC.Classes.Eq (LabeledStatement a_569) + +deriving instance GHC.Classes.Ord a_570 => GHC.Classes.Ord (LabeledStatement a_570) + +deriving instance GHC.Show.Show a_571 => GHC.Show.Show (LabeledStatement a_571) + +instance AST.Unmarshal.Unmarshal LabeledStatement + +instance Data.Foldable.Foldable LabeledStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LabeledStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LabeledStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LambdaExpression a = LambdaExpression + { ann :: a, + body :: (AST.Parse.Err ((Expression GHC.Generics.:+: Block) a)), + parameters :: (AST.Parse.Err ((FormalParameters GHC.Generics.:+: Identifier GHC.Generics.:+: InferredParameters) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_572. + AST.Traversable1.Class.Traversable1 a_572 + ) + +instance AST.Unmarshal.SymbolMatching LambdaExpression where + matchedSymbols _ = [130] + showFailure _ node_573 = + "expected " + GHC.Base.<> ( "lambda_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_573 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_573) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_574 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_575 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_576 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_577 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_574 + c1_575 = TreeSitter.Node.nodeStartPoint node_573 + TreeSitter.Node.TSPoint + r2_576 + c2_577 = TreeSitter.Node.nodeEndPoint node_573 + +deriving instance GHC.Classes.Eq a_578 => GHC.Classes.Eq (LambdaExpression a_578) + +deriving instance GHC.Classes.Ord a_579 => GHC.Classes.Ord (LambdaExpression a_579) + +deriving instance GHC.Show.Show a_580 => GHC.Show.Show (LambdaExpression a_580) + +instance AST.Unmarshal.Unmarshal LambdaExpression + +instance Data.Foldable.Foldable LambdaExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LambdaExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LambdaExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LocalVariableDeclaration a = LocalVariableDeclaration + { ann :: a, + declarator :: (GHC.Base.NonEmpty (AST.Parse.Err (VariableDeclarator a))), + type' :: (AST.Parse.Err (UnannotatedType a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Modifiers a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_581. + AST.Traversable1.Class.Traversable1 a_581 + ) + +instance AST.Unmarshal.SymbolMatching LocalVariableDeclaration where + matchedSymbols _ = [241] + showFailure _ node_582 = + "expected " + GHC.Base.<> ( "local_variable_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_582 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_582) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_583 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_584 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_585 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_586 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_583 + c1_584 = TreeSitter.Node.nodeStartPoint node_582 + TreeSitter.Node.TSPoint + r2_585 + c2_586 = TreeSitter.Node.nodeEndPoint node_582 + +deriving instance GHC.Classes.Eq a_587 => GHC.Classes.Eq (LocalVariableDeclaration a_587) + +deriving instance GHC.Classes.Ord a_588 => GHC.Classes.Ord (LocalVariableDeclaration a_588) + +deriving instance GHC.Show.Show a_589 => GHC.Show.Show (LocalVariableDeclaration a_589) + +instance AST.Unmarshal.Unmarshal LocalVariableDeclaration + +instance Data.Foldable.Foldable LocalVariableDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LocalVariableDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LocalVariableDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LocalVariableDeclarationStatement a = LocalVariableDeclarationStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (LocalVariableDeclaration a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_590. + AST.Traversable1.Class.Traversable1 a_590 + ) + +instance AST.Unmarshal.SymbolMatching LocalVariableDeclarationStatement where + matchedSymbols _ = [240] + showFailure _ node_591 = + "expected " + GHC.Base.<> ( "local_variable_declaration_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_591 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_591) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_592 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_593 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_594 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_595 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_592 + c1_593 = TreeSitter.Node.nodeStartPoint node_591 + TreeSitter.Node.TSPoint + r2_594 + c2_595 = TreeSitter.Node.nodeEndPoint node_591 + +deriving instance GHC.Classes.Eq a_596 => GHC.Classes.Eq (LocalVariableDeclarationStatement a_596) + +deriving instance GHC.Classes.Ord a_597 => GHC.Classes.Ord (LocalVariableDeclarationStatement a_597) + +deriving instance GHC.Show.Show a_598 => GHC.Show.Show (LocalVariableDeclarationStatement a_598) + +instance AST.Unmarshal.Unmarshal LocalVariableDeclarationStatement + +instance Data.Foldable.Foldable LocalVariableDeclarationStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LocalVariableDeclarationStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LocalVariableDeclarationStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MarkerAnnotation a = MarkerAnnotation + { ann :: a, + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: ScopedIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_599. + AST.Traversable1.Class.Traversable1 a_599 + ) + +instance AST.Unmarshal.SymbolMatching MarkerAnnotation where + matchedSymbols _ = [179] + showFailure _ node_600 = + "expected " + GHC.Base.<> ( "marker_annotation" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_600 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_600) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_601 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_602 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_603 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_604 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_601 + c1_602 = TreeSitter.Node.nodeStartPoint node_600 + TreeSitter.Node.TSPoint + r2_603 + c2_604 = TreeSitter.Node.nodeEndPoint node_600 + +deriving instance GHC.Classes.Eq a_605 => GHC.Classes.Eq (MarkerAnnotation a_605) + +deriving instance GHC.Classes.Ord a_606 => GHC.Classes.Ord (MarkerAnnotation a_606) + +deriving instance GHC.Show.Show a_607 => GHC.Show.Show (MarkerAnnotation a_607) + +instance AST.Unmarshal.Unmarshal MarkerAnnotation + +instance Data.Foldable.Foldable MarkerAnnotation where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MarkerAnnotation where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MarkerAnnotation where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodDeclaration a = MethodDeclaration + { ann :: a, + body :: (GHC.Maybe.Maybe (AST.Parse.Err (Block a))), + name :: (AST.Parse.Err (Identifier a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + type' :: (AST.Parse.Err (UnannotatedType a)), + dimensions :: (GHC.Maybe.Maybe (AST.Parse.Err (Dimensions a))), + extraChildren :: ([AST.Parse.Err ((Annotation GHC.Generics.:+: MarkerAnnotation GHC.Generics.:+: Modifiers GHC.Generics.:+: Throws) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_608. + AST.Traversable1.Class.Traversable1 a_608 + ) + +instance AST.Unmarshal.SymbolMatching MethodDeclaration where + matchedSymbols _ = [242] + showFailure _ node_609 = + "expected " + GHC.Base.<> ( "method_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_609 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_609) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_610 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_611 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_612 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_613 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_610 + c1_611 = TreeSitter.Node.nodeStartPoint node_609 + TreeSitter.Node.TSPoint + r2_612 + c2_613 = TreeSitter.Node.nodeEndPoint node_609 + +deriving instance GHC.Classes.Eq a_614 => GHC.Classes.Eq (MethodDeclaration a_614) + +deriving instance GHC.Classes.Ord a_615 => GHC.Classes.Ord (MethodDeclaration a_615) + +deriving instance GHC.Show.Show a_616 => GHC.Show.Show (MethodDeclaration a_616) + +instance AST.Unmarshal.Unmarshal MethodDeclaration + +instance Data.Foldable.Foldable MethodDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodInvocation a = MethodInvocation + { ann :: a, + arguments :: (AST.Parse.Err (ArgumentList a)), + name :: (AST.Parse.Err (Identifier a)), + typeArguments :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeArguments a))), + object :: (GHC.Maybe.Maybe (AST.Parse.Err ((Primary GHC.Generics.:+: Identifier GHC.Generics.:+: ScopedIdentifier GHC.Generics.:+: Super) a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Super a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_617. + AST.Traversable1.Class.Traversable1 a_617 + ) + +instance AST.Unmarshal.SymbolMatching MethodInvocation where + matchedSymbols _ = [144] + showFailure _ node_618 = + "expected " + GHC.Base.<> ( "method_invocation" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_618 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_618) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_619 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_620 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_621 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_622 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_619 + c1_620 = TreeSitter.Node.nodeStartPoint node_618 + TreeSitter.Node.TSPoint + r2_621 + c2_622 = TreeSitter.Node.nodeEndPoint node_618 + +deriving instance GHC.Classes.Eq a_623 => GHC.Classes.Eq (MethodInvocation a_623) + +deriving instance GHC.Classes.Ord a_624 => GHC.Classes.Ord (MethodInvocation a_624) + +deriving instance GHC.Show.Show a_625 => GHC.Show.Show (MethodInvocation a_625) + +instance AST.Unmarshal.Unmarshal MethodInvocation + +instance Data.Foldable.Foldable MethodInvocation where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodInvocation where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodInvocation where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodReference a = MethodReference + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Primary GHC.Generics.:+: Type GHC.Generics.:+: Identifier GHC.Generics.:+: ScopedIdentifier GHC.Generics.:+: Super GHC.Generics.:+: TypeArguments) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_626. + AST.Traversable1.Class.Traversable1 a_626 + ) + +instance AST.Unmarshal.SymbolMatching MethodReference where + matchedSymbols _ = [146] + showFailure _ node_627 = + "expected " + GHC.Base.<> ( "method_reference" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_627 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_627) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_628 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_629 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_630 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_631 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_628 + c1_629 = TreeSitter.Node.nodeStartPoint node_627 + TreeSitter.Node.TSPoint + r2_630 + c2_631 = TreeSitter.Node.nodeEndPoint node_627 + +deriving instance GHC.Classes.Eq a_632 => GHC.Classes.Eq (MethodReference a_632) + +deriving instance GHC.Classes.Ord a_633 => GHC.Classes.Ord (MethodReference a_633) + +deriving instance GHC.Show.Show a_634 => GHC.Show.Show (MethodReference a_634) + +instance AST.Unmarshal.Unmarshal MethodReference + +instance Data.Foldable.Foldable MethodReference where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodReference where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodReference where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Modifiers a = Modifiers + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Annotation GHC.Generics.:+: MarkerAnnotation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_635. + AST.Traversable1.Class.Traversable1 a_635 + ) + +instance AST.Unmarshal.SymbolMatching Modifiers where + matchedSymbols _ = [198] + showFailure _ node_636 = + "expected " + GHC.Base.<> ( "modifiers" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_636 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_636) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_637 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_638 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_639 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_640 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_637 + c1_638 = TreeSitter.Node.nodeStartPoint node_636 + TreeSitter.Node.TSPoint + r2_639 + c2_640 = TreeSitter.Node.nodeEndPoint node_636 + +deriving instance GHC.Classes.Eq a_641 => GHC.Classes.Eq (Modifiers a_641) + +deriving instance GHC.Classes.Ord a_642 => GHC.Classes.Ord (Modifiers a_642) + +deriving instance GHC.Show.Show a_643 => GHC.Show.Show (Modifiers a_643) + +instance AST.Unmarshal.Unmarshal Modifiers + +instance Data.Foldable.Foldable Modifiers where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Modifiers where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Modifiers where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ModuleDeclaration a = ModuleDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Annotation GHC.Generics.:+: Identifier GHC.Generics.:+: MarkerAnnotation GHC.Generics.:+: ModuleDirective GHC.Generics.:+: ScopedIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_644. + AST.Traversable1.Class.Traversable1 a_644 + ) + +instance AST.Unmarshal.SymbolMatching ModuleDeclaration where + matchedSymbols _ = [186] + showFailure _ node_645 = + "expected " + GHC.Base.<> ( "module_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_645 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_645) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_646 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_647 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_648 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_649 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_646 + c1_647 = TreeSitter.Node.nodeStartPoint node_645 + TreeSitter.Node.TSPoint + r2_648 + c2_649 = TreeSitter.Node.nodeEndPoint node_645 + +deriving instance GHC.Classes.Eq a_650 => GHC.Classes.Eq (ModuleDeclaration a_650) + +deriving instance GHC.Classes.Ord a_651 => GHC.Classes.Ord (ModuleDeclaration a_651) + +deriving instance GHC.Show.Show a_652 => GHC.Show.Show (ModuleDeclaration a_652) + +instance AST.Unmarshal.Unmarshal ModuleDeclaration + +instance Data.Foldable.Foldable ModuleDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ModuleDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ModuleDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ModuleDirective a = ModuleDirective + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: ModuleName GHC.Generics.:+: RequiresModifier GHC.Generics.:+: ScopedIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_653. + AST.Traversable1.Class.Traversable1 a_653 + ) + +instance AST.Unmarshal.SymbolMatching ModuleDirective where + matchedSymbols _ = [187] + showFailure _ node_654 = + "expected " + GHC.Base.<> ( "module_directive" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_654 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_654) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_655 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_656 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_657 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_658 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_655 + c1_656 = TreeSitter.Node.nodeStartPoint node_654 + TreeSitter.Node.TSPoint + r2_657 + c2_658 = TreeSitter.Node.nodeEndPoint node_654 + +deriving instance GHC.Classes.Eq a_659 => GHC.Classes.Eq (ModuleDirective a_659) + +deriving instance GHC.Classes.Ord a_660 => GHC.Classes.Ord (ModuleDirective a_660) + +deriving instance GHC.Show.Show a_661 => GHC.Show.Show (ModuleDirective a_661) + +instance AST.Unmarshal.Unmarshal ModuleDirective + +instance Data.Foldable.Foldable ModuleDirective where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ModuleDirective where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ModuleDirective where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ModuleName a = ModuleName + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: ModuleName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_662. + AST.Traversable1.Class.Traversable1 a_662 + ) + +instance AST.Unmarshal.SymbolMatching ModuleName where + matchedSymbols _ = [189] + showFailure _ node_663 = + "expected " + GHC.Base.<> ( "module_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_663 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_663) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_664 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_665 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_666 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_667 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_664 + c1_665 = TreeSitter.Node.nodeStartPoint node_663 + TreeSitter.Node.TSPoint + r2_666 + c2_667 = TreeSitter.Node.nodeEndPoint node_663 + +deriving instance GHC.Classes.Eq a_668 => GHC.Classes.Eq (ModuleName a_668) + +deriving instance GHC.Classes.Ord a_669 => GHC.Classes.Ord (ModuleName a_669) + +deriving instance GHC.Show.Show a_670 => GHC.Show.Show (ModuleName a_670) + +instance AST.Unmarshal.Unmarshal ModuleName + +instance Data.Foldable.Foldable ModuleName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ModuleName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ModuleName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ObjectCreationExpression a = ObjectCreationExpression + { ann :: a, + arguments :: (AST.Parse.Err (ArgumentList a)), + typeArguments :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeArguments a))), + type' :: (AST.Parse.Err (SimpleType a)), + extraChildren :: ([AST.Parse.Err ((Primary GHC.Generics.:+: ClassBody GHC.Generics.:+: Identifier GHC.Generics.:+: ScopedIdentifier) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_671. + AST.Traversable1.Class.Traversable1 a_671 + ) + +instance AST.Unmarshal.SymbolMatching ObjectCreationExpression where + matchedSymbols _ = [140] + showFailure _ node_672 = + "expected " + GHC.Base.<> ( "object_creation_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_672 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_672) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_673 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_674 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_675 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_676 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_673 + c1_674 = TreeSitter.Node.nodeStartPoint node_672 + TreeSitter.Node.TSPoint + r2_675 + c2_676 = TreeSitter.Node.nodeEndPoint node_672 + +deriving instance GHC.Classes.Eq a_677 => GHC.Classes.Eq (ObjectCreationExpression a_677) + +deriving instance GHC.Classes.Ord a_678 => GHC.Classes.Ord (ObjectCreationExpression a_678) + +deriving instance GHC.Show.Show a_679 => GHC.Show.Show (ObjectCreationExpression a_679) + +instance AST.Unmarshal.Unmarshal ObjectCreationExpression + +instance Data.Foldable.Foldable ObjectCreationExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ObjectCreationExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ObjectCreationExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PackageDeclaration a = PackageDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Annotation GHC.Generics.:+: Identifier GHC.Generics.:+: MarkerAnnotation GHC.Generics.:+: ScopedIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_680. + AST.Traversable1.Class.Traversable1 a_680 + ) + +instance AST.Unmarshal.SymbolMatching PackageDeclaration where + matchedSymbols _ = [190] + showFailure _ node_681 = + "expected " + GHC.Base.<> ( "package_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_681 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_681) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_682 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_683 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_684 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_685 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_682 + c1_683 = TreeSitter.Node.nodeStartPoint node_681 + TreeSitter.Node.TSPoint + r2_684 + c2_685 = TreeSitter.Node.nodeEndPoint node_681 + +deriving instance GHC.Classes.Eq a_686 => GHC.Classes.Eq (PackageDeclaration a_686) + +deriving instance GHC.Classes.Ord a_687 => GHC.Classes.Ord (PackageDeclaration a_687) + +deriving instance GHC.Show.Show a_688 => GHC.Show.Show (PackageDeclaration a_688) + +instance AST.Unmarshal.Unmarshal PackageDeclaration + +instance Data.Foldable.Foldable PackageDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PackageDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PackageDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParenthesizedExpression a = ParenthesizedExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_689. + AST.Traversable1.Class.Traversable1 a_689 + ) + +instance AST.Unmarshal.SymbolMatching ParenthesizedExpression where + matchedSymbols _ = [138] + showFailure _ node_690 = + "expected " + GHC.Base.<> ( "parenthesized_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_690 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_690) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_691 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_692 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_693 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_694 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_691 + c1_692 = TreeSitter.Node.nodeStartPoint node_690 + TreeSitter.Node.TSPoint + r2_693 + c2_694 = TreeSitter.Node.nodeEndPoint node_690 + +deriving instance GHC.Classes.Eq a_695 => GHC.Classes.Eq (ParenthesizedExpression a_695) + +deriving instance GHC.Classes.Ord a_696 => GHC.Classes.Ord (ParenthesizedExpression a_696) + +deriving instance GHC.Show.Show a_697 => GHC.Show.Show (ParenthesizedExpression a_697) + +instance AST.Unmarshal.Unmarshal ParenthesizedExpression + +instance Data.Foldable.Foldable ParenthesizedExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParenthesizedExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParenthesizedExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Program a = Program + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_698. + AST.Traversable1.Class.Traversable1 a_698 + ) + +instance AST.Unmarshal.SymbolMatching Program where + matchedSymbols _ = [123] + showFailure _ node_699 = + "expected " + GHC.Base.<> ( "program" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_699 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_699) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_700 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_701 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_702 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_703 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_700 + c1_701 = TreeSitter.Node.nodeStartPoint node_699 + TreeSitter.Node.TSPoint + r2_702 + c2_703 = TreeSitter.Node.nodeEndPoint node_699 + +deriving instance GHC.Classes.Eq a_704 => GHC.Classes.Eq (Program a_704) + +deriving instance GHC.Classes.Ord a_705 => GHC.Classes.Ord (Program a_705) + +deriving instance GHC.Show.Show a_706 => GHC.Show.Show (Program a_706) + +instance AST.Unmarshal.Unmarshal Program + +instance Data.Foldable.Foldable Program where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Program where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Program where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ReceiverParameter a = ReceiverParameter + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((UnannotatedType GHC.Generics.:+: Annotation GHC.Generics.:+: Identifier GHC.Generics.:+: MarkerAnnotation GHC.Generics.:+: This) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_707. + AST.Traversable1.Class.Traversable1 a_707 + ) + +instance AST.Unmarshal.SymbolMatching ReceiverParameter where + matchedSymbols _ = [237] + showFailure _ node_708 = + "expected " + GHC.Base.<> ( "receiver_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_708 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_708) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_709 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_710 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_711 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_712 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_709 + c1_710 = TreeSitter.Node.nodeStartPoint node_708 + TreeSitter.Node.TSPoint + r2_711 + c2_712 = TreeSitter.Node.nodeEndPoint node_708 + +deriving instance GHC.Classes.Eq a_713 => GHC.Classes.Eq (ReceiverParameter a_713) + +deriving instance GHC.Classes.Ord a_714 => GHC.Classes.Ord (ReceiverParameter a_714) + +deriving instance GHC.Show.Show a_715 => GHC.Show.Show (ReceiverParameter a_715) + +instance AST.Unmarshal.Unmarshal ReceiverParameter + +instance Data.Foldable.Foldable ReceiverParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ReceiverParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ReceiverParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RequiresModifier a = RequiresModifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_716. + AST.Traversable1.Class.Traversable1 a_716 + ) + +instance AST.Unmarshal.SymbolMatching RequiresModifier where + matchedSymbols _ = [188] + showFailure _ node_717 = + "expected " + GHC.Base.<> ( "requires_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_717 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_717) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_718 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_719 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_720 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_721 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_718 + c1_719 = TreeSitter.Node.nodeStartPoint node_717 + TreeSitter.Node.TSPoint + r2_720 + c2_721 = TreeSitter.Node.nodeEndPoint node_717 + +deriving instance GHC.Classes.Eq a_722 => GHC.Classes.Eq (RequiresModifier a_722) + +deriving instance GHC.Classes.Ord a_723 => GHC.Classes.Ord (RequiresModifier a_723) + +deriving instance GHC.Show.Show a_724 => GHC.Show.Show (RequiresModifier a_724) + +instance AST.Unmarshal.Unmarshal RequiresModifier + +instance Data.Foldable.Foldable RequiresModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RequiresModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RequiresModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Resource a = Resource + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + name :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (UnannotatedType a))), + dimensions :: (GHC.Maybe.Maybe (AST.Parse.Err (Dimensions a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((FieldAccess GHC.Generics.:+: Identifier GHC.Generics.:+: Modifiers GHC.Generics.:+: ScopedIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_725. + AST.Traversable1.Class.Traversable1 a_725 + ) + +instance AST.Unmarshal.SymbolMatching Resource where + matchedSymbols _ = [172] + showFailure _ node_726 = + "expected " + GHC.Base.<> ( "resource" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_726 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_726) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_727 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_728 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_729 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_730 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_727 + c1_728 = TreeSitter.Node.nodeStartPoint node_726 + TreeSitter.Node.TSPoint + r2_729 + c2_730 = TreeSitter.Node.nodeEndPoint node_726 + +deriving instance GHC.Classes.Eq a_731 => GHC.Classes.Eq (Resource a_731) + +deriving instance GHC.Classes.Ord a_732 => GHC.Classes.Ord (Resource a_732) + +deriving instance GHC.Show.Show a_733 => GHC.Show.Show (Resource a_733) + +instance AST.Unmarshal.Unmarshal Resource + +instance Data.Foldable.Foldable Resource where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Resource where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Resource where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ResourceSpecification a = ResourceSpecification + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Resource a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_734. + AST.Traversable1.Class.Traversable1 a_734 + ) + +instance AST.Unmarshal.SymbolMatching ResourceSpecification where + matchedSymbols _ = [171] + showFailure _ node_735 = + "expected " + GHC.Base.<> ( "resource_specification" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_735 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_735) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_736 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_737 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_738 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_739 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_736 + c1_737 = TreeSitter.Node.nodeStartPoint node_735 + TreeSitter.Node.TSPoint + r2_738 + c2_739 = TreeSitter.Node.nodeEndPoint node_735 + +deriving instance GHC.Classes.Eq a_740 => GHC.Classes.Eq (ResourceSpecification a_740) + +deriving instance GHC.Classes.Ord a_741 => GHC.Classes.Ord (ResourceSpecification a_741) + +deriving instance GHC.Show.Show a_742 => GHC.Show.Show (ResourceSpecification a_742) + +instance AST.Unmarshal.Unmarshal ResourceSpecification + +instance Data.Foldable.Foldable ResourceSpecification where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ResourceSpecification where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ResourceSpecification where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ReturnStatement a = ReturnStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_743. + AST.Traversable1.Class.Traversable1 a_743 + ) + +instance AST.Unmarshal.SymbolMatching ReturnStatement where + matchedSymbols _ = [162] + showFailure _ node_744 = + "expected " + GHC.Base.<> ( "return_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_744 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_744) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_745 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_746 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_747 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_748 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_745 + c1_746 = TreeSitter.Node.nodeStartPoint node_744 + TreeSitter.Node.TSPoint + r2_747 + c2_748 = TreeSitter.Node.nodeEndPoint node_744 + +deriving instance GHC.Classes.Eq a_749 => GHC.Classes.Eq (ReturnStatement a_749) + +deriving instance GHC.Classes.Ord a_750 => GHC.Classes.Ord (ReturnStatement a_750) + +deriving instance GHC.Show.Show a_751 => GHC.Show.Show (ReturnStatement a_751) + +instance AST.Unmarshal.Unmarshal ReturnStatement + +instance Data.Foldable.Foldable ReturnStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ReturnStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ReturnStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ScopedIdentifier a = ScopedIdentifier + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: ScopedIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_752. + AST.Traversable1.Class.Traversable1 a_752 + ) + +instance AST.Unmarshal.SymbolMatching ScopedIdentifier where + matchedSymbols _ = [211] + showFailure _ node_753 = + "expected " + GHC.Base.<> ( "scoped_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_753 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_753) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_754 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_755 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_756 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_757 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_754 + c1_755 = TreeSitter.Node.nodeStartPoint node_753 + TreeSitter.Node.TSPoint + r2_756 + c2_757 = TreeSitter.Node.nodeEndPoint node_753 + +deriving instance GHC.Classes.Eq a_758 => GHC.Classes.Eq (ScopedIdentifier a_758) + +deriving instance GHC.Classes.Ord a_759 => GHC.Classes.Ord (ScopedIdentifier a_759) + +deriving instance GHC.Show.Show a_760 => GHC.Show.Show (ScopedIdentifier a_760) + +instance AST.Unmarshal.Unmarshal ScopedIdentifier + +instance Data.Foldable.Foldable ScopedIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ScopedIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ScopedIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ScopedTypeIdentifier a = ScopedTypeIdentifier + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Annotation GHC.Generics.:+: GenericType GHC.Generics.:+: MarkerAnnotation GHC.Generics.:+: ScopedTypeIdentifier GHC.Generics.:+: TypeIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_761. + AST.Traversable1.Class.Traversable1 a_761 + ) + +instance AST.Unmarshal.SymbolMatching ScopedTypeIdentifier where + matchedSymbols _ = [228] + showFailure _ node_762 = + "expected " + GHC.Base.<> ( "scoped_type_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_762 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_762) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_763 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_764 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_765 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_766 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_763 + c1_764 = TreeSitter.Node.nodeStartPoint node_762 + TreeSitter.Node.TSPoint + r2_765 + c2_766 = TreeSitter.Node.nodeEndPoint node_762 + +deriving instance GHC.Classes.Eq a_767 => GHC.Classes.Eq (ScopedTypeIdentifier a_767) + +deriving instance GHC.Classes.Ord a_768 => GHC.Classes.Ord (ScopedTypeIdentifier a_768) + +deriving instance GHC.Show.Show a_769 => GHC.Show.Show (ScopedTypeIdentifier a_769) + +instance AST.Unmarshal.Unmarshal ScopedTypeIdentifier + +instance Data.Foldable.Foldable ScopedTypeIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ScopedTypeIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ScopedTypeIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SpreadParameter a = SpreadParameter + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((UnannotatedType GHC.Generics.:+: Modifiers GHC.Generics.:+: VariableDeclarator) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_770. + AST.Traversable1.Class.Traversable1 a_770 + ) + +instance AST.Unmarshal.SymbolMatching SpreadParameter where + matchedSymbols _ = [238] + showFailure _ node_771 = + "expected " + GHC.Base.<> ( "spread_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_771 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_771) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_772 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_773 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_774 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_775 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_772 + c1_773 = TreeSitter.Node.nodeStartPoint node_771 + TreeSitter.Node.TSPoint + r2_774 + c2_775 = TreeSitter.Node.nodeEndPoint node_771 + +deriving instance GHC.Classes.Eq a_776 => GHC.Classes.Eq (SpreadParameter a_776) + +deriving instance GHC.Classes.Ord a_777 => GHC.Classes.Ord (SpreadParameter a_777) + +deriving instance GHC.Show.Show a_778 => GHC.Show.Show (SpreadParameter a_778) + +instance AST.Unmarshal.Unmarshal SpreadParameter + +instance Data.Foldable.Foldable SpreadParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SpreadParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SpreadParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data StaticInitializer a = StaticInitializer + { ann :: a, + extraChildren :: (AST.Parse.Err (Block a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_779. + AST.Traversable1.Class.Traversable1 a_779 + ) + +instance AST.Unmarshal.SymbolMatching StaticInitializer where + matchedSymbols _ = [206] + showFailure _ node_780 = + "expected " + GHC.Base.<> ( "static_initializer" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_780 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_780) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_781 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_782 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_783 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_784 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_781 + c1_782 = TreeSitter.Node.nodeStartPoint node_780 + TreeSitter.Node.TSPoint + r2_783 + c2_784 = TreeSitter.Node.nodeEndPoint node_780 + +deriving instance GHC.Classes.Eq a_785 => GHC.Classes.Eq (StaticInitializer a_785) + +deriving instance GHC.Classes.Ord a_786 => GHC.Classes.Ord (StaticInitializer a_786) + +deriving instance GHC.Show.Show a_787 => GHC.Show.Show (StaticInitializer a_787) + +instance AST.Unmarshal.Unmarshal StaticInitializer + +instance Data.Foldable.Foldable StaticInitializer where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StaticInitializer where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StaticInitializer where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SuperInterfaces a = SuperInterfaces + { ann :: a, + extraChildren :: (AST.Parse.Err (InterfaceTypeList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_788. + AST.Traversable1.Class.Traversable1 a_788 + ) + +instance AST.Unmarshal.SymbolMatching SuperInterfaces where + matchedSymbols _ = [203] + showFailure _ node_789 = + "expected " + GHC.Base.<> ( "super_interfaces" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_789 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_789) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_790 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_791 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_792 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_793 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_790 + c1_791 = TreeSitter.Node.nodeStartPoint node_789 + TreeSitter.Node.TSPoint + r2_792 + c2_793 = TreeSitter.Node.nodeEndPoint node_789 + +deriving instance GHC.Classes.Eq a_794 => GHC.Classes.Eq (SuperInterfaces a_794) + +deriving instance GHC.Classes.Ord a_795 => GHC.Classes.Ord (SuperInterfaces a_795) + +deriving instance GHC.Show.Show a_796 => GHC.Show.Show (SuperInterfaces a_796) + +instance AST.Unmarshal.Unmarshal SuperInterfaces + +instance Data.Foldable.Foldable SuperInterfaces where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SuperInterfaces where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SuperInterfaces where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Superclass a = Superclass {ann :: a, extraChildren :: (AST.Parse.Err (Type a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_797. + AST.Traversable1.Class.Traversable1 a_797 + ) + +instance AST.Unmarshal.SymbolMatching Superclass where + matchedSymbols _ = [202] + showFailure _ node_798 = + "expected " + GHC.Base.<> ( "superclass" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_798 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_798) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_799 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_800 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_801 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_802 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_799 + c1_800 = TreeSitter.Node.nodeStartPoint node_798 + TreeSitter.Node.TSPoint + r2_801 + c2_802 = TreeSitter.Node.nodeEndPoint node_798 + +deriving instance GHC.Classes.Eq a_803 => GHC.Classes.Eq (Superclass a_803) + +deriving instance GHC.Classes.Ord a_804 => GHC.Classes.Ord (Superclass a_804) + +deriving instance GHC.Show.Show a_805 => GHC.Show.Show (Superclass a_805) + +instance AST.Unmarshal.Unmarshal Superclass + +instance Data.Foldable.Foldable Superclass where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Superclass where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Superclass where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchBlock a = SwitchBlock + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: SwitchLabel) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_806. + AST.Traversable1.Class.Traversable1 a_806 + ) + +instance AST.Unmarshal.SymbolMatching SwitchBlock where + matchedSymbols _ = [157] + showFailure _ node_807 = + "expected " + GHC.Base.<> ( "switch_block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_807 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_807) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_808 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_809 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_810 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_811 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_808 + c1_809 = TreeSitter.Node.nodeStartPoint node_807 + TreeSitter.Node.TSPoint + r2_810 + c2_811 = TreeSitter.Node.nodeEndPoint node_807 + +deriving instance GHC.Classes.Eq a_812 => GHC.Classes.Eq (SwitchBlock a_812) + +deriving instance GHC.Classes.Ord a_813 => GHC.Classes.Ord (SwitchBlock a_813) + +deriving instance GHC.Show.Show a_814 => GHC.Show.Show (SwitchBlock a_814) + +instance AST.Unmarshal.Unmarshal SwitchBlock + +instance Data.Foldable.Foldable SwitchBlock where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchBlock where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchBlock where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchLabel a = SwitchLabel + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_815. + AST.Traversable1.Class.Traversable1 a_815 + ) + +instance AST.Unmarshal.SymbolMatching SwitchLabel where + matchedSymbols _ = [158] + showFailure _ node_816 = + "expected " + GHC.Base.<> ( "switch_label" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_816 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_816) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_817 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_818 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_819 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_820 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_817 + c1_818 = TreeSitter.Node.nodeStartPoint node_816 + TreeSitter.Node.TSPoint + r2_819 + c2_820 = TreeSitter.Node.nodeEndPoint node_816 + +deriving instance GHC.Classes.Eq a_821 => GHC.Classes.Eq (SwitchLabel a_821) + +deriving instance GHC.Classes.Ord a_822 => GHC.Classes.Ord (SwitchLabel a_822) + +deriving instance GHC.Show.Show a_823 => GHC.Show.Show (SwitchLabel a_823) + +instance AST.Unmarshal.Unmarshal SwitchLabel + +instance Data.Foldable.Foldable SwitchLabel where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchLabel where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchLabel where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchStatement a = SwitchStatement + { ann :: a, + body :: (AST.Parse.Err (SwitchBlock a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_824. + AST.Traversable1.Class.Traversable1 a_824 + ) + +instance AST.Unmarshal.SymbolMatching SwitchStatement where + matchedSymbols _ = [156] + showFailure _ node_825 = + "expected " + GHC.Base.<> ( "switch_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_825 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_825) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_826 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_827 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_828 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_829 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_826 + c1_827 = TreeSitter.Node.nodeStartPoint node_825 + TreeSitter.Node.TSPoint + r2_828 + c2_829 = TreeSitter.Node.nodeEndPoint node_825 + +deriving instance GHC.Classes.Eq a_830 => GHC.Classes.Eq (SwitchStatement a_830) + +deriving instance GHC.Classes.Ord a_831 => GHC.Classes.Ord (SwitchStatement a_831) + +deriving instance GHC.Show.Show a_832 => GHC.Show.Show (SwitchStatement a_832) + +instance AST.Unmarshal.Unmarshal SwitchStatement + +instance Data.Foldable.Foldable SwitchStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SynchronizedStatement a = SynchronizedStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: Block) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_833. + AST.Traversable1.Class.Traversable1 a_833 + ) + +instance AST.Unmarshal.SymbolMatching SynchronizedStatement where + matchedSymbols _ = [163] + showFailure _ node_834 = + "expected " + GHC.Base.<> ( "synchronized_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_834 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_834) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_835 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_836 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_837 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_838 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_835 + c1_836 = TreeSitter.Node.nodeStartPoint node_834 + TreeSitter.Node.TSPoint + r2_837 + c2_838 = TreeSitter.Node.nodeEndPoint node_834 + +deriving instance GHC.Classes.Eq a_839 => GHC.Classes.Eq (SynchronizedStatement a_839) + +deriving instance GHC.Classes.Ord a_840 => GHC.Classes.Ord (SynchronizedStatement a_840) + +deriving instance GHC.Show.Show a_841 => GHC.Show.Show (SynchronizedStatement a_841) + +instance AST.Unmarshal.Unmarshal SynchronizedStatement + +instance Data.Foldable.Foldable SynchronizedStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SynchronizedStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SynchronizedStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TernaryExpression a = TernaryExpression + { ann :: a, + alternative :: (AST.Parse.Err (Expression a)), + consequence :: (AST.Parse.Err (Expression a)), + condition :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_842. + AST.Traversable1.Class.Traversable1 a_842 + ) + +instance AST.Unmarshal.SymbolMatching TernaryExpression where + matchedSymbols _ = [132] + showFailure _ node_843 = + "expected " + GHC.Base.<> ( "ternary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_843 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_843) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_844 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_845 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_846 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_847 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_844 + c1_845 = TreeSitter.Node.nodeStartPoint node_843 + TreeSitter.Node.TSPoint + r2_846 + c2_847 = TreeSitter.Node.nodeEndPoint node_843 + +deriving instance GHC.Classes.Eq a_848 => GHC.Classes.Eq (TernaryExpression a_848) + +deriving instance GHC.Classes.Ord a_849 => GHC.Classes.Ord (TernaryExpression a_849) + +deriving instance GHC.Show.Show a_850 => GHC.Show.Show (TernaryExpression a_850) + +instance AST.Unmarshal.Unmarshal TernaryExpression + +instance Data.Foldable.Foldable TernaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TernaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TernaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ThrowStatement a = ThrowStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_851. + AST.Traversable1.Class.Traversable1 a_851 + ) + +instance AST.Unmarshal.SymbolMatching ThrowStatement where + matchedSymbols _ = [164] + showFailure _ node_852 = + "expected " + GHC.Base.<> ( "throw_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_852 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_852) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_853 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_854 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_855 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_856 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_853 + c1_854 = TreeSitter.Node.nodeStartPoint node_852 + TreeSitter.Node.TSPoint + r2_855 + c2_856 = TreeSitter.Node.nodeEndPoint node_852 + +deriving instance GHC.Classes.Eq a_857 => GHC.Classes.Eq (ThrowStatement a_857) + +deriving instance GHC.Classes.Ord a_858 => GHC.Classes.Ord (ThrowStatement a_858) + +deriving instance GHC.Show.Show a_859 => GHC.Show.Show (ThrowStatement a_859) + +instance AST.Unmarshal.Unmarshal ThrowStatement + +instance Data.Foldable.Foldable ThrowStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ThrowStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ThrowStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Throws a = Throws + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Type a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_860. + AST.Traversable1.Class.Traversable1 a_860 + ) + +instance AST.Unmarshal.SymbolMatching Throws where + matchedSymbols _ = [239] + showFailure _ node_861 = + "expected " + GHC.Base.<> ( "throws" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_861 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_861) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_862 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_863 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_864 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_865 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_862 + c1_863 = TreeSitter.Node.nodeStartPoint node_861 + TreeSitter.Node.TSPoint + r2_864 + c2_865 = TreeSitter.Node.nodeEndPoint node_861 + +deriving instance GHC.Classes.Eq a_866 => GHC.Classes.Eq (Throws a_866) + +deriving instance GHC.Classes.Ord a_867 => GHC.Classes.Ord (Throws a_867) + +deriving instance GHC.Show.Show a_868 => GHC.Show.Show (Throws a_868) + +instance AST.Unmarshal.Unmarshal Throws + +instance Data.Foldable.Foldable Throws where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Throws where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Throws where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TryStatement a = TryStatement + { ann :: a, + body :: (AST.Parse.Err (Block a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((CatchClause GHC.Generics.:+: FinallyClause) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_869. + AST.Traversable1.Class.Traversable1 a_869 + ) + +instance AST.Unmarshal.SymbolMatching TryStatement where + matchedSymbols _ = [165] + showFailure _ node_870 = + "expected " + GHC.Base.<> ( "try_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_870 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_870) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_871 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_872 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_873 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_874 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_871 + c1_872 = TreeSitter.Node.nodeStartPoint node_870 + TreeSitter.Node.TSPoint + r2_873 + c2_874 = TreeSitter.Node.nodeEndPoint node_870 + +deriving instance GHC.Classes.Eq a_875 => GHC.Classes.Eq (TryStatement a_875) + +deriving instance GHC.Classes.Ord a_876 => GHC.Classes.Ord (TryStatement a_876) + +deriving instance GHC.Show.Show a_877 => GHC.Show.Show (TryStatement a_877) + +instance AST.Unmarshal.Unmarshal TryStatement + +instance Data.Foldable.Foldable TryStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TryStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TryStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TryWithResourcesStatement a = TryWithResourcesStatement + { ann :: a, + body :: (AST.Parse.Err (Block a)), + resources :: (AST.Parse.Err (ResourceSpecification a)), + extraChildren :: ([AST.Parse.Err ((CatchClause GHC.Generics.:+: FinallyClause) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_878. + AST.Traversable1.Class.Traversable1 a_878 + ) + +instance AST.Unmarshal.SymbolMatching TryWithResourcesStatement where + matchedSymbols _ = [170] + showFailure _ node_879 = + "expected " + GHC.Base.<> ( "try_with_resources_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_879 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_879) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_880 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_881 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_882 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_883 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_880 + c1_881 = TreeSitter.Node.nodeStartPoint node_879 + TreeSitter.Node.TSPoint + r2_882 + c2_883 = TreeSitter.Node.nodeEndPoint node_879 + +deriving instance GHC.Classes.Eq a_884 => GHC.Classes.Eq (TryWithResourcesStatement a_884) + +deriving instance GHC.Classes.Ord a_885 => GHC.Classes.Ord (TryWithResourcesStatement a_885) + +deriving instance GHC.Show.Show a_886 => GHC.Show.Show (TryWithResourcesStatement a_886) + +instance AST.Unmarshal.Unmarshal TryWithResourcesStatement + +instance Data.Foldable.Foldable TryWithResourcesStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TryWithResourcesStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TryWithResourcesStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeArguments a = TypeArguments + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Type GHC.Generics.:+: Wildcard) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_887. + AST.Traversable1.Class.Traversable1 a_887 + ) + +instance AST.Unmarshal.SymbolMatching TypeArguments where + matchedSymbols _ = [147] + showFailure _ node_888 = + "expected " + GHC.Base.<> ( "type_arguments" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_888 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_888) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_889 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_890 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_891 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_892 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_889 + c1_890 = TreeSitter.Node.nodeStartPoint node_888 + TreeSitter.Node.TSPoint + r2_891 + c2_892 = TreeSitter.Node.nodeEndPoint node_888 + +deriving instance GHC.Classes.Eq a_893 => GHC.Classes.Eq (TypeArguments a_893) + +deriving instance GHC.Classes.Ord a_894 => GHC.Classes.Ord (TypeArguments a_894) + +deriving instance GHC.Show.Show a_895 => GHC.Show.Show (TypeArguments a_895) + +instance AST.Unmarshal.Unmarshal TypeArguments + +instance Data.Foldable.Foldable TypeArguments where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeArguments where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeArguments where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeBound a = TypeBound + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Type a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_896. + AST.Traversable1.Class.Traversable1 a_896 + ) + +instance AST.Unmarshal.SymbolMatching TypeBound where + matchedSymbols _ = [201] + showFailure _ node_897 = + "expected " + GHC.Base.<> ( "type_bound" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_897 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_897) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_898 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_899 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_900 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_901 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_898 + c1_899 = TreeSitter.Node.nodeStartPoint node_897 + TreeSitter.Node.TSPoint + r2_900 + c2_901 = TreeSitter.Node.nodeEndPoint node_897 + +deriving instance GHC.Classes.Eq a_902 => GHC.Classes.Eq (TypeBound a_902) + +deriving instance GHC.Classes.Ord a_903 => GHC.Classes.Ord (TypeBound a_903) + +deriving instance GHC.Show.Show a_904 => GHC.Show.Show (TypeBound a_904) + +instance AST.Unmarshal.Unmarshal TypeBound + +instance Data.Foldable.Foldable TypeBound where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeBound where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeBound where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeParameter a = TypeParameter + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Annotation GHC.Generics.:+: Identifier GHC.Generics.:+: MarkerAnnotation GHC.Generics.:+: TypeBound) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_905. + AST.Traversable1.Class.Traversable1 a_905 + ) + +instance AST.Unmarshal.SymbolMatching TypeParameter where + matchedSymbols _ = [200] + showFailure _ node_906 = + "expected " + GHC.Base.<> ( "type_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_906 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_906) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_907 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_908 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_909 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_910 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_907 + c1_908 = TreeSitter.Node.nodeStartPoint node_906 + TreeSitter.Node.TSPoint + r2_909 + c2_910 = TreeSitter.Node.nodeEndPoint node_906 + +deriving instance GHC.Classes.Eq a_911 => GHC.Classes.Eq (TypeParameter a_911) + +deriving instance GHC.Classes.Ord a_912 => GHC.Classes.Ord (TypeParameter a_912) + +deriving instance GHC.Show.Show a_913 => GHC.Show.Show (TypeParameter a_913) + +instance AST.Unmarshal.Unmarshal TypeParameter + +instance Data.Foldable.Foldable TypeParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeParameters a = TypeParameters + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (TypeParameter a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_914. + AST.Traversable1.Class.Traversable1 a_914 + ) + +instance AST.Unmarshal.SymbolMatching TypeParameters where + matchedSymbols _ = [199] + showFailure _ node_915 = + "expected " + GHC.Base.<> ( "type_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_915 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_915) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_916 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_917 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_918 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_919 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_916 + c1_917 = TreeSitter.Node.nodeStartPoint node_915 + TreeSitter.Node.TSPoint + r2_918 + c2_919 = TreeSitter.Node.nodeEndPoint node_915 + +deriving instance GHC.Classes.Eq a_920 => GHC.Classes.Eq (TypeParameters a_920) + +deriving instance GHC.Classes.Ord a_921 => GHC.Classes.Ord (TypeParameters a_921) + +deriving instance GHC.Show.Show a_922 => GHC.Show.Show (TypeParameters a_922) + +instance AST.Unmarshal.Unmarshal TypeParameters + +instance Data.Foldable.Foldable TypeParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnaryExpression a = UnaryExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousBang GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousTilde) a)), + operand :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_923. + AST.Traversable1.Class.Traversable1 a_923 + ) + +instance AST.Unmarshal.SymbolMatching UnaryExpression where + matchedSymbols _ = [133] + showFailure _ node_924 = + "expected " + GHC.Base.<> ( "unary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_924 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_924) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_925 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_926 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_927 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_928 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_925 + c1_926 = TreeSitter.Node.nodeStartPoint node_924 + TreeSitter.Node.TSPoint + r2_927 + c2_928 = TreeSitter.Node.nodeEndPoint node_924 + +deriving instance GHC.Classes.Eq a_929 => GHC.Classes.Eq (UnaryExpression a_929) + +deriving instance GHC.Classes.Ord a_930 => GHC.Classes.Ord (UnaryExpression a_930) + +deriving instance GHC.Show.Show a_931 => GHC.Show.Show (UnaryExpression a_931) + +instance AST.Unmarshal.Unmarshal UnaryExpression + +instance Data.Foldable.Foldable UnaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UpdateExpression a = UpdateExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_932. + AST.Traversable1.Class.Traversable1 a_932 + ) + +instance AST.Unmarshal.SymbolMatching UpdateExpression where + matchedSymbols _ = [134] + showFailure _ node_933 = + "expected " + GHC.Base.<> ( "update_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_933 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_933) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_934 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_935 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_936 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_937 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_934 + c1_935 = TreeSitter.Node.nodeStartPoint node_933 + TreeSitter.Node.TSPoint + r2_936 + c2_937 = TreeSitter.Node.nodeEndPoint node_933 + +deriving instance GHC.Classes.Eq a_938 => GHC.Classes.Eq (UpdateExpression a_938) + +deriving instance GHC.Classes.Ord a_939 => GHC.Classes.Ord (UpdateExpression a_939) + +deriving instance GHC.Show.Show a_940 => GHC.Show.Show (UpdateExpression a_940) + +instance AST.Unmarshal.Unmarshal UpdateExpression + +instance Data.Foldable.Foldable UpdateExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UpdateExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UpdateExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VariableDeclarator a = VariableDeclarator + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: ArrayInitializer) a))), + name :: (AST.Parse.Err (Identifier a)), + dimensions :: (GHC.Maybe.Maybe (AST.Parse.Err (Dimensions a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_941. + AST.Traversable1.Class.Traversable1 a_941 + ) + +instance AST.Unmarshal.SymbolMatching VariableDeclarator where + matchedSymbols _ = [222] + showFailure _ node_942 = + "expected " + GHC.Base.<> ( "variable_declarator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_942 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_942) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_943 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_944 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_945 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_946 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_943 + c1_944 = TreeSitter.Node.nodeStartPoint node_942 + TreeSitter.Node.TSPoint + r2_945 + c2_946 = TreeSitter.Node.nodeEndPoint node_942 + +deriving instance GHC.Classes.Eq a_947 => GHC.Classes.Eq (VariableDeclarator a_947) + +deriving instance GHC.Classes.Ord a_948 => GHC.Classes.Ord (VariableDeclarator a_948) + +deriving instance GHC.Show.Show a_949 => GHC.Show.Show (VariableDeclarator a_949) + +instance AST.Unmarshal.Unmarshal VariableDeclarator + +instance Data.Foldable.Foldable VariableDeclarator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VariableDeclarator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VariableDeclarator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WhileStatement a = WhileStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_950. + AST.Traversable1.Class.Traversable1 a_950 + ) + +instance AST.Unmarshal.SymbolMatching WhileStatement where + matchedSymbols _ = [174] + showFailure _ node_951 = + "expected " + GHC.Base.<> ( "while_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_951 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_951) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_952 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_953 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_954 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_955 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_952 + c1_953 = TreeSitter.Node.nodeStartPoint node_951 + TreeSitter.Node.TSPoint + r2_954 + c2_955 = TreeSitter.Node.nodeEndPoint node_951 + +deriving instance GHC.Classes.Eq a_956 => GHC.Classes.Eq (WhileStatement a_956) + +deriving instance GHC.Classes.Ord a_957 => GHC.Classes.Ord (WhileStatement a_957) + +deriving instance GHC.Show.Show a_958 => GHC.Show.Show (WhileStatement a_958) + +instance AST.Unmarshal.Unmarshal WhileStatement + +instance Data.Foldable.Foldable WhileStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WhileStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WhileStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Wildcard a = Wildcard + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Type GHC.Generics.:+: Annotation GHC.Generics.:+: MarkerAnnotation GHC.Generics.:+: Super) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_959. + AST.Traversable1.Class.Traversable1 a_959 + ) + +instance AST.Unmarshal.SymbolMatching Wildcard where + matchedSymbols _ = [148] + showFailure _ node_960 = + "expected " + GHC.Base.<> ( "wildcard" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_960 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_960) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_961 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_962 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_963 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_964 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_961 + c1_962 = TreeSitter.Node.nodeStartPoint node_960 + TreeSitter.Node.TSPoint + r2_963 + c2_964 = TreeSitter.Node.nodeEndPoint node_960 + +deriving instance GHC.Classes.Eq a_965 => GHC.Classes.Eq (Wildcard a_965) + +deriving instance GHC.Classes.Ord a_966 => GHC.Classes.Ord (Wildcard a_966) + +deriving instance GHC.Show.Show a_967 => GHC.Show.Show (Wildcard a_967) + +instance AST.Unmarshal.Unmarshal Wildcard + +instance Data.Foldable.Foldable Wildcard where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Wildcard where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Wildcard where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousBang = AST.Token.Token "!" 51 + +type AnonymousBangEqual = AST.Token.Token "!=" 33 + +type AnonymousPercent = AST.Token.Token "%" 42 + +type AnonymousPercentEqual = AST.Token.Token "%=" 24 + +type AnonymousAmpersand = AST.Token.Token "&" 14 + +type AnonymousAmpersandAmpersand = AST.Token.Token "&&" 34 + +type AnonymousAmpersandEqual = AST.Token.Token "&=" 21 + +type AnonymousLParen = AST.Token.Token "(" 13 + +type AnonymousRParen = AST.Token.Token ")" 15 + +type AnonymousStar = AST.Token.Token "*" 38 + +type AnonymousStarEqual = AST.Token.Token "*=" 19 + +type AnonymousPlus = AST.Token.Token "+" 36 + +type AnonymousPlusPlus = AST.Token.Token "++" 53 + +type AnonymousPlusEqual = AST.Token.Token "+=" 17 + +type AnonymousComma = AST.Token.Token "," 48 + +type AnonymousMinus = AST.Token.Token "-" 37 + +type AnonymousMinusMinus = AST.Token.Token "--" 54 + +type AnonymousMinusEqual = AST.Token.Token "-=" 18 + +type AnonymousMinusRAngle = AST.Token.Token "->" 47 + +type AnonymousDot = AST.Token.Token "." 58 + +type AnonymousDotDotDot = AST.Token.Token "..." 118 + +type AnonymousSlash = AST.Token.Token "/" 39 + +type AnonymousSlashEqual = AST.Token.Token "/=" 20 + +type AnonymousColon = AST.Token.Token ":" 50 + +type AnonymousColonColon = AST.Token.Token "::" 60 + +type AnonymousSemicolon = AST.Token.Token ";" 62 + +type AnonymousLAngle = AST.Token.Token "<" 29 + +type AnonymousLAngleLAngle = AST.Token.Token "<<" 43 + +type AnonymousLAngleLAngleEqual = AST.Token.Token "<<=" 25 + +type AnonymousLAngleEqual = AST.Token.Token "<=" 32 + +type AnonymousEqual = AST.Token.Token "=" 16 + +type AnonymousEqualEqual = AST.Token.Token "==" 30 + +type AnonymousRAngle = AST.Token.Token ">" 28 + +type AnonymousRAngleEqual = AST.Token.Token ">=" 31 + +type AnonymousRAngleRAngle = AST.Token.Token ">>" 44 + +type AnonymousRAngleRAngleEqual = AST.Token.Token ">>=" 26 + +type AnonymousRAngleRAngleRAngle = AST.Token.Token ">>>" 45 + +type AnonymousRAngleRAngleRAngleEqual = AST.Token.Token ">>>=" 27 + +type AnonymousQuestion = AST.Token.Token "?" 49 + +type AnonymousAt = AST.Token.Token "@" 82 + +type AnonymousAtinterface = AST.Token.Token "@interface" 107 + +type AnonymousLBracket = AST.Token.Token "[" 56 + +type AnonymousRBracket = AST.Token.Token "]" 57 + +type AnonymousCaret = AST.Token.Token "^" 41 + +type AnonymousCaretEqual = AST.Token.Token "^=" 23 + +type AnonymousAbstract = AST.Token.Token "abstract" 100 + +type AnonymousAssert = AST.Token.Token "assert" 65 + +data BinaryIntegerLiteral a = BinaryIntegerLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_968. + AST.Traversable1.Class.Traversable1 a_968 + ) + +instance AST.Unmarshal.SymbolMatching BinaryIntegerLiteral where + matchedSymbols _ = [5] + showFailure _ node_969 = + "expected " + GHC.Base.<> ( "binary_integer_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_969 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_969) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_970 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_971 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_972 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_973 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_970 + c1_971 = TreeSitter.Node.nodeStartPoint node_969 + TreeSitter.Node.TSPoint + r2_972 + c2_973 = TreeSitter.Node.nodeEndPoint node_969 + +deriving instance GHC.Classes.Eq a_974 => GHC.Classes.Eq (BinaryIntegerLiteral a_974) + +deriving instance GHC.Classes.Ord a_975 => GHC.Classes.Ord (BinaryIntegerLiteral a_975) + +deriving instance GHC.Show.Show a_976 => GHC.Show.Show (BinaryIntegerLiteral a_976) + +instance AST.Unmarshal.Unmarshal BinaryIntegerLiteral + +instance Data.Foldable.Foldable BinaryIntegerLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BinaryIntegerLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BinaryIntegerLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BooleanType a = BooleanType {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_977. + AST.Traversable1.Class.Traversable1 a_977 + ) + +instance AST.Unmarshal.SymbolMatching BooleanType where + matchedSymbols _ = [116] + showFailure _ node_978 = + "expected " + GHC.Base.<> ( "boolean_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_978 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_978) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_979 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_980 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_981 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_982 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_979 + c1_980 = TreeSitter.Node.nodeStartPoint node_978 + TreeSitter.Node.TSPoint + r2_981 + c2_982 = TreeSitter.Node.nodeEndPoint node_978 + +deriving instance GHC.Classes.Eq a_983 => GHC.Classes.Eq (BooleanType a_983) + +deriving instance GHC.Classes.Ord a_984 => GHC.Classes.Ord (BooleanType a_984) + +deriving instance GHC.Show.Show a_985 => GHC.Show.Show (BooleanType a_985) + +instance AST.Unmarshal.Unmarshal BooleanType + +instance Data.Foldable.Foldable BooleanType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BooleanType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BooleanType where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousBreak = AST.Token.Token "break" 71 + +type AnonymousByte = AST.Token.Token "byte" 109 + +type AnonymousCase = AST.Token.Token "case" 67 + +type AnonymousCatch = AST.Token.Token "catch" 77 + +type AnonymousChar = AST.Token.Token "char" 113 + +data CharacterLiteral a = CharacterLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_986. + AST.Traversable1.Class.Traversable1 a_986 + ) + +instance AST.Unmarshal.SymbolMatching CharacterLiteral where + matchedSymbols _ = [10] + showFailure _ node_987 = + "expected " + GHC.Base.<> ( "character_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_987 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_987) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_988 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_989 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_990 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_991 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_988 + c1_989 = TreeSitter.Node.nodeStartPoint node_987 + TreeSitter.Node.TSPoint + r2_990 + c2_991 = TreeSitter.Node.nodeEndPoint node_987 + +deriving instance GHC.Classes.Eq a_992 => GHC.Classes.Eq (CharacterLiteral a_992) + +deriving instance GHC.Classes.Ord a_993 => GHC.Classes.Ord (CharacterLiteral a_993) + +deriving instance GHC.Show.Show a_994 => GHC.Show.Show (CharacterLiteral a_994) + +instance AST.Unmarshal.Unmarshal CharacterLiteral + +instance Data.Foldable.Foldable CharacterLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CharacterLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CharacterLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousClass = AST.Token.Token "class" 59 + +type AnonymousContinue = AST.Token.Token "continue" 72 + +data DecimalFloatingPointLiteral a = DecimalFloatingPointLiteral + { ann :: a, + text :: Data.Text.Internal.Text + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_995. + AST.Traversable1.Class.Traversable1 a_995 + ) + +instance AST.Unmarshal.SymbolMatching DecimalFloatingPointLiteral where + matchedSymbols _ = [6] + showFailure _ node_996 = + "expected " + GHC.Base.<> ( "decimal_floating_point_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_996 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_996) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_997 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_998 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_999 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1000 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_997 + c1_998 = TreeSitter.Node.nodeStartPoint node_996 + TreeSitter.Node.TSPoint + r2_999 + c2_1000 = TreeSitter.Node.nodeEndPoint node_996 + +deriving instance GHC.Classes.Eq a_1001 => GHC.Classes.Eq (DecimalFloatingPointLiteral a_1001) + +deriving instance GHC.Classes.Ord a_1002 => GHC.Classes.Ord (DecimalFloatingPointLiteral a_1002) + +deriving instance GHC.Show.Show a_1003 => GHC.Show.Show (DecimalFloatingPointLiteral a_1003) + +instance AST.Unmarshal.Unmarshal DecimalFloatingPointLiteral + +instance Data.Foldable.Foldable DecimalFloatingPointLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DecimalFloatingPointLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DecimalFloatingPointLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DecimalIntegerLiteral a = DecimalIntegerLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1004. + AST.Traversable1.Class.Traversable1 a_1004 + ) + +instance AST.Unmarshal.SymbolMatching DecimalIntegerLiteral where + matchedSymbols _ = [2] + showFailure _ node_1005 = + "expected " + GHC.Base.<> ( "decimal_integer_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1005 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1005) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1006 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1007 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1008 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1009 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1006 + c1_1007 = TreeSitter.Node.nodeStartPoint node_1005 + TreeSitter.Node.TSPoint + r2_1008 + c2_1009 = TreeSitter.Node.nodeEndPoint node_1005 + +deriving instance GHC.Classes.Eq a_1010 => GHC.Classes.Eq (DecimalIntegerLiteral a_1010) + +deriving instance GHC.Classes.Ord a_1011 => GHC.Classes.Ord (DecimalIntegerLiteral a_1011) + +deriving instance GHC.Show.Show a_1012 => GHC.Show.Show (DecimalIntegerLiteral a_1012) + +instance AST.Unmarshal.Unmarshal DecimalIntegerLiteral + +instance Data.Foldable.Foldable DecimalIntegerLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DecimalIntegerLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DecimalIntegerLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousDefault = AST.Token.Token "default" 68 + +type AnonymousDo = AST.Token.Token "do" 69 + +type AnonymousDouble = AST.Token.Token "double" 115 + +type AnonymousElse = AST.Token.Token "else" 80 + +type AnonymousEnum = AST.Token.Token "enum" 96 + +type AnonymousExports = AST.Token.Token "exports" 86 + +type AnonymousExtends = AST.Token.Token "extends" 61 + +data False a = False {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1013. + AST.Traversable1.Class.Traversable1 a_1013 + ) + +instance AST.Unmarshal.SymbolMatching False where + matchedSymbols _ = [9] + showFailure _ node_1014 = + "expected " + GHC.Base.<> ( "false" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1014 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1014) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1015 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1016 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1017 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1018 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1015 + c1_1016 = TreeSitter.Node.nodeStartPoint node_1014 + TreeSitter.Node.TSPoint + r2_1017 + c2_1018 = TreeSitter.Node.nodeEndPoint node_1014 + +deriving instance GHC.Classes.Eq a_1019 => GHC.Classes.Eq (False a_1019) + +deriving instance GHC.Classes.Ord a_1020 => GHC.Classes.Ord (False a_1020) + +deriving instance GHC.Show.Show a_1021 => GHC.Show.Show (False a_1021) + +instance AST.Unmarshal.Unmarshal False + +instance Data.Foldable.Foldable False where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor False where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable False where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFinal = AST.Token.Token "final" 101 + +type AnonymousFinally = AST.Token.Token "finally" 78 + +type AnonymousFloat = AST.Token.Token "float" 114 + +type AnonymousFor = AST.Token.Token "for" 81 + +data HexFloatingPointLiteral a = HexFloatingPointLiteral + { ann :: a, + text :: Data.Text.Internal.Text + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1022. + AST.Traversable1.Class.Traversable1 a_1022 + ) + +instance AST.Unmarshal.SymbolMatching HexFloatingPointLiteral where + matchedSymbols _ = [7] + showFailure _ node_1023 = + "expected " + GHC.Base.<> ( "hex_floating_point_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1023 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1023) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1024 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1025 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1026 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1027 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1024 + c1_1025 = TreeSitter.Node.nodeStartPoint node_1023 + TreeSitter.Node.TSPoint + r2_1026 + c2_1027 = TreeSitter.Node.nodeEndPoint node_1023 + +deriving instance GHC.Classes.Eq a_1028 => GHC.Classes.Eq (HexFloatingPointLiteral a_1028) + +deriving instance GHC.Classes.Ord a_1029 => GHC.Classes.Ord (HexFloatingPointLiteral a_1029) + +deriving instance GHC.Show.Show a_1030 => GHC.Show.Show (HexFloatingPointLiteral a_1030) + +instance AST.Unmarshal.Unmarshal HexFloatingPointLiteral + +instance Data.Foldable.Foldable HexFloatingPointLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor HexFloatingPointLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable HexFloatingPointLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data HexIntegerLiteral a = HexIntegerLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1031. + AST.Traversable1.Class.Traversable1 a_1031 + ) + +instance AST.Unmarshal.SymbolMatching HexIntegerLiteral where + matchedSymbols _ = [3] + showFailure _ node_1032 = + "expected " + GHC.Base.<> ( "hex_integer_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1032 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1032) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1033 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1034 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1035 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1036 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1033 + c1_1034 = TreeSitter.Node.nodeStartPoint node_1032 + TreeSitter.Node.TSPoint + r2_1035 + c2_1036 = TreeSitter.Node.nodeEndPoint node_1032 + +deriving instance GHC.Classes.Eq a_1037 => GHC.Classes.Eq (HexIntegerLiteral a_1037) + +deriving instance GHC.Classes.Ord a_1038 => GHC.Classes.Ord (HexIntegerLiteral a_1038) + +deriving instance GHC.Show.Show a_1039 => GHC.Show.Show (HexIntegerLiteral a_1039) + +instance AST.Unmarshal.Unmarshal HexIntegerLiteral + +instance Data.Foldable.Foldable HexIntegerLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor HexIntegerLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable HexIntegerLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Identifier a = Identifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1040. + AST.Traversable1.Class.Traversable1 a_1040 + ) + +instance AST.Unmarshal.SymbolMatching Identifier where + matchedSymbols _ = [1] + showFailure _ node_1041 = + "expected " + GHC.Base.<> ( "identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1041 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1041) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1042 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1043 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1044 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1045 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1042 + c1_1043 = TreeSitter.Node.nodeStartPoint node_1041 + TreeSitter.Node.TSPoint + r2_1044 + c2_1045 = TreeSitter.Node.nodeEndPoint node_1041 + +deriving instance GHC.Classes.Eq a_1046 => GHC.Classes.Eq (Identifier a_1046) + +deriving instance GHC.Classes.Ord a_1047 => GHC.Classes.Ord (Identifier a_1047) + +deriving instance GHC.Show.Show a_1048 => GHC.Show.Show (Identifier a_1048) + +instance AST.Unmarshal.Unmarshal Identifier + +instance Data.Foldable.Foldable Identifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Identifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Identifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousIf = AST.Token.Token "if" 79 + +type AnonymousImplements = AST.Token.Token "implements" 106 + +type AnonymousImport = AST.Token.Token "import" 95 + +type AnonymousInstanceof = AST.Token.Token "instanceof" 46 + +type AnonymousInt = AST.Token.Token "int" 111 + +type AnonymousInterface = AST.Token.Token "interface" 108 + +type AnonymousLong = AST.Token.Token "long" 112 + +type AnonymousModule = AST.Token.Token "module" 84 + +type AnonymousNative = AST.Token.Token "native" 103 + +type AnonymousNew = AST.Token.Token "new" 55 + +data NullLiteral a = NullLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1049. + AST.Traversable1.Class.Traversable1 a_1049 + ) + +instance AST.Unmarshal.SymbolMatching NullLiteral where + matchedSymbols _ = [12] + showFailure _ node_1050 = + "expected " + GHC.Base.<> ( "null_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1050 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1050) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1051 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1052 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1053 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1054 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1051 + c1_1052 = TreeSitter.Node.nodeStartPoint node_1050 + TreeSitter.Node.TSPoint + r2_1053 + c2_1054 = TreeSitter.Node.nodeEndPoint node_1050 + +deriving instance GHC.Classes.Eq a_1055 => GHC.Classes.Eq (NullLiteral a_1055) + +deriving instance GHC.Classes.Ord a_1056 => GHC.Classes.Ord (NullLiteral a_1056) + +deriving instance GHC.Show.Show a_1057 => GHC.Show.Show (NullLiteral a_1057) + +instance AST.Unmarshal.Unmarshal NullLiteral + +instance Data.Foldable.Foldable NullLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NullLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NullLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data OctalIntegerLiteral a = OctalIntegerLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1058. + AST.Traversable1.Class.Traversable1 a_1058 + ) + +instance AST.Unmarshal.SymbolMatching OctalIntegerLiteral where + matchedSymbols _ = [4] + showFailure _ node_1059 = + "expected " + GHC.Base.<> ( "octal_integer_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1059 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1059) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1060 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1061 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1062 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1063 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1060 + c1_1061 = TreeSitter.Node.nodeStartPoint node_1059 + TreeSitter.Node.TSPoint + r2_1062 + c2_1063 = TreeSitter.Node.nodeEndPoint node_1059 + +deriving instance GHC.Classes.Eq a_1064 => GHC.Classes.Eq (OctalIntegerLiteral a_1064) + +deriving instance GHC.Classes.Ord a_1065 => GHC.Classes.Ord (OctalIntegerLiteral a_1065) + +deriving instance GHC.Show.Show a_1066 => GHC.Show.Show (OctalIntegerLiteral a_1066) + +instance AST.Unmarshal.Unmarshal OctalIntegerLiteral + +instance Data.Foldable.Foldable OctalIntegerLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor OctalIntegerLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable OctalIntegerLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousOpen = AST.Token.Token "open" 83 + +type AnonymousOpens = AST.Token.Token "opens" 88 + +type AnonymousPackage = AST.Token.Token "package" 94 + +type AnonymousPrivate = AST.Token.Token "private" 99 + +type AnonymousProtected = AST.Token.Token "protected" 98 + +type AnonymousProvides = AST.Token.Token "provides" 90 + +type AnonymousPublic = AST.Token.Token "public" 97 + +type AnonymousRequires = AST.Token.Token "requires" 85 + +type AnonymousReturn = AST.Token.Token "return" 73 + +type AnonymousShort = AST.Token.Token "short" 110 + +type AnonymousStatic = AST.Token.Token "static" 93 + +type AnonymousStrictfp = AST.Token.Token "strictfp" 102 + +data StringLiteral a = StringLiteral {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1067. + AST.Traversable1.Class.Traversable1 a_1067 + ) + +instance AST.Unmarshal.SymbolMatching StringLiteral where + matchedSymbols _ = [11] + showFailure _ node_1068 = + "expected " + GHC.Base.<> ( "string_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1068 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1068) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1069 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1070 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1071 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1072 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1069 + c1_1070 = TreeSitter.Node.nodeStartPoint node_1068 + TreeSitter.Node.TSPoint + r2_1071 + c2_1072 = TreeSitter.Node.nodeEndPoint node_1068 + +deriving instance GHC.Classes.Eq a_1073 => GHC.Classes.Eq (StringLiteral a_1073) + +deriving instance GHC.Classes.Ord a_1074 => GHC.Classes.Ord (StringLiteral a_1074) + +deriving instance GHC.Show.Show a_1075 => GHC.Show.Show (StringLiteral a_1075) + +instance AST.Unmarshal.Unmarshal StringLiteral + +instance Data.Foldable.Foldable StringLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StringLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StringLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Super a = Super {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1076. + AST.Traversable1.Class.Traversable1 a_1076 + ) + +instance AST.Unmarshal.SymbolMatching Super where + matchedSymbols _ = [121] + showFailure _ node_1077 = + "expected " + GHC.Base.<> ( "super" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1077 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1077) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1078 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1079 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1080 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1081 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1078 + c1_1079 = TreeSitter.Node.nodeStartPoint node_1077 + TreeSitter.Node.TSPoint + r2_1080 + c2_1081 = TreeSitter.Node.nodeEndPoint node_1077 + +deriving instance GHC.Classes.Eq a_1082 => GHC.Classes.Eq (Super a_1082) + +deriving instance GHC.Classes.Ord a_1083 => GHC.Classes.Ord (Super a_1083) + +deriving instance GHC.Show.Show a_1084 => GHC.Show.Show (Super a_1084) + +instance AST.Unmarshal.Unmarshal Super + +instance Data.Foldable.Foldable Super where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Super where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Super where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousSwitch = AST.Token.Token "switch" 66 + +type AnonymousSynchronized = AST.Token.Token "synchronized" 74 + +data This a = This {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1085. + AST.Traversable1.Class.Traversable1 a_1085 + ) + +instance AST.Unmarshal.SymbolMatching This where + matchedSymbols _ = [120] + showFailure _ node_1086 = + "expected " + GHC.Base.<> ( "this" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1086 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1086) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1087 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1088 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1089 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1090 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1087 + c1_1088 = TreeSitter.Node.nodeStartPoint node_1086 + TreeSitter.Node.TSPoint + r2_1089 + c2_1090 = TreeSitter.Node.nodeEndPoint node_1086 + +deriving instance GHC.Classes.Eq a_1091 => GHC.Classes.Eq (This a_1091) + +deriving instance GHC.Classes.Ord a_1092 => GHC.Classes.Ord (This a_1092) + +deriving instance GHC.Show.Show a_1093 => GHC.Show.Show (This a_1093) + +instance AST.Unmarshal.Unmarshal This + +instance Data.Foldable.Foldable This where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor This where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable This where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousThrow = AST.Token.Token "throw" 75 + +type AnonymousThrows = AST.Token.Token "throws" 119 + +type AnonymousTo = AST.Token.Token "to" 87 + +type AnonymousTransient = AST.Token.Token "transient" 104 + +type AnonymousTransitive = AST.Token.Token "transitive" 92 + +data True a = True {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1094. + AST.Traversable1.Class.Traversable1 a_1094 + ) + +instance AST.Unmarshal.SymbolMatching True where + matchedSymbols _ = [8] + showFailure _ node_1095 = + "expected " + GHC.Base.<> ( "true" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1095 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1095) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1096 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1097 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1098 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1099 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1096 + c1_1097 = TreeSitter.Node.nodeStartPoint node_1095 + TreeSitter.Node.TSPoint + r2_1098 + c2_1099 = TreeSitter.Node.nodeEndPoint node_1095 + +deriving instance GHC.Classes.Eq a_1100 => GHC.Classes.Eq (True a_1100) + +deriving instance GHC.Classes.Ord a_1101 => GHC.Classes.Ord (True a_1101) + +deriving instance GHC.Show.Show a_1102 => GHC.Show.Show (True a_1102) + +instance AST.Unmarshal.Unmarshal True + +instance Data.Foldable.Foldable True where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor True where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable True where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousTry = AST.Token.Token "try" 76 + +data TypeIdentifier a = TypeIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1103. + AST.Traversable1.Class.Traversable1 a_1103 + ) + +instance AST.Unmarshal.SymbolMatching TypeIdentifier where + matchedSymbols _ = [274] + showFailure _ node_1104 = + "expected " + GHC.Base.<> ( "type_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1104 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1104) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1105 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1106 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1107 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1108 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1105 + c1_1106 = TreeSitter.Node.nodeStartPoint node_1104 + TreeSitter.Node.TSPoint + r2_1107 + c2_1108 = TreeSitter.Node.nodeEndPoint node_1104 + +deriving instance GHC.Classes.Eq a_1109 => GHC.Classes.Eq (TypeIdentifier a_1109) + +deriving instance GHC.Classes.Ord a_1110 => GHC.Classes.Ord (TypeIdentifier a_1110) + +deriving instance GHC.Show.Show a_1111 => GHC.Show.Show (TypeIdentifier a_1111) + +instance AST.Unmarshal.Unmarshal TypeIdentifier + +instance Data.Foldable.Foldable TypeIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousUses = AST.Token.Token "uses" 89 + +data VoidType a = VoidType {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1112. + AST.Traversable1.Class.Traversable1 a_1112 + ) + +instance AST.Unmarshal.SymbolMatching VoidType where + matchedSymbols _ = [117] + showFailure _ node_1113 = + "expected " + GHC.Base.<> ( "void_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1113 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1113) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1114 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1115 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1116 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1117 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1114 + c1_1115 = TreeSitter.Node.nodeStartPoint node_1113 + TreeSitter.Node.TSPoint + r2_1116 + c2_1117 = TreeSitter.Node.nodeEndPoint node_1113 + +deriving instance GHC.Classes.Eq a_1118 => GHC.Classes.Eq (VoidType a_1118) + +deriving instance GHC.Classes.Ord a_1119 => GHC.Classes.Ord (VoidType a_1119) + +deriving instance GHC.Show.Show a_1120 => GHC.Show.Show (VoidType a_1120) + +instance AST.Unmarshal.Unmarshal VoidType + +instance Data.Foldable.Foldable VoidType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VoidType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VoidType where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousVolatile = AST.Token.Token "volatile" 105 + +type AnonymousWhile = AST.Token.Token "while" 70 + +type AnonymousWith = AST.Token.Token "with" 91 + +type AnonymousLBrace = AST.Token.Token "{" 63 + +type AnonymousPipe = AST.Token.Token "|" 40 + +type AnonymousPipeEqual = AST.Token.Token "|=" 22 + +type AnonymousPipePipe = AST.Token.Token "||" 35 + +type AnonymousRBrace = AST.Token.Token "}" 64 + +type AnonymousTilde = AST.Token.Token "~" 52 diff --git a/semantic-java/src/Language/Java/Grammar.hs b/semantic-java/src/Language/Java/Grammar.hs new file mode 100644 index 0000000000..c6b8a35b74 --- /dev/null +++ b/semantic-java/src/Language/Java/Grammar.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE TemplateHaskell #-} + +module Language.Java.Grammar +( tree_sitter_java +, Grammar(..) +) where + +import AST.Grammar.TH +import Language.Haskell.TH +import TreeSitter.Java (tree_sitter_java) + +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData (mkName "Grammar") tree_sitter_java diff --git a/semantic-java/src/Language/Java/Tags.hs b/semantic-java/src/Language/Java/Tags.hs new file mode 100644 index 0000000000..855b3667ca --- /dev/null +++ b/semantic-java/src/Language/Java/Tags.hs @@ -0,0 +1,249 @@ +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module Language.Java.Tags + ( ToTags (..), + ) +where + +import AST.Element +import qualified AST.Parse as Parse +import AST.Token +import AST.Traversable1 +import Control.Effect.Reader +import Control.Effect.Writer +import Control.Effect.State +import Data.Foldable +import qualified Language.Java.AST as Java +import Proto.Semantic as P +import Source.Loc +import Source.Range +import Source.Source as Source +import qualified Tags.Tagging.Precise as Tags + +class ToTags t where + tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m + ) => + t Loc -> + m () + default tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () + tags = gtags + +instance (ToTags l, ToTags r) => ToTags (l :+: r) where + tags (L1 l) = tags l + tags (R1 r) = tags r + +instance ToTags (Token sym n) where tags _ = pure () + +instance ToTags Java.MethodDeclaration where + tags + t@Java.MethodDeclaration + { ann = Loc {byteRange = range}, + name = Parse.Success (Java.Identifier {text, ann}), + body + } = do + let srcRange = + range + { end = case body of + Just (Parse.Success (Java.Block {ann = Loc Range {end} _})) -> end + Nothing -> end range + Just (Parse.Fail _) -> end range + } + Tags.yield text P.METHOD P.DEFINITION ann srcRange + gtags t + tags _ = pure () + +-- TODO: we can coalesce a lot of these instances given proper use of HasField +-- to do the equivalent of type-generic pattern-matching. + +instance ToTags Java.ClassDeclaration where + tags + t@Java.ClassDeclaration + { ann = Loc {byteRange = Range {start}}, + name = Parse.Success (Java.Identifier {text, ann}), + body = Parse.Success (Java.ClassBody {ann = Loc Range {start = end} _}) + } = do + Tags.yield text P.CLASS P.DEFINITION ann (Range start end) + gtags t + tags _ = pure () + +instance ToTags Java.MethodInvocation where + tags + t@Java.MethodInvocation + { ann = Loc {byteRange = range}, + name = Parse.Success (Java.Identifier {text, ann}) + } = do + Tags.yield text P.CALL P.REFERENCE ann range + gtags t + tags _ = pure () + +instance ToTags Java.InterfaceDeclaration where + tags + t@Java.InterfaceDeclaration + { ann = Loc {byteRange}, + name = Parse.Success (Java.Identifier {text, ann}) + } = do + Tags.yield text P.INTERFACE P.DEFINITION ann byteRange + gtags t + tags _ = pure () + +instance ToTags Java.InterfaceTypeList where + tags t@Java.InterfaceTypeList {extraChildren = interfaces} = do + for_ interfaces $ \x -> case x of + Parse.Success (Java.Type (Prj (Java.UnannotatedType (Prj (Java.SimpleType (Prj Java.TypeIdentifier {ann = loc@Loc {byteRange = range}, text = name})))))) -> + Tags.yield name P.IMPLEMENTATION P.REFERENCE loc range + _ -> pure () + gtags t + +gtags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () +gtags = traverse1_ @ToTags (const (pure ())) tags + +instance ToTags Java.AnnotatedType +instance ToTags Java.Annotation +instance ToTags Java.AnnotationArgumentList +instance ToTags Java.AnnotationTypeBody +instance ToTags Java.AnnotationTypeDeclaration +instance ToTags Java.AnnotationTypeElementDeclaration +instance ToTags Java.ArgumentList +instance ToTags Java.ArrayAccess +instance ToTags Java.ArrayCreationExpression +instance ToTags Java.ArrayInitializer +instance ToTags Java.ArrayType +instance ToTags Java.AssertStatement +instance ToTags Java.AssignmentExpression +instance ToTags Java.Asterisk +instance ToTags Java.BinaryExpression +instance ToTags Java.BinaryIntegerLiteral +instance ToTags Java.Block +instance ToTags Java.BooleanType +instance ToTags Java.BreakStatement +instance ToTags Java.CastExpression +instance ToTags Java.CatchClause +instance ToTags Java.CatchFormalParameter +instance ToTags Java.CatchType +instance ToTags Java.CharacterLiteral +instance ToTags Java.ClassBody +-- instance ToTags Java.ClassDeclaration +instance ToTags Java.ClassLiteral +instance ToTags Java.ConstantDeclaration +instance ToTags Java.ConstructorBody +instance ToTags Java.ConstructorDeclaration +instance ToTags Java.ContinueStatement +instance ToTags Java.DecimalFloatingPointLiteral +instance ToTags Java.DecimalIntegerLiteral +instance ToTags Java.Declaration +instance ToTags Java.Dimensions +instance ToTags Java.DimensionsExpr +instance ToTags Java.DoStatement +instance ToTags Java.ElementValueArrayInitializer +instance ToTags Java.ElementValuePair +instance ToTags Java.EnhancedForStatement +instance ToTags Java.EnumBody +instance ToTags Java.EnumBodyDeclarations +instance ToTags Java.EnumConstant +instance ToTags Java.EnumDeclaration +instance ToTags Java.ExplicitConstructorInvocation +instance ToTags Java.Expression +instance ToTags Java.ExpressionStatement +instance ToTags Java.ExtendsInterfaces +instance ToTags Java.False +instance ToTags Java.FieldAccess +instance ToTags Java.FieldDeclaration +instance ToTags Java.FinallyClause +instance ToTags Java.FloatingPointType +instance ToTags Java.ForInit +instance ToTags Java.ForStatement +instance ToTags Java.FormalParameter +instance ToTags Java.FormalParameters +instance ToTags Java.GenericType +instance ToTags Java.HexFloatingPointLiteral +instance ToTags Java.HexIntegerLiteral +instance ToTags Java.Identifier +instance ToTags Java.IfStatement +instance ToTags Java.ImportDeclaration +instance ToTags Java.InferredParameters +instance ToTags Java.InstanceofExpression +instance ToTags Java.IntegralType +instance ToTags Java.InterfaceBody +--instance ToTags Java.InterfaceDeclaration +-- instance ToTags Java.InterfaceTypeList +instance ToTags Java.LabeledStatement +instance ToTags Java.LambdaExpression +instance ToTags Java.Literal +instance ToTags Java.LocalVariableDeclaration +instance ToTags Java.LocalVariableDeclarationStatement +instance ToTags Java.MarkerAnnotation +-- instance ToTags Java.MethodDeclaration +-- instance ToTags Java.MethodInvocation +instance ToTags Java.MethodReference +instance ToTags Java.Modifiers +instance ToTags Java.ModuleDeclaration +instance ToTags Java.ModuleDirective +instance ToTags Java.ModuleName +instance ToTags Java.NullLiteral +instance ToTags Java.ObjectCreationExpression +instance ToTags Java.OctalIntegerLiteral +instance ToTags Java.PackageDeclaration +instance ToTags Java.ParenthesizedExpression +instance ToTags Java.Primary +instance ToTags Java.Program +instance ToTags Java.ReceiverParameter +instance ToTags Java.RequiresModifier +instance ToTags Java.Resource +instance ToTags Java.ResourceSpecification +instance ToTags Java.ReturnStatement +instance ToTags Java.ScopedIdentifier +instance ToTags Java.ScopedTypeIdentifier +instance ToTags Java.SimpleType +instance ToTags Java.SpreadParameter +instance ToTags Java.Statement +instance ToTags Java.StaticInitializer +instance ToTags Java.StringLiteral +instance ToTags Java.Super +instance ToTags Java.SuperInterfaces +instance ToTags Java.Superclass +instance ToTags Java.SwitchBlock +instance ToTags Java.SwitchLabel +instance ToTags Java.SwitchStatement +instance ToTags Java.SynchronizedStatement +instance ToTags Java.TernaryExpression +instance ToTags Java.This +instance ToTags Java.ThrowStatement +instance ToTags Java.Throws +instance ToTags Java.True +instance ToTags Java.TryStatement +instance ToTags Java.TryWithResourcesStatement +instance ToTags Java.Type +instance ToTags Java.TypeArguments +instance ToTags Java.TypeBound +instance ToTags Java.TypeIdentifier +instance ToTags Java.TypeParameter +instance ToTags Java.TypeParameters +instance ToTags Java.UnannotatedType +instance ToTags Java.UnaryExpression +instance ToTags Java.UpdateExpression +instance ToTags Java.VariableDeclarator +instance ToTags Java.VoidType +instance ToTags Java.WhileStatement +instance ToTags Java.Wildcard diff --git a/semantic-java/test/PreciseTest.hs b/semantic-java/test/PreciseTest.hs new file mode 100644 index 0000000000..860e666b22 --- /dev/null +++ b/semantic-java/test/PreciseTest.hs @@ -0,0 +1,36 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-unused-imports #-} +module Main + ( main, + ) +where + +import AST.TestHelpers +import AST.Unmarshal +import qualified Language.Java.AST as Java +import qualified System.Path.Fixture as Fixture +import Test.Tasty +import TreeSitter.Java + +main :: IO () +main = do +#if BAZEL_BUILD + rf <- Fixture.create + -- + let ?project = "external/tree-sitter-java" + ?runfiles = rf + let dirs = Fixture.absRelDir "corpus" +#else + dirs <- Java.getTestCorpusDir +#endif + readCorpusFiles' dirs + >>= traverse (testCorpus parse) + >>= defaultMain . tests + where + parse = parseByteString @Java.Program @() tree_sitter_java + +tests :: [TestTree] -> TestTree +tests = testGroup "tree-sitter-java corpus tests" diff --git a/semantic-json/BUILD.bazel b/semantic-json/BUILD.bazel new file mode 100644 index 0000000000..d06b757da7 --- /dev/null +++ b/semantic-json/BUILD.bazel @@ -0,0 +1,12 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "//:build/common.bzl", + "semantic_language_library", +) + +semantic_language_library( + name = "semantic-json", + srcs = glob(["src/**/*.hs"]), + language = "json", +) diff --git a/semantic-json/LICENSE b/semantic-json/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-json/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-json/README.md b/semantic-json/README.md new file mode 100644 index 0000000000..050464e60f --- /dev/null +++ b/semantic-json/README.md @@ -0,0 +1,18 @@ +# semantic-json + +Semantic support for JSON. + + +## Development + +This project consists of a Haskell package named `semantic-json`. The library’s sources are in [`src`][]. + +Development of `semantic-json` is typically done using `cabal v2-build`: + +```shell +cabal v2-build # build the library +cabal v2-repl # load the package into ghci +cabal v2-test # build and run the doctests +``` + +[`src`]: https://github.com/github/semantic/tree/master/semantic-json/src diff --git a/semantic-json/Setup.hs b/semantic-json/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-json/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-json/semantic-json.cabal b/semantic-json/semantic-json.cabal new file mode 100644 index 0000000000..7eec406a6d --- /dev/null +++ b/semantic-json/semantic-json.cabal @@ -0,0 +1,73 @@ +cabal-version: 2.4 + +name: semantic-json +version: 0.0.0.0 +synopsis: Semantic support for JSON +description: Semantic support for JSON. +homepage: https://github.com/github/semantic/tree/master/semantic-json#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + cpp-options: + -DBAZEL_BUILD=0 + +library + import: haskell + exposed-modules: + Language.JSON + Language.JSON.AST + Language.JSON.Grammar + hs-source-dirs: src + default-language: Haskell2010 + build-depends: + , base >= 4.13 && < 5 + , semantic-ast + , semantic-tags ^>= 0.0 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3 + , tree-sitter ^>= 0.9 + , tree-sitter-json ^>= 0.7.0.1 + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: PreciseTest.hs + build-depends: + , base + , semantic-ast + , semantic-json + , tasty diff --git a/semantic-json/src/Language/JSON.hs b/semantic-json/src/Language/JSON.hs new file mode 100644 index 0000000000..969f44e050 --- /dev/null +++ b/semantic-json/src/Language/JSON.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +-- | Semantic functionality for JSON programs. +module Language.JSON +( Term(..) +, TreeSitter.JSON.tree_sitter_json +) where + +import AST.Marshal.JSON +import Data.Proxy +import qualified Language.JSON.AST as JSON +import qualified Tags.Tagging.Precise as Tags +import qualified TreeSitter.JSON (tree_sitter_json) +import qualified AST.Unmarshal as TS + +newtype Term a = Term { getTerm :: JSON.Document a } + deriving MarshalJSON + +instance TS.SymbolMatching Term where + matchedSymbols _ = TS.matchedSymbols (Proxy :: Proxy JSON.Document) + showFailure _ = TS.showFailure (Proxy :: Proxy JSON.Document) + +instance TS.Unmarshal Term where + matchers = fmap (fmap (TS.hoist Term)) TS.matchers + +-- | Tags aren’t really meaningful for JSON, but by implementing this we can avoid having to customize the set of parsers used for computing tags. +instance Tags.ToTags Term where + tags _ _ = [] diff --git a/semantic-json/src/Language/JSON/AST.hs b/semantic-json/src/Language/JSON/AST.hs new file mode 100644 index 0000000000..48a6333b29 --- /dev/null +++ b/semantic-json/src/Language/JSON/AST.hs @@ -0,0 +1,606 @@ +-- Language definition for JSON, generated by ast-generate. Do not edit! +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Language.JSON.AST (module Language.JSON.AST, getTestCorpusDir) where + +import qualified AST.Parse +import qualified AST.Token +import qualified AST.Traversable1.Class +import qualified AST.Unmarshal +import qualified Data.Foldable +import qualified Data.List as Data.OldList +import qualified Data.Maybe as GHC.Maybe +import qualified Data.Text.Internal +import qualified Data.Traversable +import qualified GHC.Base +import qualified GHC.Generics +import qualified GHC.Records +import qualified GHC.Show +import TreeSitter.JSON (getTestCorpusDir) +import qualified TreeSitter.Node +import qualified Prelude as GHC.Classes + +debugSymbolNames :: [GHC.Base.String] +debugSymbolNames = debugSymbolNames_0 + +debugSymbolNames_0 :: [GHC.Base.String] +debugSymbolNames_0 = + [ "end", + "_{", + "_,", + "_}", + "_:", + "_[", + "_]", + "_\"", + "_string_content_token1", + "escape_sequence", + "number", + "true", + "false", + "null", + "document", + "_value", + "object", + "pair", + "array", + "string", + "string_content", + "_object_repeat1", + "_array_repeat1", + "_string_content_repeat1" + ] + +newtype Value a = Value {getValue :: ((Array GHC.Generics.:+: False GHC.Generics.:+: Null GHC.Generics.:+: Number GHC.Generics.:+: Object GHC.Generics.:+: String GHC.Generics.:+: True) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1. + AST.Traversable1.Class.Traversable1 a_1 + ) + +instance GHC.Records.HasField "ann" (Value a_2) a_2 where + getField = AST.Unmarshal.gann GHC.Base.. getValue + +deriving instance GHC.Classes.Eq a_3 => GHC.Classes.Eq (Value a_3) + +deriving instance GHC.Classes.Ord a_4 => GHC.Classes.Ord (Value a_4) + +deriving instance GHC.Show.Show a_5 => GHC.Show.Show (Value a_5) + +instance AST.Unmarshal.Unmarshal Value + +instance Data.Foldable.Foldable Value where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Value where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Value where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Array a = Array {ann :: a, extraChildren :: ([AST.Parse.Err (Value a)])} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_6. + AST.Traversable1.Class.Traversable1 a_6 + ) + +instance AST.Unmarshal.SymbolMatching Array where + matchedSymbols _ = [18] + showFailure _ node_7 = + "expected " + GHC.Base.<> ( "array" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_7 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_7) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_8 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_9 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_10 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_11 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_8 + c1_9 = TreeSitter.Node.nodeStartPoint node_7 + TreeSitter.Node.TSPoint + r2_10 + c2_11 = TreeSitter.Node.nodeEndPoint node_7 + +deriving instance GHC.Classes.Eq a_12 => GHC.Classes.Eq (Array a_12) + +deriving instance GHC.Classes.Ord a_13 => GHC.Classes.Ord (Array a_13) + +deriving instance GHC.Show.Show a_14 => GHC.Show.Show (Array a_14) + +instance AST.Unmarshal.Unmarshal Array + +instance Data.Foldable.Foldable Array where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Array where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Array where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Document a = Document {ann :: a, extraChildren :: (AST.Parse.Err (Value a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_15. + AST.Traversable1.Class.Traversable1 a_15 + ) + +instance AST.Unmarshal.SymbolMatching Document where + matchedSymbols _ = [14] + showFailure _ node_16 = + "expected " + GHC.Base.<> ( "document" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_16 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_16) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_17 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_18 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_19 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_20 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_17 + c1_18 = TreeSitter.Node.nodeStartPoint node_16 + TreeSitter.Node.TSPoint + r2_19 + c2_20 = TreeSitter.Node.nodeEndPoint node_16 + +deriving instance GHC.Classes.Eq a_21 => GHC.Classes.Eq (Document a_21) + +deriving instance GHC.Classes.Ord a_22 => GHC.Classes.Ord (Document a_22) + +deriving instance GHC.Show.Show a_23 => GHC.Show.Show (Document a_23) + +instance AST.Unmarshal.Unmarshal Document + +instance Data.Foldable.Foldable Document where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Document where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Document where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Object a = Object {ann :: a, extraChildren :: ([AST.Parse.Err (Pair a)])} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_24. + AST.Traversable1.Class.Traversable1 a_24 + ) + +instance AST.Unmarshal.SymbolMatching Object where + matchedSymbols _ = [16] + showFailure _ node_25 = + "expected " + GHC.Base.<> ( "object" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_25 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_25) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_26 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_27 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_28 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_29 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_26 + c1_27 = TreeSitter.Node.nodeStartPoint node_25 + TreeSitter.Node.TSPoint + r2_28 + c2_29 = TreeSitter.Node.nodeEndPoint node_25 + +deriving instance GHC.Classes.Eq a_30 => GHC.Classes.Eq (Object a_30) + +deriving instance GHC.Classes.Ord a_31 => GHC.Classes.Ord (Object a_31) + +deriving instance GHC.Show.Show a_32 => GHC.Show.Show (Object a_32) + +instance AST.Unmarshal.Unmarshal Object + +instance Data.Foldable.Foldable Object where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Object where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Object where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Pair a = Pair + { ann :: a, + value :: (AST.Parse.Err (Value a)), + key :: (AST.Parse.Err ((Number GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_33. + AST.Traversable1.Class.Traversable1 a_33 + ) + +instance AST.Unmarshal.SymbolMatching Pair where + matchedSymbols _ = [17] + showFailure _ node_34 = + "expected " + GHC.Base.<> ( "pair" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_34 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_34) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_35 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_36 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_37 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_38 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_35 + c1_36 = TreeSitter.Node.nodeStartPoint node_34 + TreeSitter.Node.TSPoint + r2_37 + c2_38 = TreeSitter.Node.nodeEndPoint node_34 + +deriving instance GHC.Classes.Eq a_39 => GHC.Classes.Eq (Pair a_39) + +deriving instance GHC.Classes.Ord a_40 => GHC.Classes.Ord (Pair a_40) + +deriving instance GHC.Show.Show a_41 => GHC.Show.Show (Pair a_41) + +instance AST.Unmarshal.Unmarshal Pair + +instance Data.Foldable.Foldable Pair where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Pair where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Pair where + traverse = AST.Traversable1.Class.traverseDefault1 + +data String a = String + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (StringContent a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_42. + AST.Traversable1.Class.Traversable1 a_42 + ) + +instance AST.Unmarshal.SymbolMatching String where + matchedSymbols _ = [19] + showFailure _ node_43 = + "expected " + GHC.Base.<> ( "string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_43 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_43) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_44 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_45 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_46 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_47 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_44 + c1_45 = TreeSitter.Node.nodeStartPoint node_43 + TreeSitter.Node.TSPoint + r2_46 + c2_47 = TreeSitter.Node.nodeEndPoint node_43 + +deriving instance GHC.Classes.Eq a_48 => GHC.Classes.Eq (String a_48) + +deriving instance GHC.Classes.Ord a_49 => GHC.Classes.Ord (String a_49) + +deriving instance GHC.Show.Show a_50 => GHC.Show.Show (String a_50) + +instance AST.Unmarshal.Unmarshal String + +instance Data.Foldable.Foldable String where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor String where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable String where + traverse = AST.Traversable1.Class.traverseDefault1 + +data StringContent a = StringContent + { ann :: a, + extraChildren :: ([AST.Parse.Err (EscapeSequence a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_51. + AST.Traversable1.Class.Traversable1 a_51 + ) + +instance AST.Unmarshal.SymbolMatching StringContent where + matchedSymbols _ = [20] + showFailure _ node_52 = + "expected " + GHC.Base.<> ( "string_content" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_52 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_52) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_53 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_54 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_55 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_56 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_53 + c1_54 = TreeSitter.Node.nodeStartPoint node_52 + TreeSitter.Node.TSPoint + r2_55 + c2_56 = TreeSitter.Node.nodeEndPoint node_52 + +deriving instance GHC.Classes.Eq a_57 => GHC.Classes.Eq (StringContent a_57) + +deriving instance GHC.Classes.Ord a_58 => GHC.Classes.Ord (StringContent a_58) + +deriving instance GHC.Show.Show a_59 => GHC.Show.Show (StringContent a_59) + +instance AST.Unmarshal.Unmarshal StringContent + +instance Data.Foldable.Foldable StringContent where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StringContent where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StringContent where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousDQuote = AST.Token.Token "\"" 7 + +type AnonymousComma = AST.Token.Token "," 2 + +type AnonymousColon = AST.Token.Token ":" 4 + +type AnonymousLBracket = AST.Token.Token "[" 5 + +type AnonymousRBracket = AST.Token.Token "]" 6 + +data EscapeSequence a = EscapeSequence {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_60. + AST.Traversable1.Class.Traversable1 a_60 + ) + +instance AST.Unmarshal.SymbolMatching EscapeSequence where + matchedSymbols _ = [9] + showFailure _ node_61 = + "expected " + GHC.Base.<> ( "escape_sequence" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_61 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_61) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_62 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_63 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_64 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_65 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_62 + c1_63 = TreeSitter.Node.nodeStartPoint node_61 + TreeSitter.Node.TSPoint + r2_64 + c2_65 = TreeSitter.Node.nodeEndPoint node_61 + +deriving instance GHC.Classes.Eq a_66 => GHC.Classes.Eq (EscapeSequence a_66) + +deriving instance GHC.Classes.Ord a_67 => GHC.Classes.Ord (EscapeSequence a_67) + +deriving instance GHC.Show.Show a_68 => GHC.Show.Show (EscapeSequence a_68) + +instance AST.Unmarshal.Unmarshal EscapeSequence + +instance Data.Foldable.Foldable EscapeSequence where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EscapeSequence where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EscapeSequence where + traverse = AST.Traversable1.Class.traverseDefault1 + +data False a = False {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_69. + AST.Traversable1.Class.Traversable1 a_69 + ) + +instance AST.Unmarshal.SymbolMatching False where + matchedSymbols _ = [12] + showFailure _ node_70 = + "expected " + GHC.Base.<> ( "false" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_70 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_70) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_71 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_72 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_73 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_74 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_71 + c1_72 = TreeSitter.Node.nodeStartPoint node_70 + TreeSitter.Node.TSPoint + r2_73 + c2_74 = TreeSitter.Node.nodeEndPoint node_70 + +deriving instance GHC.Classes.Eq a_75 => GHC.Classes.Eq (False a_75) + +deriving instance GHC.Classes.Ord a_76 => GHC.Classes.Ord (False a_76) + +deriving instance GHC.Show.Show a_77 => GHC.Show.Show (False a_77) + +instance AST.Unmarshal.Unmarshal False + +instance Data.Foldable.Foldable False where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor False where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable False where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Null a = Null {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_78. + AST.Traversable1.Class.Traversable1 a_78 + ) + +instance AST.Unmarshal.SymbolMatching Null where + matchedSymbols _ = [13] + showFailure _ node_79 = + "expected " + GHC.Base.<> ( "null" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_79 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_79) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_80 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_81 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_82 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_83 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_80 + c1_81 = TreeSitter.Node.nodeStartPoint node_79 + TreeSitter.Node.TSPoint + r2_82 + c2_83 = TreeSitter.Node.nodeEndPoint node_79 + +deriving instance GHC.Classes.Eq a_84 => GHC.Classes.Eq (Null a_84) + +deriving instance GHC.Classes.Ord a_85 => GHC.Classes.Ord (Null a_85) + +deriving instance GHC.Show.Show a_86 => GHC.Show.Show (Null a_86) + +instance AST.Unmarshal.Unmarshal Null + +instance Data.Foldable.Foldable Null where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Null where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Null where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Number a = Number {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_87. + AST.Traversable1.Class.Traversable1 a_87 + ) + +instance AST.Unmarshal.SymbolMatching Number where + matchedSymbols _ = [10] + showFailure _ node_88 = + "expected " + GHC.Base.<> ( "number" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_88 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_88) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_89 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_90 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_91 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_92 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_89 + c1_90 = TreeSitter.Node.nodeStartPoint node_88 + TreeSitter.Node.TSPoint + r2_91 + c2_92 = TreeSitter.Node.nodeEndPoint node_88 + +deriving instance GHC.Classes.Eq a_93 => GHC.Classes.Eq (Number a_93) + +deriving instance GHC.Classes.Ord a_94 => GHC.Classes.Ord (Number a_94) + +deriving instance GHC.Show.Show a_95 => GHC.Show.Show (Number a_95) + +instance AST.Unmarshal.Unmarshal Number + +instance Data.Foldable.Foldable Number where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Number where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Number where + traverse = AST.Traversable1.Class.traverseDefault1 + +data True a = True {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_96. + AST.Traversable1.Class.Traversable1 a_96 + ) + +instance AST.Unmarshal.SymbolMatching True where + matchedSymbols _ = [11] + showFailure _ node_97 = + "expected " + GHC.Base.<> ( "true" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_97 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_97) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_98 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_99 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_100 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_101 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_98 + c1_99 = TreeSitter.Node.nodeStartPoint node_97 + TreeSitter.Node.TSPoint + r2_100 + c2_101 = TreeSitter.Node.nodeEndPoint node_97 + +deriving instance GHC.Classes.Eq a_102 => GHC.Classes.Eq (True a_102) + +deriving instance GHC.Classes.Ord a_103 => GHC.Classes.Ord (True a_103) + +deriving instance GHC.Show.Show a_104 => GHC.Show.Show (True a_104) + +instance AST.Unmarshal.Unmarshal True + +instance Data.Foldable.Foldable True where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor True where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable True where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousLBrace = AST.Token.Token "{" 1 + +type AnonymousRBrace = AST.Token.Token "}" 3 + diff --git a/semantic-json/src/Language/JSON/Grammar.hs b/semantic-json/src/Language/JSON/Grammar.hs new file mode 100644 index 0000000000..726972c555 --- /dev/null +++ b/semantic-json/src/Language/JSON/Grammar.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} +module Language.JSON.Grammar +( tree_sitter_json +, Grammar(..) +) where + +import AST.Grammar.TH +import Language.Haskell.TH +import TreeSitter.JSON (tree_sitter_json) + +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData (mkName "Grammar") tree_sitter_json diff --git a/semantic-json/test/PreciseTest.hs b/semantic-json/test/PreciseTest.hs new file mode 100644 index 0000000000..4fd7f01b8f --- /dev/null +++ b/semantic-json/test/PreciseTest.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +module Main (main) where + +import AST.TestHelpers +import AST.Unmarshal +import qualified Language.JSON.AST as JSON +import Language.JSON.Grammar +import Test.Tasty + +main :: IO () +main = do +#if BAZEL_BUILD + rf <- Fixture.create + let ?project = "external/semantic-json" + ?runfiles = rf + let dirs = Fixture.absRelDir "corpus" +#else + dirs <- JSON.getTestCorpusDir +#endif + readCorpusFiles' dirs + >>= traverse (testCorpus parse) + >>= defaultMain . tests + where parse = parseByteString @(JSON.Document) @() tree_sitter_json + +tests :: [TestTree] -> TestTree +tests = testGroup "tree-sitter-json corpus tests" diff --git a/semantic-parse/BUILD.bazel b/semantic-parse/BUILD.bazel new file mode 100644 index 0000000000..b487a1dcda --- /dev/null +++ b/semantic-parse/BUILD.bazel @@ -0,0 +1,28 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_binary", +) +load( + "//:build/common.bzl", + "GHC_FLAGS", +) + +haskell_binary( + name = "exe", + srcs = ["app/Main.hs"], + compiler_flags = GHC_FLAGS, + deps = [ + "//:base", + "//:bytestring", + "//:text", + "//semantic-ast", + "//semantic-python", + "//semantic-source", + "@stackage//:aeson", + "@stackage//:aeson-pretty", + "@stackage//:optparse-applicative", + "@stackage//:pretty-simple", + ], +) diff --git a/semantic-parse/CHANGELOG.md b/semantic-parse/CHANGELOG.md new file mode 100644 index 0000000000..ee89a5d7d0 --- /dev/null +++ b/semantic-parse/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for semantic-parse + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/semantic-parse/LICENSE b/semantic-parse/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-parse/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-parse/README.md b/semantic-parse/README.md new file mode 100644 index 0000000000..04be8e6b71 --- /dev/null +++ b/semantic-parse/README.md @@ -0,0 +1,29 @@ +# semantic-parse + +This package provides a command line tool that will output ASTs in supported formats. + +#### CLI + +To output ASTs, run the `semantic-parse` command, specifying two mandatory options: 1) the format you'd like to return (ex., `Show`, `JSON`, etc.) and 2) the option specifying whether the source code will be passed in directly via command line (using `--sourceString`) or via providing the file path `--sourceFile`. + +Filepath: +``` +semantic-parse --format [FORMAT] --sourceFile [FILEPATH] +``` + +Source string: +``` +semantic-parse --format [FORMAT] --sourceString [SOURCE] +``` + +An example command is: + +``` +semantic-parse -- --format Show --sourceString "a" +``` + +This will generate an AST + +``` +Right (Module {ann = (Range {start = 0, end = 1},Span {start = Pos {line = 0, column = 0}, end = Pos {line = 0, column = 1}}), extraChildren = [R1 (ExpressionStatementSimpleStatement (ExpressionStatement {ann = (Range {start = 0, end = 1},Span {start = Pos {line = 0, column = 0}, end = Pos {line = 0, column = 1}}), extraChildren = L1 (PrimaryExpressionExpression (IdentifierPrimaryExpression (Identifier {ann = (Range {start = 0, end = 1},Span {start = Pos {line = 0, column = 0}, end = Pos {line = 0, column = 1}}), bytes = "a"}))) :| []}))]}) +``` diff --git a/semantic-parse/Setup.hs b/semantic-parse/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-parse/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-parse/app/Main.hs b/semantic-parse/app/Main.hs new file mode 100644 index 0000000000..475b6ec97a --- /dev/null +++ b/semantic-parse/app/Main.hs @@ -0,0 +1,75 @@ +{-# LANGUAGE TypeApplications #-} + +module Main (main) where + +import AST.Unmarshal +import qualified Language.Python.AST as AST +import qualified Language.Python.Grammar as Python +import Source.Range +import Source.Span +import Data.Aeson (toJSON) +import Data.ByteString.Char8 +import Data.ByteString (readFile) +import Options.Applicative hiding (style) +import Text.Pretty.Simple (pPrint, pPrintNoColor) +import Data.Foldable (traverse_) +import Control.Monad ((>=>)) +import AST.Marshal.JSON (marshal) +import Data.ByteString.Lazy.Char8 (putStrLn) +import Data.Aeson.Encode.Pretty (encodePretty) + +data SemanticAST = SemanticAST + { _format :: Format + , _noColor :: Bool + , _source :: Either [FilePath] String + } + +-- Usage: semantic-parse --format ARG [--no-color] (--sourceString STRING | FILEPATHS…) +parseAST :: Parser SemanticAST +parseAST = SemanticAST + <$> option auto + ( long "format" + <> help "Specify desired output: show, json, sexpression" ) + <*> switch + ( long "no-color" + <> help "Print with color: --color" + ) + <*> (Left <$> some + (Options.Applicative.argument str (metavar "FILEPATH(S)")) + <|> Right <$> strOption + ( long "sourceString" + <> metavar "STRING" + <> help "Specify source input to parse" + )) + + +main :: IO () +main = generateAST =<< execParser opts + + +generateAST :: SemanticAST -> IO () +generateAST (SemanticAST format noColor source) = + getByteStrings >>= traverse_ go + where getByteStrings = case source of + Left filePaths -> traverse Data.ByteString.readFile filePaths + Right source -> pure [Data.ByteString.Char8.pack source] + go = ast >=> display + ast = parseByteString @AST.Module @(Range, Span) Python.tree_sitter_python -- TODO: generalize for all languages + display = case format of + Json -> Data.ByteString.Lazy.Char8.putStrLn . encodePretty . either toJSON (marshal . fmap (const ())) -- TODO: replacing range and span annotations with () for which there is a ToJSON instance for now, deal with this later + Show -> print + Pretty | noColor -> pPrintNoColor + | otherwise -> pPrint + + +opts :: ParserInfo SemanticAST +opts = info (parseAST <**> helper) + ( fullDesc + <> progDesc "Parse source code and produce an AST" + <> header "semantic-parse is a package used to parse source code" ) + +-- TODO: Define formats for json, sexpression, etc. +data Format = Show + | Pretty + | Json + deriving (Read) diff --git a/semantic-parse/semantic-parse.cabal b/semantic-parse/semantic-parse.cabal new file mode 100644 index 0000000000..0b54cfed19 --- /dev/null +++ b/semantic-parse/semantic-parse.cabal @@ -0,0 +1,61 @@ +cabal-version: 2.4 +-- Initial package description 'semantic-ast.cabal' generated by 'cabal +-- init'. For further documentation, see +-- http://haskell.org/cabal/users-guide/ + +name: semantic-parse +version: 0.1.0.0 +-- synopsis: +-- description: +-- bug-reports: +license: MIT +license-file: LICENSE +author: The Semantic Authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +extra-source-files: CHANGELOG.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + +executable semantic-parse + import: haskell + main-is: Main.hs + -- other-modules: + -- other-extensions: + build-depends: + , aeson + , aeson-pretty + , base + , bytestring + , optparse-applicative + , pretty-simple + , semantic-ast + , semantic-python + , semantic-source ^>= 0.2 + hs-source-dirs: app + default-language: Haskell2010 diff --git a/semantic-php/BUILD.bazel b/semantic-php/BUILD.bazel new file mode 100644 index 0000000000..90399eaa93 --- /dev/null +++ b/semantic-php/BUILD.bazel @@ -0,0 +1,12 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "//:build/common.bzl", + "semantic_language_library", +) + +semantic_language_library( + name = "semantic-php", + srcs = glob(["src/**/*.hs"]), + language = "php", +) diff --git a/semantic-php/CHANGELOG.md b/semantic-php/CHANGELOG.md new file mode 100644 index 0000000000..f80128fc09 --- /dev/null +++ b/semantic-php/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for semantic-php + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/semantic-php/LICENSE b/semantic-php/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-php/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-php/README.md b/semantic-php/README.md new file mode 100644 index 0000000000..c73176d184 --- /dev/null +++ b/semantic-php/README.md @@ -0,0 +1,3 @@ +# Semantic support for PHP + +This package implements `semantic` support for PHP. diff --git a/semantic-php/Setup.hs b/semantic-php/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-php/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-php/semantic-php.cabal b/semantic-php/semantic-php.cabal new file mode 100644 index 0000000000..f79f7e9050 --- /dev/null +++ b/semantic-php/semantic-php.cabal @@ -0,0 +1,63 @@ +cabal-version: 2.4 + +name: semantic-php +version: 0.0.0.0 +synopsis: Semantic support for PHP. +description: Semantic support for PHP. +homepage: https://github.com/github/semantic/tree/master/semantic-php#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + +library + import: haskell + exposed-modules: + Language.PHP + Language.PHP.AST + Language.PHP.Grammar + Language.PHP.Tags + hs-source-dirs: src + build-depends: + , base >= 4.13 && < 5 + , fused-effects ^>= 1.1 + , semantic-ast + , semantic-proto ^>= 0 + , semantic-source ^>= 0.2 + , semantic-tags ^>= 0.0 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3 + , tree-sitter ^>= 0.9 + , tree-sitter-php ^>= 0.5.0.0 diff --git a/semantic-php/src/Language/PHP.hs b/semantic-php/src/Language/PHP.hs new file mode 100644 index 0000000000..6be60fe224 --- /dev/null +++ b/semantic-php/src/Language/PHP.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +-- | Semantic functionality for PHP programs. +module Language.PHP +( Term(..) +, TreeSitter.PHP.tree_sitter_php +) where + +import AST.Marshal.JSON +import qualified AST.Unmarshal as TS +import Data.Proxy +import qualified Language.PHP.AST as PHP +import qualified Language.PHP.Tags as PHPTags +import qualified Tags.Tagging.Precise as Tags +import qualified TreeSitter.PHP (tree_sitter_php) + +newtype Term a = Term { getTerm :: PHP.Program a } + deriving MarshalJSON + +instance TS.SymbolMatching Term where + matchedSymbols _ = TS.matchedSymbols (Proxy :: Proxy PHP.Program) + showFailure _ = TS.showFailure (Proxy :: Proxy PHP.Program) + +instance TS.Unmarshal Term where + matchers = fmap (fmap (TS.hoist Term)) TS.matchers + +instance Tags.ToTags Term where + tags src = Tags.runTagging src . PHPTags.tags . getTerm diff --git a/semantic-php/src/Language/PHP/AST.hs b/semantic-php/src/Language/PHP/AST.hs new file mode 100644 index 0000000000..84aecb5097 --- /dev/null +++ b/semantic-php/src/Language/PHP/AST.hs @@ -0,0 +1,6257 @@ +-- Language definition for PHP, generated by ast-generate. Do not edit! +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Language.PHP.AST (module Language.PHP.AST) where + +import qualified AST.Parse +import qualified AST.Token +import qualified AST.Traversable1.Class +import qualified AST.Unmarshal +import qualified Data.Foldable +import qualified Data.List as Data.OldList +import qualified Data.Maybe as GHC.Maybe +import qualified Data.Text.Internal +import qualified Data.Traversable +import qualified GHC.Base +import qualified GHC.Generics +import qualified GHC.Records +import qualified GHC.Show +import qualified TreeSitter.Node +import qualified Prelude as GHC.Classes + +debugSymbolNames :: [GHC.Base.String] +debugSymbolNames = debugSymbolNames_0 + +debugSymbolNames_0 :: [GHC.Base.String] +debugSymbolNames_0 = + [ "end", + "name", + "php_tag", + "_?>", + "_text_token1", + "_text_token2", + "_;", + "_static", + "_,", + "_=", + "_global", + "_namespace", + "_use", + "_\\", + "_function", + "_const", + "_as", + "_{", + "_}", + "_trait", + "_interface", + "_extends", + "_class", + "_abstract", + "_final", + "_implements", + "var_modifier", + "_insteadof", + "_public", + "_protected", + "_private", + "_&", + "_(", + "_)", + "_...", + "_?", + "_array", + "_callable", + "_iterable", + "_bool", + "_float", + "_int", + "_string", + "_void", + "_binary", + "_boolean", + "_double", + "_integer", + "_object", + "_real", + "_unset", + "_:", + "_echo", + "_declare", + "_enddeclare", + "_ticks", + "_encoding", + "_strict_types", + "float", + "_try", + "_catch", + "_finally", + "_goto", + "_continue", + "_break", + "integer", + "_return", + "_throw", + "_while", + "_endwhile", + "_do", + "_for", + "_endfor", + "_foreach", + "_endforeach", + "_=>", + "_if", + "_endif", + "_elseif", + "_else", + "_switch", + "_endswitch", + "_case", + "_default", + "_@", + "_+", + "_-", + "_~", + "_!", + "_**", + "_clone", + "_::", + "_print", + "_new", + "_++", + "_--", + "shell_command_expression", + "_**=", + "_*=", + "_/=", + "_%=", + "_+=", + "_-=", + "_.=", + "_<<=", + "_>>=", + "_&=", + "_^=", + "_|=", + "_->", + "_list", + "_self", + "_parent", + "_[", + "_]", + "string", + "boolean", + "null", + "_$", + "_yield", + "_from", + "_instanceof", + "_??", + "_and", + "_or", + "_xor", + "_||", + "_&&", + "_|", + "_^", + "_==", + "_!=", + "_<>", + "_===", + "_!==", + "_<", + "_>", + "_<=", + "_>=", + "_<=>", + "_<<", + "_>>", + "_.", + "_*", + "_/", + "_%", + "_include", + "_include_once", + "_require", + "_require_once", + "comment", + "_automatic_semicolon", + "heredoc", + "_eof", + "program", + "text_interpolation", + "text", + "empty_statement", + "function_static_declaration", + "static_variable_declaration", + "global_declaration", + "namespace_definition", + "namespace_use_declaration", + "namespace_function_or_const", + "namespace_use_clause", + "qualified_name", + "namespace_name_as_prefix", + "namespace_name", + "namespace_aliasing_clause", + "namespace_use_group", + "namespace_use_group_clause", + "trait_declaration", + "interface_declaration", + "interface_base_clause", + "class_declaration", + "declaration_list", + "class_modifier", + "class_base_clause", + "class_interface_clause", + "_member_declaration", + "const_declaration", + "property_declaration", + "_modifier", + "property_element", + "property_initializer", + "method_declaration", + "static_modifier", + "use_declaration", + "use_list", + "use_instead_of_clause", + "use_as_clause", + "visibility_modifier", + "function_definition", + "_function_definition_header", + "formal_parameters", + "simple_parameter", + "variadic_parameter", + "_type", + "optional_type", + "primitive_type", + "cast_type", + "_return_type", + "const_element", + "echo_statement", + "unset_statement", + "declare_statement", + "declare_directive", + "try_statement", + "catch_clause", + "finally_clause", + "_jump_statement", + "goto_statement", + "continue_statement", + "break_statement", + "return_statement", + "throw_statement", + "while_statement", + "do_statement", + "for_statement", + "_expressions", + "sequence_expression", + "foreach_statement", + "pair", + "if_statement", + "colon_block", + "else_if_clause", + "else_clause", + "else_if_clause", + "else_clause", + "switch_statement", + "switch_block", + "case_statement", + "default_statement", + "compound_statement", + "named_label_statement", + "expression_statement", + "_expression", + "_unary_expression", + "unary_op_expression", + "exponentiation_expression", + "clone_expression", + "_primary_expression", + "parenthesized_expression", + "class_constant_access_expression", + "print_intrinsic", + "anonymous_function_creation_expression", + "anonymous_function_use_clause", + "object_creation_expression", + "update_expression", + "cast_expression", + "cast_expression", + "assignment_expression", + "conditional_expression", + "augmented_assignment_expression", + "member_access_expression", + "scoped_property_access_expression", + "list_literal", + "function_call_expression", + "scoped_call_expression", + "_scope_resolution_qualifier", + "relative_scope", + "arguments", + "member_call_expression", + "variadic_unpacking", + "subscript_expression", + "_dereferencable_expression", + "array_creation_expression", + "_string", + "dynamic_variable_name", + "variable_name", + "yield_expression", + "array_element_initializer", + "binary_expression", + "include_expression", + "include_once_expression", + "require_expression", + "require_once_expression", + "name", + "_program_repeat1", + "_text_repeat1", + "_function_static_declaration_repeat1", + "_global_declaration_repeat1", + "_namespace_use_declaration_repeat1", + "_namespace_name_repeat1", + "_namespace_use_group_repeat1", + "_interface_base_clause_repeat1", + "_declaration_list_repeat1", + "_const_declaration_repeat1", + "_property_declaration_repeat1", + "_property_declaration_repeat2", + "_use_list_repeat1", + "_formal_parameters_repeat1", + "_unset_statement_repeat1", + "_try_statement_repeat1", + "_if_statement_repeat1", + "_if_statement_repeat2", + "_switch_block_repeat1", + "_anonymous_function_use_clause_repeat1", + "_list_literal_repeat1", + "_arguments_repeat1", + "_array_creation_expression_repeat1", + "type_name" + ] + +newtype Expression a = Expression {getExpression :: ((PrimaryExpression GHC.Generics.:+: AssignmentExpression GHC.Generics.:+: AugmentedAssignmentExpression GHC.Generics.:+: BinaryExpression GHC.Generics.:+: CastExpression GHC.Generics.:+: CloneExpression GHC.Generics.:+: ConditionalExpression GHC.Generics.:+: ExponentiationExpression GHC.Generics.:+: IncludeExpression GHC.Generics.:+: IncludeOnceExpression GHC.Generics.:+: RequireExpression GHC.Generics.:+: RequireOnceExpression GHC.Generics.:+: UnaryOpExpression GHC.Generics.:+: YieldExpression) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1. + AST.Traversable1.Class.Traversable1 a_1 + ) + +instance GHC.Records.HasField "ann" (Expression a_2) a_2 where + getField = AST.Unmarshal.gann GHC.Base.. getExpression + +deriving instance GHC.Classes.Eq a_3 => GHC.Classes.Eq (Expression a_3) + +deriving instance GHC.Classes.Ord a_4 => GHC.Classes.Ord (Expression a_4) + +deriving instance GHC.Show.Show a_5 => GHC.Show.Show (Expression a_5) + +instance AST.Unmarshal.Unmarshal Expression + +instance Data.Foldable.Foldable Expression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Expression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Expression where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Literal a = Literal {getLiteral :: ((Boolean GHC.Generics.:+: Float GHC.Generics.:+: Heredoc GHC.Generics.:+: Integer GHC.Generics.:+: Null GHC.Generics.:+: String) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_6. + AST.Traversable1.Class.Traversable1 a_6 + ) + +instance GHC.Records.HasField "ann" (Literal a_7) a_7 where + getField = AST.Unmarshal.gann GHC.Base.. getLiteral + +deriving instance GHC.Classes.Eq a_8 => GHC.Classes.Eq (Literal a_8) + +deriving instance GHC.Classes.Ord a_9 => GHC.Classes.Ord (Literal a_9) + +deriving instance GHC.Show.Show a_10 => GHC.Show.Show (Literal a_10) + +instance AST.Unmarshal.Unmarshal Literal + +instance Data.Foldable.Foldable Literal where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Literal where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Literal where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype PrimaryExpression a = PrimaryExpression {getPrimaryExpression :: ((Literal GHC.Generics.:+: AnonymousFunctionCreationExpression GHC.Generics.:+: ArrayCreationExpression GHC.Generics.:+: CastExpression GHC.Generics.:+: ClassConstantAccessExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ObjectCreationExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: PrintIntrinsic GHC.Generics.:+: QualifiedName GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: ShellCommandExpression GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: UpdateExpression GHC.Generics.:+: VariableName) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_11. + AST.Traversable1.Class.Traversable1 a_11 + ) + +instance GHC.Records.HasField "ann" (PrimaryExpression a_12) a_12 where + getField = AST.Unmarshal.gann GHC.Base.. getPrimaryExpression + +deriving instance GHC.Classes.Eq a_13 => GHC.Classes.Eq (PrimaryExpression a_13) + +deriving instance GHC.Classes.Ord a_14 => GHC.Classes.Ord (PrimaryExpression a_14) + +deriving instance GHC.Show.Show a_15 => GHC.Show.Show (PrimaryExpression a_15) + +instance AST.Unmarshal.Unmarshal PrimaryExpression + +instance Data.Foldable.Foldable PrimaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PrimaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PrimaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Statement a = Statement {getStatement :: ((BreakStatement GHC.Generics.:+: ClassDeclaration GHC.Generics.:+: CompoundStatement GHC.Generics.:+: ConstDeclaration GHC.Generics.:+: ContinueStatement GHC.Generics.:+: DeclareStatement GHC.Generics.:+: DoStatement GHC.Generics.:+: EchoStatement GHC.Generics.:+: EmptyStatement GHC.Generics.:+: ExpressionStatement GHC.Generics.:+: ForStatement GHC.Generics.:+: ForeachStatement GHC.Generics.:+: FunctionDefinition GHC.Generics.:+: FunctionStaticDeclaration GHC.Generics.:+: GlobalDeclaration GHC.Generics.:+: GotoStatement GHC.Generics.:+: IfStatement GHC.Generics.:+: InterfaceDeclaration GHC.Generics.:+: NamedLabelStatement GHC.Generics.:+: NamespaceDefinition GHC.Generics.:+: NamespaceUseDeclaration GHC.Generics.:+: ReturnStatement GHC.Generics.:+: SwitchStatement GHC.Generics.:+: ThrowStatement GHC.Generics.:+: TraitDeclaration GHC.Generics.:+: TryStatement GHC.Generics.:+: UnsetStatement GHC.Generics.:+: WhileStatement) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_16. + AST.Traversable1.Class.Traversable1 a_16 + ) + +instance GHC.Records.HasField "ann" (Statement a_17) a_17 where + getField = AST.Unmarshal.gann GHC.Base.. getStatement + +deriving instance GHC.Classes.Eq a_18 => GHC.Classes.Eq (Statement a_18) + +deriving instance GHC.Classes.Ord a_19 => GHC.Classes.Ord (Statement a_19) + +deriving instance GHC.Show.Show a_20 => GHC.Show.Show (Statement a_20) + +instance AST.Unmarshal.Unmarshal Statement + +instance Data.Foldable.Foldable Statement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Statement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Statement where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Type a = Type {getType :: ((OptionalType GHC.Generics.:+: PrimitiveType GHC.Generics.:+: TypeName) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_21. + AST.Traversable1.Class.Traversable1 a_21 + ) + +instance GHC.Records.HasField "ann" (Type a_22) a_22 where + getField = AST.Unmarshal.gann GHC.Base.. getType + +deriving instance GHC.Classes.Eq a_23 => GHC.Classes.Eq (Type a_23) + +deriving instance GHC.Classes.Ord a_24 => GHC.Classes.Ord (Type a_24) + +deriving instance GHC.Show.Show a_25 => GHC.Show.Show (Type a_25) + +instance AST.Unmarshal.Unmarshal Type + +instance Data.Foldable.Foldable Type where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Type where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Type where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AnonymousFunctionCreationExpression a = AnonymousFunctionCreationExpression + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (Type a))), + body :: (AST.Parse.Err (CompoundStatement a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (AnonymousFunctionUseClause a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_26. + AST.Traversable1.Class.Traversable1 a_26 + ) + +instance AST.Unmarshal.SymbolMatching AnonymousFunctionCreationExpression where + matchedSymbols _ = [245] + showFailure _ node_27 = + "expected " + GHC.Base.<> ( "anonymous_function_creation_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_27 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_27) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_28 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_29 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_30 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_31 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_28 + c1_29 = TreeSitter.Node.nodeStartPoint node_27 + TreeSitter.Node.TSPoint + r2_30 + c2_31 = TreeSitter.Node.nodeEndPoint node_27 + +deriving instance GHC.Classes.Eq a_32 => GHC.Classes.Eq (AnonymousFunctionCreationExpression a_32) + +deriving instance GHC.Classes.Ord a_33 => GHC.Classes.Ord (AnonymousFunctionCreationExpression a_33) + +deriving instance GHC.Show.Show a_34 => GHC.Show.Show (AnonymousFunctionCreationExpression a_34) + +instance AST.Unmarshal.Unmarshal AnonymousFunctionCreationExpression + +instance Data.Foldable.Foldable AnonymousFunctionCreationExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AnonymousFunctionCreationExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AnonymousFunctionCreationExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AnonymousFunctionUseClause a = AnonymousFunctionUseClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (VariableName a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_35. + AST.Traversable1.Class.Traversable1 a_35 + ) + +instance AST.Unmarshal.SymbolMatching AnonymousFunctionUseClause where + matchedSymbols _ = [246] + showFailure _ node_36 = + "expected " + GHC.Base.<> ( "anonymous_function_use_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_36 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_36) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_37 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_38 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_39 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_40 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_37 + c1_38 = TreeSitter.Node.nodeStartPoint node_36 + TreeSitter.Node.TSPoint + r2_39 + c2_40 = TreeSitter.Node.nodeEndPoint node_36 + +deriving instance GHC.Classes.Eq a_41 => GHC.Classes.Eq (AnonymousFunctionUseClause a_41) + +deriving instance GHC.Classes.Ord a_42 => GHC.Classes.Ord (AnonymousFunctionUseClause a_42) + +deriving instance GHC.Show.Show a_43 => GHC.Show.Show (AnonymousFunctionUseClause a_43) + +instance AST.Unmarshal.Unmarshal AnonymousFunctionUseClause + +instance Data.Foldable.Foldable AnonymousFunctionUseClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AnonymousFunctionUseClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AnonymousFunctionUseClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Arguments a = Arguments + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: VariadicUnpacking) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_44. + AST.Traversable1.Class.Traversable1 a_44 + ) + +instance AST.Unmarshal.SymbolMatching Arguments where + matchedSymbols _ = [261] + showFailure _ node_45 = + "expected " + GHC.Base.<> ( "arguments" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_45 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_45) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_46 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_47 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_48 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_49 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_46 + c1_47 = TreeSitter.Node.nodeStartPoint node_45 + TreeSitter.Node.TSPoint + r2_48 + c2_49 = TreeSitter.Node.nodeEndPoint node_45 + +deriving instance GHC.Classes.Eq a_50 => GHC.Classes.Eq (Arguments a_50) + +deriving instance GHC.Classes.Ord a_51 => GHC.Classes.Ord (Arguments a_51) + +deriving instance GHC.Show.Show a_52 => GHC.Show.Show (Arguments a_52) + +instance AST.Unmarshal.Unmarshal Arguments + +instance Data.Foldable.Foldable Arguments where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Arguments where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Arguments where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayCreationExpression a = ArrayCreationExpression + { ann :: a, + extraChildren :: ([AST.Parse.Err (ArrayElementInitializer a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_53. + AST.Traversable1.Class.Traversable1 a_53 + ) + +instance AST.Unmarshal.SymbolMatching ArrayCreationExpression where + matchedSymbols _ = [266] + showFailure _ node_54 = + "expected " + GHC.Base.<> ( "array_creation_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_54 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_54) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_55 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_56 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_57 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_58 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_55 + c1_56 = TreeSitter.Node.nodeStartPoint node_54 + TreeSitter.Node.TSPoint + r2_57 + c2_58 = TreeSitter.Node.nodeEndPoint node_54 + +deriving instance GHC.Classes.Eq a_59 => GHC.Classes.Eq (ArrayCreationExpression a_59) + +deriving instance GHC.Classes.Ord a_60 => GHC.Classes.Ord (ArrayCreationExpression a_60) + +deriving instance GHC.Show.Show a_61 => GHC.Show.Show (ArrayCreationExpression a_61) + +instance AST.Unmarshal.Unmarshal ArrayCreationExpression + +instance Data.Foldable.Foldable ArrayCreationExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayCreationExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayCreationExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayElementInitializer a = ArrayElementInitializer + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_62. + AST.Traversable1.Class.Traversable1 a_62 + ) + +instance AST.Unmarshal.SymbolMatching ArrayElementInitializer where + matchedSymbols _ = [271] + showFailure _ node_63 = + "expected " + GHC.Base.<> ( "array_element_initializer" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_63 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_63) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_64 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_65 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_66 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_67 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_64 + c1_65 = TreeSitter.Node.nodeStartPoint node_63 + TreeSitter.Node.TSPoint + r2_66 + c2_67 = TreeSitter.Node.nodeEndPoint node_63 + +deriving instance GHC.Classes.Eq a_68 => GHC.Classes.Eq (ArrayElementInitializer a_68) + +deriving instance GHC.Classes.Ord a_69 => GHC.Classes.Ord (ArrayElementInitializer a_69) + +deriving instance GHC.Show.Show a_70 => GHC.Show.Show (ArrayElementInitializer a_70) + +instance AST.Unmarshal.Unmarshal ArrayElementInitializer + +instance Data.Foldable.Foldable ArrayElementInitializer where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayElementInitializer where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayElementInitializer where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AssignmentExpression a = AssignmentExpression + { ann :: a, + left :: (AST.Parse.Err ((ArrayCreationExpression GHC.Generics.:+: CastExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: ListLiteral GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_71. + AST.Traversable1.Class.Traversable1 a_71 + ) + +instance AST.Unmarshal.SymbolMatching AssignmentExpression where + matchedSymbols _ = [251] + showFailure _ node_72 = + "expected " + GHC.Base.<> ( "assignment_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_72 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_72) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_73 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_74 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_75 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_76 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_73 + c1_74 = TreeSitter.Node.nodeStartPoint node_72 + TreeSitter.Node.TSPoint + r2_75 + c2_76 = TreeSitter.Node.nodeEndPoint node_72 + +deriving instance GHC.Classes.Eq a_77 => GHC.Classes.Eq (AssignmentExpression a_77) + +deriving instance GHC.Classes.Ord a_78 => GHC.Classes.Ord (AssignmentExpression a_78) + +deriving instance GHC.Show.Show a_79 => GHC.Show.Show (AssignmentExpression a_79) + +instance AST.Unmarshal.Unmarshal AssignmentExpression + +instance Data.Foldable.Foldable AssignmentExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AssignmentExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AssignmentExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AugmentedAssignmentExpression a = AugmentedAssignmentExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousPercentEqual GHC.Generics.:+: AnonymousAmpersandEqual GHC.Generics.:+: AnonymousStarStarEqual GHC.Generics.:+: AnonymousStarEqual GHC.Generics.:+: AnonymousPlusEqual GHC.Generics.:+: AnonymousMinusEqual GHC.Generics.:+: AnonymousDotEqual GHC.Generics.:+: AnonymousSlashEqual GHC.Generics.:+: AnonymousLAngleLAngleEqual GHC.Generics.:+: AnonymousRAngleRAngleEqual GHC.Generics.:+: AnonymousCaretEqual GHC.Generics.:+: AnonymousPipeEqual) a)), + left :: (AST.Parse.Err ((CastExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_80. + AST.Traversable1.Class.Traversable1 a_80 + ) + +instance AST.Unmarshal.SymbolMatching AugmentedAssignmentExpression where + matchedSymbols _ = [253] + showFailure _ node_81 = + "expected " + GHC.Base.<> ( "augmented_assignment_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_81 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_81) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_82 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_83 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_84 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_85 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_82 + c1_83 = TreeSitter.Node.nodeStartPoint node_81 + TreeSitter.Node.TSPoint + r2_84 + c2_85 = TreeSitter.Node.nodeEndPoint node_81 + +deriving instance GHC.Classes.Eq a_86 => GHC.Classes.Eq (AugmentedAssignmentExpression a_86) + +deriving instance GHC.Classes.Ord a_87 => GHC.Classes.Ord (AugmentedAssignmentExpression a_87) + +deriving instance GHC.Show.Show a_88 => GHC.Show.Show (AugmentedAssignmentExpression a_88) + +instance AST.Unmarshal.Unmarshal AugmentedAssignmentExpression + +instance Data.Foldable.Foldable AugmentedAssignmentExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AugmentedAssignmentExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AugmentedAssignmentExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BinaryExpression a = BinaryExpression + { ann :: a, + operator :: (GHC.Maybe.Maybe (AST.Parse.Err ((AnonymousBangEqual GHC.Generics.:+: AnonymousBangEqualEqual GHC.Generics.:+: AnonymousPercent GHC.Generics.:+: AnonymousAmpersand GHC.Generics.:+: AnonymousAmpersandAmpersand GHC.Generics.:+: AnonymousStar GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousDot GHC.Generics.:+: AnonymousSlash GHC.Generics.:+: AnonymousLAngle GHC.Generics.:+: AnonymousLAngleLAngle GHC.Generics.:+: AnonymousLAngleEqual GHC.Generics.:+: AnonymousLAngleEqualRAngle GHC.Generics.:+: AnonymousLAngleRAngle GHC.Generics.:+: AnonymousEqualEqual GHC.Generics.:+: AnonymousEqualEqualEqual GHC.Generics.:+: AnonymousRAngle GHC.Generics.:+: AnonymousRAngleEqual GHC.Generics.:+: AnonymousRAngleRAngle GHC.Generics.:+: AnonymousCaret GHC.Generics.:+: AnonymousAnd GHC.Generics.:+: AnonymousInstanceof GHC.Generics.:+: AnonymousOr GHC.Generics.:+: AnonymousXor GHC.Generics.:+: AnonymousPipe GHC.Generics.:+: AnonymousPipePipe) a))), + left :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + right :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: QualifiedName GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a))), + extraChildren :: ([AST.Parse.Err (Expression a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_89. + AST.Traversable1.Class.Traversable1 a_89 + ) + +instance AST.Unmarshal.SymbolMatching BinaryExpression where + matchedSymbols _ = [272] + showFailure _ node_90 = + "expected " + GHC.Base.<> ( "binary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_90 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_90) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_91 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_92 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_93 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_94 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_91 + c1_92 = TreeSitter.Node.nodeStartPoint node_90 + TreeSitter.Node.TSPoint + r2_93 + c2_94 = TreeSitter.Node.nodeEndPoint node_90 + +deriving instance GHC.Classes.Eq a_95 => GHC.Classes.Eq (BinaryExpression a_95) + +deriving instance GHC.Classes.Ord a_96 => GHC.Classes.Ord (BinaryExpression a_96) + +deriving instance GHC.Show.Show a_97 => GHC.Show.Show (BinaryExpression a_97) + +instance AST.Unmarshal.Unmarshal BinaryExpression + +instance Data.Foldable.Foldable BinaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BinaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BinaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BreakStatement a = BreakStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_98. + AST.Traversable1.Class.Traversable1 a_98 + ) + +instance AST.Unmarshal.SymbolMatching BreakStatement where + matchedSymbols _ = [213] + showFailure _ node_99 = + "expected " + GHC.Base.<> ( "break_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_99 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_99) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_100 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_101 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_102 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_103 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_100 + c1_101 = TreeSitter.Node.nodeStartPoint node_99 + TreeSitter.Node.TSPoint + r2_102 + c2_103 = TreeSitter.Node.nodeEndPoint node_99 + +deriving instance GHC.Classes.Eq a_104 => GHC.Classes.Eq (BreakStatement a_104) + +deriving instance GHC.Classes.Ord a_105 => GHC.Classes.Ord (BreakStatement a_105) + +deriving instance GHC.Show.Show a_106 => GHC.Show.Show (BreakStatement a_106) + +instance AST.Unmarshal.Unmarshal BreakStatement + +instance Data.Foldable.Foldable BreakStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BreakStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BreakStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CaseStatement a = CaseStatement + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_107. + AST.Traversable1.Class.Traversable1 a_107 + ) + +instance AST.Unmarshal.SymbolMatching CaseStatement where + matchedSymbols _ = [231] + showFailure _ node_108 = + "expected " + GHC.Base.<> ( "case_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_108 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_108) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_109 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_110 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_111 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_112 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_109 + c1_110 = TreeSitter.Node.nodeStartPoint node_108 + TreeSitter.Node.TSPoint + r2_111 + c2_112 = TreeSitter.Node.nodeEndPoint node_108 + +deriving instance GHC.Classes.Eq a_113 => GHC.Classes.Eq (CaseStatement a_113) + +deriving instance GHC.Classes.Ord a_114 => GHC.Classes.Ord (CaseStatement a_114) + +deriving instance GHC.Show.Show a_115 => GHC.Show.Show (CaseStatement a_115) + +instance AST.Unmarshal.Unmarshal CaseStatement + +instance Data.Foldable.Foldable CaseStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CaseStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CaseStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CastExpression a = CastExpression + { ann :: a, + value :: (AST.Parse.Err ((PrimaryExpression GHC.Generics.:+: CloneExpression GHC.Generics.:+: ExponentiationExpression GHC.Generics.:+: UnaryOpExpression) a)), + type' :: (AST.Parse.Err (CastType a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_116. + AST.Traversable1.Class.Traversable1 a_116 + ) + +instance AST.Unmarshal.SymbolMatching CastExpression where + matchedSymbols _ = [249, 250] + showFailure _ node_117 = + "expected " + GHC.Base.<> ( "cast_expression, cast_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_117 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_117) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_118 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_119 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_120 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_121 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_118 + c1_119 = TreeSitter.Node.nodeStartPoint node_117 + TreeSitter.Node.TSPoint + r2_120 + c2_121 = TreeSitter.Node.nodeEndPoint node_117 + +deriving instance GHC.Classes.Eq a_122 => GHC.Classes.Eq (CastExpression a_122) + +deriving instance GHC.Classes.Ord a_123 => GHC.Classes.Ord (CastExpression a_123) + +deriving instance GHC.Show.Show a_124 => GHC.Show.Show (CastExpression a_124) + +instance AST.Unmarshal.Unmarshal CastExpression + +instance Data.Foldable.Foldable CastExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CastExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CastExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CastType a = CastType {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_125. + AST.Traversable1.Class.Traversable1 a_125 + ) + +instance AST.Unmarshal.SymbolMatching CastType where + matchedSymbols _ = [200] + showFailure _ node_126 = + "expected " + GHC.Base.<> ( "cast_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_126 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_126) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_127 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_128 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_129 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_130 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_127 + c1_128 = TreeSitter.Node.nodeStartPoint node_126 + TreeSitter.Node.TSPoint + r2_129 + c2_130 = TreeSitter.Node.nodeEndPoint node_126 + +deriving instance GHC.Classes.Eq a_131 => GHC.Classes.Eq (CastType a_131) + +deriving instance GHC.Classes.Ord a_132 => GHC.Classes.Ord (CastType a_132) + +deriving instance GHC.Show.Show a_133 => GHC.Show.Show (CastType a_133) + +instance AST.Unmarshal.Unmarshal CastType + +instance Data.Foldable.Foldable CastType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CastType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CastType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CatchClause a = CatchClause + { ann :: a, + body :: (AST.Parse.Err (CompoundStatement a)), + name :: (AST.Parse.Err (VariableName a)), + type' :: (AST.Parse.Err (TypeName a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_134. + AST.Traversable1.Class.Traversable1 a_134 + ) + +instance AST.Unmarshal.SymbolMatching CatchClause where + matchedSymbols _ = [208] + showFailure _ node_135 = + "expected " + GHC.Base.<> ( "catch_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_135 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_135) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_136 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_137 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_138 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_139 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_136 + c1_137 = TreeSitter.Node.nodeStartPoint node_135 + TreeSitter.Node.TSPoint + r2_138 + c2_139 = TreeSitter.Node.nodeEndPoint node_135 + +deriving instance GHC.Classes.Eq a_140 => GHC.Classes.Eq (CatchClause a_140) + +deriving instance GHC.Classes.Ord a_141 => GHC.Classes.Ord (CatchClause a_141) + +deriving instance GHC.Show.Show a_142 => GHC.Show.Show (CatchClause a_142) + +instance AST.Unmarshal.Unmarshal CatchClause + +instance Data.Foldable.Foldable CatchClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CatchClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CatchClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassBaseClause a = ClassBaseClause + { ann :: a, + extraChildren :: (AST.Parse.Err (QualifiedName a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_143. + AST.Traversable1.Class.Traversable1 a_143 + ) + +instance AST.Unmarshal.SymbolMatching ClassBaseClause where + matchedSymbols _ = [177] + showFailure _ node_144 = + "expected " + GHC.Base.<> ( "class_base_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_144 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_144) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_145 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_146 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_147 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_148 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_145 + c1_146 = TreeSitter.Node.nodeStartPoint node_144 + TreeSitter.Node.TSPoint + r2_147 + c2_148 = TreeSitter.Node.nodeEndPoint node_144 + +deriving instance GHC.Classes.Eq a_149 => GHC.Classes.Eq (ClassBaseClause a_149) + +deriving instance GHC.Classes.Ord a_150 => GHC.Classes.Ord (ClassBaseClause a_150) + +deriving instance GHC.Show.Show a_151 => GHC.Show.Show (ClassBaseClause a_151) + +instance AST.Unmarshal.Unmarshal ClassBaseClause + +instance Data.Foldable.Foldable ClassBaseClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassBaseClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassBaseClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassConstantAccessExpression a = ClassConstantAccessExpression + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayCreationExpression GHC.Generics.:+: CastExpression GHC.Generics.:+: ClassConstantAccessExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: Heredoc GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: Name GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: QualifiedName GHC.Generics.:+: RelativeScope GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_152. + AST.Traversable1.Class.Traversable1 a_152 + ) + +instance AST.Unmarshal.SymbolMatching ClassConstantAccessExpression where + matchedSymbols _ = [243] + showFailure _ node_153 = + "expected " + GHC.Base.<> ( "class_constant_access_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_153 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_153) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_154 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_155 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_156 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_157 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_154 + c1_155 = TreeSitter.Node.nodeStartPoint node_153 + TreeSitter.Node.TSPoint + r2_156 + c2_157 = TreeSitter.Node.nodeEndPoint node_153 + +deriving instance GHC.Classes.Eq a_158 => GHC.Classes.Eq (ClassConstantAccessExpression a_158) + +deriving instance GHC.Classes.Ord a_159 => GHC.Classes.Ord (ClassConstantAccessExpression a_159) + +deriving instance GHC.Show.Show a_160 => GHC.Show.Show (ClassConstantAccessExpression a_160) + +instance AST.Unmarshal.Unmarshal ClassConstantAccessExpression + +instance Data.Foldable.Foldable ClassConstantAccessExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassConstantAccessExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassConstantAccessExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassDeclaration a = ClassDeclaration + { ann :: a, + body :: (AST.Parse.Err (DeclarationList a)), + name :: (AST.Parse.Err (Name a)), + extraChildren :: ([AST.Parse.Err ((ClassBaseClause GHC.Generics.:+: ClassInterfaceClause GHC.Generics.:+: ClassModifier) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_161. + AST.Traversable1.Class.Traversable1 a_161 + ) + +instance AST.Unmarshal.SymbolMatching ClassDeclaration where + matchedSymbols _ = [174] + showFailure _ node_162 = + "expected " + GHC.Base.<> ( "class_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_162 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_162) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_163 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_164 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_165 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_166 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_163 + c1_164 = TreeSitter.Node.nodeStartPoint node_162 + TreeSitter.Node.TSPoint + r2_165 + c2_166 = TreeSitter.Node.nodeEndPoint node_162 + +deriving instance GHC.Classes.Eq a_167 => GHC.Classes.Eq (ClassDeclaration a_167) + +deriving instance GHC.Classes.Ord a_168 => GHC.Classes.Ord (ClassDeclaration a_168) + +deriving instance GHC.Show.Show a_169 => GHC.Show.Show (ClassDeclaration a_169) + +instance AST.Unmarshal.Unmarshal ClassDeclaration + +instance Data.Foldable.Foldable ClassDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassInterfaceClause a = ClassInterfaceClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (QualifiedName a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_170. + AST.Traversable1.Class.Traversable1 a_170 + ) + +instance AST.Unmarshal.SymbolMatching ClassInterfaceClause where + matchedSymbols _ = [178] + showFailure _ node_171 = + "expected " + GHC.Base.<> ( "class_interface_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_171 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_171) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_172 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_173 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_174 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_175 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_172 + c1_173 = TreeSitter.Node.nodeStartPoint node_171 + TreeSitter.Node.TSPoint + r2_174 + c2_175 = TreeSitter.Node.nodeEndPoint node_171 + +deriving instance GHC.Classes.Eq a_176 => GHC.Classes.Eq (ClassInterfaceClause a_176) + +deriving instance GHC.Classes.Ord a_177 => GHC.Classes.Ord (ClassInterfaceClause a_177) + +deriving instance GHC.Show.Show a_178 => GHC.Show.Show (ClassInterfaceClause a_178) + +instance AST.Unmarshal.Unmarshal ClassInterfaceClause + +instance Data.Foldable.Foldable ClassInterfaceClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassInterfaceClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassInterfaceClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassModifier a = ClassModifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_179. + AST.Traversable1.Class.Traversable1 a_179 + ) + +instance AST.Unmarshal.SymbolMatching ClassModifier where + matchedSymbols _ = [176] + showFailure _ node_180 = + "expected " + GHC.Base.<> ( "class_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_180 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_180) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_181 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_182 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_183 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_184 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_181 + c1_182 = TreeSitter.Node.nodeStartPoint node_180 + TreeSitter.Node.TSPoint + r2_183 + c2_184 = TreeSitter.Node.nodeEndPoint node_180 + +deriving instance GHC.Classes.Eq a_185 => GHC.Classes.Eq (ClassModifier a_185) + +deriving instance GHC.Classes.Ord a_186 => GHC.Classes.Ord (ClassModifier a_186) + +deriving instance GHC.Show.Show a_187 => GHC.Show.Show (ClassModifier a_187) + +instance AST.Unmarshal.Unmarshal ClassModifier + +instance Data.Foldable.Foldable ClassModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CloneExpression a = CloneExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (PrimaryExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_188. + AST.Traversable1.Class.Traversable1 a_188 + ) + +instance AST.Unmarshal.SymbolMatching CloneExpression where + matchedSymbols _ = [240] + showFailure _ node_189 = + "expected " + GHC.Base.<> ( "clone_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_189 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_189) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_190 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_191 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_192 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_193 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_190 + c1_191 = TreeSitter.Node.nodeStartPoint node_189 + TreeSitter.Node.TSPoint + r2_192 + c2_193 = TreeSitter.Node.nodeEndPoint node_189 + +deriving instance GHC.Classes.Eq a_194 => GHC.Classes.Eq (CloneExpression a_194) + +deriving instance GHC.Classes.Ord a_195 => GHC.Classes.Ord (CloneExpression a_195) + +deriving instance GHC.Show.Show a_196 => GHC.Show.Show (CloneExpression a_196) + +instance AST.Unmarshal.Unmarshal CloneExpression + +instance Data.Foldable.Foldable CloneExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CloneExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CloneExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ColonBlock a = ColonBlock + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_197. + AST.Traversable1.Class.Traversable1 a_197 + ) + +instance AST.Unmarshal.SymbolMatching ColonBlock where + matchedSymbols _ = [224] + showFailure _ node_198 = + "expected " + GHC.Base.<> ( "colon_block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_198 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_198) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_199 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_200 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_201 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_202 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_199 + c1_200 = TreeSitter.Node.nodeStartPoint node_198 + TreeSitter.Node.TSPoint + r2_201 + c2_202 = TreeSitter.Node.nodeEndPoint node_198 + +deriving instance GHC.Classes.Eq a_203 => GHC.Classes.Eq (ColonBlock a_203) + +deriving instance GHC.Classes.Ord a_204 => GHC.Classes.Ord (ColonBlock a_204) + +deriving instance GHC.Show.Show a_205 => GHC.Show.Show (ColonBlock a_205) + +instance AST.Unmarshal.Unmarshal ColonBlock + +instance Data.Foldable.Foldable ColonBlock where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ColonBlock where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ColonBlock where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CompoundStatement a = CompoundStatement + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_206. + AST.Traversable1.Class.Traversable1 a_206 + ) + +instance AST.Unmarshal.SymbolMatching CompoundStatement where + matchedSymbols _ = [233] + showFailure _ node_207 = + "expected " + GHC.Base.<> ( "compound_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_207 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_207) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_208 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_209 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_210 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_211 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_208 + c1_209 = TreeSitter.Node.nodeStartPoint node_207 + TreeSitter.Node.TSPoint + r2_210 + c2_211 = TreeSitter.Node.nodeEndPoint node_207 + +deriving instance GHC.Classes.Eq a_212 => GHC.Classes.Eq (CompoundStatement a_212) + +deriving instance GHC.Classes.Ord a_213 => GHC.Classes.Ord (CompoundStatement a_213) + +deriving instance GHC.Show.Show a_214 => GHC.Show.Show (CompoundStatement a_214) + +instance AST.Unmarshal.Unmarshal CompoundStatement + +instance Data.Foldable.Foldable CompoundStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CompoundStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CompoundStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConditionalExpression a = ConditionalExpression + { ann :: a, + alternative :: (AST.Parse.Err (Expression a)), + body :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + condition :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_215. + AST.Traversable1.Class.Traversable1 a_215 + ) + +instance AST.Unmarshal.SymbolMatching ConditionalExpression where + matchedSymbols _ = [252] + showFailure _ node_216 = + "expected " + GHC.Base.<> ( "conditional_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_216 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_216) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_217 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_218 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_219 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_220 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_217 + c1_218 = TreeSitter.Node.nodeStartPoint node_216 + TreeSitter.Node.TSPoint + r2_219 + c2_220 = TreeSitter.Node.nodeEndPoint node_216 + +deriving instance GHC.Classes.Eq a_221 => GHC.Classes.Eq (ConditionalExpression a_221) + +deriving instance GHC.Classes.Ord a_222 => GHC.Classes.Ord (ConditionalExpression a_222) + +deriving instance GHC.Show.Show a_223 => GHC.Show.Show (ConditionalExpression a_223) + +instance AST.Unmarshal.Unmarshal ConditionalExpression + +instance Data.Foldable.Foldable ConditionalExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConditionalExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConditionalExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstDeclaration a = ConstDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ConstElement GHC.Generics.:+: VisibilityModifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_224. + AST.Traversable1.Class.Traversable1 a_224 + ) + +instance AST.Unmarshal.SymbolMatching ConstDeclaration where + matchedSymbols _ = [180] + showFailure _ node_225 = + "expected " + GHC.Base.<> ( "const_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_225 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_225) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_226 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_227 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_228 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_229 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_226 + c1_227 = TreeSitter.Node.nodeStartPoint node_225 + TreeSitter.Node.TSPoint + r2_228 + c2_229 = TreeSitter.Node.nodeEndPoint node_225 + +deriving instance GHC.Classes.Eq a_230 => GHC.Classes.Eq (ConstDeclaration a_230) + +deriving instance GHC.Classes.Ord a_231 => GHC.Classes.Ord (ConstDeclaration a_231) + +deriving instance GHC.Show.Show a_232 => GHC.Show.Show (ConstDeclaration a_232) + +instance AST.Unmarshal.Unmarshal ConstDeclaration + +instance Data.Foldable.Foldable ConstDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstElement a = ConstElement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: Name) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_233. + AST.Traversable1.Class.Traversable1 a_233 + ) + +instance AST.Unmarshal.SymbolMatching ConstElement where + matchedSymbols _ = [202] + showFailure _ node_234 = + "expected " + GHC.Base.<> ( "const_element" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_234 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_234) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_235 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_236 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_237 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_238 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_235 + c1_236 = TreeSitter.Node.nodeStartPoint node_234 + TreeSitter.Node.TSPoint + r2_237 + c2_238 = TreeSitter.Node.nodeEndPoint node_234 + +deriving instance GHC.Classes.Eq a_239 => GHC.Classes.Eq (ConstElement a_239) + +deriving instance GHC.Classes.Ord a_240 => GHC.Classes.Ord (ConstElement a_240) + +deriving instance GHC.Show.Show a_241 => GHC.Show.Show (ConstElement a_241) + +instance AST.Unmarshal.Unmarshal ConstElement + +instance Data.Foldable.Foldable ConstElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ContinueStatement a = ContinueStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_242. + AST.Traversable1.Class.Traversable1 a_242 + ) + +instance AST.Unmarshal.SymbolMatching ContinueStatement where + matchedSymbols _ = [212] + showFailure _ node_243 = + "expected " + GHC.Base.<> ( "continue_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_243 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_243) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_244 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_245 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_246 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_247 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_244 + c1_245 = TreeSitter.Node.nodeStartPoint node_243 + TreeSitter.Node.TSPoint + r2_246 + c2_247 = TreeSitter.Node.nodeEndPoint node_243 + +deriving instance GHC.Classes.Eq a_248 => GHC.Classes.Eq (ContinueStatement a_248) + +deriving instance GHC.Classes.Ord a_249 => GHC.Classes.Ord (ContinueStatement a_249) + +deriving instance GHC.Show.Show a_250 => GHC.Show.Show (ContinueStatement a_250) + +instance AST.Unmarshal.Unmarshal ContinueStatement + +instance Data.Foldable.Foldable ContinueStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ContinueStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ContinueStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DeclarationList a = DeclarationList + { ann :: a, + extraChildren :: ([AST.Parse.Err ((ConstDeclaration GHC.Generics.:+: MethodDeclaration GHC.Generics.:+: PropertyDeclaration GHC.Generics.:+: UseDeclaration) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_251. + AST.Traversable1.Class.Traversable1 a_251 + ) + +instance AST.Unmarshal.SymbolMatching DeclarationList where + matchedSymbols _ = [175] + showFailure _ node_252 = + "expected " + GHC.Base.<> ( "declaration_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_252 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_252) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_253 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_254 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_255 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_256 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_253 + c1_254 = TreeSitter.Node.nodeStartPoint node_252 + TreeSitter.Node.TSPoint + r2_255 + c2_256 = TreeSitter.Node.nodeEndPoint node_252 + +deriving instance GHC.Classes.Eq a_257 => GHC.Classes.Eq (DeclarationList a_257) + +deriving instance GHC.Classes.Ord a_258 => GHC.Classes.Ord (DeclarationList a_258) + +deriving instance GHC.Show.Show a_259 => GHC.Show.Show (DeclarationList a_259) + +instance AST.Unmarshal.Unmarshal DeclarationList + +instance Data.Foldable.Foldable DeclarationList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DeclarationList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DeclarationList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DeclareDirective a = DeclareDirective + { ann :: a, + extraChildren :: (AST.Parse.Err (Literal a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_260. + AST.Traversable1.Class.Traversable1 a_260 + ) + +instance AST.Unmarshal.SymbolMatching DeclareDirective where + matchedSymbols _ = [206] + showFailure _ node_261 = + "expected " + GHC.Base.<> ( "declare_directive" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_261 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_261) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_262 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_263 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_264 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_265 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_262 + c1_263 = TreeSitter.Node.nodeStartPoint node_261 + TreeSitter.Node.TSPoint + r2_264 + c2_265 = TreeSitter.Node.nodeEndPoint node_261 + +deriving instance GHC.Classes.Eq a_266 => GHC.Classes.Eq (DeclareDirective a_266) + +deriving instance GHC.Classes.Ord a_267 => GHC.Classes.Ord (DeclareDirective a_267) + +deriving instance GHC.Show.Show a_268 => GHC.Show.Show (DeclareDirective a_268) + +instance AST.Unmarshal.Unmarshal DeclareDirective + +instance Data.Foldable.Foldable DeclareDirective where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DeclareDirective where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DeclareDirective where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DeclareStatement a = DeclareStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Statement GHC.Generics.:+: DeclareDirective) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_269. + AST.Traversable1.Class.Traversable1 a_269 + ) + +instance AST.Unmarshal.SymbolMatching DeclareStatement where + matchedSymbols _ = [205] + showFailure _ node_270 = + "expected " + GHC.Base.<> ( "declare_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_270 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_270) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_271 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_272 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_273 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_274 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_271 + c1_272 = TreeSitter.Node.nodeStartPoint node_270 + TreeSitter.Node.TSPoint + r2_273 + c2_274 = TreeSitter.Node.nodeEndPoint node_270 + +deriving instance GHC.Classes.Eq a_275 => GHC.Classes.Eq (DeclareStatement a_275) + +deriving instance GHC.Classes.Ord a_276 => GHC.Classes.Ord (DeclareStatement a_276) + +deriving instance GHC.Show.Show a_277 => GHC.Show.Show (DeclareStatement a_277) + +instance AST.Unmarshal.Unmarshal DeclareStatement + +instance Data.Foldable.Foldable DeclareStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DeclareStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DeclareStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DefaultStatement a = DefaultStatement + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_278. + AST.Traversable1.Class.Traversable1 a_278 + ) + +instance AST.Unmarshal.SymbolMatching DefaultStatement where + matchedSymbols _ = [232] + showFailure _ node_279 = + "expected " + GHC.Base.<> ( "default_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_279 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_279) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_280 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_281 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_282 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_283 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_280 + c1_281 = TreeSitter.Node.nodeStartPoint node_279 + TreeSitter.Node.TSPoint + r2_282 + c2_283 = TreeSitter.Node.nodeEndPoint node_279 + +deriving instance GHC.Classes.Eq a_284 => GHC.Classes.Eq (DefaultStatement a_284) + +deriving instance GHC.Classes.Ord a_285 => GHC.Classes.Ord (DefaultStatement a_285) + +deriving instance GHC.Show.Show a_286 => GHC.Show.Show (DefaultStatement a_286) + +instance AST.Unmarshal.Unmarshal DefaultStatement + +instance Data.Foldable.Foldable DefaultStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DefaultStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DefaultStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DoStatement a = DoStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_287. + AST.Traversable1.Class.Traversable1 a_287 + ) + +instance AST.Unmarshal.SymbolMatching DoStatement where + matchedSymbols _ = [217] + showFailure _ node_288 = + "expected " + GHC.Base.<> ( "do_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_288 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_288) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_289 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_290 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_291 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_292 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_289 + c1_290 = TreeSitter.Node.nodeStartPoint node_288 + TreeSitter.Node.TSPoint + r2_291 + c2_292 = TreeSitter.Node.nodeEndPoint node_288 + +deriving instance GHC.Classes.Eq a_293 => GHC.Classes.Eq (DoStatement a_293) + +deriving instance GHC.Classes.Ord a_294 => GHC.Classes.Ord (DoStatement a_294) + +deriving instance GHC.Show.Show a_295 => GHC.Show.Show (DoStatement a_295) + +instance AST.Unmarshal.Unmarshal DoStatement + +instance Data.Foldable.Foldable DoStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DoStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DoStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DynamicVariableName a = DynamicVariableName + { ann :: a, + extraChildren :: (AST.Parse.Err ((Expression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: VariableName) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_296. + AST.Traversable1.Class.Traversable1 a_296 + ) + +instance AST.Unmarshal.SymbolMatching DynamicVariableName where + matchedSymbols _ = [268] + showFailure _ node_297 = + "expected " + GHC.Base.<> ( "dynamic_variable_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_297 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_297) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_298 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_299 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_300 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_301 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_298 + c1_299 = TreeSitter.Node.nodeStartPoint node_297 + TreeSitter.Node.TSPoint + r2_300 + c2_301 = TreeSitter.Node.nodeEndPoint node_297 + +deriving instance GHC.Classes.Eq a_302 => GHC.Classes.Eq (DynamicVariableName a_302) + +deriving instance GHC.Classes.Ord a_303 => GHC.Classes.Ord (DynamicVariableName a_303) + +deriving instance GHC.Show.Show a_304 => GHC.Show.Show (DynamicVariableName a_304) + +instance AST.Unmarshal.Unmarshal DynamicVariableName + +instance Data.Foldable.Foldable DynamicVariableName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DynamicVariableName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DynamicVariableName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EchoStatement a = EchoStatement + { ann :: a, + extraChildren :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_305. + AST.Traversable1.Class.Traversable1 a_305 + ) + +instance AST.Unmarshal.SymbolMatching EchoStatement where + matchedSymbols _ = [203] + showFailure _ node_306 = + "expected " + GHC.Base.<> ( "echo_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_306 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_306) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_307 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_308 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_309 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_310 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_307 + c1_308 = TreeSitter.Node.nodeStartPoint node_306 + TreeSitter.Node.TSPoint + r2_309 + c2_310 = TreeSitter.Node.nodeEndPoint node_306 + +deriving instance GHC.Classes.Eq a_311 => GHC.Classes.Eq (EchoStatement a_311) + +deriving instance GHC.Classes.Ord a_312 => GHC.Classes.Ord (EchoStatement a_312) + +deriving instance GHC.Show.Show a_313 => GHC.Show.Show (EchoStatement a_313) + +instance AST.Unmarshal.Unmarshal EchoStatement + +instance Data.Foldable.Foldable EchoStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EchoStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EchoStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ElseClause a = ElseClause + { ann :: a, + body :: (AST.Parse.Err ((Statement GHC.Generics.:+: ColonBlock) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_314. + AST.Traversable1.Class.Traversable1 a_314 + ) + +instance AST.Unmarshal.SymbolMatching ElseClause where + matchedSymbols _ = [226, 228] + showFailure _ node_315 = + "expected " + GHC.Base.<> ( "else_clause, else_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_315 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_315) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_316 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_317 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_318 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_319 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_316 + c1_317 = TreeSitter.Node.nodeStartPoint node_315 + TreeSitter.Node.TSPoint + r2_318 + c2_319 = TreeSitter.Node.nodeEndPoint node_315 + +deriving instance GHC.Classes.Eq a_320 => GHC.Classes.Eq (ElseClause a_320) + +deriving instance GHC.Classes.Ord a_321 => GHC.Classes.Ord (ElseClause a_321) + +deriving instance GHC.Show.Show a_322 => GHC.Show.Show (ElseClause a_322) + +instance AST.Unmarshal.Unmarshal ElseClause + +instance Data.Foldable.Foldable ElseClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ElseClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ElseClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ElseIfClause a = ElseIfClause + { ann :: a, + body :: (AST.Parse.Err ((Statement GHC.Generics.:+: ColonBlock) a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_323. + AST.Traversable1.Class.Traversable1 a_323 + ) + +instance AST.Unmarshal.SymbolMatching ElseIfClause where + matchedSymbols _ = [225, 227] + showFailure _ node_324 = + "expected " + GHC.Base.<> ( "else_if_clause, else_if_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_324 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_324) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_325 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_326 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_327 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_328 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_325 + c1_326 = TreeSitter.Node.nodeStartPoint node_324 + TreeSitter.Node.TSPoint + r2_327 + c2_328 = TreeSitter.Node.nodeEndPoint node_324 + +deriving instance GHC.Classes.Eq a_329 => GHC.Classes.Eq (ElseIfClause a_329) + +deriving instance GHC.Classes.Ord a_330 => GHC.Classes.Ord (ElseIfClause a_330) + +deriving instance GHC.Show.Show a_331 => GHC.Show.Show (ElseIfClause a_331) + +instance AST.Unmarshal.Unmarshal ElseIfClause + +instance Data.Foldable.Foldable ElseIfClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ElseIfClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ElseIfClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EmptyStatement a = EmptyStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_332. + AST.Traversable1.Class.Traversable1 a_332 + ) + +instance AST.Unmarshal.SymbolMatching EmptyStatement where + matchedSymbols _ = [157] + showFailure _ node_333 = + "expected " + GHC.Base.<> ( "empty_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_333 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_333) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_334 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_335 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_336 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_337 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_334 + c1_335 = TreeSitter.Node.nodeStartPoint node_333 + TreeSitter.Node.TSPoint + r2_336 + c2_337 = TreeSitter.Node.nodeEndPoint node_333 + +deriving instance GHC.Classes.Eq a_338 => GHC.Classes.Eq (EmptyStatement a_338) + +deriving instance GHC.Classes.Ord a_339 => GHC.Classes.Ord (EmptyStatement a_339) + +deriving instance GHC.Show.Show a_340 => GHC.Show.Show (EmptyStatement a_340) + +instance AST.Unmarshal.Unmarshal EmptyStatement + +instance Data.Foldable.Foldable EmptyStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EmptyStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EmptyStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExponentiationExpression a = ExponentiationExpression + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((PrimaryExpression GHC.Generics.:+: CloneExpression GHC.Generics.:+: ExponentiationExpression) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_341. + AST.Traversable1.Class.Traversable1 a_341 + ) + +instance AST.Unmarshal.SymbolMatching ExponentiationExpression where + matchedSymbols _ = [239] + showFailure _ node_342 = + "expected " + GHC.Base.<> ( "exponentiation_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_342 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_342) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_343 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_344 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_345 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_346 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_343 + c1_344 = TreeSitter.Node.nodeStartPoint node_342 + TreeSitter.Node.TSPoint + r2_345 + c2_346 = TreeSitter.Node.nodeEndPoint node_342 + +deriving instance GHC.Classes.Eq a_347 => GHC.Classes.Eq (ExponentiationExpression a_347) + +deriving instance GHC.Classes.Ord a_348 => GHC.Classes.Ord (ExponentiationExpression a_348) + +deriving instance GHC.Show.Show a_349 => GHC.Show.Show (ExponentiationExpression a_349) + +instance AST.Unmarshal.Unmarshal ExponentiationExpression + +instance Data.Foldable.Foldable ExponentiationExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExponentiationExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExponentiationExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExpressionStatement a = ExpressionStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_350. + AST.Traversable1.Class.Traversable1 a_350 + ) + +instance AST.Unmarshal.SymbolMatching ExpressionStatement where + matchedSymbols _ = [235] + showFailure _ node_351 = + "expected " + GHC.Base.<> ( "expression_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_351 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_351) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_352 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_353 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_354 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_355 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_352 + c1_353 = TreeSitter.Node.nodeStartPoint node_351 + TreeSitter.Node.TSPoint + r2_354 + c2_355 = TreeSitter.Node.nodeEndPoint node_351 + +deriving instance GHC.Classes.Eq a_356 => GHC.Classes.Eq (ExpressionStatement a_356) + +deriving instance GHC.Classes.Ord a_357 => GHC.Classes.Ord (ExpressionStatement a_357) + +deriving instance GHC.Show.Show a_358 => GHC.Show.Show (ExpressionStatement a_358) + +instance AST.Unmarshal.Unmarshal ExpressionStatement + +instance Data.Foldable.Foldable ExpressionStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExpressionStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExpressionStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FinallyClause a = FinallyClause + { ann :: a, + body :: (AST.Parse.Err (CompoundStatement a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_359. + AST.Traversable1.Class.Traversable1 a_359 + ) + +instance AST.Unmarshal.SymbolMatching FinallyClause where + matchedSymbols _ = [209] + showFailure _ node_360 = + "expected " + GHC.Base.<> ( "finally_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_360 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_360) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_361 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_362 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_363 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_364 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_361 + c1_362 = TreeSitter.Node.nodeStartPoint node_360 + TreeSitter.Node.TSPoint + r2_363 + c2_364 = TreeSitter.Node.nodeEndPoint node_360 + +deriving instance GHC.Classes.Eq a_365 => GHC.Classes.Eq (FinallyClause a_365) + +deriving instance GHC.Classes.Ord a_366 => GHC.Classes.Ord (FinallyClause a_366) + +deriving instance GHC.Show.Show a_367 => GHC.Show.Show (FinallyClause a_367) + +instance AST.Unmarshal.Unmarshal FinallyClause + +instance Data.Foldable.Foldable FinallyClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FinallyClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FinallyClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForStatement a = ForStatement + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: Statement GHC.Generics.:+: SequenceExpression) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_368. + AST.Traversable1.Class.Traversable1 a_368 + ) + +instance AST.Unmarshal.SymbolMatching ForStatement where + matchedSymbols _ = [218] + showFailure _ node_369 = + "expected " + GHC.Base.<> ( "for_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_369 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_369) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_370 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_371 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_372 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_373 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_370 + c1_371 = TreeSitter.Node.nodeStartPoint node_369 + TreeSitter.Node.TSPoint + r2_372 + c2_373 = TreeSitter.Node.nodeEndPoint node_369 + +deriving instance GHC.Classes.Eq a_374 => GHC.Classes.Eq (ForStatement a_374) + +deriving instance GHC.Classes.Ord a_375 => GHC.Classes.Ord (ForStatement a_375) + +deriving instance GHC.Show.Show a_376 => GHC.Show.Show (ForStatement a_376) + +instance AST.Unmarshal.Unmarshal ForStatement + +instance Data.Foldable.Foldable ForStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForeachStatement a = ForeachStatement + { ann :: a, + body :: (GHC.Maybe.Maybe (AST.Parse.Err ((Statement GHC.Generics.:+: ColonBlock) a))), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: ListLiteral GHC.Generics.:+: Pair) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_377. + AST.Traversable1.Class.Traversable1 a_377 + ) + +instance AST.Unmarshal.SymbolMatching ForeachStatement where + matchedSymbols _ = [221] + showFailure _ node_378 = + "expected " + GHC.Base.<> ( "foreach_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_378 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_378) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_379 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_380 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_381 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_382 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_379 + c1_380 = TreeSitter.Node.nodeStartPoint node_378 + TreeSitter.Node.TSPoint + r2_381 + c2_382 = TreeSitter.Node.nodeEndPoint node_378 + +deriving instance GHC.Classes.Eq a_383 => GHC.Classes.Eq (ForeachStatement a_383) + +deriving instance GHC.Classes.Ord a_384 => GHC.Classes.Ord (ForeachStatement a_384) + +deriving instance GHC.Show.Show a_385 => GHC.Show.Show (ForeachStatement a_385) + +instance AST.Unmarshal.Unmarshal ForeachStatement + +instance Data.Foldable.Foldable ForeachStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForeachStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForeachStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FormalParameters a = FormalParameters + { ann :: a, + extraChildren :: ([AST.Parse.Err ((SimpleParameter GHC.Generics.:+: VariadicParameter) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_386. + AST.Traversable1.Class.Traversable1 a_386 + ) + +instance AST.Unmarshal.SymbolMatching FormalParameters where + matchedSymbols _ = [194] + showFailure _ node_387 = + "expected " + GHC.Base.<> ( "formal_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_387 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_387) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_388 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_389 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_390 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_391 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_388 + c1_389 = TreeSitter.Node.nodeStartPoint node_387 + TreeSitter.Node.TSPoint + r2_390 + c2_391 = TreeSitter.Node.nodeEndPoint node_387 + +deriving instance GHC.Classes.Eq a_392 => GHC.Classes.Eq (FormalParameters a_392) + +deriving instance GHC.Classes.Ord a_393 => GHC.Classes.Ord (FormalParameters a_393) + +deriving instance GHC.Show.Show a_394 => GHC.Show.Show (FormalParameters a_394) + +instance AST.Unmarshal.Unmarshal FormalParameters + +instance Data.Foldable.Foldable FormalParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FormalParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FormalParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionCallExpression a = FunctionCallExpression + { ann :: a, + function :: (AST.Parse.Err ((ArrayCreationExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: Heredoc GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: QualifiedName GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a)), + arguments :: (AST.Parse.Err (Arguments a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_395. + AST.Traversable1.Class.Traversable1 a_395 + ) + +instance AST.Unmarshal.SymbolMatching FunctionCallExpression where + matchedSymbols _ = [257] + showFailure _ node_396 = + "expected " + GHC.Base.<> ( "function_call_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_396 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_396) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_397 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_398 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_399 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_400 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_397 + c1_398 = TreeSitter.Node.nodeStartPoint node_396 + TreeSitter.Node.TSPoint + r2_399 + c2_400 = TreeSitter.Node.nodeEndPoint node_396 + +deriving instance GHC.Classes.Eq a_401 => GHC.Classes.Eq (FunctionCallExpression a_401) + +deriving instance GHC.Classes.Ord a_402 => GHC.Classes.Ord (FunctionCallExpression a_402) + +deriving instance GHC.Show.Show a_403 => GHC.Show.Show (FunctionCallExpression a_403) + +instance AST.Unmarshal.Unmarshal FunctionCallExpression + +instance Data.Foldable.Foldable FunctionCallExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionCallExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionCallExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionDefinition a = FunctionDefinition + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (Type a))), + body :: (AST.Parse.Err (CompoundStatement a)), + name :: (AST.Parse.Err (Name a)), + parameters :: (AST.Parse.Err (FormalParameters a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_404. + AST.Traversable1.Class.Traversable1 a_404 + ) + +instance AST.Unmarshal.SymbolMatching FunctionDefinition where + matchedSymbols _ = [192] + showFailure _ node_405 = + "expected " + GHC.Base.<> ( "function_definition" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_405 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_405) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_406 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_407 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_408 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_409 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_406 + c1_407 = TreeSitter.Node.nodeStartPoint node_405 + TreeSitter.Node.TSPoint + r2_408 + c2_409 = TreeSitter.Node.nodeEndPoint node_405 + +deriving instance GHC.Classes.Eq a_410 => GHC.Classes.Eq (FunctionDefinition a_410) + +deriving instance GHC.Classes.Ord a_411 => GHC.Classes.Ord (FunctionDefinition a_411) + +deriving instance GHC.Show.Show a_412 => GHC.Show.Show (FunctionDefinition a_412) + +instance AST.Unmarshal.Unmarshal FunctionDefinition + +instance Data.Foldable.Foldable FunctionDefinition where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionDefinition where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionDefinition where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionStaticDeclaration a = FunctionStaticDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (StaticVariableDeclaration a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_413. + AST.Traversable1.Class.Traversable1 a_413 + ) + +instance AST.Unmarshal.SymbolMatching FunctionStaticDeclaration where + matchedSymbols _ = [158] + showFailure _ node_414 = + "expected " + GHC.Base.<> ( "function_static_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_414 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_414) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_415 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_416 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_417 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_418 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_415 + c1_416 = TreeSitter.Node.nodeStartPoint node_414 + TreeSitter.Node.TSPoint + r2_417 + c2_418 = TreeSitter.Node.nodeEndPoint node_414 + +deriving instance GHC.Classes.Eq a_419 => GHC.Classes.Eq (FunctionStaticDeclaration a_419) + +deriving instance GHC.Classes.Ord a_420 => GHC.Classes.Ord (FunctionStaticDeclaration a_420) + +deriving instance GHC.Show.Show a_421 => GHC.Show.Show (FunctionStaticDeclaration a_421) + +instance AST.Unmarshal.Unmarshal FunctionStaticDeclaration + +instance Data.Foldable.Foldable FunctionStaticDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionStaticDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionStaticDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GlobalDeclaration a = GlobalDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((DynamicVariableName GHC.Generics.:+: VariableName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_422. + AST.Traversable1.Class.Traversable1 a_422 + ) + +instance AST.Unmarshal.SymbolMatching GlobalDeclaration where + matchedSymbols _ = [160] + showFailure _ node_423 = + "expected " + GHC.Base.<> ( "global_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_423 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_423) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_424 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_425 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_426 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_427 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_424 + c1_425 = TreeSitter.Node.nodeStartPoint node_423 + TreeSitter.Node.TSPoint + r2_426 + c2_427 = TreeSitter.Node.nodeEndPoint node_423 + +deriving instance GHC.Classes.Eq a_428 => GHC.Classes.Eq (GlobalDeclaration a_428) + +deriving instance GHC.Classes.Ord a_429 => GHC.Classes.Ord (GlobalDeclaration a_429) + +deriving instance GHC.Show.Show a_430 => GHC.Show.Show (GlobalDeclaration a_430) + +instance AST.Unmarshal.Unmarshal GlobalDeclaration + +instance Data.Foldable.Foldable GlobalDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GlobalDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GlobalDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GotoStatement a = GotoStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (Name a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_431. + AST.Traversable1.Class.Traversable1 a_431 + ) + +instance AST.Unmarshal.SymbolMatching GotoStatement where + matchedSymbols _ = [211] + showFailure _ node_432 = + "expected " + GHC.Base.<> ( "goto_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_432 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_432) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_433 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_434 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_435 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_436 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_433 + c1_434 = TreeSitter.Node.nodeStartPoint node_432 + TreeSitter.Node.TSPoint + r2_435 + c2_436 = TreeSitter.Node.nodeEndPoint node_432 + +deriving instance GHC.Classes.Eq a_437 => GHC.Classes.Eq (GotoStatement a_437) + +deriving instance GHC.Classes.Ord a_438 => GHC.Classes.Ord (GotoStatement a_438) + +deriving instance GHC.Show.Show a_439 => GHC.Show.Show (GotoStatement a_439) + +instance AST.Unmarshal.Unmarshal GotoStatement + +instance Data.Foldable.Foldable GotoStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GotoStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GotoStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IfStatement a = IfStatement + { ann :: a, + alternative :: ([AST.Parse.Err ((ElseClause GHC.Generics.:+: ElseIfClause) a)]), + body :: (AST.Parse.Err ((Statement GHC.Generics.:+: ColonBlock) a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_440. + AST.Traversable1.Class.Traversable1 a_440 + ) + +instance AST.Unmarshal.SymbolMatching IfStatement where + matchedSymbols _ = [223] + showFailure _ node_441 = + "expected " + GHC.Base.<> ( "if_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_441 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_441) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_442 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_443 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_444 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_445 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_442 + c1_443 = TreeSitter.Node.nodeStartPoint node_441 + TreeSitter.Node.TSPoint + r2_444 + c2_445 = TreeSitter.Node.nodeEndPoint node_441 + +deriving instance GHC.Classes.Eq a_446 => GHC.Classes.Eq (IfStatement a_446) + +deriving instance GHC.Classes.Ord a_447 => GHC.Classes.Ord (IfStatement a_447) + +deriving instance GHC.Show.Show a_448 => GHC.Show.Show (IfStatement a_448) + +instance AST.Unmarshal.Unmarshal IfStatement + +instance Data.Foldable.Foldable IfStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IfStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IfStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IncludeExpression a = IncludeExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_449. + AST.Traversable1.Class.Traversable1 a_449 + ) + +instance AST.Unmarshal.SymbolMatching IncludeExpression where + matchedSymbols _ = [273] + showFailure _ node_450 = + "expected " + GHC.Base.<> ( "include_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_450 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_450) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_451 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_452 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_453 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_454 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_451 + c1_452 = TreeSitter.Node.nodeStartPoint node_450 + TreeSitter.Node.TSPoint + r2_453 + c2_454 = TreeSitter.Node.nodeEndPoint node_450 + +deriving instance GHC.Classes.Eq a_455 => GHC.Classes.Eq (IncludeExpression a_455) + +deriving instance GHC.Classes.Ord a_456 => GHC.Classes.Ord (IncludeExpression a_456) + +deriving instance GHC.Show.Show a_457 => GHC.Show.Show (IncludeExpression a_457) + +instance AST.Unmarshal.Unmarshal IncludeExpression + +instance Data.Foldable.Foldable IncludeExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IncludeExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IncludeExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IncludeOnceExpression a = IncludeOnceExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_458. + AST.Traversable1.Class.Traversable1 a_458 + ) + +instance AST.Unmarshal.SymbolMatching IncludeOnceExpression where + matchedSymbols _ = [274] + showFailure _ node_459 = + "expected " + GHC.Base.<> ( "include_once_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_459 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_459) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_460 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_461 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_462 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_463 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_460 + c1_461 = TreeSitter.Node.nodeStartPoint node_459 + TreeSitter.Node.TSPoint + r2_462 + c2_463 = TreeSitter.Node.nodeEndPoint node_459 + +deriving instance GHC.Classes.Eq a_464 => GHC.Classes.Eq (IncludeOnceExpression a_464) + +deriving instance GHC.Classes.Ord a_465 => GHC.Classes.Ord (IncludeOnceExpression a_465) + +deriving instance GHC.Show.Show a_466 => GHC.Show.Show (IncludeOnceExpression a_466) + +instance AST.Unmarshal.Unmarshal IncludeOnceExpression + +instance Data.Foldable.Foldable IncludeOnceExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IncludeOnceExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IncludeOnceExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InterfaceBaseClause a = InterfaceBaseClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (QualifiedName a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_467. + AST.Traversable1.Class.Traversable1 a_467 + ) + +instance AST.Unmarshal.SymbolMatching InterfaceBaseClause where + matchedSymbols _ = [173] + showFailure _ node_468 = + "expected " + GHC.Base.<> ( "interface_base_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_468 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_468) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_469 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_470 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_471 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_472 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_469 + c1_470 = TreeSitter.Node.nodeStartPoint node_468 + TreeSitter.Node.TSPoint + r2_471 + c2_472 = TreeSitter.Node.nodeEndPoint node_468 + +deriving instance GHC.Classes.Eq a_473 => GHC.Classes.Eq (InterfaceBaseClause a_473) + +deriving instance GHC.Classes.Ord a_474 => GHC.Classes.Ord (InterfaceBaseClause a_474) + +deriving instance GHC.Show.Show a_475 => GHC.Show.Show (InterfaceBaseClause a_475) + +instance AST.Unmarshal.Unmarshal InterfaceBaseClause + +instance Data.Foldable.Foldable InterfaceBaseClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InterfaceBaseClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InterfaceBaseClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InterfaceDeclaration a = InterfaceDeclaration + { ann :: a, + body :: (AST.Parse.Err (DeclarationList a)), + name :: (AST.Parse.Err (Name a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (InterfaceBaseClause a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_476. + AST.Traversable1.Class.Traversable1 a_476 + ) + +instance AST.Unmarshal.SymbolMatching InterfaceDeclaration where + matchedSymbols _ = [172] + showFailure _ node_477 = + "expected " + GHC.Base.<> ( "interface_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_477 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_477) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_478 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_479 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_480 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_481 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_478 + c1_479 = TreeSitter.Node.nodeStartPoint node_477 + TreeSitter.Node.TSPoint + r2_480 + c2_481 = TreeSitter.Node.nodeEndPoint node_477 + +deriving instance GHC.Classes.Eq a_482 => GHC.Classes.Eq (InterfaceDeclaration a_482) + +deriving instance GHC.Classes.Ord a_483 => GHC.Classes.Ord (InterfaceDeclaration a_483) + +deriving instance GHC.Show.Show a_484 => GHC.Show.Show (InterfaceDeclaration a_484) + +instance AST.Unmarshal.Unmarshal InterfaceDeclaration + +instance Data.Foldable.Foldable InterfaceDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InterfaceDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InterfaceDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ListLiteral a = ListLiteral + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: ListLiteral GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_485. + AST.Traversable1.Class.Traversable1 a_485 + ) + +instance AST.Unmarshal.SymbolMatching ListLiteral where + matchedSymbols _ = [256] + showFailure _ node_486 = + "expected " + GHC.Base.<> ( "list_literal" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_486 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_486) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_487 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_488 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_489 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_490 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_487 + c1_488 = TreeSitter.Node.nodeStartPoint node_486 + TreeSitter.Node.TSPoint + r2_489 + c2_490 = TreeSitter.Node.nodeEndPoint node_486 + +deriving instance GHC.Classes.Eq a_491 => GHC.Classes.Eq (ListLiteral a_491) + +deriving instance GHC.Classes.Ord a_492 => GHC.Classes.Ord (ListLiteral a_492) + +deriving instance GHC.Show.Show a_493 => GHC.Show.Show (ListLiteral a_493) + +instance AST.Unmarshal.Unmarshal ListLiteral + +instance Data.Foldable.Foldable ListLiteral where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ListLiteral where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ListLiteral where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MemberAccessExpression a = MemberAccessExpression + { ann :: a, + name :: (AST.Parse.Err ((Expression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: Name GHC.Generics.:+: VariableName) a)), + object :: (AST.Parse.Err ((ArrayCreationExpression GHC.Generics.:+: CastExpression GHC.Generics.:+: ClassConstantAccessExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: Heredoc GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_494. + AST.Traversable1.Class.Traversable1 a_494 + ) + +instance AST.Unmarshal.SymbolMatching MemberAccessExpression where + matchedSymbols _ = [254] + showFailure _ node_495 = + "expected " + GHC.Base.<> ( "member_access_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_495 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_495) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_496 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_497 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_498 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_499 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_496 + c1_497 = TreeSitter.Node.nodeStartPoint node_495 + TreeSitter.Node.TSPoint + r2_498 + c2_499 = TreeSitter.Node.nodeEndPoint node_495 + +deriving instance GHC.Classes.Eq a_500 => GHC.Classes.Eq (MemberAccessExpression a_500) + +deriving instance GHC.Classes.Ord a_501 => GHC.Classes.Ord (MemberAccessExpression a_501) + +deriving instance GHC.Show.Show a_502 => GHC.Show.Show (MemberAccessExpression a_502) + +instance AST.Unmarshal.Unmarshal MemberAccessExpression + +instance Data.Foldable.Foldable MemberAccessExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MemberAccessExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MemberAccessExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MemberCallExpression a = MemberCallExpression + { ann :: a, + arguments :: (AST.Parse.Err (Arguments a)), + name :: (AST.Parse.Err ((Expression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: Name GHC.Generics.:+: VariableName) a)), + object :: (AST.Parse.Err ((ArrayCreationExpression GHC.Generics.:+: CastExpression GHC.Generics.:+: ClassConstantAccessExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: Heredoc GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_503. + AST.Traversable1.Class.Traversable1 a_503 + ) + +instance AST.Unmarshal.SymbolMatching MemberCallExpression where + matchedSymbols _ = [262] + showFailure _ node_504 = + "expected " + GHC.Base.<> ( "member_call_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_504 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_504) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_505 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_506 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_507 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_508 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_505 + c1_506 = TreeSitter.Node.nodeStartPoint node_504 + TreeSitter.Node.TSPoint + r2_507 + c2_508 = TreeSitter.Node.nodeEndPoint node_504 + +deriving instance GHC.Classes.Eq a_509 => GHC.Classes.Eq (MemberCallExpression a_509) + +deriving instance GHC.Classes.Ord a_510 => GHC.Classes.Ord (MemberCallExpression a_510) + +deriving instance GHC.Show.Show a_511 => GHC.Show.Show (MemberCallExpression a_511) + +instance AST.Unmarshal.Unmarshal MemberCallExpression + +instance Data.Foldable.Foldable MemberCallExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MemberCallExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MemberCallExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodDeclaration a = MethodDeclaration + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (Type a))), + body :: (GHC.Maybe.Maybe (AST.Parse.Err (CompoundStatement a))), + name :: (AST.Parse.Err (Name a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + extraChildren :: ([AST.Parse.Err ((ClassModifier GHC.Generics.:+: StaticModifier GHC.Generics.:+: VarModifier GHC.Generics.:+: VisibilityModifier) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_512. + AST.Traversable1.Class.Traversable1 a_512 + ) + +instance AST.Unmarshal.SymbolMatching MethodDeclaration where + matchedSymbols _ = [185] + showFailure _ node_513 = + "expected " + GHC.Base.<> ( "method_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_513 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_513) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_514 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_515 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_516 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_517 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_514 + c1_515 = TreeSitter.Node.nodeStartPoint node_513 + TreeSitter.Node.TSPoint + r2_516 + c2_517 = TreeSitter.Node.nodeEndPoint node_513 + +deriving instance GHC.Classes.Eq a_518 => GHC.Classes.Eq (MethodDeclaration a_518) + +deriving instance GHC.Classes.Ord a_519 => GHC.Classes.Ord (MethodDeclaration a_519) + +deriving instance GHC.Show.Show a_520 => GHC.Show.Show (MethodDeclaration a_520) + +instance AST.Unmarshal.Unmarshal MethodDeclaration + +instance Data.Foldable.Foldable MethodDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Name a = Name {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_521. + AST.Traversable1.Class.Traversable1 a_521 + ) + +instance AST.Unmarshal.SymbolMatching Name where + matchedSymbols _ = [1, 277] + showFailure _ node_522 = + "expected " + GHC.Base.<> ( "name, name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_522 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_522) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_523 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_524 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_525 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_526 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_523 + c1_524 = TreeSitter.Node.nodeStartPoint node_522 + TreeSitter.Node.TSPoint + r2_525 + c2_526 = TreeSitter.Node.nodeEndPoint node_522 + +deriving instance GHC.Classes.Eq a_527 => GHC.Classes.Eq (Name a_527) + +deriving instance GHC.Classes.Ord a_528 => GHC.Classes.Ord (Name a_528) + +deriving instance GHC.Show.Show a_529 => GHC.Show.Show (Name a_529) + +instance AST.Unmarshal.Unmarshal Name + +instance Data.Foldable.Foldable Name where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Name where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Name where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamedLabelStatement a = NamedLabelStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (Name a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_530. + AST.Traversable1.Class.Traversable1 a_530 + ) + +instance AST.Unmarshal.SymbolMatching NamedLabelStatement where + matchedSymbols _ = [234] + showFailure _ node_531 = + "expected " + GHC.Base.<> ( "named_label_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_531 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_531) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_532 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_533 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_534 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_535 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_532 + c1_533 = TreeSitter.Node.nodeStartPoint node_531 + TreeSitter.Node.TSPoint + r2_534 + c2_535 = TreeSitter.Node.nodeEndPoint node_531 + +deriving instance GHC.Classes.Eq a_536 => GHC.Classes.Eq (NamedLabelStatement a_536) + +deriving instance GHC.Classes.Ord a_537 => GHC.Classes.Ord (NamedLabelStatement a_537) + +deriving instance GHC.Show.Show a_538 => GHC.Show.Show (NamedLabelStatement a_538) + +instance AST.Unmarshal.Unmarshal NamedLabelStatement + +instance Data.Foldable.Foldable NamedLabelStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamedLabelStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamedLabelStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceAliasingClause a = NamespaceAliasingClause + { ann :: a, + extraChildren :: (AST.Parse.Err (Name a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_539. + AST.Traversable1.Class.Traversable1 a_539 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceAliasingClause where + matchedSymbols _ = [168] + showFailure _ node_540 = + "expected " + GHC.Base.<> ( "namespace_aliasing_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_540 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_540) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_541 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_542 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_543 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_544 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_541 + c1_542 = TreeSitter.Node.nodeStartPoint node_540 + TreeSitter.Node.TSPoint + r2_543 + c2_544 = TreeSitter.Node.nodeEndPoint node_540 + +deriving instance GHC.Classes.Eq a_545 => GHC.Classes.Eq (NamespaceAliasingClause a_545) + +deriving instance GHC.Classes.Ord a_546 => GHC.Classes.Ord (NamespaceAliasingClause a_546) + +deriving instance GHC.Show.Show a_547 => GHC.Show.Show (NamespaceAliasingClause a_547) + +instance AST.Unmarshal.Unmarshal NamespaceAliasingClause + +instance Data.Foldable.Foldable NamespaceAliasingClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceAliasingClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceAliasingClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceDefinition a = NamespaceDefinition + { ann :: a, + body :: (GHC.Maybe.Maybe (AST.Parse.Err (CompoundStatement a))), + name :: (GHC.Maybe.Maybe (AST.Parse.Err (NamespaceName a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_548. + AST.Traversable1.Class.Traversable1 a_548 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceDefinition where + matchedSymbols _ = [161] + showFailure _ node_549 = + "expected " + GHC.Base.<> ( "namespace_definition" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_549 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_549) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_550 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_551 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_552 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_553 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_550 + c1_551 = TreeSitter.Node.nodeStartPoint node_549 + TreeSitter.Node.TSPoint + r2_552 + c2_553 = TreeSitter.Node.nodeEndPoint node_549 + +deriving instance GHC.Classes.Eq a_554 => GHC.Classes.Eq (NamespaceDefinition a_554) + +deriving instance GHC.Classes.Ord a_555 => GHC.Classes.Ord (NamespaceDefinition a_555) + +deriving instance GHC.Show.Show a_556 => GHC.Show.Show (NamespaceDefinition a_556) + +instance AST.Unmarshal.Unmarshal NamespaceDefinition + +instance Data.Foldable.Foldable NamespaceDefinition where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceDefinition where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceDefinition where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceFunctionOrConst a = NamespaceFunctionOrConst + { ann :: a, + text :: Data.Text.Internal.Text + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_557. + AST.Traversable1.Class.Traversable1 a_557 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceFunctionOrConst where + matchedSymbols _ = [163] + showFailure _ node_558 = + "expected " + GHC.Base.<> ( "namespace_function_or_const" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_558 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_558) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_559 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_560 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_561 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_562 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_559 + c1_560 = TreeSitter.Node.nodeStartPoint node_558 + TreeSitter.Node.TSPoint + r2_561 + c2_562 = TreeSitter.Node.nodeEndPoint node_558 + +deriving instance GHC.Classes.Eq a_563 => GHC.Classes.Eq (NamespaceFunctionOrConst a_563) + +deriving instance GHC.Classes.Ord a_564 => GHC.Classes.Ord (NamespaceFunctionOrConst a_564) + +deriving instance GHC.Show.Show a_565 => GHC.Show.Show (NamespaceFunctionOrConst a_565) + +instance AST.Unmarshal.Unmarshal NamespaceFunctionOrConst + +instance Data.Foldable.Foldable NamespaceFunctionOrConst where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceFunctionOrConst where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceFunctionOrConst where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceName a = NamespaceName + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Name a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_566. + AST.Traversable1.Class.Traversable1 a_566 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceName where + matchedSymbols _ = [167] + showFailure _ node_567 = + "expected " + GHC.Base.<> ( "namespace_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_567 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_567) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_568 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_569 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_570 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_571 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_568 + c1_569 = TreeSitter.Node.nodeStartPoint node_567 + TreeSitter.Node.TSPoint + r2_570 + c2_571 = TreeSitter.Node.nodeEndPoint node_567 + +deriving instance GHC.Classes.Eq a_572 => GHC.Classes.Eq (NamespaceName a_572) + +deriving instance GHC.Classes.Ord a_573 => GHC.Classes.Ord (NamespaceName a_573) + +deriving instance GHC.Show.Show a_574 => GHC.Show.Show (NamespaceName a_574) + +instance AST.Unmarshal.Unmarshal NamespaceName + +instance Data.Foldable.Foldable NamespaceName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceNameAsPrefix a = NamespaceNameAsPrefix + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (NamespaceName a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_575. + AST.Traversable1.Class.Traversable1 a_575 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceNameAsPrefix where + matchedSymbols _ = [166] + showFailure _ node_576 = + "expected " + GHC.Base.<> ( "namespace_name_as_prefix" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_576 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_576) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_577 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_578 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_579 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_580 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_577 + c1_578 = TreeSitter.Node.nodeStartPoint node_576 + TreeSitter.Node.TSPoint + r2_579 + c2_580 = TreeSitter.Node.nodeEndPoint node_576 + +deriving instance GHC.Classes.Eq a_581 => GHC.Classes.Eq (NamespaceNameAsPrefix a_581) + +deriving instance GHC.Classes.Ord a_582 => GHC.Classes.Ord (NamespaceNameAsPrefix a_582) + +deriving instance GHC.Show.Show a_583 => GHC.Show.Show (NamespaceNameAsPrefix a_583) + +instance AST.Unmarshal.Unmarshal NamespaceNameAsPrefix + +instance Data.Foldable.Foldable NamespaceNameAsPrefix where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceNameAsPrefix where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceNameAsPrefix where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceUseClause a = NamespaceUseClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((NamespaceAliasingClause GHC.Generics.:+: QualifiedName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_584. + AST.Traversable1.Class.Traversable1 a_584 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceUseClause where + matchedSymbols _ = [164] + showFailure _ node_585 = + "expected " + GHC.Base.<> ( "namespace_use_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_585 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_585) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_586 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_587 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_588 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_589 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_586 + c1_587 = TreeSitter.Node.nodeStartPoint node_585 + TreeSitter.Node.TSPoint + r2_588 + c2_589 = TreeSitter.Node.nodeEndPoint node_585 + +deriving instance GHC.Classes.Eq a_590 => GHC.Classes.Eq (NamespaceUseClause a_590) + +deriving instance GHC.Classes.Ord a_591 => GHC.Classes.Ord (NamespaceUseClause a_591) + +deriving instance GHC.Show.Show a_592 => GHC.Show.Show (NamespaceUseClause a_592) + +instance AST.Unmarshal.Unmarshal NamespaceUseClause + +instance Data.Foldable.Foldable NamespaceUseClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceUseClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceUseClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceUseDeclaration a = NamespaceUseDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((NamespaceFunctionOrConst GHC.Generics.:+: NamespaceName GHC.Generics.:+: NamespaceUseClause GHC.Generics.:+: NamespaceUseGroup) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_593. + AST.Traversable1.Class.Traversable1 a_593 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceUseDeclaration where + matchedSymbols _ = [162] + showFailure _ node_594 = + "expected " + GHC.Base.<> ( "namespace_use_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_594 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_594) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_595 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_596 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_597 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_598 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_595 + c1_596 = TreeSitter.Node.nodeStartPoint node_594 + TreeSitter.Node.TSPoint + r2_597 + c2_598 = TreeSitter.Node.nodeEndPoint node_594 + +deriving instance GHC.Classes.Eq a_599 => GHC.Classes.Eq (NamespaceUseDeclaration a_599) + +deriving instance GHC.Classes.Ord a_600 => GHC.Classes.Ord (NamespaceUseDeclaration a_600) + +deriving instance GHC.Show.Show a_601 => GHC.Show.Show (NamespaceUseDeclaration a_601) + +instance AST.Unmarshal.Unmarshal NamespaceUseDeclaration + +instance Data.Foldable.Foldable NamespaceUseDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceUseDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceUseDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceUseGroup a = NamespaceUseGroup + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (NamespaceUseGroupClause a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_602. + AST.Traversable1.Class.Traversable1 a_602 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceUseGroup where + matchedSymbols _ = [169] + showFailure _ node_603 = + "expected " + GHC.Base.<> ( "namespace_use_group" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_603 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_603) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_604 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_605 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_606 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_607 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_604 + c1_605 = TreeSitter.Node.nodeStartPoint node_603 + TreeSitter.Node.TSPoint + r2_606 + c2_607 = TreeSitter.Node.nodeEndPoint node_603 + +deriving instance GHC.Classes.Eq a_608 => GHC.Classes.Eq (NamespaceUseGroup a_608) + +deriving instance GHC.Classes.Ord a_609 => GHC.Classes.Ord (NamespaceUseGroup a_609) + +deriving instance GHC.Show.Show a_610 => GHC.Show.Show (NamespaceUseGroup a_610) + +instance AST.Unmarshal.Unmarshal NamespaceUseGroup + +instance Data.Foldable.Foldable NamespaceUseGroup where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceUseGroup where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceUseGroup where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceUseGroupClause a = NamespaceUseGroupClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((NamespaceAliasingClause GHC.Generics.:+: NamespaceFunctionOrConst GHC.Generics.:+: NamespaceName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_611. + AST.Traversable1.Class.Traversable1 a_611 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceUseGroupClause where + matchedSymbols _ = [170] + showFailure _ node_612 = + "expected " + GHC.Base.<> ( "namespace_use_group_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_612 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_612) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_613 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_614 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_615 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_616 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_613 + c1_614 = TreeSitter.Node.nodeStartPoint node_612 + TreeSitter.Node.TSPoint + r2_615 + c2_616 = TreeSitter.Node.nodeEndPoint node_612 + +deriving instance GHC.Classes.Eq a_617 => GHC.Classes.Eq (NamespaceUseGroupClause a_617) + +deriving instance GHC.Classes.Ord a_618 => GHC.Classes.Ord (NamespaceUseGroupClause a_618) + +deriving instance GHC.Show.Show a_619 => GHC.Show.Show (NamespaceUseGroupClause a_619) + +instance AST.Unmarshal.Unmarshal NamespaceUseGroupClause + +instance Data.Foldable.Foldable NamespaceUseGroupClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceUseGroupClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceUseGroupClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ObjectCreationExpression a = ObjectCreationExpression + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Arguments GHC.Generics.:+: ClassBaseClause GHC.Generics.:+: ClassInterfaceClause GHC.Generics.:+: DeclarationList GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: QualifiedName GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_620. + AST.Traversable1.Class.Traversable1 a_620 + ) + +instance AST.Unmarshal.SymbolMatching ObjectCreationExpression where + matchedSymbols _ = [247] + showFailure _ node_621 = + "expected " + GHC.Base.<> ( "object_creation_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_621 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_621) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_622 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_623 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_624 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_625 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_622 + c1_623 = TreeSitter.Node.nodeStartPoint node_621 + TreeSitter.Node.TSPoint + r2_624 + c2_625 = TreeSitter.Node.nodeEndPoint node_621 + +deriving instance GHC.Classes.Eq a_626 => GHC.Classes.Eq (ObjectCreationExpression a_626) + +deriving instance GHC.Classes.Ord a_627 => GHC.Classes.Ord (ObjectCreationExpression a_627) + +deriving instance GHC.Show.Show a_628 => GHC.Show.Show (ObjectCreationExpression a_628) + +instance AST.Unmarshal.Unmarshal ObjectCreationExpression + +instance Data.Foldable.Foldable ObjectCreationExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ObjectCreationExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ObjectCreationExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data OptionalType a = OptionalType + { ann :: a, + extraChildren :: (AST.Parse.Err ((PrimitiveType GHC.Generics.:+: TypeName) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_629. + AST.Traversable1.Class.Traversable1 a_629 + ) + +instance AST.Unmarshal.SymbolMatching OptionalType where + matchedSymbols _ = [198] + showFailure _ node_630 = + "expected " + GHC.Base.<> ( "optional_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_630 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_630) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_631 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_632 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_633 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_634 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_631 + c1_632 = TreeSitter.Node.nodeStartPoint node_630 + TreeSitter.Node.TSPoint + r2_633 + c2_634 = TreeSitter.Node.nodeEndPoint node_630 + +deriving instance GHC.Classes.Eq a_635 => GHC.Classes.Eq (OptionalType a_635) + +deriving instance GHC.Classes.Ord a_636 => GHC.Classes.Ord (OptionalType a_636) + +deriving instance GHC.Show.Show a_637 => GHC.Show.Show (OptionalType a_637) + +instance AST.Unmarshal.Unmarshal OptionalType + +instance Data.Foldable.Foldable OptionalType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor OptionalType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable OptionalType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Pair a = Pair + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: ListLiteral) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_638. + AST.Traversable1.Class.Traversable1 a_638 + ) + +instance AST.Unmarshal.SymbolMatching Pair where + matchedSymbols _ = [222] + showFailure _ node_639 = + "expected " + GHC.Base.<> ( "pair" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_639 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_639) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_640 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_641 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_642 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_643 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_640 + c1_641 = TreeSitter.Node.nodeStartPoint node_639 + TreeSitter.Node.TSPoint + r2_642 + c2_643 = TreeSitter.Node.nodeEndPoint node_639 + +deriving instance GHC.Classes.Eq a_644 => GHC.Classes.Eq (Pair a_644) + +deriving instance GHC.Classes.Ord a_645 => GHC.Classes.Ord (Pair a_645) + +deriving instance GHC.Show.Show a_646 => GHC.Show.Show (Pair a_646) + +instance AST.Unmarshal.Unmarshal Pair + +instance Data.Foldable.Foldable Pair where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Pair where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Pair where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParenthesizedExpression a = ParenthesizedExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_647. + AST.Traversable1.Class.Traversable1 a_647 + ) + +instance AST.Unmarshal.SymbolMatching ParenthesizedExpression where + matchedSymbols _ = [242] + showFailure _ node_648 = + "expected " + GHC.Base.<> ( "parenthesized_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_648 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_648) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_649 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_650 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_651 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_652 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_649 + c1_650 = TreeSitter.Node.nodeStartPoint node_648 + TreeSitter.Node.TSPoint + r2_651 + c2_652 = TreeSitter.Node.nodeEndPoint node_648 + +deriving instance GHC.Classes.Eq a_653 => GHC.Classes.Eq (ParenthesizedExpression a_653) + +deriving instance GHC.Classes.Ord a_654 => GHC.Classes.Ord (ParenthesizedExpression a_654) + +deriving instance GHC.Show.Show a_655 => GHC.Show.Show (ParenthesizedExpression a_655) + +instance AST.Unmarshal.Unmarshal ParenthesizedExpression + +instance Data.Foldable.Foldable ParenthesizedExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParenthesizedExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParenthesizedExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PrimitiveType a = PrimitiveType {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_656. + AST.Traversable1.Class.Traversable1 a_656 + ) + +instance AST.Unmarshal.SymbolMatching PrimitiveType where + matchedSymbols _ = [199] + showFailure _ node_657 = + "expected " + GHC.Base.<> ( "primitive_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_657 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_657) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_658 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_659 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_660 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_661 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_658 + c1_659 = TreeSitter.Node.nodeStartPoint node_657 + TreeSitter.Node.TSPoint + r2_660 + c2_661 = TreeSitter.Node.nodeEndPoint node_657 + +deriving instance GHC.Classes.Eq a_662 => GHC.Classes.Eq (PrimitiveType a_662) + +deriving instance GHC.Classes.Ord a_663 => GHC.Classes.Ord (PrimitiveType a_663) + +deriving instance GHC.Show.Show a_664 => GHC.Show.Show (PrimitiveType a_664) + +instance AST.Unmarshal.Unmarshal PrimitiveType + +instance Data.Foldable.Foldable PrimitiveType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PrimitiveType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PrimitiveType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PrintIntrinsic a = PrintIntrinsic + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_665. + AST.Traversable1.Class.Traversable1 a_665 + ) + +instance AST.Unmarshal.SymbolMatching PrintIntrinsic where + matchedSymbols _ = [244] + showFailure _ node_666 = + "expected " + GHC.Base.<> ( "print_intrinsic" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_666 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_666) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_667 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_668 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_669 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_670 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_667 + c1_668 = TreeSitter.Node.nodeStartPoint node_666 + TreeSitter.Node.TSPoint + r2_669 + c2_670 = TreeSitter.Node.nodeEndPoint node_666 + +deriving instance GHC.Classes.Eq a_671 => GHC.Classes.Eq (PrintIntrinsic a_671) + +deriving instance GHC.Classes.Ord a_672 => GHC.Classes.Ord (PrintIntrinsic a_672) + +deriving instance GHC.Show.Show a_673 => GHC.Show.Show (PrintIntrinsic a_673) + +instance AST.Unmarshal.Unmarshal PrintIntrinsic + +instance Data.Foldable.Foldable PrintIntrinsic where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PrintIntrinsic where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PrintIntrinsic where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Program a = Program + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: PhpTag GHC.Generics.:+: Text) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_674. + AST.Traversable1.Class.Traversable1 a_674 + ) + +instance AST.Unmarshal.SymbolMatching Program where + matchedSymbols _ = [154] + showFailure _ node_675 = + "expected " + GHC.Base.<> ( "program" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_675 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_675) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_676 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_677 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_678 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_679 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_676 + c1_677 = TreeSitter.Node.nodeStartPoint node_675 + TreeSitter.Node.TSPoint + r2_678 + c2_679 = TreeSitter.Node.nodeEndPoint node_675 + +deriving instance GHC.Classes.Eq a_680 => GHC.Classes.Eq (Program a_680) + +deriving instance GHC.Classes.Ord a_681 => GHC.Classes.Ord (Program a_681) + +deriving instance GHC.Show.Show a_682 => GHC.Show.Show (Program a_682) + +instance AST.Unmarshal.Unmarshal Program + +instance Data.Foldable.Foldable Program where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Program where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Program where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PropertyDeclaration a = PropertyDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ClassModifier GHC.Generics.:+: PropertyElement GHC.Generics.:+: StaticModifier GHC.Generics.:+: VarModifier GHC.Generics.:+: VisibilityModifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_683. + AST.Traversable1.Class.Traversable1 a_683 + ) + +instance AST.Unmarshal.SymbolMatching PropertyDeclaration where + matchedSymbols _ = [181] + showFailure _ node_684 = + "expected " + GHC.Base.<> ( "property_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_684 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_684) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_685 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_686 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_687 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_688 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_685 + c1_686 = TreeSitter.Node.nodeStartPoint node_684 + TreeSitter.Node.TSPoint + r2_687 + c2_688 = TreeSitter.Node.nodeEndPoint node_684 + +deriving instance GHC.Classes.Eq a_689 => GHC.Classes.Eq (PropertyDeclaration a_689) + +deriving instance GHC.Classes.Ord a_690 => GHC.Classes.Ord (PropertyDeclaration a_690) + +deriving instance GHC.Show.Show a_691 => GHC.Show.Show (PropertyDeclaration a_691) + +instance AST.Unmarshal.Unmarshal PropertyDeclaration + +instance Data.Foldable.Foldable PropertyDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PropertyDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PropertyDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PropertyElement a = PropertyElement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((PropertyInitializer GHC.Generics.:+: VariableName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_692. + AST.Traversable1.Class.Traversable1 a_692 + ) + +instance AST.Unmarshal.SymbolMatching PropertyElement where + matchedSymbols _ = [183] + showFailure _ node_693 = + "expected " + GHC.Base.<> ( "property_element" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_693 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_693) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_694 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_695 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_696 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_697 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_694 + c1_695 = TreeSitter.Node.nodeStartPoint node_693 + TreeSitter.Node.TSPoint + r2_696 + c2_697 = TreeSitter.Node.nodeEndPoint node_693 + +deriving instance GHC.Classes.Eq a_698 => GHC.Classes.Eq (PropertyElement a_698) + +deriving instance GHC.Classes.Ord a_699 => GHC.Classes.Ord (PropertyElement a_699) + +deriving instance GHC.Show.Show a_700 => GHC.Show.Show (PropertyElement a_700) + +instance AST.Unmarshal.Unmarshal PropertyElement + +instance Data.Foldable.Foldable PropertyElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PropertyElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PropertyElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PropertyInitializer a = PropertyInitializer + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_701. + AST.Traversable1.Class.Traversable1 a_701 + ) + +instance AST.Unmarshal.SymbolMatching PropertyInitializer where + matchedSymbols _ = [184] + showFailure _ node_702 = + "expected " + GHC.Base.<> ( "property_initializer" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_702 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_702) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_703 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_704 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_705 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_706 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_703 + c1_704 = TreeSitter.Node.nodeStartPoint node_702 + TreeSitter.Node.TSPoint + r2_705 + c2_706 = TreeSitter.Node.nodeEndPoint node_702 + +deriving instance GHC.Classes.Eq a_707 => GHC.Classes.Eq (PropertyInitializer a_707) + +deriving instance GHC.Classes.Ord a_708 => GHC.Classes.Ord (PropertyInitializer a_708) + +deriving instance GHC.Show.Show a_709 => GHC.Show.Show (PropertyInitializer a_709) + +instance AST.Unmarshal.Unmarshal PropertyInitializer + +instance Data.Foldable.Foldable PropertyInitializer where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PropertyInitializer where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PropertyInitializer where + traverse = AST.Traversable1.Class.traverseDefault1 + +data QualifiedName a = QualifiedName + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Name GHC.Generics.:+: NamespaceNameAsPrefix) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_710. + AST.Traversable1.Class.Traversable1 a_710 + ) + +instance AST.Unmarshal.SymbolMatching QualifiedName where + matchedSymbols _ = [165] + showFailure _ node_711 = + "expected " + GHC.Base.<> ( "qualified_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_711 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_711) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_712 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_713 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_714 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_715 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_712 + c1_713 = TreeSitter.Node.nodeStartPoint node_711 + TreeSitter.Node.TSPoint + r2_714 + c2_715 = TreeSitter.Node.nodeEndPoint node_711 + +deriving instance GHC.Classes.Eq a_716 => GHC.Classes.Eq (QualifiedName a_716) + +deriving instance GHC.Classes.Ord a_717 => GHC.Classes.Ord (QualifiedName a_717) + +deriving instance GHC.Show.Show a_718 => GHC.Show.Show (QualifiedName a_718) + +instance AST.Unmarshal.Unmarshal QualifiedName + +instance Data.Foldable.Foldable QualifiedName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor QualifiedName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable QualifiedName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RelativeScope a = RelativeScope {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_719. + AST.Traversable1.Class.Traversable1 a_719 + ) + +instance AST.Unmarshal.SymbolMatching RelativeScope where + matchedSymbols _ = [260] + showFailure _ node_720 = + "expected " + GHC.Base.<> ( "relative_scope" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_720 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_720) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_721 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_722 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_723 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_724 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_721 + c1_722 = TreeSitter.Node.nodeStartPoint node_720 + TreeSitter.Node.TSPoint + r2_723 + c2_724 = TreeSitter.Node.nodeEndPoint node_720 + +deriving instance GHC.Classes.Eq a_725 => GHC.Classes.Eq (RelativeScope a_725) + +deriving instance GHC.Classes.Ord a_726 => GHC.Classes.Ord (RelativeScope a_726) + +deriving instance GHC.Show.Show a_727 => GHC.Show.Show (RelativeScope a_727) + +instance AST.Unmarshal.Unmarshal RelativeScope + +instance Data.Foldable.Foldable RelativeScope where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RelativeScope where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RelativeScope where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RequireExpression a = RequireExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_728. + AST.Traversable1.Class.Traversable1 a_728 + ) + +instance AST.Unmarshal.SymbolMatching RequireExpression where + matchedSymbols _ = [275] + showFailure _ node_729 = + "expected " + GHC.Base.<> ( "require_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_729 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_729) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_730 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_731 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_732 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_733 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_730 + c1_731 = TreeSitter.Node.nodeStartPoint node_729 + TreeSitter.Node.TSPoint + r2_732 + c2_733 = TreeSitter.Node.nodeEndPoint node_729 + +deriving instance GHC.Classes.Eq a_734 => GHC.Classes.Eq (RequireExpression a_734) + +deriving instance GHC.Classes.Ord a_735 => GHC.Classes.Ord (RequireExpression a_735) + +deriving instance GHC.Show.Show a_736 => GHC.Show.Show (RequireExpression a_736) + +instance AST.Unmarshal.Unmarshal RequireExpression + +instance Data.Foldable.Foldable RequireExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RequireExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RequireExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RequireOnceExpression a = RequireOnceExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_737. + AST.Traversable1.Class.Traversable1 a_737 + ) + +instance AST.Unmarshal.SymbolMatching RequireOnceExpression where + matchedSymbols _ = [276] + showFailure _ node_738 = + "expected " + GHC.Base.<> ( "require_once_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_738 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_738) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_739 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_740 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_741 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_742 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_739 + c1_740 = TreeSitter.Node.nodeStartPoint node_738 + TreeSitter.Node.TSPoint + r2_741 + c2_742 = TreeSitter.Node.nodeEndPoint node_738 + +deriving instance GHC.Classes.Eq a_743 => GHC.Classes.Eq (RequireOnceExpression a_743) + +deriving instance GHC.Classes.Ord a_744 => GHC.Classes.Ord (RequireOnceExpression a_744) + +deriving instance GHC.Show.Show a_745 => GHC.Show.Show (RequireOnceExpression a_745) + +instance AST.Unmarshal.Unmarshal RequireOnceExpression + +instance Data.Foldable.Foldable RequireOnceExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RequireOnceExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RequireOnceExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ReturnStatement a = ReturnStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_746. + AST.Traversable1.Class.Traversable1 a_746 + ) + +instance AST.Unmarshal.SymbolMatching ReturnStatement where + matchedSymbols _ = [214] + showFailure _ node_747 = + "expected " + GHC.Base.<> ( "return_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_747 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_747) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_748 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_749 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_750 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_751 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_748 + c1_749 = TreeSitter.Node.nodeStartPoint node_747 + TreeSitter.Node.TSPoint + r2_750 + c2_751 = TreeSitter.Node.nodeEndPoint node_747 + +deriving instance GHC.Classes.Eq a_752 => GHC.Classes.Eq (ReturnStatement a_752) + +deriving instance GHC.Classes.Ord a_753 => GHC.Classes.Ord (ReturnStatement a_753) + +deriving instance GHC.Show.Show a_754 => GHC.Show.Show (ReturnStatement a_754) + +instance AST.Unmarshal.Unmarshal ReturnStatement + +instance Data.Foldable.Foldable ReturnStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ReturnStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ReturnStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ScopedCallExpression a = ScopedCallExpression + { ann :: a, + arguments :: (AST.Parse.Err (Arguments a)), + name :: (AST.Parse.Err ((Expression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: Name GHC.Generics.:+: VariableName) a)), + scope :: (AST.Parse.Err ((ArrayCreationExpression GHC.Generics.:+: CastExpression GHC.Generics.:+: ClassConstantAccessExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: Heredoc GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: QualifiedName GHC.Generics.:+: RelativeScope GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_755. + AST.Traversable1.Class.Traversable1 a_755 + ) + +instance AST.Unmarshal.SymbolMatching ScopedCallExpression where + matchedSymbols _ = [258] + showFailure _ node_756 = + "expected " + GHC.Base.<> ( "scoped_call_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_756 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_756) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_757 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_758 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_759 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_760 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_757 + c1_758 = TreeSitter.Node.nodeStartPoint node_756 + TreeSitter.Node.TSPoint + r2_759 + c2_760 = TreeSitter.Node.nodeEndPoint node_756 + +deriving instance GHC.Classes.Eq a_761 => GHC.Classes.Eq (ScopedCallExpression a_761) + +deriving instance GHC.Classes.Ord a_762 => GHC.Classes.Ord (ScopedCallExpression a_762) + +deriving instance GHC.Show.Show a_763 => GHC.Show.Show (ScopedCallExpression a_763) + +instance AST.Unmarshal.Unmarshal ScopedCallExpression + +instance Data.Foldable.Foldable ScopedCallExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ScopedCallExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ScopedCallExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ScopedPropertyAccessExpression a = ScopedPropertyAccessExpression + { ann :: a, + name :: (AST.Parse.Err ((DynamicVariableName GHC.Generics.:+: VariableName) a)), + scope :: (AST.Parse.Err ((ArrayCreationExpression GHC.Generics.:+: CastExpression GHC.Generics.:+: ClassConstantAccessExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: Heredoc GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: QualifiedName GHC.Generics.:+: RelativeScope GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_764. + AST.Traversable1.Class.Traversable1 a_764 + ) + +instance AST.Unmarshal.SymbolMatching ScopedPropertyAccessExpression where + matchedSymbols _ = [255] + showFailure _ node_765 = + "expected " + GHC.Base.<> ( "scoped_property_access_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_765 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_765) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_766 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_767 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_768 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_769 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_766 + c1_767 = TreeSitter.Node.nodeStartPoint node_765 + TreeSitter.Node.TSPoint + r2_768 + c2_769 = TreeSitter.Node.nodeEndPoint node_765 + +deriving instance GHC.Classes.Eq a_770 => GHC.Classes.Eq (ScopedPropertyAccessExpression a_770) + +deriving instance GHC.Classes.Ord a_771 => GHC.Classes.Ord (ScopedPropertyAccessExpression a_771) + +deriving instance GHC.Show.Show a_772 => GHC.Show.Show (ScopedPropertyAccessExpression a_772) + +instance AST.Unmarshal.Unmarshal ScopedPropertyAccessExpression + +instance Data.Foldable.Foldable ScopedPropertyAccessExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ScopedPropertyAccessExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ScopedPropertyAccessExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SequenceExpression a = SequenceExpression + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_773. + AST.Traversable1.Class.Traversable1 a_773 + ) + +instance AST.Unmarshal.SymbolMatching SequenceExpression where + matchedSymbols _ = [220] + showFailure _ node_774 = + "expected " + GHC.Base.<> ( "sequence_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_774 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_774) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_775 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_776 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_777 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_778 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_775 + c1_776 = TreeSitter.Node.nodeStartPoint node_774 + TreeSitter.Node.TSPoint + r2_777 + c2_778 = TreeSitter.Node.nodeEndPoint node_774 + +deriving instance GHC.Classes.Eq a_779 => GHC.Classes.Eq (SequenceExpression a_779) + +deriving instance GHC.Classes.Ord a_780 => GHC.Classes.Ord (SequenceExpression a_780) + +deriving instance GHC.Show.Show a_781 => GHC.Show.Show (SequenceExpression a_781) + +instance AST.Unmarshal.Unmarshal SequenceExpression + +instance Data.Foldable.Foldable SequenceExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SequenceExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SequenceExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SimpleParameter a = SimpleParameter + { ann :: a, + defaultValue :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + name :: (AST.Parse.Err (VariableName a)), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (Type a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_782. + AST.Traversable1.Class.Traversable1 a_782 + ) + +instance AST.Unmarshal.SymbolMatching SimpleParameter where + matchedSymbols _ = [195] + showFailure _ node_783 = + "expected " + GHC.Base.<> ( "simple_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_783 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_783) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_784 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_785 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_786 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_787 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_784 + c1_785 = TreeSitter.Node.nodeStartPoint node_783 + TreeSitter.Node.TSPoint + r2_786 + c2_787 = TreeSitter.Node.nodeEndPoint node_783 + +deriving instance GHC.Classes.Eq a_788 => GHC.Classes.Eq (SimpleParameter a_788) + +deriving instance GHC.Classes.Ord a_789 => GHC.Classes.Ord (SimpleParameter a_789) + +deriving instance GHC.Show.Show a_790 => GHC.Show.Show (SimpleParameter a_790) + +instance AST.Unmarshal.Unmarshal SimpleParameter + +instance Data.Foldable.Foldable SimpleParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SimpleParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SimpleParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data StaticModifier a = StaticModifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_791. + AST.Traversable1.Class.Traversable1 a_791 + ) + +instance AST.Unmarshal.SymbolMatching StaticModifier where + matchedSymbols _ = [186] + showFailure _ node_792 = + "expected " + GHC.Base.<> ( "static_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_792 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_792) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_793 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_794 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_795 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_796 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_793 + c1_794 = TreeSitter.Node.nodeStartPoint node_792 + TreeSitter.Node.TSPoint + r2_795 + c2_796 = TreeSitter.Node.nodeEndPoint node_792 + +deriving instance GHC.Classes.Eq a_797 => GHC.Classes.Eq (StaticModifier a_797) + +deriving instance GHC.Classes.Ord a_798 => GHC.Classes.Ord (StaticModifier a_798) + +deriving instance GHC.Show.Show a_799 => GHC.Show.Show (StaticModifier a_799) + +instance AST.Unmarshal.Unmarshal StaticModifier + +instance Data.Foldable.Foldable StaticModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StaticModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StaticModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data StaticVariableDeclaration a = StaticVariableDeclaration + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + name :: (AST.Parse.Err (VariableName a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_800. + AST.Traversable1.Class.Traversable1 a_800 + ) + +instance AST.Unmarshal.SymbolMatching StaticVariableDeclaration where + matchedSymbols _ = [159] + showFailure _ node_801 = + "expected " + GHC.Base.<> ( "static_variable_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_801 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_801) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_802 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_803 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_804 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_805 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_802 + c1_803 = TreeSitter.Node.nodeStartPoint node_801 + TreeSitter.Node.TSPoint + r2_804 + c2_805 = TreeSitter.Node.nodeEndPoint node_801 + +deriving instance GHC.Classes.Eq a_806 => GHC.Classes.Eq (StaticVariableDeclaration a_806) + +deriving instance GHC.Classes.Ord a_807 => GHC.Classes.Ord (StaticVariableDeclaration a_807) + +deriving instance GHC.Show.Show a_808 => GHC.Show.Show (StaticVariableDeclaration a_808) + +instance AST.Unmarshal.Unmarshal StaticVariableDeclaration + +instance Data.Foldable.Foldable StaticVariableDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StaticVariableDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StaticVariableDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SubscriptExpression a = SubscriptExpression + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: ArrayCreationExpression GHC.Generics.:+: ClassConstantAccessExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: Heredoc GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_809. + AST.Traversable1.Class.Traversable1 a_809 + ) + +instance AST.Unmarshal.SymbolMatching SubscriptExpression where + matchedSymbols _ = [264] + showFailure _ node_810 = + "expected " + GHC.Base.<> ( "subscript_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_810 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_810) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_811 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_812 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_813 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_814 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_811 + c1_812 = TreeSitter.Node.nodeStartPoint node_810 + TreeSitter.Node.TSPoint + r2_813 + c2_814 = TreeSitter.Node.nodeEndPoint node_810 + +deriving instance GHC.Classes.Eq a_815 => GHC.Classes.Eq (SubscriptExpression a_815) + +deriving instance GHC.Classes.Ord a_816 => GHC.Classes.Ord (SubscriptExpression a_816) + +deriving instance GHC.Show.Show a_817 => GHC.Show.Show (SubscriptExpression a_817) + +instance AST.Unmarshal.Unmarshal SubscriptExpression + +instance Data.Foldable.Foldable SubscriptExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SubscriptExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SubscriptExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchBlock a = SwitchBlock + { ann :: a, + extraChildren :: ([AST.Parse.Err ((CaseStatement GHC.Generics.:+: DefaultStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_818. + AST.Traversable1.Class.Traversable1 a_818 + ) + +instance AST.Unmarshal.SymbolMatching SwitchBlock where + matchedSymbols _ = [230] + showFailure _ node_819 = + "expected " + GHC.Base.<> ( "switch_block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_819 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_819) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_820 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_821 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_822 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_823 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_820 + c1_821 = TreeSitter.Node.nodeStartPoint node_819 + TreeSitter.Node.TSPoint + r2_822 + c2_823 = TreeSitter.Node.nodeEndPoint node_819 + +deriving instance GHC.Classes.Eq a_824 => GHC.Classes.Eq (SwitchBlock a_824) + +deriving instance GHC.Classes.Ord a_825 => GHC.Classes.Ord (SwitchBlock a_825) + +deriving instance GHC.Show.Show a_826 => GHC.Show.Show (SwitchBlock a_826) + +instance AST.Unmarshal.Unmarshal SwitchBlock + +instance Data.Foldable.Foldable SwitchBlock where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchBlock where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchBlock where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchStatement a = SwitchStatement + { ann :: a, + body :: (AST.Parse.Err (SwitchBlock a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_827. + AST.Traversable1.Class.Traversable1 a_827 + ) + +instance AST.Unmarshal.SymbolMatching SwitchStatement where + matchedSymbols _ = [229] + showFailure _ node_828 = + "expected " + GHC.Base.<> ( "switch_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_828 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_828) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_829 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_830 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_831 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_832 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_829 + c1_830 = TreeSitter.Node.nodeStartPoint node_828 + TreeSitter.Node.TSPoint + r2_831 + c2_832 = TreeSitter.Node.nodeEndPoint node_828 + +deriving instance GHC.Classes.Eq a_833 => GHC.Classes.Eq (SwitchStatement a_833) + +deriving instance GHC.Classes.Ord a_834 => GHC.Classes.Ord (SwitchStatement a_834) + +deriving instance GHC.Show.Show a_835 => GHC.Show.Show (SwitchStatement a_835) + +instance AST.Unmarshal.Unmarshal SwitchStatement + +instance Data.Foldable.Foldable SwitchStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Text a = Text {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_836. + AST.Traversable1.Class.Traversable1 a_836 + ) + +instance AST.Unmarshal.SymbolMatching Text where + matchedSymbols _ = [156] + showFailure _ node_837 = + "expected " + GHC.Base.<> ( "text" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_837 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_837) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_838 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_839 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_840 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_841 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_838 + c1_839 = TreeSitter.Node.nodeStartPoint node_837 + TreeSitter.Node.TSPoint + r2_840 + c2_841 = TreeSitter.Node.nodeEndPoint node_837 + +deriving instance GHC.Classes.Eq a_842 => GHC.Classes.Eq (Text a_842) + +deriving instance GHC.Classes.Ord a_843 => GHC.Classes.Ord (Text a_843) + +deriving instance GHC.Show.Show a_844 => GHC.Show.Show (Text a_844) + +instance AST.Unmarshal.Unmarshal Text + +instance Data.Foldable.Foldable Text where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Text where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Text where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ThrowStatement a = ThrowStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_845. + AST.Traversable1.Class.Traversable1 a_845 + ) + +instance AST.Unmarshal.SymbolMatching ThrowStatement where + matchedSymbols _ = [215] + showFailure _ node_846 = + "expected " + GHC.Base.<> ( "throw_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_846 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_846) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_847 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_848 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_849 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_850 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_847 + c1_848 = TreeSitter.Node.nodeStartPoint node_846 + TreeSitter.Node.TSPoint + r2_849 + c2_850 = TreeSitter.Node.nodeEndPoint node_846 + +deriving instance GHC.Classes.Eq a_851 => GHC.Classes.Eq (ThrowStatement a_851) + +deriving instance GHC.Classes.Ord a_852 => GHC.Classes.Ord (ThrowStatement a_852) + +deriving instance GHC.Show.Show a_853 => GHC.Show.Show (ThrowStatement a_853) + +instance AST.Unmarshal.Unmarshal ThrowStatement + +instance Data.Foldable.Foldable ThrowStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ThrowStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ThrowStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TraitDeclaration a = TraitDeclaration + { ann :: a, + body :: (AST.Parse.Err (DeclarationList a)), + name :: (AST.Parse.Err (Name a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_854. + AST.Traversable1.Class.Traversable1 a_854 + ) + +instance AST.Unmarshal.SymbolMatching TraitDeclaration where + matchedSymbols _ = [171] + showFailure _ node_855 = + "expected " + GHC.Base.<> ( "trait_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_855 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_855) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_856 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_857 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_858 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_859 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_856 + c1_857 = TreeSitter.Node.nodeStartPoint node_855 + TreeSitter.Node.TSPoint + r2_858 + c2_859 = TreeSitter.Node.nodeEndPoint node_855 + +deriving instance GHC.Classes.Eq a_860 => GHC.Classes.Eq (TraitDeclaration a_860) + +deriving instance GHC.Classes.Ord a_861 => GHC.Classes.Ord (TraitDeclaration a_861) + +deriving instance GHC.Show.Show a_862 => GHC.Show.Show (TraitDeclaration a_862) + +instance AST.Unmarshal.Unmarshal TraitDeclaration + +instance Data.Foldable.Foldable TraitDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TraitDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TraitDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TryStatement a = TryStatement + { ann :: a, + body :: (AST.Parse.Err (CompoundStatement a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((CatchClause GHC.Generics.:+: FinallyClause) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_863. + AST.Traversable1.Class.Traversable1 a_863 + ) + +instance AST.Unmarshal.SymbolMatching TryStatement where + matchedSymbols _ = [207] + showFailure _ node_864 = + "expected " + GHC.Base.<> ( "try_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_864 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_864) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_865 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_866 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_867 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_868 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_865 + c1_866 = TreeSitter.Node.nodeStartPoint node_864 + TreeSitter.Node.TSPoint + r2_867 + c2_868 = TreeSitter.Node.nodeEndPoint node_864 + +deriving instance GHC.Classes.Eq a_869 => GHC.Classes.Eq (TryStatement a_869) + +deriving instance GHC.Classes.Ord a_870 => GHC.Classes.Ord (TryStatement a_870) + +deriving instance GHC.Show.Show a_871 => GHC.Show.Show (TryStatement a_871) + +instance AST.Unmarshal.Unmarshal TryStatement + +instance Data.Foldable.Foldable TryStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TryStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TryStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeName a = TypeName + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Name GHC.Generics.:+: NamespaceNameAsPrefix) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_872. + AST.Traversable1.Class.Traversable1 a_872 + ) + +instance AST.Unmarshal.SymbolMatching TypeName where + matchedSymbols _ = [301] + showFailure _ node_873 = + "expected " + GHC.Base.<> ( "type_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_873 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_873) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_874 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_875 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_876 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_877 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_874 + c1_875 = TreeSitter.Node.nodeStartPoint node_873 + TreeSitter.Node.TSPoint + r2_876 + c2_877 = TreeSitter.Node.nodeEndPoint node_873 + +deriving instance GHC.Classes.Eq a_878 => GHC.Classes.Eq (TypeName a_878) + +deriving instance GHC.Classes.Ord a_879 => GHC.Classes.Ord (TypeName a_879) + +deriving instance GHC.Show.Show a_880 => GHC.Show.Show (TypeName a_880) + +instance AST.Unmarshal.Unmarshal TypeName + +instance Data.Foldable.Foldable TypeName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnaryOpExpression a = UnaryOpExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_881. + AST.Traversable1.Class.Traversable1 a_881 + ) + +instance AST.Unmarshal.SymbolMatching UnaryOpExpression where + matchedSymbols _ = [238] + showFailure _ node_882 = + "expected " + GHC.Base.<> ( "unary_op_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_882 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_882) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_883 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_884 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_885 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_886 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_883 + c1_884 = TreeSitter.Node.nodeStartPoint node_882 + TreeSitter.Node.TSPoint + r2_885 + c2_886 = TreeSitter.Node.nodeEndPoint node_882 + +deriving instance GHC.Classes.Eq a_887 => GHC.Classes.Eq (UnaryOpExpression a_887) + +deriving instance GHC.Classes.Ord a_888 => GHC.Classes.Ord (UnaryOpExpression a_888) + +deriving instance GHC.Show.Show a_889 => GHC.Show.Show (UnaryOpExpression a_889) + +instance AST.Unmarshal.Unmarshal UnaryOpExpression + +instance Data.Foldable.Foldable UnaryOpExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnaryOpExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnaryOpExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnsetStatement a = UnsetStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((CastExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_890. + AST.Traversable1.Class.Traversable1 a_890 + ) + +instance AST.Unmarshal.SymbolMatching UnsetStatement where + matchedSymbols _ = [204] + showFailure _ node_891 = + "expected " + GHC.Base.<> ( "unset_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_891 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_891) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_892 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_893 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_894 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_895 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_892 + c1_893 = TreeSitter.Node.nodeStartPoint node_891 + TreeSitter.Node.TSPoint + r2_894 + c2_895 = TreeSitter.Node.nodeEndPoint node_891 + +deriving instance GHC.Classes.Eq a_896 => GHC.Classes.Eq (UnsetStatement a_896) + +deriving instance GHC.Classes.Ord a_897 => GHC.Classes.Ord (UnsetStatement a_897) + +deriving instance GHC.Show.Show a_898 => GHC.Show.Show (UnsetStatement a_898) + +instance AST.Unmarshal.Unmarshal UnsetStatement + +instance Data.Foldable.Foldable UnsetStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnsetStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnsetStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UpdateExpression a = UpdateExpression + { ann :: a, + extraChildren :: (AST.Parse.Err ((CastExpression GHC.Generics.:+: DynamicVariableName GHC.Generics.:+: FunctionCallExpression GHC.Generics.:+: MemberAccessExpression GHC.Generics.:+: MemberCallExpression GHC.Generics.:+: ScopedCallExpression GHC.Generics.:+: ScopedPropertyAccessExpression GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: VariableName) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_899. + AST.Traversable1.Class.Traversable1 a_899 + ) + +instance AST.Unmarshal.SymbolMatching UpdateExpression where + matchedSymbols _ = [248] + showFailure _ node_900 = + "expected " + GHC.Base.<> ( "update_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_900 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_900) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_901 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_902 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_903 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_904 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_901 + c1_902 = TreeSitter.Node.nodeStartPoint node_900 + TreeSitter.Node.TSPoint + r2_903 + c2_904 = TreeSitter.Node.nodeEndPoint node_900 + +deriving instance GHC.Classes.Eq a_905 => GHC.Classes.Eq (UpdateExpression a_905) + +deriving instance GHC.Classes.Ord a_906 => GHC.Classes.Ord (UpdateExpression a_906) + +deriving instance GHC.Show.Show a_907 => GHC.Show.Show (UpdateExpression a_907) + +instance AST.Unmarshal.Unmarshal UpdateExpression + +instance Data.Foldable.Foldable UpdateExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UpdateExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UpdateExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UseAsClause a = UseAsClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ClassConstantAccessExpression GHC.Generics.:+: Name GHC.Generics.:+: VisibilityModifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_908. + AST.Traversable1.Class.Traversable1 a_908 + ) + +instance AST.Unmarshal.SymbolMatching UseAsClause where + matchedSymbols _ = [190] + showFailure _ node_909 = + "expected " + GHC.Base.<> ( "use_as_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_909 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_909) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_910 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_911 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_912 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_913 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_910 + c1_911 = TreeSitter.Node.nodeStartPoint node_909 + TreeSitter.Node.TSPoint + r2_912 + c2_913 = TreeSitter.Node.nodeEndPoint node_909 + +deriving instance GHC.Classes.Eq a_914 => GHC.Classes.Eq (UseAsClause a_914) + +deriving instance GHC.Classes.Ord a_915 => GHC.Classes.Ord (UseAsClause a_915) + +deriving instance GHC.Show.Show a_916 => GHC.Show.Show (UseAsClause a_916) + +instance AST.Unmarshal.Unmarshal UseAsClause + +instance Data.Foldable.Foldable UseAsClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UseAsClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UseAsClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UseDeclaration a = UseDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((QualifiedName GHC.Generics.:+: UseList) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_917. + AST.Traversable1.Class.Traversable1 a_917 + ) + +instance AST.Unmarshal.SymbolMatching UseDeclaration where + matchedSymbols _ = [187] + showFailure _ node_918 = + "expected " + GHC.Base.<> ( "use_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_918 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_918) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_919 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_920 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_921 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_922 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_919 + c1_920 = TreeSitter.Node.nodeStartPoint node_918 + TreeSitter.Node.TSPoint + r2_921 + c2_922 = TreeSitter.Node.nodeEndPoint node_918 + +deriving instance GHC.Classes.Eq a_923 => GHC.Classes.Eq (UseDeclaration a_923) + +deriving instance GHC.Classes.Ord a_924 => GHC.Classes.Ord (UseDeclaration a_924) + +deriving instance GHC.Show.Show a_925 => GHC.Show.Show (UseDeclaration a_925) + +instance AST.Unmarshal.Unmarshal UseDeclaration + +instance Data.Foldable.Foldable UseDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UseDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UseDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UseInsteadOfClause a = UseInsteadOfClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ClassConstantAccessExpression GHC.Generics.:+: Name) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_926. + AST.Traversable1.Class.Traversable1 a_926 + ) + +instance AST.Unmarshal.SymbolMatching UseInsteadOfClause where + matchedSymbols _ = [189] + showFailure _ node_927 = + "expected " + GHC.Base.<> ( "use_instead_of_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_927 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_927) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_928 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_929 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_930 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_931 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_928 + c1_929 = TreeSitter.Node.nodeStartPoint node_927 + TreeSitter.Node.TSPoint + r2_930 + c2_931 = TreeSitter.Node.nodeEndPoint node_927 + +deriving instance GHC.Classes.Eq a_932 => GHC.Classes.Eq (UseInsteadOfClause a_932) + +deriving instance GHC.Classes.Ord a_933 => GHC.Classes.Ord (UseInsteadOfClause a_933) + +deriving instance GHC.Show.Show a_934 => GHC.Show.Show (UseInsteadOfClause a_934) + +instance AST.Unmarshal.Unmarshal UseInsteadOfClause + +instance Data.Foldable.Foldable UseInsteadOfClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UseInsteadOfClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UseInsteadOfClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UseList a = UseList + { ann :: a, + extraChildren :: ([AST.Parse.Err ((UseAsClause GHC.Generics.:+: UseInsteadOfClause) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_935. + AST.Traversable1.Class.Traversable1 a_935 + ) + +instance AST.Unmarshal.SymbolMatching UseList where + matchedSymbols _ = [188] + showFailure _ node_936 = + "expected " + GHC.Base.<> ( "use_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_936 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_936) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_937 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_938 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_939 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_940 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_937 + c1_938 = TreeSitter.Node.nodeStartPoint node_936 + TreeSitter.Node.TSPoint + r2_939 + c2_940 = TreeSitter.Node.nodeEndPoint node_936 + +deriving instance GHC.Classes.Eq a_941 => GHC.Classes.Eq (UseList a_941) + +deriving instance GHC.Classes.Ord a_942 => GHC.Classes.Ord (UseList a_942) + +deriving instance GHC.Show.Show a_943 => GHC.Show.Show (UseList a_943) + +instance AST.Unmarshal.Unmarshal UseList + +instance Data.Foldable.Foldable UseList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UseList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UseList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VariableName a = VariableName + { ann :: a, + extraChildren :: (AST.Parse.Err (Name a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_944. + AST.Traversable1.Class.Traversable1 a_944 + ) + +instance AST.Unmarshal.SymbolMatching VariableName where + matchedSymbols _ = [269] + showFailure _ node_945 = + "expected " + GHC.Base.<> ( "variable_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_945 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_945) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_946 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_947 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_948 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_949 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_946 + c1_947 = TreeSitter.Node.nodeStartPoint node_945 + TreeSitter.Node.TSPoint + r2_948 + c2_949 = TreeSitter.Node.nodeEndPoint node_945 + +deriving instance GHC.Classes.Eq a_950 => GHC.Classes.Eq (VariableName a_950) + +deriving instance GHC.Classes.Ord a_951 => GHC.Classes.Ord (VariableName a_951) + +deriving instance GHC.Show.Show a_952 => GHC.Show.Show (VariableName a_952) + +instance AST.Unmarshal.Unmarshal VariableName + +instance Data.Foldable.Foldable VariableName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VariableName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VariableName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VariadicParameter a = VariadicParameter + { ann :: a, + name :: (AST.Parse.Err (VariableName a)), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (Type a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_953. + AST.Traversable1.Class.Traversable1 a_953 + ) + +instance AST.Unmarshal.SymbolMatching VariadicParameter where + matchedSymbols _ = [196] + showFailure _ node_954 = + "expected " + GHC.Base.<> ( "variadic_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_954 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_954) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_955 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_956 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_957 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_958 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_955 + c1_956 = TreeSitter.Node.nodeStartPoint node_954 + TreeSitter.Node.TSPoint + r2_957 + c2_958 = TreeSitter.Node.nodeEndPoint node_954 + +deriving instance GHC.Classes.Eq a_959 => GHC.Classes.Eq (VariadicParameter a_959) + +deriving instance GHC.Classes.Ord a_960 => GHC.Classes.Ord (VariadicParameter a_960) + +deriving instance GHC.Show.Show a_961 => GHC.Show.Show (VariadicParameter a_961) + +instance AST.Unmarshal.Unmarshal VariadicParameter + +instance Data.Foldable.Foldable VariadicParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VariadicParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VariadicParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VariadicUnpacking a = VariadicUnpacking + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_962. + AST.Traversable1.Class.Traversable1 a_962 + ) + +instance AST.Unmarshal.SymbolMatching VariadicUnpacking where + matchedSymbols _ = [263] + showFailure _ node_963 = + "expected " + GHC.Base.<> ( "variadic_unpacking" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_963 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_963) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_964 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_965 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_966 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_967 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_964 + c1_965 = TreeSitter.Node.nodeStartPoint node_963 + TreeSitter.Node.TSPoint + r2_966 + c2_967 = TreeSitter.Node.nodeEndPoint node_963 + +deriving instance GHC.Classes.Eq a_968 => GHC.Classes.Eq (VariadicUnpacking a_968) + +deriving instance GHC.Classes.Ord a_969 => GHC.Classes.Ord (VariadicUnpacking a_969) + +deriving instance GHC.Show.Show a_970 => GHC.Show.Show (VariadicUnpacking a_970) + +instance AST.Unmarshal.Unmarshal VariadicUnpacking + +instance Data.Foldable.Foldable VariadicUnpacking where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VariadicUnpacking where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VariadicUnpacking where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VisibilityModifier a = VisibilityModifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_971. + AST.Traversable1.Class.Traversable1 a_971 + ) + +instance AST.Unmarshal.SymbolMatching VisibilityModifier where + matchedSymbols _ = [191] + showFailure _ node_972 = + "expected " + GHC.Base.<> ( "visibility_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_972 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_972) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_973 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_974 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_975 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_976 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_973 + c1_974 = TreeSitter.Node.nodeStartPoint node_972 + TreeSitter.Node.TSPoint + r2_975 + c2_976 = TreeSitter.Node.nodeEndPoint node_972 + +deriving instance GHC.Classes.Eq a_977 => GHC.Classes.Eq (VisibilityModifier a_977) + +deriving instance GHC.Classes.Ord a_978 => GHC.Classes.Ord (VisibilityModifier a_978) + +deriving instance GHC.Show.Show a_979 => GHC.Show.Show (VisibilityModifier a_979) + +instance AST.Unmarshal.Unmarshal VisibilityModifier + +instance Data.Foldable.Foldable VisibilityModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VisibilityModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VisibilityModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WhileStatement a = WhileStatement + { ann :: a, + body :: (AST.Parse.Err ((Statement GHC.Generics.:+: ColonBlock) a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_980. + AST.Traversable1.Class.Traversable1 a_980 + ) + +instance AST.Unmarshal.SymbolMatching WhileStatement where + matchedSymbols _ = [216] + showFailure _ node_981 = + "expected " + GHC.Base.<> ( "while_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_981 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_981) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_982 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_983 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_984 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_985 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_982 + c1_983 = TreeSitter.Node.nodeStartPoint node_981 + TreeSitter.Node.TSPoint + r2_984 + c2_985 = TreeSitter.Node.nodeEndPoint node_981 + +deriving instance GHC.Classes.Eq a_986 => GHC.Classes.Eq (WhileStatement a_986) + +deriving instance GHC.Classes.Ord a_987 => GHC.Classes.Ord (WhileStatement a_987) + +deriving instance GHC.Show.Show a_988 => GHC.Show.Show (WhileStatement a_988) + +instance AST.Unmarshal.Unmarshal WhileStatement + +instance Data.Foldable.Foldable WhileStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WhileStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WhileStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data YieldExpression a = YieldExpression + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: ArrayElementInitializer) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_989. + AST.Traversable1.Class.Traversable1 a_989 + ) + +instance AST.Unmarshal.SymbolMatching YieldExpression where + matchedSymbols _ = [270] + showFailure _ node_990 = + "expected " + GHC.Base.<> ( "yield_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_990 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_990) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_991 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_992 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_993 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_994 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_991 + c1_992 = TreeSitter.Node.nodeStartPoint node_990 + TreeSitter.Node.TSPoint + r2_993 + c2_994 = TreeSitter.Node.nodeEndPoint node_990 + +deriving instance GHC.Classes.Eq a_995 => GHC.Classes.Eq (YieldExpression a_995) + +deriving instance GHC.Classes.Ord a_996 => GHC.Classes.Ord (YieldExpression a_996) + +deriving instance GHC.Show.Show a_997 => GHC.Show.Show (YieldExpression a_997) + +instance AST.Unmarshal.Unmarshal YieldExpression + +instance Data.Foldable.Foldable YieldExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor YieldExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable YieldExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousBang = AST.Token.Token "!" 88 + +type AnonymousBangEqual = AST.Token.Token "!=" 131 + +type AnonymousBangEqualEqual = AST.Token.Token "!==" 134 + +type AnonymousDollar = AST.Token.Token "$" 118 + +type AnonymousPercent = AST.Token.Token "%" 145 + +type AnonymousPercentEqual = AST.Token.Token "%=" 100 + +type AnonymousAmpersand = AST.Token.Token "&" 31 + +type AnonymousAmpersandAmpersand = AST.Token.Token "&&" 127 + +type AnonymousAmpersandEqual = AST.Token.Token "&=" 106 + +type AnonymousLParen = AST.Token.Token "(" 32 + +type AnonymousRParen = AST.Token.Token ")" 33 + +type AnonymousStar = AST.Token.Token "*" 143 + +type AnonymousStarStar = AST.Token.Token "**" 89 + +type AnonymousStarStarEqual = AST.Token.Token "**=" 97 + +type AnonymousStarEqual = AST.Token.Token "*=" 98 + +type AnonymousPlus = AST.Token.Token "+" 85 + +type AnonymousPlusPlus = AST.Token.Token "++" 94 + +type AnonymousPlusEqual = AST.Token.Token "+=" 101 + +type AnonymousComma = AST.Token.Token "," 8 + +type AnonymousMinus = AST.Token.Token "-" 86 + +type AnonymousMinusMinus = AST.Token.Token "--" 95 + +type AnonymousMinusEqual = AST.Token.Token "-=" 102 + +type AnonymousMinusRAngle = AST.Token.Token "->" 109 + +type AnonymousDot = AST.Token.Token "." 142 + +type AnonymousDotDotDot = AST.Token.Token "..." 34 + +type AnonymousDotEqual = AST.Token.Token ".=" 103 + +type AnonymousSlash = AST.Token.Token "/" 144 + +type AnonymousSlashEqual = AST.Token.Token "/=" 99 + +type AnonymousColon = AST.Token.Token ":" 51 + +type AnonymousColonColon = AST.Token.Token "::" 91 + +type AnonymousSemicolon = AST.Token.Token ";" 6 + +type AnonymousLAngle = AST.Token.Token "<" 135 + +type AnonymousLAngleLAngle = AST.Token.Token "<<" 140 + +type AnonymousLAngleLAngleEqual = AST.Token.Token "<<=" 104 + +type AnonymousLAngleEqual = AST.Token.Token "<=" 137 + +type AnonymousLAngleEqualRAngle = AST.Token.Token "<=>" 139 + +type AnonymousLAngleRAngle = AST.Token.Token "<>" 132 + +type AnonymousEqual = AST.Token.Token "=" 9 + +type AnonymousEqualEqual = AST.Token.Token "==" 130 + +type AnonymousEqualEqualEqual = AST.Token.Token "===" 133 + +type AnonymousEqualRAngle = AST.Token.Token "=>" 75 + +type AnonymousRAngle = AST.Token.Token ">" 136 + +type AnonymousRAngleEqual = AST.Token.Token ">=" 138 + +type AnonymousRAngleRAngle = AST.Token.Token ">>" 141 + +type AnonymousRAngleRAngleEqual = AST.Token.Token ">>=" 105 + +type AnonymousQuestion = AST.Token.Token "?" 35 + +type AnonymousQuestionRAngle = AST.Token.Token "?>" 3 + +type AnonymousQuestionQuestion = AST.Token.Token "??" 122 + +type AnonymousAt = AST.Token.Token "@" 84 + +type AnonymousLBracket = AST.Token.Token "[" 113 + +type AnonymousBackslash = AST.Token.Token "\\" 13 + +type AnonymousRBracket = AST.Token.Token "]" 114 + +type AnonymousCaret = AST.Token.Token "^" 129 + +type AnonymousCaretEqual = AST.Token.Token "^=" 107 + +type AnonymousAbstract = AST.Token.Token "abstract" 23 + +type AnonymousAnd = AST.Token.Token "and" 123 + +type AnonymousArray = AST.Token.Token "array" 36 + +type AnonymousAs = AST.Token.Token "as" 16 + +type AnonymousBinary = AST.Token.Token "binary" 44 + +type AnonymousBool = AST.Token.Token "bool" 39 + +data Boolean a = Boolean {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_998. + AST.Traversable1.Class.Traversable1 a_998 + ) + +instance AST.Unmarshal.SymbolMatching Boolean where + matchedSymbols _ = [116] + showFailure _ node_999 = + "expected " + GHC.Base.<> ( "boolean" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_999 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_999) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1000 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1001 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1002 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1003 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1000 + c1_1001 = TreeSitter.Node.nodeStartPoint node_999 + TreeSitter.Node.TSPoint + r2_1002 + c2_1003 = TreeSitter.Node.nodeEndPoint node_999 + +deriving instance GHC.Classes.Eq a_1004 => GHC.Classes.Eq (Boolean a_1004) + +deriving instance GHC.Classes.Ord a_1005 => GHC.Classes.Ord (Boolean a_1005) + +deriving instance GHC.Show.Show a_1006 => GHC.Show.Show (Boolean a_1006) + +instance AST.Unmarshal.Unmarshal Boolean + +instance Data.Foldable.Foldable Boolean where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Boolean where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Boolean where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousBoolean = AST.Token.Token "boolean" 45 + +type AnonymousBreak = AST.Token.Token "break" 64 + +type AnonymousCallable = AST.Token.Token "callable" 37 + +type AnonymousCase = AST.Token.Token "case" 82 + +type AnonymousCatch = AST.Token.Token "catch" 60 + +type AnonymousClass = AST.Token.Token "class" 22 + +type AnonymousClone = AST.Token.Token "clone" 90 + +type AnonymousConst = AST.Token.Token "const" 15 + +type AnonymousContinue = AST.Token.Token "continue" 63 + +type AnonymousDeclare = AST.Token.Token "declare" 53 + +type AnonymousDefault = AST.Token.Token "default" 83 + +type AnonymousDo = AST.Token.Token "do" 70 + +type AnonymousDouble = AST.Token.Token "double" 46 + +type AnonymousEcho = AST.Token.Token "echo" 52 + +type AnonymousElse = AST.Token.Token "else" 79 + +type AnonymousElseif = AST.Token.Token "elseif" 78 + +type AnonymousEncoding = AST.Token.Token "encoding" 56 + +type AnonymousEnddeclare = AST.Token.Token "enddeclare" 54 + +type AnonymousEndfor = AST.Token.Token "endfor" 72 + +type AnonymousEndforeach = AST.Token.Token "endforeach" 74 + +type AnonymousEndif = AST.Token.Token "endif" 77 + +type AnonymousEndswitch = AST.Token.Token "endswitch" 81 + +type AnonymousEndwhile = AST.Token.Token "endwhile" 69 + +type AnonymousExtends = AST.Token.Token "extends" 21 + +type AnonymousFinal = AST.Token.Token "final" 24 + +type AnonymousFinally = AST.Token.Token "finally" 61 + +type AnonymousFloat = AST.Token.Token "float" 40 + +data Float a = Float {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1007. + AST.Traversable1.Class.Traversable1 a_1007 + ) + +instance AST.Unmarshal.SymbolMatching Float where + matchedSymbols _ = [58] + showFailure _ node_1008 = + "expected " + GHC.Base.<> ( "float" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1008 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1008) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1009 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1010 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1011 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1012 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1009 + c1_1010 = TreeSitter.Node.nodeStartPoint node_1008 + TreeSitter.Node.TSPoint + r2_1011 + c2_1012 = TreeSitter.Node.nodeEndPoint node_1008 + +deriving instance GHC.Classes.Eq a_1013 => GHC.Classes.Eq (Float a_1013) + +deriving instance GHC.Classes.Ord a_1014 => GHC.Classes.Ord (Float a_1014) + +deriving instance GHC.Show.Show a_1015 => GHC.Show.Show (Float a_1015) + +instance AST.Unmarshal.Unmarshal Float + +instance Data.Foldable.Foldable Float where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Float where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Float where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFor = AST.Token.Token "for" 71 + +type AnonymousForeach = AST.Token.Token "foreach" 73 + +type AnonymousFrom = AST.Token.Token "from" 120 + +type AnonymousFunction = AST.Token.Token "function" 14 + +type AnonymousGlobal = AST.Token.Token "global" 10 + +type AnonymousGoto = AST.Token.Token "goto" 62 + +data Heredoc a = Heredoc {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1016. + AST.Traversable1.Class.Traversable1 a_1016 + ) + +instance AST.Unmarshal.SymbolMatching Heredoc where + matchedSymbols _ = [152] + showFailure _ node_1017 = + "expected " + GHC.Base.<> ( "heredoc" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1017 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1017) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1018 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1019 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1020 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1021 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1018 + c1_1019 = TreeSitter.Node.nodeStartPoint node_1017 + TreeSitter.Node.TSPoint + r2_1020 + c2_1021 = TreeSitter.Node.nodeEndPoint node_1017 + +deriving instance GHC.Classes.Eq a_1022 => GHC.Classes.Eq (Heredoc a_1022) + +deriving instance GHC.Classes.Ord a_1023 => GHC.Classes.Ord (Heredoc a_1023) + +deriving instance GHC.Show.Show a_1024 => GHC.Show.Show (Heredoc a_1024) + +instance AST.Unmarshal.Unmarshal Heredoc + +instance Data.Foldable.Foldable Heredoc where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Heredoc where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Heredoc where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousIf = AST.Token.Token "if" 76 + +type AnonymousImplements = AST.Token.Token "implements" 25 + +type AnonymousInclude = AST.Token.Token "include" 146 + +type AnonymousIncludeOnce = AST.Token.Token "include_once" 147 + +type AnonymousInstanceof = AST.Token.Token "instanceof" 121 + +type AnonymousInsteadof = AST.Token.Token "insteadof" 27 + +type AnonymousInt = AST.Token.Token "int" 41 + +type AnonymousInteger = AST.Token.Token "integer" 47 + +data Integer a = Integer {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1025. + AST.Traversable1.Class.Traversable1 a_1025 + ) + +instance AST.Unmarshal.SymbolMatching Integer where + matchedSymbols _ = [65] + showFailure _ node_1026 = + "expected " + GHC.Base.<> ( "integer" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1026 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1026) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1027 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1028 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1029 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1030 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1027 + c1_1028 = TreeSitter.Node.nodeStartPoint node_1026 + TreeSitter.Node.TSPoint + r2_1029 + c2_1030 = TreeSitter.Node.nodeEndPoint node_1026 + +deriving instance GHC.Classes.Eq a_1031 => GHC.Classes.Eq (Integer a_1031) + +deriving instance GHC.Classes.Ord a_1032 => GHC.Classes.Ord (Integer a_1032) + +deriving instance GHC.Show.Show a_1033 => GHC.Show.Show (Integer a_1033) + +instance AST.Unmarshal.Unmarshal Integer + +instance Data.Foldable.Foldable Integer where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Integer where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Integer where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousInterface = AST.Token.Token "interface" 20 + +type AnonymousIterable = AST.Token.Token "iterable" 38 + +type AnonymousList = AST.Token.Token "list" 110 + +type AnonymousNamespace = AST.Token.Token "namespace" 11 + +type AnonymousNew = AST.Token.Token "new" 93 + +data Null a = Null {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1034. + AST.Traversable1.Class.Traversable1 a_1034 + ) + +instance AST.Unmarshal.SymbolMatching Null where + matchedSymbols _ = [117] + showFailure _ node_1035 = + "expected " + GHC.Base.<> ( "null" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1035 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1035) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1036 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1037 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1038 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1039 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1036 + c1_1037 = TreeSitter.Node.nodeStartPoint node_1035 + TreeSitter.Node.TSPoint + r2_1038 + c2_1039 = TreeSitter.Node.nodeEndPoint node_1035 + +deriving instance GHC.Classes.Eq a_1040 => GHC.Classes.Eq (Null a_1040) + +deriving instance GHC.Classes.Ord a_1041 => GHC.Classes.Ord (Null a_1041) + +deriving instance GHC.Show.Show a_1042 => GHC.Show.Show (Null a_1042) + +instance AST.Unmarshal.Unmarshal Null + +instance Data.Foldable.Foldable Null where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Null where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Null where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousObject = AST.Token.Token "object" 48 + +type AnonymousOr = AST.Token.Token "or" 124 + +type AnonymousParent = AST.Token.Token "parent" 112 + +data PhpTag a = PhpTag {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1043. + AST.Traversable1.Class.Traversable1 a_1043 + ) + +instance AST.Unmarshal.SymbolMatching PhpTag where + matchedSymbols _ = [2] + showFailure _ node_1044 = + "expected " + GHC.Base.<> ( "php_tag" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1044 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1044) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1045 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1046 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1047 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1048 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1045 + c1_1046 = TreeSitter.Node.nodeStartPoint node_1044 + TreeSitter.Node.TSPoint + r2_1047 + c2_1048 = TreeSitter.Node.nodeEndPoint node_1044 + +deriving instance GHC.Classes.Eq a_1049 => GHC.Classes.Eq (PhpTag a_1049) + +deriving instance GHC.Classes.Ord a_1050 => GHC.Classes.Ord (PhpTag a_1050) + +deriving instance GHC.Show.Show a_1051 => GHC.Show.Show (PhpTag a_1051) + +instance AST.Unmarshal.Unmarshal PhpTag + +instance Data.Foldable.Foldable PhpTag where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PhpTag where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PhpTag where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousPrint = AST.Token.Token "print" 92 + +type AnonymousPrivate = AST.Token.Token "private" 30 + +type AnonymousProtected = AST.Token.Token "protected" 29 + +type AnonymousPublic = AST.Token.Token "public" 28 + +type AnonymousReal = AST.Token.Token "real" 49 + +type AnonymousRequire = AST.Token.Token "require" 148 + +type AnonymousRequireOnce = AST.Token.Token "require_once" 149 + +type AnonymousReturn = AST.Token.Token "return" 66 + +type AnonymousSelf = AST.Token.Token "self" 111 + +data ShellCommandExpression a = ShellCommandExpression + { ann :: a, + text :: Data.Text.Internal.Text + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1052. + AST.Traversable1.Class.Traversable1 a_1052 + ) + +instance AST.Unmarshal.SymbolMatching ShellCommandExpression where + matchedSymbols _ = [96] + showFailure _ node_1053 = + "expected " + GHC.Base.<> ( "shell_command_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1053 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1053) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1054 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1055 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1056 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1057 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1054 + c1_1055 = TreeSitter.Node.nodeStartPoint node_1053 + TreeSitter.Node.TSPoint + r2_1056 + c2_1057 = TreeSitter.Node.nodeEndPoint node_1053 + +deriving instance GHC.Classes.Eq a_1058 => GHC.Classes.Eq (ShellCommandExpression a_1058) + +deriving instance GHC.Classes.Ord a_1059 => GHC.Classes.Ord (ShellCommandExpression a_1059) + +deriving instance GHC.Show.Show a_1060 => GHC.Show.Show (ShellCommandExpression a_1060) + +instance AST.Unmarshal.Unmarshal ShellCommandExpression + +instance Data.Foldable.Foldable ShellCommandExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ShellCommandExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ShellCommandExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousStatic = AST.Token.Token "static" 7 + +type AnonymousStrictTypes = AST.Token.Token "strict_types" 57 + +type AnonymousString = AST.Token.Token "string" 42 + +data String a = String {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1061. + AST.Traversable1.Class.Traversable1 a_1061 + ) + +instance AST.Unmarshal.SymbolMatching String where + matchedSymbols _ = [115] + showFailure _ node_1062 = + "expected " + GHC.Base.<> ( "string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1062 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1062) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1063 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1064 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1065 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1066 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1063 + c1_1064 = TreeSitter.Node.nodeStartPoint node_1062 + TreeSitter.Node.TSPoint + r2_1065 + c2_1066 = TreeSitter.Node.nodeEndPoint node_1062 + +deriving instance GHC.Classes.Eq a_1067 => GHC.Classes.Eq (String a_1067) + +deriving instance GHC.Classes.Ord a_1068 => GHC.Classes.Ord (String a_1068) + +deriving instance GHC.Show.Show a_1069 => GHC.Show.Show (String a_1069) + +instance AST.Unmarshal.Unmarshal String + +instance Data.Foldable.Foldable String where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor String where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable String where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousSwitch = AST.Token.Token "switch" 80 + +type AnonymousThrow = AST.Token.Token "throw" 67 + +type AnonymousTicks = AST.Token.Token "ticks" 55 + +type AnonymousTrait = AST.Token.Token "trait" 19 + +type AnonymousTry = AST.Token.Token "try" 59 + +type AnonymousUnset = AST.Token.Token "unset" 50 + +type AnonymousUse = AST.Token.Token "use" 12 + +data VarModifier a = VarModifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1070. + AST.Traversable1.Class.Traversable1 a_1070 + ) + +instance AST.Unmarshal.SymbolMatching VarModifier where + matchedSymbols _ = [26] + showFailure _ node_1071 = + "expected " + GHC.Base.<> ( "var_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1071 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1071) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1072 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1073 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1074 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1075 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1072 + c1_1073 = TreeSitter.Node.nodeStartPoint node_1071 + TreeSitter.Node.TSPoint + r2_1074 + c2_1075 = TreeSitter.Node.nodeEndPoint node_1071 + +deriving instance GHC.Classes.Eq a_1076 => GHC.Classes.Eq (VarModifier a_1076) + +deriving instance GHC.Classes.Ord a_1077 => GHC.Classes.Ord (VarModifier a_1077) + +deriving instance GHC.Show.Show a_1078 => GHC.Show.Show (VarModifier a_1078) + +instance AST.Unmarshal.Unmarshal VarModifier + +instance Data.Foldable.Foldable VarModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VarModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VarModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousVoid = AST.Token.Token "void" 43 + +type AnonymousWhile = AST.Token.Token "while" 68 + +type AnonymousXor = AST.Token.Token "xor" 125 + +type AnonymousYield = AST.Token.Token "yield" 119 + +type AnonymousLBrace = AST.Token.Token "{" 17 + +type AnonymousPipe = AST.Token.Token "|" 128 + +type AnonymousPipeEqual = AST.Token.Token "|=" 108 + +type AnonymousPipePipe = AST.Token.Token "||" 126 + +type AnonymousRBrace = AST.Token.Token "}" 18 + +type AnonymousTilde = AST.Token.Token "~" 87 diff --git a/semantic-php/src/Language/PHP/Grammar.hs b/semantic-php/src/Language/PHP/Grammar.hs new file mode 100644 index 0000000000..247f8202f8 --- /dev/null +++ b/semantic-php/src/Language/PHP/Grammar.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} +module Language.PHP.Grammar +( tree_sitter_php +, Grammar(..) +) where + +import AST.Grammar.TH +import Language.Haskell.TH +import TreeSitter.PHP (tree_sitter_php) + +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData (mkName "Grammar") tree_sitter_php diff --git a/semantic-php/src/Language/PHP/Tags.hs b/semantic-php/src/Language/PHP/Tags.hs new file mode 100644 index 0000000000..78bcd0e5e0 --- /dev/null +++ b/semantic-php/src/Language/PHP/Tags.hs @@ -0,0 +1,218 @@ +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedLists #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module Language.PHP.Tags + ( tags, + ) +where + +import AST.Element +import qualified AST.Parse as Parse +import AST.Token +import AST.Traversable1 +import Control.Effect.Reader +import Control.Effect.Writer +import Control.Effect.State +import qualified Language.PHP.AST as PHP +import Proto.Semantic as P +import Source.Loc +import Source.Source as Source +import qualified Tags.Tagging.Precise as Tags + +class ToTags t where + tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m + ) => + t Loc -> + m () + default tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () + tags = gtags + +instance ToTags (Token sym n) where tags _ = pure () + +instance (ToTags l, ToTags r) => ToTags (l :+: r) where + tags (L1 l) = tags l + tags (R1 r) = tags r + +gtags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () +gtags = traverse1_ @ToTags (const (pure ())) tags + +instance ToTags PHP.FunctionDefinition where + tags + t@PHP.FunctionDefinition + { PHP.ann = Loc {byteRange}, + PHP.name = Parse.Success (PHP.Name {text, ann}) + } = Tags.yield text P.METHOD P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags PHP.MethodDeclaration where + tags + t@PHP.MethodDeclaration + { PHP.ann = Loc {byteRange}, + PHP.name = Parse.Success (PHP.Name {text, ann}) + } = Tags.yield text P.FUNCTION P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags PHP.FunctionCallExpression where + tags + t@PHP.FunctionCallExpression + { PHP.ann = Loc {byteRange}, + PHP.function = func + } = match func + where + yield name loc = Tags.yield name P.CALL P.REFERENCE loc byteRange >> gtags t + match expr = case expr of + EPrj PHP.VariableName {extraChildren = Parse.Success (PHP.Name {text, ann})} -> yield text ann *> gtags t + EPrj PHP.QualifiedName {extraChildren = [EPrj PHP.Name {text, ann}]} -> yield text ann *> gtags t + _ -> gtags t + + +instance ToTags PHP.MemberCallExpression where + tags + t@PHP.MemberCallExpression + { PHP.ann = Loc {byteRange}, + PHP.name = Parse.Success (Prj PHP.Name {text, ann}) + } = Tags.yield text P.CALL P.REFERENCE ann byteRange >> gtags t + tags t = gtags t + + + +instance ToTags PHP.AnonymousFunctionCreationExpression +instance ToTags PHP.AnonymousFunctionUseClause +instance ToTags PHP.Arguments +instance ToTags PHP.ArrayCreationExpression +instance ToTags PHP.ArrayElementInitializer +instance ToTags PHP.AssignmentExpression +instance ToTags PHP.AugmentedAssignmentExpression +instance ToTags PHP.BinaryExpression +instance ToTags PHP.Boolean +instance ToTags PHP.BreakStatement +instance ToTags PHP.CaseStatement +instance ToTags PHP.CastExpression +instance ToTags PHP.CastType +instance ToTags PHP.CatchClause +instance ToTags PHP.ClassBaseClause +instance ToTags PHP.ClassConstantAccessExpression +instance ToTags PHP.ClassDeclaration +instance ToTags PHP.ClassInterfaceClause +instance ToTags PHP.ClassModifier +instance ToTags PHP.CloneExpression +instance ToTags PHP.ColonBlock +instance ToTags PHP.CompoundStatement +instance ToTags PHP.ConditionalExpression +instance ToTags PHP.ConstDeclaration +instance ToTags PHP.ConstElement +instance ToTags PHP.ContinueStatement +instance ToTags PHP.DeclarationList +instance ToTags PHP.DeclareDirective +instance ToTags PHP.DeclareStatement +instance ToTags PHP.DefaultStatement +instance ToTags PHP.DoStatement +instance ToTags PHP.DynamicVariableName +instance ToTags PHP.EchoStatement +instance ToTags PHP.ElseClause +instance ToTags PHP.ElseIfClause +instance ToTags PHP.EmptyStatement +instance ToTags PHP.ExponentiationExpression +instance ToTags PHP.Expression +instance ToTags PHP.ExpressionStatement +instance ToTags PHP.FinallyClause +instance ToTags PHP.Float +instance ToTags PHP.ForStatement +instance ToTags PHP.ForeachStatement +instance ToTags PHP.FormalParameters +instance ToTags PHP.FunctionStaticDeclaration +instance ToTags PHP.GlobalDeclaration +instance ToTags PHP.GotoStatement +instance ToTags PHP.Heredoc +instance ToTags PHP.IfStatement +instance ToTags PHP.IncludeExpression +instance ToTags PHP.IncludeOnceExpression +instance ToTags PHP.InterfaceBaseClause +instance ToTags PHP.InterfaceDeclaration +instance ToTags PHP.ListLiteral +instance ToTags PHP.Literal +instance ToTags PHP.MemberAccessExpression +instance ToTags PHP.Name +instance ToTags PHP.NamedLabelStatement +instance ToTags PHP.NamespaceAliasingClause +instance ToTags PHP.NamespaceDefinition +instance ToTags PHP.NamespaceFunctionOrConst +instance ToTags PHP.NamespaceName +instance ToTags PHP.NamespaceNameAsPrefix +instance ToTags PHP.NamespaceUseClause +instance ToTags PHP.NamespaceUseDeclaration +instance ToTags PHP.NamespaceUseGroup +instance ToTags PHP.NamespaceUseGroupClause +instance ToTags PHP.Null +instance ToTags PHP.ObjectCreationExpression +instance ToTags PHP.OptionalType +instance ToTags PHP.Pair +instance ToTags PHP.ParenthesizedExpression +instance ToTags PHP.PhpTag +instance ToTags PHP.PrimaryExpression +instance ToTags PHP.PrimitiveType +instance ToTags PHP.PrintIntrinsic +instance ToTags PHP.Program +instance ToTags PHP.PropertyDeclaration +instance ToTags PHP.PropertyElement +instance ToTags PHP.PropertyInitializer +instance ToTags PHP.QualifiedName +instance ToTags PHP.RelativeScope +instance ToTags PHP.RequireExpression +instance ToTags PHP.RequireOnceExpression +instance ToTags PHP.ReturnStatement +instance ToTags PHP.ScopedCallExpression +instance ToTags PHP.ScopedPropertyAccessExpression +instance ToTags PHP.SequenceExpression +instance ToTags PHP.ShellCommandExpression +instance ToTags PHP.SimpleParameter +instance ToTags PHP.Statement +instance ToTags PHP.StaticModifier +instance ToTags PHP.StaticVariableDeclaration +instance ToTags PHP.String +instance ToTags PHP.SubscriptExpression +instance ToTags PHP.SwitchBlock +instance ToTags PHP.SwitchStatement +instance ToTags PHP.Text +instance ToTags PHP.ThrowStatement +instance ToTags PHP.TraitDeclaration +instance ToTags PHP.TryStatement +instance ToTags PHP.Type +instance ToTags PHP.TypeName +instance ToTags PHP.UnaryOpExpression +instance ToTags PHP.UnsetStatement +instance ToTags PHP.UpdateExpression +instance ToTags PHP.UseAsClause +instance ToTags PHP.UseDeclaration +instance ToTags PHP.UseInsteadOfClause +instance ToTags PHP.UseList +instance ToTags PHP.VarModifier +instance ToTags PHP.VariableName +instance ToTags PHP.VariadicParameter +instance ToTags PHP.VariadicUnpacking +instance ToTags PHP.VisibilityModifier +instance ToTags PHP.WhileStatement +instance ToTags PHP.YieldExpression +instance ToTags PHP.Integer diff --git a/semantic-proto/BUILD.bazel b/semantic-proto/BUILD.bazel new file mode 100644 index 0000000000..dd0e51284e --- /dev/null +++ b/semantic-proto/BUILD.bazel @@ -0,0 +1,26 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_binary", + "haskell_library", +) +load( + "@rules_haskell//haskell:cabal.bzl", + "haskell_cabal_binary", + "haskell_cabal_library", +) + +haskell_library( + name = "semantic-proto", + srcs = glob(["src/**/*.hs"]), + compiler_flags = ["-XOverloadedStrings"], + deps = [ + "//:base", + "//:text", + "@stackage//:aeson", + "@stackage//:proto-lens", + "@stackage//:proto-lens-jsonpb", + "@stackage//:proto-lens-runtime", + ], +) diff --git a/semantic-proto/LICENSE b/semantic-proto/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-proto/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-proto/README.md b/semantic-proto/README.md new file mode 100644 index 0000000000..dfc57df120 --- /dev/null +++ b/semantic-proto/README.md @@ -0,0 +1,18 @@ +# semantic-proto + +Datatypes generated from the protobuf schema + + +## Development + +This project consists of a Haskell package named `semantic-proto`. The library’s sources are in [`src`][]. + +Development of `semantic-proto` is typically done using `cabal v2-build`: + +```shell +cabal v2-build # build the library +cabal v2-repl # load the package into ghci +cabal v2-test # build and run the doctests +``` + +[`src`]: https://github.com/github/semantic/tree/master/semantic-proto/src diff --git a/semantic-proto/Setup.hs b/semantic-proto/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-proto/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-proto/semantic-proto.cabal b/semantic-proto/semantic-proto.cabal new file mode 100644 index 0000000000..75c00d1146 --- /dev/null +++ b/semantic-proto/semantic-proto.cabal @@ -0,0 +1,58 @@ +cabal-version: 2.4 + +name: semantic-proto +version: 0.0.0.0 +synopsis: Datatypes generated from protobuf schema +description: Datatypes generated from protobuf schema +homepage: https://github.com/github/semantic/tree/master/semantic-proto#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +library + exposed-modules: + Proto.Semantic + , Proto.Semantic_Fields + , Proto.Semantic_JSON + build-depends: + , base >= 4.13 && < 5 + , aeson >= 1.4.2.0 && < 3 + , text ^>= 1.2.3.1 + , proto-lens >= 0.5 && < 0.8 + , proto-lens-jsonpb + , proto-lens-runtime >= 0.5 && <0.8 + hs-source-dirs: src + default-language: Haskell2010 + default-extensions: OverloadedStrings + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missing-export-lists + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + -Wno-missing-export-lists + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures diff --git a/semantic-proto/src/Proto/Semantic.hs b/semantic-proto/src/Proto/Semantic.hs new file mode 100644 index 0000000000..1c5c3dc172 --- /dev/null +++ b/semantic-proto/src/Proto/Semantic.hs @@ -0,0 +1,5026 @@ +{- This file was auto-generated from semantic.proto by the proto-lens-protoc program. -} +{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies, UndecidableInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, PatternSynonyms, MagicHash, NoImplicitPrelude, DataKinds, BangPatterns, TypeApplications, OverloadedStrings, DerivingStrategies#-} +{-# OPTIONS_GHC -Wno-unused-imports#-} +{-# OPTIONS_GHC -Wno-duplicate-exports#-} +{-# OPTIONS_GHC -Wno-dodgy-exports#-} +module Proto.Semantic ( + Blob(), ByteRange(), Docstring(), File(), NodeType(..), NodeType(), + NodeType'UnrecognizedValue, ParseError(), ParseTreeRequest(), + ParseTreeSymbolResponse(), PingRequest(), PingResponse(), + Position(), Span(), StackGraphFile(), StackGraphNode(), + StackGraphPath(), StackGraphRequest(), StackGraphResponse(), + Symbol(), SyntaxType(..), SyntaxType(), + SyntaxType'UnrecognizedValue + ) where +import qualified Data.ProtoLens.Runtime.Control.DeepSeq as Control.DeepSeq +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Prism as Data.ProtoLens.Prism +import qualified Data.ProtoLens.Runtime.Prelude as Prelude +import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int +import qualified Data.ProtoLens.Runtime.Data.Monoid as Data.Monoid +import qualified Data.ProtoLens.Runtime.Data.Word as Data.Word +import qualified Data.ProtoLens.Runtime.Data.ProtoLens as Data.ProtoLens +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Bytes as Data.ProtoLens.Encoding.Bytes +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Growing as Data.ProtoLens.Encoding.Growing +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Parser.Unsafe as Data.ProtoLens.Encoding.Parser.Unsafe +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Wire as Data.ProtoLens.Encoding.Wire +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Field as Data.ProtoLens.Field +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Message.Enum as Data.ProtoLens.Message.Enum +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Service.Types as Data.ProtoLens.Service.Types +import qualified Data.ProtoLens.Runtime.Lens.Family2 as Lens.Family2 +import qualified Data.ProtoLens.Runtime.Lens.Family2.Unchecked as Lens.Family2.Unchecked +import qualified Data.ProtoLens.Runtime.Data.Text as Data.Text +import qualified Data.ProtoLens.Runtime.Data.Map as Data.Map +import qualified Data.ProtoLens.Runtime.Data.ByteString as Data.ByteString +import qualified Data.ProtoLens.Runtime.Data.ByteString.Char8 as Data.ByteString.Char8 +import qualified Data.ProtoLens.Runtime.Data.Text.Encoding as Data.Text.Encoding +import qualified Data.ProtoLens.Runtime.Data.Vector as Data.Vector +import qualified Data.ProtoLens.Runtime.Data.Vector.Generic as Data.Vector.Generic +import qualified Data.ProtoLens.Runtime.Data.Vector.Unboxed as Data.Vector.Unboxed +import qualified Data.ProtoLens.Runtime.Text.Read as Text.Read +{- | Fields : + + * 'Proto.Semantic_Fields.content' @:: Lens' Blob Data.Text.Text@ + * 'Proto.Semantic_Fields.path' @:: Lens' Blob Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' Blob Data.Text.Text@ -} +data Blob + = Blob'_constructor {_Blob'content :: !Data.Text.Text, + _Blob'path :: !Data.Text.Text, + _Blob'language :: !Data.Text.Text, + _Blob'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show Blob where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField Blob "content" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Blob'content (\ x__ y__ -> x__ {_Blob'content = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Blob "path" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Blob'path (\ x__ y__ -> x__ {_Blob'path = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Blob "language" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Blob'language (\ x__ y__ -> x__ {_Blob'language = y__})) + Prelude.id +instance Data.ProtoLens.Message Blob where + messageName _ = Data.Text.pack "github.semantic.Blob" + packedMessageDescriptor _ + = "\n\ + \\EOTBlob\DC2\CAN\n\ + \\acontent\CAN\SOH \SOH(\tR\acontent\DC2\DC2\n\ + \\EOTpath\CAN\STX \SOH(\tR\EOTpath\DC2\SUB\n\ + \\blanguage\CAN\ETX \SOH(\tR\blanguage" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + content__field_descriptor + = Data.ProtoLens.FieldDescriptor + "content" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"content")) :: + Data.ProtoLens.FieldDescriptor Blob + path__field_descriptor + = Data.ProtoLens.FieldDescriptor + "path" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"path")) :: + Data.ProtoLens.FieldDescriptor Blob + language__field_descriptor + = Data.ProtoLens.FieldDescriptor + "language" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"language")) :: + Data.ProtoLens.FieldDescriptor Blob + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, content__field_descriptor), + (Data.ProtoLens.Tag 2, path__field_descriptor), + (Data.ProtoLens.Tag 3, language__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _Blob'_unknownFields + (\ x__ y__ -> x__ {_Blob'_unknownFields = y__}) + defMessage + = Blob'_constructor + {_Blob'content = Data.ProtoLens.fieldDefault, + _Blob'path = Data.ProtoLens.fieldDefault, + _Blob'language = Data.ProtoLens.fieldDefault, + _Blob'_unknownFields = []} + parseMessage + = let + loop :: Blob -> Data.ProtoLens.Encoding.Bytes.Parser Blob + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "content" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"content") y x) + 18 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "path" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y x) + 26 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "language" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"language") y x) + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + in + (Data.ProtoLens.Encoding.Bytes.) + (do loop Data.ProtoLens.defMessage) "Blob" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"content") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 18) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 26) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)))) +instance Control.DeepSeq.NFData Blob where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_Blob'_unknownFields x__) + (Control.DeepSeq.deepseq + (_Blob'content x__) + (Control.DeepSeq.deepseq + (_Blob'path x__) + (Control.DeepSeq.deepseq (_Blob'language x__) ()))) +{- | Fields : + + * 'Proto.Semantic_Fields.start' @:: Lens' ByteRange Data.Int.Int32@ + * 'Proto.Semantic_Fields.end' @:: Lens' ByteRange Data.Int.Int32@ -} +data ByteRange + = ByteRange'_constructor {_ByteRange'start :: !Data.Int.Int32, + _ByteRange'end :: !Data.Int.Int32, + _ByteRange'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ByteRange where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ByteRange "start" Data.Int.Int32 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ByteRange'start (\ x__ y__ -> x__ {_ByteRange'start = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField ByteRange "end" Data.Int.Int32 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ByteRange'end (\ x__ y__ -> x__ {_ByteRange'end = y__})) + Prelude.id +instance Data.ProtoLens.Message ByteRange where + messageName _ = Data.Text.pack "github.semantic.ByteRange" + packedMessageDescriptor _ + = "\n\ + \\tByteRange\DC2\DC4\n\ + \\ENQstart\CAN\SOH \SOH(\ENQR\ENQstart\DC2\DLE\n\ + \\ETXend\CAN\STX \SOH(\ENQR\ETXend" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + start__field_descriptor + = Data.ProtoLens.FieldDescriptor + "start" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"start")) :: + Data.ProtoLens.FieldDescriptor ByteRange + end__field_descriptor + = Data.ProtoLens.FieldDescriptor + "end" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"end")) :: + Data.ProtoLens.FieldDescriptor ByteRange + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, start__field_descriptor), + (Data.ProtoLens.Tag 2, end__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _ByteRange'_unknownFields + (\ x__ y__ -> x__ {_ByteRange'_unknownFields = y__}) + defMessage + = ByteRange'_constructor + {_ByteRange'start = Data.ProtoLens.fieldDefault, + _ByteRange'end = Data.ProtoLens.fieldDefault, + _ByteRange'_unknownFields = []} + parseMessage + = let + loop :: ByteRange -> Data.ProtoLens.Encoding.Bytes.Parser ByteRange + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 8 -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "start" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"start") y x) + 16 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "end" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"end") y x) + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + in + (Data.ProtoLens.Encoding.Bytes.) + (do loop Data.ProtoLens.defMessage) "ByteRange" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"start") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 8) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral _v)) + ((Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"end") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 16) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x))) +instance Control.DeepSeq.NFData ByteRange where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_ByteRange'_unknownFields x__) + (Control.DeepSeq.deepseq + (_ByteRange'start x__) + (Control.DeepSeq.deepseq (_ByteRange'end x__) ())) +{- | Fields : + + * 'Proto.Semantic_Fields.docstring' @:: Lens' Docstring Data.Text.Text@ -} +data Docstring + = Docstring'_constructor {_Docstring'docstring :: !Data.Text.Text, + _Docstring'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show Docstring where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField Docstring "docstring" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Docstring'docstring + (\ x__ y__ -> x__ {_Docstring'docstring = y__})) + Prelude.id +instance Data.ProtoLens.Message Docstring where + messageName _ = Data.Text.pack "github.semantic.Docstring" + packedMessageDescriptor _ + = "\n\ + \\tDocstring\DC2\FS\n\ + \\tdocstring\CAN\SOH \SOH(\tR\tdocstring" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + docstring__field_descriptor + = Data.ProtoLens.FieldDescriptor + "docstring" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"docstring")) :: + Data.ProtoLens.FieldDescriptor Docstring + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, docstring__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _Docstring'_unknownFields + (\ x__ y__ -> x__ {_Docstring'_unknownFields = y__}) + defMessage + = Docstring'_constructor + {_Docstring'docstring = Data.ProtoLens.fieldDefault, + _Docstring'_unknownFields = []} + parseMessage + = let + loop :: Docstring -> Data.ProtoLens.Encoding.Bytes.Parser Docstring + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "docstring" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"docstring") y x) + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + in + (Data.ProtoLens.Encoding.Bytes.) + (do loop Data.ProtoLens.defMessage) "Docstring" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"docstring") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData Docstring where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_Docstring'_unknownFields x__) + (Control.DeepSeq.deepseq (_Docstring'docstring x__) ()) +{- | Fields : + + * 'Proto.Semantic_Fields.path' @:: Lens' File Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' File Data.Text.Text@ + * 'Proto.Semantic_Fields.symbols' @:: Lens' File [Symbol]@ + * 'Proto.Semantic_Fields.vec'symbols' @:: Lens' File (Data.Vector.Vector Symbol)@ + * 'Proto.Semantic_Fields.errors' @:: Lens' File [ParseError]@ + * 'Proto.Semantic_Fields.vec'errors' @:: Lens' File (Data.Vector.Vector ParseError)@ + * 'Proto.Semantic_Fields.blobOid' @:: Lens' File Data.Text.Text@ -} +data File + = File'_constructor {_File'path :: !Data.Text.Text, + _File'language :: !Data.Text.Text, + _File'symbols :: !(Data.Vector.Vector Symbol), + _File'errors :: !(Data.Vector.Vector ParseError), + _File'blobOid :: !Data.Text.Text, + _File'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show File where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField File "path" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _File'path (\ x__ y__ -> x__ {_File'path = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField File "language" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _File'language (\ x__ y__ -> x__ {_File'language = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField File "symbols" [Symbol] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _File'symbols (\ x__ y__ -> x__ {_File'symbols = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField File "vec'symbols" (Data.Vector.Vector Symbol) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _File'symbols (\ x__ y__ -> x__ {_File'symbols = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField File "errors" [ParseError] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _File'errors (\ x__ y__ -> x__ {_File'errors = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField File "vec'errors" (Data.Vector.Vector ParseError) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _File'errors (\ x__ y__ -> x__ {_File'errors = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField File "blobOid" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _File'blobOid (\ x__ y__ -> x__ {_File'blobOid = y__})) + Prelude.id +instance Data.ProtoLens.Message File where + messageName _ = Data.Text.pack "github.semantic.File" + packedMessageDescriptor _ + = "\n\ + \\EOTFile\DC2\DC2\n\ + \\EOTpath\CAN\SOH \SOH(\tR\EOTpath\DC2\SUB\n\ + \\blanguage\CAN\STX \SOH(\tR\blanguage\DC21\n\ + \\asymbols\CAN\ETX \ETX(\v2\ETB.github.semantic.SymbolR\asymbols\DC23\n\ + \\ACKerrors\CAN\EOT \ETX(\v2\ESC.github.semantic.ParseErrorR\ACKerrors\DC2\EM\n\ + \\bblob_oid\CAN\ENQ \SOH(\tR\ablobOid" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + path__field_descriptor + = Data.ProtoLens.FieldDescriptor + "path" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"path")) :: + Data.ProtoLens.FieldDescriptor File + language__field_descriptor + = Data.ProtoLens.FieldDescriptor + "language" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"language")) :: + Data.ProtoLens.FieldDescriptor File + symbols__field_descriptor + = Data.ProtoLens.FieldDescriptor + "symbols" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Symbol) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"symbols")) :: + Data.ProtoLens.FieldDescriptor File + errors__field_descriptor + = Data.ProtoLens.FieldDescriptor + "errors" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor ParseError) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"errors")) :: + Data.ProtoLens.FieldDescriptor File + blobOid__field_descriptor + = Data.ProtoLens.FieldDescriptor + "blob_oid" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"blobOid")) :: + Data.ProtoLens.FieldDescriptor File + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, path__field_descriptor), + (Data.ProtoLens.Tag 2, language__field_descriptor), + (Data.ProtoLens.Tag 3, symbols__field_descriptor), + (Data.ProtoLens.Tag 4, errors__field_descriptor), + (Data.ProtoLens.Tag 5, blobOid__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _File'_unknownFields + (\ x__ y__ -> x__ {_File'_unknownFields = y__}) + defMessage + = File'_constructor + {_File'path = Data.ProtoLens.fieldDefault, + _File'language = Data.ProtoLens.fieldDefault, + _File'symbols = Data.Vector.Generic.empty, + _File'errors = Data.Vector.Generic.empty, + _File'blobOid = Data.ProtoLens.fieldDefault, + _File'_unknownFields = []} + parseMessage + = let + loop :: + File + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld ParseError + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Symbol + -> Data.ProtoLens.Encoding.Bytes.Parser File + loop x mutable'errors mutable'symbols + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'errors) + frozen'symbols <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'symbols) + (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields + (\ !t -> Prelude.reverse t) + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'errors") + frozen'errors + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'symbols") frozen'symbols x))) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "path" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y x) + mutable'errors + mutable'symbols + 18 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "language" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"language") y x) + mutable'errors + mutable'symbols + 26 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + "symbols" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'symbols y) + loop x mutable'errors v + 34 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + "errors" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'errors y) + loop x v mutable'symbols + 42 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "blob_oid" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"blobOid") y x) + mutable'errors + mutable'symbols + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + mutable'errors + mutable'symbols + in + (Data.ProtoLens.Encoding.Bytes.) + (do mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'symbols <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'errors mutable'symbols) + "File" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 18) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 26) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'symbols") _x)) + ((Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 34) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'errors") _x)) + ((Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"blobOid") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 42) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)))))) +instance Control.DeepSeq.NFData File where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_File'_unknownFields x__) + (Control.DeepSeq.deepseq + (_File'path x__) + (Control.DeepSeq.deepseq + (_File'language x__) + (Control.DeepSeq.deepseq + (_File'symbols x__) + (Control.DeepSeq.deepseq + (_File'errors x__) + (Control.DeepSeq.deepseq (_File'blobOid x__) ()))))) +newtype NodeType'UnrecognizedValue + = NodeType'UnrecognizedValue Data.Int.Int32 + deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show) +data NodeType + = ROOT_SCOPE | + JUMP_TO_SCOPE | + EXPORTED_SCOPE | + DEFINITION | + REFERENCE | + NodeType'Unrecognized !NodeType'UnrecognizedValue + deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord) +instance Data.ProtoLens.MessageEnum NodeType where + maybeToEnum 0 = Prelude.Just ROOT_SCOPE + maybeToEnum 1 = Prelude.Just JUMP_TO_SCOPE + maybeToEnum 2 = Prelude.Just EXPORTED_SCOPE + maybeToEnum 3 = Prelude.Just DEFINITION + maybeToEnum 4 = Prelude.Just REFERENCE + maybeToEnum k + = Prelude.Just + (NodeType'Unrecognized + (NodeType'UnrecognizedValue (Prelude.fromIntegral k))) + showEnum ROOT_SCOPE = "ROOT_SCOPE" + showEnum JUMP_TO_SCOPE = "JUMP_TO_SCOPE" + showEnum EXPORTED_SCOPE = "EXPORTED_SCOPE" + showEnum DEFINITION = "DEFINITION" + showEnum REFERENCE = "REFERENCE" + showEnum (NodeType'Unrecognized (NodeType'UnrecognizedValue k)) + = Prelude.show k + readEnum k + | (Prelude.==) k "ROOT_SCOPE" = Prelude.Just ROOT_SCOPE + | (Prelude.==) k "JUMP_TO_SCOPE" = Prelude.Just JUMP_TO_SCOPE + | (Prelude.==) k "EXPORTED_SCOPE" = Prelude.Just EXPORTED_SCOPE + | (Prelude.==) k "DEFINITION" = Prelude.Just DEFINITION + | (Prelude.==) k "REFERENCE" = Prelude.Just REFERENCE + | Prelude.otherwise + = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum +instance Prelude.Bounded NodeType where + minBound = ROOT_SCOPE + maxBound = REFERENCE +instance Prelude.Enum NodeType where + toEnum k__ + = Prelude.maybe + (Prelude.error + ((Prelude.++) + "toEnum: unknown value for enum NodeType: " (Prelude.show k__))) + Prelude.id + (Data.ProtoLens.maybeToEnum k__) + fromEnum ROOT_SCOPE = 0 + fromEnum JUMP_TO_SCOPE = 1 + fromEnum EXPORTED_SCOPE = 2 + fromEnum DEFINITION = 3 + fromEnum REFERENCE = 4 + fromEnum (NodeType'Unrecognized (NodeType'UnrecognizedValue k)) + = Prelude.fromIntegral k + succ REFERENCE + = Prelude.error + "NodeType.succ: bad argument REFERENCE. This value would be out of bounds." + succ ROOT_SCOPE = JUMP_TO_SCOPE + succ JUMP_TO_SCOPE = EXPORTED_SCOPE + succ EXPORTED_SCOPE = DEFINITION + succ DEFINITION = REFERENCE + succ (NodeType'Unrecognized _) + = Prelude.error "NodeType.succ: bad argument: unrecognized value" + pred ROOT_SCOPE + = Prelude.error + "NodeType.pred: bad argument ROOT_SCOPE. This value would be out of bounds." + pred JUMP_TO_SCOPE = ROOT_SCOPE + pred EXPORTED_SCOPE = JUMP_TO_SCOPE + pred DEFINITION = EXPORTED_SCOPE + pred REFERENCE = DEFINITION + pred (NodeType'Unrecognized _) + = Prelude.error "NodeType.pred: bad argument: unrecognized value" + enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom + enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo + enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen + enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo +instance Data.ProtoLens.FieldDefault NodeType where + fieldDefault = ROOT_SCOPE +instance Control.DeepSeq.NFData NodeType where + rnf x__ = Prelude.seq x__ () +{- | Fields : + + * 'Proto.Semantic_Fields.error' @:: Lens' ParseError Data.Text.Text@ -} +data ParseError + = ParseError'_constructor {_ParseError'error :: !Data.Text.Text, + _ParseError'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ParseError where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ParseError "error" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseError'error (\ x__ y__ -> x__ {_ParseError'error = y__})) + Prelude.id +instance Data.ProtoLens.Message ParseError where + messageName _ = Data.Text.pack "github.semantic.ParseError" + packedMessageDescriptor _ + = "\n\ + \\n\ + \ParseError\DC2\DC4\n\ + \\ENQerror\CAN\SOH \SOH(\tR\ENQerror" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + error__field_descriptor + = Data.ProtoLens.FieldDescriptor + "error" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"error")) :: + Data.ProtoLens.FieldDescriptor ParseError + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, error__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _ParseError'_unknownFields + (\ x__ y__ -> x__ {_ParseError'_unknownFields = y__}) + defMessage + = ParseError'_constructor + {_ParseError'error = Data.ProtoLens.fieldDefault, + _ParseError'_unknownFields = []} + parseMessage + = let + loop :: + ParseError -> Data.ProtoLens.Encoding.Bytes.Parser ParseError + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "error" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"error") y x) + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + in + (Data.ProtoLens.Encoding.Bytes.) + (do loop Data.ProtoLens.defMessage) "ParseError" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"error") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData ParseError where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_ParseError'_unknownFields x__) + (Control.DeepSeq.deepseq (_ParseError'error x__) ()) +{- | Fields : + + * 'Proto.Semantic_Fields.blobs' @:: Lens' ParseTreeRequest [Blob]@ + * 'Proto.Semantic_Fields.vec'blobs' @:: Lens' ParseTreeRequest (Data.Vector.Vector Blob)@ -} +data ParseTreeRequest + = ParseTreeRequest'_constructor {_ParseTreeRequest'blobs :: !(Data.Vector.Vector Blob), + _ParseTreeRequest'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ParseTreeRequest where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ParseTreeRequest "blobs" [Blob] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeRequest'blobs + (\ x__ y__ -> x__ {_ParseTreeRequest'blobs = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField ParseTreeRequest "vec'blobs" (Data.Vector.Vector Blob) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeRequest'blobs + (\ x__ y__ -> x__ {_ParseTreeRequest'blobs = y__})) + Prelude.id +instance Data.ProtoLens.Message ParseTreeRequest where + messageName _ = Data.Text.pack "github.semantic.ParseTreeRequest" + packedMessageDescriptor _ + = "\n\ + \\DLEParseTreeRequest\DC2+\n\ + \\ENQblobs\CAN\SOH \ETX(\v2\NAK.github.semantic.BlobR\ENQblobs" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + blobs__field_descriptor + = Data.ProtoLens.FieldDescriptor + "blobs" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Blob) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"blobs")) :: + Data.ProtoLens.FieldDescriptor ParseTreeRequest + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, blobs__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _ParseTreeRequest'_unknownFields + (\ x__ y__ -> x__ {_ParseTreeRequest'_unknownFields = y__}) + defMessage + = ParseTreeRequest'_constructor + {_ParseTreeRequest'blobs = Data.Vector.Generic.empty, + _ParseTreeRequest'_unknownFields = []} + parseMessage + = let + loop :: + ParseTreeRequest + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Blob + -> Data.ProtoLens.Encoding.Bytes.Parser ParseTreeRequest + loop x mutable'blobs + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'blobs <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze mutable'blobs) + (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields + (\ !t -> Prelude.reverse t) + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'blobs") frozen'blobs x)) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + "blobs" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'blobs y) + loop x v + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + mutable'blobs + in + (Data.ProtoLens.Encoding.Bytes.) + (do mutable'blobs <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'blobs) + "ParseTreeRequest" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'blobs") _x)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData ParseTreeRequest where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_ParseTreeRequest'_unknownFields x__) + (Control.DeepSeq.deepseq (_ParseTreeRequest'blobs x__) ()) +{- | Fields : + + * 'Proto.Semantic_Fields.files' @:: Lens' ParseTreeSymbolResponse [File]@ + * 'Proto.Semantic_Fields.vec'files' @:: Lens' ParseTreeSymbolResponse (Data.Vector.Vector File)@ -} +data ParseTreeSymbolResponse + = ParseTreeSymbolResponse'_constructor {_ParseTreeSymbolResponse'files :: !(Data.Vector.Vector File), + _ParseTreeSymbolResponse'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ParseTreeSymbolResponse where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ParseTreeSymbolResponse "files" [File] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeSymbolResponse'files + (\ x__ y__ -> x__ {_ParseTreeSymbolResponse'files = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField ParseTreeSymbolResponse "vec'files" (Data.Vector.Vector File) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeSymbolResponse'files + (\ x__ y__ -> x__ {_ParseTreeSymbolResponse'files = y__})) + Prelude.id +instance Data.ProtoLens.Message ParseTreeSymbolResponse where + messageName _ + = Data.Text.pack "github.semantic.ParseTreeSymbolResponse" + packedMessageDescriptor _ + = "\n\ + \\ETBParseTreeSymbolResponse\DC2+\n\ + \\ENQfiles\CAN\SOH \ETX(\v2\NAK.github.semantic.FileR\ENQfiles" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + files__field_descriptor + = Data.ProtoLens.FieldDescriptor + "files" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor File) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"files")) :: + Data.ProtoLens.FieldDescriptor ParseTreeSymbolResponse + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _ParseTreeSymbolResponse'_unknownFields + (\ x__ y__ -> x__ {_ParseTreeSymbolResponse'_unknownFields = y__}) + defMessage + = ParseTreeSymbolResponse'_constructor + {_ParseTreeSymbolResponse'files = Data.Vector.Generic.empty, + _ParseTreeSymbolResponse'_unknownFields = []} + parseMessage + = let + loop :: + ParseTreeSymbolResponse + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld File + -> Data.ProtoLens.Encoding.Bytes.Parser ParseTreeSymbolResponse + loop x mutable'files + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze mutable'files) + (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields + (\ !t -> Prelude.reverse t) + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'files") frozen'files x)) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + "files" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'files y) + loop x v + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + mutable'files + in + (Data.ProtoLens.Encoding.Bytes.) + (do mutable'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'files) + "ParseTreeSymbolResponse" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'files") _x)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData ParseTreeSymbolResponse where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_ParseTreeSymbolResponse'_unknownFields x__) + (Control.DeepSeq.deepseq (_ParseTreeSymbolResponse'files x__) ()) +{- | Fields : + + * 'Proto.Semantic_Fields.service' @:: Lens' PingRequest Data.Text.Text@ -} +data PingRequest + = PingRequest'_constructor {_PingRequest'service :: !Data.Text.Text, + _PingRequest'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show PingRequest where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField PingRequest "service" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _PingRequest'service + (\ x__ y__ -> x__ {_PingRequest'service = y__})) + Prelude.id +instance Data.ProtoLens.Message PingRequest where + messageName _ = Data.Text.pack "github.semantic.PingRequest" + packedMessageDescriptor _ + = "\n\ + \\vPingRequest\DC2\CAN\n\ + \\aservice\CAN\SOH \SOH(\tR\aservice" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + service__field_descriptor + = Data.ProtoLens.FieldDescriptor + "service" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"service")) :: + Data.ProtoLens.FieldDescriptor PingRequest + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, service__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _PingRequest'_unknownFields + (\ x__ y__ -> x__ {_PingRequest'_unknownFields = y__}) + defMessage + = PingRequest'_constructor + {_PingRequest'service = Data.ProtoLens.fieldDefault, + _PingRequest'_unknownFields = []} + parseMessage + = let + loop :: + PingRequest -> Data.ProtoLens.Encoding.Bytes.Parser PingRequest + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "service" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"service") y x) + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + in + (Data.ProtoLens.Encoding.Bytes.) + (do loop Data.ProtoLens.defMessage) "PingRequest" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"service") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData PingRequest where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_PingRequest'_unknownFields x__) + (Control.DeepSeq.deepseq (_PingRequest'service x__) ()) +{- | Fields : + + * 'Proto.Semantic_Fields.status' @:: Lens' PingResponse Data.Text.Text@ + * 'Proto.Semantic_Fields.hostname' @:: Lens' PingResponse Data.Text.Text@ + * 'Proto.Semantic_Fields.timestamp' @:: Lens' PingResponse Data.Text.Text@ + * 'Proto.Semantic_Fields.sha' @:: Lens' PingResponse Data.Text.Text@ -} +data PingResponse + = PingResponse'_constructor {_PingResponse'status :: !Data.Text.Text, + _PingResponse'hostname :: !Data.Text.Text, + _PingResponse'timestamp :: !Data.Text.Text, + _PingResponse'sha :: !Data.Text.Text, + _PingResponse'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show PingResponse where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField PingResponse "status" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _PingResponse'status + (\ x__ y__ -> x__ {_PingResponse'status = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField PingResponse "hostname" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _PingResponse'hostname + (\ x__ y__ -> x__ {_PingResponse'hostname = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField PingResponse "timestamp" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _PingResponse'timestamp + (\ x__ y__ -> x__ {_PingResponse'timestamp = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField PingResponse "sha" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _PingResponse'sha (\ x__ y__ -> x__ {_PingResponse'sha = y__})) + Prelude.id +instance Data.ProtoLens.Message PingResponse where + messageName _ = Data.Text.pack "github.semantic.PingResponse" + packedMessageDescriptor _ + = "\n\ + \\fPingResponse\DC2\SYN\n\ + \\ACKstatus\CAN\SOH \SOH(\tR\ACKstatus\DC2\SUB\n\ + \\bhostname\CAN\STX \SOH(\tR\bhostname\DC2\FS\n\ + \\ttimestamp\CAN\ETX \SOH(\tR\ttimestamp\DC2\DLE\n\ + \\ETXsha\CAN\EOT \SOH(\tR\ETXsha" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + status__field_descriptor + = Data.ProtoLens.FieldDescriptor + "status" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"status")) :: + Data.ProtoLens.FieldDescriptor PingResponse + hostname__field_descriptor + = Data.ProtoLens.FieldDescriptor + "hostname" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"hostname")) :: + Data.ProtoLens.FieldDescriptor PingResponse + timestamp__field_descriptor + = Data.ProtoLens.FieldDescriptor + "timestamp" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"timestamp")) :: + Data.ProtoLens.FieldDescriptor PingResponse + sha__field_descriptor + = Data.ProtoLens.FieldDescriptor + "sha" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"sha")) :: + Data.ProtoLens.FieldDescriptor PingResponse + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, status__field_descriptor), + (Data.ProtoLens.Tag 2, hostname__field_descriptor), + (Data.ProtoLens.Tag 3, timestamp__field_descriptor), + (Data.ProtoLens.Tag 4, sha__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _PingResponse'_unknownFields + (\ x__ y__ -> x__ {_PingResponse'_unknownFields = y__}) + defMessage + = PingResponse'_constructor + {_PingResponse'status = Data.ProtoLens.fieldDefault, + _PingResponse'hostname = Data.ProtoLens.fieldDefault, + _PingResponse'timestamp = Data.ProtoLens.fieldDefault, + _PingResponse'sha = Data.ProtoLens.fieldDefault, + _PingResponse'_unknownFields = []} + parseMessage + = let + loop :: + PingResponse -> Data.ProtoLens.Encoding.Bytes.Parser PingResponse + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "status" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"status") y x) + 18 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "hostname" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"hostname") y x) + 26 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "timestamp" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"timestamp") y x) + 34 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "sha" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"sha") y x) + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + in + (Data.ProtoLens.Encoding.Bytes.) + (do loop Data.ProtoLens.defMessage) "PingResponse" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"status") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"hostname") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 18) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"timestamp") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 26) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"sha") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 34) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x))))) +instance Control.DeepSeq.NFData PingResponse where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_PingResponse'_unknownFields x__) + (Control.DeepSeq.deepseq + (_PingResponse'status x__) + (Control.DeepSeq.deepseq + (_PingResponse'hostname x__) + (Control.DeepSeq.deepseq + (_PingResponse'timestamp x__) + (Control.DeepSeq.deepseq (_PingResponse'sha x__) ())))) +{- | Fields : + + * 'Proto.Semantic_Fields.line' @:: Lens' Position Data.Int.Int32@ + * 'Proto.Semantic_Fields.column' @:: Lens' Position Data.Int.Int32@ -} +data Position + = Position'_constructor {_Position'line :: !Data.Int.Int32, + _Position'column :: !Data.Int.Int32, + _Position'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show Position where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField Position "line" Data.Int.Int32 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Position'line (\ x__ y__ -> x__ {_Position'line = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Position "column" Data.Int.Int32 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Position'column (\ x__ y__ -> x__ {_Position'column = y__})) + Prelude.id +instance Data.ProtoLens.Message Position where + messageName _ = Data.Text.pack "github.semantic.Position" + packedMessageDescriptor _ + = "\n\ + \\bPosition\DC2\DC2\n\ + \\EOTline\CAN\SOH \SOH(\ENQR\EOTline\DC2\SYN\n\ + \\ACKcolumn\CAN\STX \SOH(\ENQR\ACKcolumn" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + line__field_descriptor + = Data.ProtoLens.FieldDescriptor + "line" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"line")) :: + Data.ProtoLens.FieldDescriptor Position + column__field_descriptor + = Data.ProtoLens.FieldDescriptor + "column" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"column")) :: + Data.ProtoLens.FieldDescriptor Position + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, line__field_descriptor), + (Data.ProtoLens.Tag 2, column__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _Position'_unknownFields + (\ x__ y__ -> x__ {_Position'_unknownFields = y__}) + defMessage + = Position'_constructor + {_Position'line = Data.ProtoLens.fieldDefault, + _Position'column = Data.ProtoLens.fieldDefault, + _Position'_unknownFields = []} + parseMessage + = let + loop :: Position -> Data.ProtoLens.Encoding.Bytes.Parser Position + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 8 -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "line" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"line") y x) + 16 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "column" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"column") y x) + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + in + (Data.ProtoLens.Encoding.Bytes.) + (do loop Data.ProtoLens.defMessage) "Position" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"line") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 8) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral _v)) + ((Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"column") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 16) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x))) +instance Control.DeepSeq.NFData Position where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_Position'_unknownFields x__) + (Control.DeepSeq.deepseq + (_Position'line x__) + (Control.DeepSeq.deepseq (_Position'column x__) ())) +{- | Fields : + + * 'Proto.Semantic_Fields.start' @:: Lens' Span Position@ + * 'Proto.Semantic_Fields.maybe'start' @:: Lens' Span (Prelude.Maybe Position)@ + * 'Proto.Semantic_Fields.end' @:: Lens' Span Position@ + * 'Proto.Semantic_Fields.maybe'end' @:: Lens' Span (Prelude.Maybe Position)@ -} +data Span + = Span'_constructor {_Span'start :: !(Prelude.Maybe Position), + _Span'end :: !(Prelude.Maybe Position), + _Span'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show Span where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField Span "start" Position where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Span'start (\ x__ y__ -> x__ {_Span'start = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField Span "maybe'start" (Prelude.Maybe Position) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Span'start (\ x__ y__ -> x__ {_Span'start = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Span "end" Position where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Span'end (\ x__ y__ -> x__ {_Span'end = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField Span "maybe'end" (Prelude.Maybe Position) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Span'end (\ x__ y__ -> x__ {_Span'end = y__})) + Prelude.id +instance Data.ProtoLens.Message Span where + messageName _ = Data.Text.pack "github.semantic.Span" + packedMessageDescriptor _ + = "\n\ + \\EOTSpan\DC2/\n\ + \\ENQstart\CAN\SOH \SOH(\v2\EM.github.semantic.PositionR\ENQstart\DC2+\n\ + \\ETXend\CAN\STX \SOH(\v2\EM.github.semantic.PositionR\ETXend" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + start__field_descriptor + = Data.ProtoLens.FieldDescriptor + "start" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Position) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'start")) :: + Data.ProtoLens.FieldDescriptor Span + end__field_descriptor + = Data.ProtoLens.FieldDescriptor + "end" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Position) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'end")) :: + Data.ProtoLens.FieldDescriptor Span + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, start__field_descriptor), + (Data.ProtoLens.Tag 2, end__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _Span'_unknownFields + (\ x__ y__ -> x__ {_Span'_unknownFields = y__}) + defMessage + = Span'_constructor + {_Span'start = Prelude.Nothing, _Span'end = Prelude.Nothing, + _Span'_unknownFields = []} + parseMessage + = let + loop :: Span -> Data.ProtoLens.Encoding.Bytes.Parser Span + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) Data.ProtoLens.parseMessage) + "start" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"start") y x) + 18 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) Data.ProtoLens.parseMessage) + "end" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"end") y x) + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + in + (Data.ProtoLens.Encoding.Bytes.) + (do loop Data.ProtoLens.defMessage) "Span" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'start") _x + of + Prelude.Nothing -> Data.Monoid.mempty + (Prelude.Just _v) + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + ((Data.Monoid.<>) + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'end") _x + of + Prelude.Nothing -> Data.Monoid.mempty + (Prelude.Just _v) + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 18) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x))) +instance Control.DeepSeq.NFData Span where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_Span'_unknownFields x__) + (Control.DeepSeq.deepseq + (_Span'start x__) (Control.DeepSeq.deepseq (_Span'end x__) ())) +{- | Fields : + + * 'Proto.Semantic_Fields.path' @:: Lens' StackGraphFile Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' StackGraphFile Data.Text.Text@ + * 'Proto.Semantic_Fields.nodes' @:: Lens' StackGraphFile [StackGraphNode]@ + * 'Proto.Semantic_Fields.vec'nodes' @:: Lens' StackGraphFile (Data.Vector.Vector StackGraphNode)@ + * 'Proto.Semantic_Fields.paths' @:: Lens' StackGraphFile [StackGraphPath]@ + * 'Proto.Semantic_Fields.vec'paths' @:: Lens' StackGraphFile (Data.Vector.Vector StackGraphPath)@ + * 'Proto.Semantic_Fields.errors' @:: Lens' StackGraphFile [ParseError]@ + * 'Proto.Semantic_Fields.vec'errors' @:: Lens' StackGraphFile (Data.Vector.Vector ParseError)@ -} +data StackGraphFile + = StackGraphFile'_constructor {_StackGraphFile'path :: !Data.Text.Text, + _StackGraphFile'language :: !Data.Text.Text, + _StackGraphFile'nodes :: !(Data.Vector.Vector StackGraphNode), + _StackGraphFile'paths :: !(Data.Vector.Vector StackGraphPath), + _StackGraphFile'errors :: !(Data.Vector.Vector ParseError), + _StackGraphFile'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show StackGraphFile where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField StackGraphFile "path" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphFile'path + (\ x__ y__ -> x__ {_StackGraphFile'path = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphFile "language" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphFile'language + (\ x__ y__ -> x__ {_StackGraphFile'language = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphFile "nodes" [StackGraphNode] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphFile'nodes + (\ x__ y__ -> x__ {_StackGraphFile'nodes = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField StackGraphFile "vec'nodes" (Data.Vector.Vector StackGraphNode) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphFile'nodes + (\ x__ y__ -> x__ {_StackGraphFile'nodes = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphFile "paths" [StackGraphPath] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphFile'paths + (\ x__ y__ -> x__ {_StackGraphFile'paths = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField StackGraphFile "vec'paths" (Data.Vector.Vector StackGraphPath) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphFile'paths + (\ x__ y__ -> x__ {_StackGraphFile'paths = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphFile "errors" [ParseError] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphFile'errors + (\ x__ y__ -> x__ {_StackGraphFile'errors = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField StackGraphFile "vec'errors" (Data.Vector.Vector ParseError) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphFile'errors + (\ x__ y__ -> x__ {_StackGraphFile'errors = y__})) + Prelude.id +instance Data.ProtoLens.Message StackGraphFile where + messageName _ = Data.Text.pack "github.semantic.StackGraphFile" + packedMessageDescriptor _ + = "\n\ + \\SOStackGraphFile\DC2\DC2\n\ + \\EOTpath\CAN\SOH \SOH(\tR\EOTpath\DC2\SUB\n\ + \\blanguage\CAN\STX \SOH(\tR\blanguage\DC25\n\ + \\ENQnodes\CAN\ETX \ETX(\v2\US.github.semantic.StackGraphNodeR\ENQnodes\DC25\n\ + \\ENQpaths\CAN\EOT \ETX(\v2\US.github.semantic.StackGraphPathR\ENQpaths\DC23\n\ + \\ACKerrors\CAN\ENQ \ETX(\v2\ESC.github.semantic.ParseErrorR\ACKerrors" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + path__field_descriptor + = Data.ProtoLens.FieldDescriptor + "path" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"path")) :: + Data.ProtoLens.FieldDescriptor StackGraphFile + language__field_descriptor + = Data.ProtoLens.FieldDescriptor + "language" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"language")) :: + Data.ProtoLens.FieldDescriptor StackGraphFile + nodes__field_descriptor + = Data.ProtoLens.FieldDescriptor + "nodes" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor StackGraphNode) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"nodes")) :: + Data.ProtoLens.FieldDescriptor StackGraphFile + paths__field_descriptor + = Data.ProtoLens.FieldDescriptor + "paths" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor StackGraphPath) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"paths")) :: + Data.ProtoLens.FieldDescriptor StackGraphFile + errors__field_descriptor + = Data.ProtoLens.FieldDescriptor + "errors" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor ParseError) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"errors")) :: + Data.ProtoLens.FieldDescriptor StackGraphFile + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, path__field_descriptor), + (Data.ProtoLens.Tag 2, language__field_descriptor), + (Data.ProtoLens.Tag 3, nodes__field_descriptor), + (Data.ProtoLens.Tag 4, paths__field_descriptor), + (Data.ProtoLens.Tag 5, errors__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _StackGraphFile'_unknownFields + (\ x__ y__ -> x__ {_StackGraphFile'_unknownFields = y__}) + defMessage + = StackGraphFile'_constructor + {_StackGraphFile'path = Data.ProtoLens.fieldDefault, + _StackGraphFile'language = Data.ProtoLens.fieldDefault, + _StackGraphFile'nodes = Data.Vector.Generic.empty, + _StackGraphFile'paths = Data.Vector.Generic.empty, + _StackGraphFile'errors = Data.Vector.Generic.empty, + _StackGraphFile'_unknownFields = []} + parseMessage + = let + loop :: + StackGraphFile + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld ParseError + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld StackGraphNode + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld StackGraphPath + -> Data.ProtoLens.Encoding.Bytes.Parser StackGraphFile + loop x mutable'errors mutable'nodes mutable'paths + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'errors) + frozen'nodes <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze mutable'nodes) + frozen'paths <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze mutable'paths) + (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields + (\ !t -> Prelude.reverse t) + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'errors") + frozen'errors + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'nodes") + frozen'nodes + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'paths") frozen'paths x)))) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "path" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y x) + mutable'errors + mutable'nodes + mutable'paths + 18 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "language" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"language") y x) + mutable'errors + mutable'nodes + mutable'paths + 26 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + "nodes" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'nodes y) + loop x mutable'errors v mutable'paths + 34 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + "paths" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'paths y) + loop x mutable'errors mutable'nodes v + 42 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + "errors" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'errors y) + loop x v mutable'nodes mutable'paths + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + mutable'errors + mutable'nodes + mutable'paths + in + (Data.ProtoLens.Encoding.Bytes.) + (do mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'nodes <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'paths <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop + Data.ProtoLens.defMessage + mutable'errors + mutable'nodes + mutable'paths) + "StackGraphFile" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 18) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 26) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'nodes") _x)) + ((Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 34) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'paths") _x)) + ((Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 42) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral + (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'errors") _x)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)))))) +instance Control.DeepSeq.NFData StackGraphFile where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_StackGraphFile'_unknownFields x__) + (Control.DeepSeq.deepseq + (_StackGraphFile'path x__) + (Control.DeepSeq.deepseq + (_StackGraphFile'language x__) + (Control.DeepSeq.deepseq + (_StackGraphFile'nodes x__) + (Control.DeepSeq.deepseq + (_StackGraphFile'paths x__) + (Control.DeepSeq.deepseq (_StackGraphFile'errors x__) ()))))) +{- | Fields : + + * 'Proto.Semantic_Fields.id' @:: Lens' StackGraphNode Data.Int.Int64@ + * 'Proto.Semantic_Fields.name' @:: Lens' StackGraphNode Data.Text.Text@ + * 'Proto.Semantic_Fields.line' @:: Lens' StackGraphNode Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' StackGraphNode Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' StackGraphNode (Prelude.Maybe Span)@ + * 'Proto.Semantic_Fields.syntaxType' @:: Lens' StackGraphNode SyntaxType@ + * 'Proto.Semantic_Fields.nodeType' @:: Lens' StackGraphNode NodeType@ -} +data StackGraphNode + = StackGraphNode'_constructor {_StackGraphNode'id :: !Data.Int.Int64, + _StackGraphNode'name :: !Data.Text.Text, + _StackGraphNode'line :: !Data.Text.Text, + _StackGraphNode'span :: !(Prelude.Maybe Span), + _StackGraphNode'syntaxType :: !SyntaxType, + _StackGraphNode'nodeType :: !NodeType, + _StackGraphNode'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show StackGraphNode where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField StackGraphNode "id" Data.Int.Int64 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphNode'id (\ x__ y__ -> x__ {_StackGraphNode'id = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphNode "name" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphNode'name + (\ x__ y__ -> x__ {_StackGraphNode'name = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphNode "line" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphNode'line + (\ x__ y__ -> x__ {_StackGraphNode'line = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphNode "span" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphNode'span + (\ x__ y__ -> x__ {_StackGraphNode'span = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField StackGraphNode "maybe'span" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphNode'span + (\ x__ y__ -> x__ {_StackGraphNode'span = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphNode "syntaxType" SyntaxType where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphNode'syntaxType + (\ x__ y__ -> x__ {_StackGraphNode'syntaxType = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphNode "nodeType" NodeType where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphNode'nodeType + (\ x__ y__ -> x__ {_StackGraphNode'nodeType = y__})) + Prelude.id +instance Data.ProtoLens.Message StackGraphNode where + messageName _ = Data.Text.pack "github.semantic.StackGraphNode" + packedMessageDescriptor _ + = "\n\ + \\SOStackGraphNode\DC2\SO\n\ + \\STXid\CAN\SOH \SOH(\ETXR\STXid\DC2\DC2\n\ + \\EOTname\CAN\STX \SOH(\tR\EOTname\DC2\DC2\n\ + \\EOTline\CAN\ETX \SOH(\tR\EOTline\DC2)\n\ + \\EOTspan\CAN\EOT \SOH(\v2\NAK.github.semantic.SpanR\EOTspan\DC2<\n\ + \\vsyntax_type\CAN\ENQ \SOH(\SO2\ESC.github.semantic.SyntaxTypeR\n\ + \syntaxType\DC26\n\ + \\tnode_type\CAN\ACK \SOH(\SO2\EM.github.semantic.NodeTypeR\bnodeType" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + id__field_descriptor + = Data.ProtoLens.FieldDescriptor + "id" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int64Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int64) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"id")) :: + Data.ProtoLens.FieldDescriptor StackGraphNode + name__field_descriptor + = Data.ProtoLens.FieldDescriptor + "name" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"name")) :: + Data.ProtoLens.FieldDescriptor StackGraphNode + line__field_descriptor + = Data.ProtoLens.FieldDescriptor + "line" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"line")) :: + Data.ProtoLens.FieldDescriptor StackGraphNode + span__field_descriptor + = Data.ProtoLens.FieldDescriptor + "span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'span")) :: + Data.ProtoLens.FieldDescriptor StackGraphNode + syntaxType__field_descriptor + = Data.ProtoLens.FieldDescriptor + "syntax_type" + (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField :: + Data.ProtoLens.FieldTypeDescriptor SyntaxType) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"syntaxType")) :: + Data.ProtoLens.FieldDescriptor StackGraphNode + nodeType__field_descriptor + = Data.ProtoLens.FieldDescriptor + "node_type" + (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField :: + Data.ProtoLens.FieldTypeDescriptor NodeType) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"nodeType")) :: + Data.ProtoLens.FieldDescriptor StackGraphNode + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, id__field_descriptor), + (Data.ProtoLens.Tag 2, name__field_descriptor), + (Data.ProtoLens.Tag 3, line__field_descriptor), + (Data.ProtoLens.Tag 4, span__field_descriptor), + (Data.ProtoLens.Tag 5, syntaxType__field_descriptor), + (Data.ProtoLens.Tag 6, nodeType__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _StackGraphNode'_unknownFields + (\ x__ y__ -> x__ {_StackGraphNode'_unknownFields = y__}) + defMessage + = StackGraphNode'_constructor + {_StackGraphNode'id = Data.ProtoLens.fieldDefault, + _StackGraphNode'name = Data.ProtoLens.fieldDefault, + _StackGraphNode'line = Data.ProtoLens.fieldDefault, + _StackGraphNode'span = Prelude.Nothing, + _StackGraphNode'syntaxType = Data.ProtoLens.fieldDefault, + _StackGraphNode'nodeType = Data.ProtoLens.fieldDefault, + _StackGraphNode'_unknownFields = []} + parseMessage + = let + loop :: + StackGraphNode + -> Data.ProtoLens.Encoding.Bytes.Parser StackGraphNode + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 8 -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "id" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"id") y x) + 18 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "name" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"name") y x) + 26 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "line" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"line") y x) + 34 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) Data.ProtoLens.parseMessage) + "span" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y x) + 40 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.toEnum + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt)) + "syntax_type" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"syntaxType") y x) + 48 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.toEnum + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt)) + "node_type" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"nodeType") y x) + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + in + (Data.ProtoLens.Encoding.Bytes.) + (do loop Data.ProtoLens.defMessage) "StackGraphNode" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"id") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 8) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral _v)) + ((Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"name") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 18) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"line") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 26) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'span") _x + of + Prelude.Nothing -> Data.Monoid.mempty + (Prelude.Just _v) + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 34) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + ((Data.Monoid.<>) + (let + _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"syntaxType") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 40) + ((Prelude..) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt + Prelude.fromIntegral) + Prelude.fromEnum + _v)) + ((Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"nodeType") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 48) + ((Prelude..) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt + Prelude.fromIntegral) + Prelude.fromEnum + _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x))))))) +instance Control.DeepSeq.NFData StackGraphNode where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_StackGraphNode'_unknownFields x__) + (Control.DeepSeq.deepseq + (_StackGraphNode'id x__) + (Control.DeepSeq.deepseq + (_StackGraphNode'name x__) + (Control.DeepSeq.deepseq + (_StackGraphNode'line x__) + (Control.DeepSeq.deepseq + (_StackGraphNode'span x__) + (Control.DeepSeq.deepseq + (_StackGraphNode'syntaxType x__) + (Control.DeepSeq.deepseq (_StackGraphNode'nodeType x__) ())))))) +{- | Fields : + + * 'Proto.Semantic_Fields.startingSymbolStack' @:: Lens' StackGraphPath [Data.Text.Text]@ + * 'Proto.Semantic_Fields.vec'startingSymbolStack' @:: Lens' StackGraphPath (Data.Vector.Vector Data.Text.Text)@ + * 'Proto.Semantic_Fields.startingScopeStackSize' @:: Lens' StackGraphPath Data.Int.Int64@ + * 'Proto.Semantic_Fields.from' @:: Lens' StackGraphPath Data.Int.Int64@ + * 'Proto.Semantic_Fields.edges' @:: Lens' StackGraphPath Data.Text.Text@ + * 'Proto.Semantic_Fields.to' @:: Lens' StackGraphPath Data.Int.Int64@ + * 'Proto.Semantic_Fields.endingScopeStack' @:: Lens' StackGraphPath [Data.Int.Int64]@ + * 'Proto.Semantic_Fields.vec'endingScopeStack' @:: Lens' StackGraphPath (Data.Vector.Unboxed.Vector Data.Int.Int64)@ + * 'Proto.Semantic_Fields.endingSymbolStack' @:: Lens' StackGraphPath [Data.Text.Text]@ + * 'Proto.Semantic_Fields.vec'endingSymbolStack' @:: Lens' StackGraphPath (Data.Vector.Vector Data.Text.Text)@ -} +data StackGraphPath + = StackGraphPath'_constructor {_StackGraphPath'startingSymbolStack :: !(Data.Vector.Vector Data.Text.Text), + _StackGraphPath'startingScopeStackSize :: !Data.Int.Int64, + _StackGraphPath'from :: !Data.Int.Int64, + _StackGraphPath'edges :: !Data.Text.Text, + _StackGraphPath'to :: !Data.Int.Int64, + _StackGraphPath'endingScopeStack :: !(Data.Vector.Unboxed.Vector Data.Int.Int64), + _StackGraphPath'endingSymbolStack :: !(Data.Vector.Vector Data.Text.Text), + _StackGraphPath'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show StackGraphPath where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField StackGraphPath "startingSymbolStack" [Data.Text.Text] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphPath'startingSymbolStack + (\ x__ y__ -> x__ {_StackGraphPath'startingSymbolStack = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField StackGraphPath "vec'startingSymbolStack" (Data.Vector.Vector Data.Text.Text) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphPath'startingSymbolStack + (\ x__ y__ -> x__ {_StackGraphPath'startingSymbolStack = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphPath "startingScopeStackSize" Data.Int.Int64 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphPath'startingScopeStackSize + (\ x__ y__ -> x__ {_StackGraphPath'startingScopeStackSize = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphPath "from" Data.Int.Int64 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphPath'from + (\ x__ y__ -> x__ {_StackGraphPath'from = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphPath "edges" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphPath'edges + (\ x__ y__ -> x__ {_StackGraphPath'edges = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphPath "to" Data.Int.Int64 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphPath'to (\ x__ y__ -> x__ {_StackGraphPath'to = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphPath "endingScopeStack" [Data.Int.Int64] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphPath'endingScopeStack + (\ x__ y__ -> x__ {_StackGraphPath'endingScopeStack = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField StackGraphPath "vec'endingScopeStack" (Data.Vector.Unboxed.Vector Data.Int.Int64) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphPath'endingScopeStack + (\ x__ y__ -> x__ {_StackGraphPath'endingScopeStack = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField StackGraphPath "endingSymbolStack" [Data.Text.Text] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphPath'endingSymbolStack + (\ x__ y__ -> x__ {_StackGraphPath'endingSymbolStack = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField StackGraphPath "vec'endingSymbolStack" (Data.Vector.Vector Data.Text.Text) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphPath'endingSymbolStack + (\ x__ y__ -> x__ {_StackGraphPath'endingSymbolStack = y__})) + Prelude.id +instance Data.ProtoLens.Message StackGraphPath where + messageName _ = Data.Text.pack "github.semantic.StackGraphPath" + packedMessageDescriptor _ + = "\n\ + \\SOStackGraphPath\DC22\n\ + \\NAKstarting_symbol_stack\CAN\SOH \ETX(\tR\DC3startingSymbolStack\DC29\n\ + \\EMstarting_scope_stack_size\CAN\STX \SOH(\ETXR\SYNstartingScopeStackSize\DC2\DC2\n\ + \\EOTfrom\CAN\ETX \SOH(\ETXR\EOTfrom\DC2\DC4\n\ + \\ENQedges\CAN\EOT \SOH(\tR\ENQedges\DC2\SO\n\ + \\STXto\CAN\ENQ \SOH(\ETXR\STXto\DC2,\n\ + \\DC2ending_scope_stack\CAN\ACK \ETX(\ETXR\DLEendingScopeStack\DC2.\n\ + \\DC3ending_symbol_stack\CAN\a \ETX(\tR\DC1endingSymbolStack" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + startingSymbolStack__field_descriptor + = Data.ProtoLens.FieldDescriptor + "starting_symbol_stack" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"startingSymbolStack")) :: + Data.ProtoLens.FieldDescriptor StackGraphPath + startingScopeStackSize__field_descriptor + = Data.ProtoLens.FieldDescriptor + "starting_scope_stack_size" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int64Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int64) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"startingScopeStackSize")) :: + Data.ProtoLens.FieldDescriptor StackGraphPath + from__field_descriptor + = Data.ProtoLens.FieldDescriptor + "from" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int64Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int64) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"from")) :: + Data.ProtoLens.FieldDescriptor StackGraphPath + edges__field_descriptor + = Data.ProtoLens.FieldDescriptor + "edges" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"edges")) :: + Data.ProtoLens.FieldDescriptor StackGraphPath + to__field_descriptor + = Data.ProtoLens.FieldDescriptor + "to" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int64Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int64) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"to")) :: + Data.ProtoLens.FieldDescriptor StackGraphPath + endingScopeStack__field_descriptor + = Data.ProtoLens.FieldDescriptor + "ending_scope_stack" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int64Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int64) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Packed + (Data.ProtoLens.Field.field @"endingScopeStack")) :: + Data.ProtoLens.FieldDescriptor StackGraphPath + endingSymbolStack__field_descriptor + = Data.ProtoLens.FieldDescriptor + "ending_symbol_stack" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"endingSymbolStack")) :: + Data.ProtoLens.FieldDescriptor StackGraphPath + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, startingSymbolStack__field_descriptor), + (Data.ProtoLens.Tag 2, startingScopeStackSize__field_descriptor), + (Data.ProtoLens.Tag 3, from__field_descriptor), + (Data.ProtoLens.Tag 4, edges__field_descriptor), + (Data.ProtoLens.Tag 5, to__field_descriptor), + (Data.ProtoLens.Tag 6, endingScopeStack__field_descriptor), + (Data.ProtoLens.Tag 7, endingSymbolStack__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _StackGraphPath'_unknownFields + (\ x__ y__ -> x__ {_StackGraphPath'_unknownFields = y__}) + defMessage + = StackGraphPath'_constructor + {_StackGraphPath'startingSymbolStack = Data.Vector.Generic.empty, + _StackGraphPath'startingScopeStackSize = Data.ProtoLens.fieldDefault, + _StackGraphPath'from = Data.ProtoLens.fieldDefault, + _StackGraphPath'edges = Data.ProtoLens.fieldDefault, + _StackGraphPath'to = Data.ProtoLens.fieldDefault, + _StackGraphPath'endingScopeStack = Data.Vector.Generic.empty, + _StackGraphPath'endingSymbolStack = Data.Vector.Generic.empty, + _StackGraphPath'_unknownFields = []} + parseMessage + = let + loop :: + StackGraphPath + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Unboxed.Vector Data.ProtoLens.Encoding.Growing.RealWorld Data.Int.Int64 + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Data.Text.Text + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Data.Text.Text + -> Data.ProtoLens.Encoding.Bytes.Parser StackGraphPath + loop + x + mutable'endingScopeStack + mutable'endingSymbolStack + mutable'startingSymbolStack + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'endingScopeStack <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'endingScopeStack) + frozen'endingSymbolStack <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'endingSymbolStack) + frozen'startingSymbolStack <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'startingSymbolStack) + (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields + (\ !t -> Prelude.reverse t) + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'endingScopeStack") + frozen'endingScopeStack + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'endingSymbolStack") + frozen'endingSymbolStack + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'startingSymbolStack") + frozen'startingSymbolStack + x)))) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "starting_symbol_stack" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'startingSymbolStack y) + loop x mutable'endingScopeStack mutable'endingSymbolStack v + 16 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "starting_scope_stack_size" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"startingScopeStackSize") y x) + mutable'endingScopeStack + mutable'endingSymbolStack + mutable'startingSymbolStack + 24 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "from" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"from") y x) + mutable'endingScopeStack + mutable'endingSymbolStack + mutable'startingSymbolStack + 34 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "edges" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"edges") y x) + mutable'endingScopeStack + mutable'endingSymbolStack + mutable'startingSymbolStack + 40 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "to" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"to") y x) + mutable'endingScopeStack + mutable'endingSymbolStack + mutable'startingSymbolStack + 48 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "ending_scope_stack" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'endingScopeStack y) + loop x v mutable'endingSymbolStack mutable'startingSymbolStack + 50 + -> do y <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + ((let + ploop qs + = do packedEnd <- Data.ProtoLens.Encoding.Bytes.atEnd + if packedEnd then + Prelude.return qs + else + do !q <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "ending_scope_stack" + qs' <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + qs q) + ploop qs' + in ploop) + mutable'endingScopeStack) + loop x y mutable'endingSymbolStack mutable'startingSymbolStack + 58 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "ending_symbol_stack" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'endingSymbolStack y) + loop x mutable'endingScopeStack v mutable'startingSymbolStack + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + mutable'endingScopeStack + mutable'endingSymbolStack + mutable'startingSymbolStack + in + (Data.ProtoLens.Encoding.Bytes.) + (do mutable'endingScopeStack <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'endingSymbolStack <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'startingSymbolStack <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop + Data.ProtoLens.defMessage + mutable'endingScopeStack + mutable'endingSymbolStack + mutable'startingSymbolStack) + "StackGraphPath" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + (Lens.Family2.view + (Data.ProtoLens.Field.field @"vec'startingSymbolStack") _x)) + ((Data.Monoid.<>) + (let + _v + = Lens.Family2.view + (Data.ProtoLens.Field.field @"startingScopeStackSize") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 16) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral _v)) + ((Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"from") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 24) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral _v)) + ((Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"edges") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 34) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"to") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 40) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt + Prelude.fromIntegral + _v)) + ((Data.Monoid.<>) + (let + p = Lens.Family2.view + (Data.ProtoLens.Field.field @"vec'endingScopeStack") _x + in + if Data.Vector.Generic.null p then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 50) + ((\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + (Data.ProtoLens.Encoding.Bytes.runBuilder + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt + Prelude.fromIntegral) + p)))) + ((Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 58) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral + (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + (Lens.Family2.view + (Data.ProtoLens.Field.field @"vec'endingSymbolStack") _x)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)))))))) +instance Control.DeepSeq.NFData StackGraphPath where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_StackGraphPath'_unknownFields x__) + (Control.DeepSeq.deepseq + (_StackGraphPath'startingSymbolStack x__) + (Control.DeepSeq.deepseq + (_StackGraphPath'startingScopeStackSize x__) + (Control.DeepSeq.deepseq + (_StackGraphPath'from x__) + (Control.DeepSeq.deepseq + (_StackGraphPath'edges x__) + (Control.DeepSeq.deepseq + (_StackGraphPath'to x__) + (Control.DeepSeq.deepseq + (_StackGraphPath'endingScopeStack x__) + (Control.DeepSeq.deepseq + (_StackGraphPath'endingSymbolStack x__) ()))))))) +{- | Fields : + + * 'Proto.Semantic_Fields.blobs' @:: Lens' StackGraphRequest [Blob]@ + * 'Proto.Semantic_Fields.vec'blobs' @:: Lens' StackGraphRequest (Data.Vector.Vector Blob)@ -} +data StackGraphRequest + = StackGraphRequest'_constructor {_StackGraphRequest'blobs :: !(Data.Vector.Vector Blob), + _StackGraphRequest'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show StackGraphRequest where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField StackGraphRequest "blobs" [Blob] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphRequest'blobs + (\ x__ y__ -> x__ {_StackGraphRequest'blobs = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField StackGraphRequest "vec'blobs" (Data.Vector.Vector Blob) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphRequest'blobs + (\ x__ y__ -> x__ {_StackGraphRequest'blobs = y__})) + Prelude.id +instance Data.ProtoLens.Message StackGraphRequest where + messageName _ = Data.Text.pack "github.semantic.StackGraphRequest" + packedMessageDescriptor _ + = "\n\ + \\DC1StackGraphRequest\DC2+\n\ + \\ENQblobs\CAN\SOH \ETX(\v2\NAK.github.semantic.BlobR\ENQblobs" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + blobs__field_descriptor + = Data.ProtoLens.FieldDescriptor + "blobs" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Blob) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"blobs")) :: + Data.ProtoLens.FieldDescriptor StackGraphRequest + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, blobs__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _StackGraphRequest'_unknownFields + (\ x__ y__ -> x__ {_StackGraphRequest'_unknownFields = y__}) + defMessage + = StackGraphRequest'_constructor + {_StackGraphRequest'blobs = Data.Vector.Generic.empty, + _StackGraphRequest'_unknownFields = []} + parseMessage + = let + loop :: + StackGraphRequest + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Blob + -> Data.ProtoLens.Encoding.Bytes.Parser StackGraphRequest + loop x mutable'blobs + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'blobs <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze mutable'blobs) + (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields + (\ !t -> Prelude.reverse t) + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'blobs") frozen'blobs x)) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + "blobs" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'blobs y) + loop x v + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + mutable'blobs + in + (Data.ProtoLens.Encoding.Bytes.) + (do mutable'blobs <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'blobs) + "StackGraphRequest" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'blobs") _x)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData StackGraphRequest where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_StackGraphRequest'_unknownFields x__) + (Control.DeepSeq.deepseq (_StackGraphRequest'blobs x__) ()) +{- | Fields : + + * 'Proto.Semantic_Fields.files' @:: Lens' StackGraphResponse [StackGraphFile]@ + * 'Proto.Semantic_Fields.vec'files' @:: Lens' StackGraphResponse (Data.Vector.Vector StackGraphFile)@ -} +data StackGraphResponse + = StackGraphResponse'_constructor {_StackGraphResponse'files :: !(Data.Vector.Vector StackGraphFile), + _StackGraphResponse'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show StackGraphResponse where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField StackGraphResponse "files" [StackGraphFile] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphResponse'files + (\ x__ y__ -> x__ {_StackGraphResponse'files = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField StackGraphResponse "vec'files" (Data.Vector.Vector StackGraphFile) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphResponse'files + (\ x__ y__ -> x__ {_StackGraphResponse'files = y__})) + Prelude.id +instance Data.ProtoLens.Message StackGraphResponse where + messageName _ = Data.Text.pack "github.semantic.StackGraphResponse" + packedMessageDescriptor _ + = "\n\ + \\DC2StackGraphResponse\DC25\n\ + \\ENQfiles\CAN\SOH \ETX(\v2\US.github.semantic.StackGraphFileR\ENQfiles" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + files__field_descriptor + = Data.ProtoLens.FieldDescriptor + "files" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor StackGraphFile) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"files")) :: + Data.ProtoLens.FieldDescriptor StackGraphResponse + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _StackGraphResponse'_unknownFields + (\ x__ y__ -> x__ {_StackGraphResponse'_unknownFields = y__}) + defMessage + = StackGraphResponse'_constructor + {_StackGraphResponse'files = Data.Vector.Generic.empty, + _StackGraphResponse'_unknownFields = []} + parseMessage + = let + loop :: + StackGraphResponse + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld StackGraphFile + -> Data.ProtoLens.Encoding.Bytes.Parser StackGraphResponse + loop x mutable'files + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze mutable'files) + (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields + (\ !t -> Prelude.reverse t) + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'files") frozen'files x)) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do !y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + "files" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'files y) + loop x v + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + mutable'files + in + (Data.ProtoLens.Encoding.Bytes.) + (do mutable'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'files) + "StackGraphResponse" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'files") _x)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData StackGraphResponse where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_StackGraphResponse'_unknownFields x__) + (Control.DeepSeq.deepseq (_StackGraphResponse'files x__) ()) +{- | Fields : + + * 'Proto.Semantic_Fields.symbol' @:: Lens' Symbol Data.Text.Text@ + * 'Proto.Semantic_Fields.kind' @:: Lens' Symbol Data.Text.Text@ + * 'Proto.Semantic_Fields.line' @:: Lens' Symbol Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' Symbol Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' Symbol (Prelude.Maybe Span)@ + * 'Proto.Semantic_Fields.docs' @:: Lens' Symbol Docstring@ + * 'Proto.Semantic_Fields.maybe'docs' @:: Lens' Symbol (Prelude.Maybe Docstring)@ + * 'Proto.Semantic_Fields.nodeType' @:: Lens' Symbol NodeType@ + * 'Proto.Semantic_Fields.syntaxType' @:: Lens' Symbol SyntaxType@ + * 'Proto.Semantic_Fields.utf16CodeUnitSpan' @:: Lens' Symbol Span@ + * 'Proto.Semantic_Fields.maybe'utf16CodeUnitSpan' @:: Lens' Symbol (Prelude.Maybe Span)@ + * 'Proto.Semantic_Fields.byteRange' @:: Lens' Symbol ByteRange@ + * 'Proto.Semantic_Fields.maybe'byteRange' @:: Lens' Symbol (Prelude.Maybe ByteRange)@ -} +data Symbol + = Symbol'_constructor {_Symbol'symbol :: !Data.Text.Text, + _Symbol'kind :: !Data.Text.Text, + _Symbol'line :: !Data.Text.Text, + _Symbol'span :: !(Prelude.Maybe Span), + _Symbol'docs :: !(Prelude.Maybe Docstring), + _Symbol'nodeType :: !NodeType, + _Symbol'syntaxType :: !SyntaxType, + _Symbol'utf16CodeUnitSpan :: !(Prelude.Maybe Span), + _Symbol'byteRange :: !(Prelude.Maybe ByteRange), + _Symbol'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving stock (Prelude.Eq, Prelude.Ord) +instance Prelude.Show Symbol where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField Symbol "symbol" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'symbol (\ x__ y__ -> x__ {_Symbol'symbol = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "kind" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'kind (\ x__ y__ -> x__ {_Symbol'kind = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "line" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'line (\ x__ y__ -> x__ {_Symbol'line = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "span" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'span (\ x__ y__ -> x__ {_Symbol'span = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField Symbol "maybe'span" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'span (\ x__ y__ -> x__ {_Symbol'span = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "docs" Docstring where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'docs (\ x__ y__ -> x__ {_Symbol'docs = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField Symbol "maybe'docs" (Prelude.Maybe Docstring) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'docs (\ x__ y__ -> x__ {_Symbol'docs = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "nodeType" NodeType where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'nodeType (\ x__ y__ -> x__ {_Symbol'nodeType = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "syntaxType" SyntaxType where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'syntaxType (\ x__ y__ -> x__ {_Symbol'syntaxType = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "utf16CodeUnitSpan" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'utf16CodeUnitSpan + (\ x__ y__ -> x__ {_Symbol'utf16CodeUnitSpan = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField Symbol "maybe'utf16CodeUnitSpan" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'utf16CodeUnitSpan + (\ x__ y__ -> x__ {_Symbol'utf16CodeUnitSpan = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "byteRange" ByteRange where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'byteRange (\ x__ y__ -> x__ {_Symbol'byteRange = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField Symbol "maybe'byteRange" (Prelude.Maybe ByteRange) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _Symbol'byteRange (\ x__ y__ -> x__ {_Symbol'byteRange = y__})) + Prelude.id +instance Data.ProtoLens.Message Symbol where + messageName _ = Data.Text.pack "github.semantic.Symbol" + packedMessageDescriptor _ + = "\n\ + \\ACKSymbol\DC2\SYN\n\ + \\ACKsymbol\CAN\SOH \SOH(\tR\ACKsymbol\DC2\DC2\n\ + \\EOTkind\CAN\STX \SOH(\tR\EOTkind\DC2\DC2\n\ + \\EOTline\CAN\ETX \SOH(\tR\EOTline\DC2)\n\ + \\EOTspan\CAN\EOT \SOH(\v2\NAK.github.semantic.SpanR\EOTspan\DC2.\n\ + \\EOTdocs\CAN\ENQ \SOH(\v2\SUB.github.semantic.DocstringR\EOTdocs\DC26\n\ + \\tnode_type\CAN\ACK \SOH(\SO2\EM.github.semantic.NodeTypeR\bnodeType\DC2<\n\ + \\vsyntax_type\CAN\a \SOH(\SO2\ESC.github.semantic.SyntaxTypeR\n\ + \syntaxType\DC2F\n\ + \\DC4utf16_code_unit_span\CAN\b \SOH(\v2\NAK.github.semantic.SpanR\DC1utf16CodeUnitSpan\DC29\n\ + \\n\ + \byte_range\CAN\t \SOH(\v2\SUB.github.semantic.ByteRangeR\tbyteRange" + packedFileDescriptor _ = packedFileDescriptor + fieldsByTag + = let + symbol__field_descriptor + = Data.ProtoLens.FieldDescriptor + "symbol" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"symbol")) :: + Data.ProtoLens.FieldDescriptor Symbol + kind__field_descriptor + = Data.ProtoLens.FieldDescriptor + "kind" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"kind")) :: + Data.ProtoLens.FieldDescriptor Symbol + line__field_descriptor + = Data.ProtoLens.FieldDescriptor + "line" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"line")) :: + Data.ProtoLens.FieldDescriptor Symbol + span__field_descriptor + = Data.ProtoLens.FieldDescriptor + "span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'span")) :: + Data.ProtoLens.FieldDescriptor Symbol + docs__field_descriptor + = Data.ProtoLens.FieldDescriptor + "docs" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Docstring) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'docs")) :: + Data.ProtoLens.FieldDescriptor Symbol + nodeType__field_descriptor + = Data.ProtoLens.FieldDescriptor + "node_type" + (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField :: + Data.ProtoLens.FieldTypeDescriptor NodeType) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"nodeType")) :: + Data.ProtoLens.FieldDescriptor Symbol + syntaxType__field_descriptor + = Data.ProtoLens.FieldDescriptor + "syntax_type" + (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField :: + Data.ProtoLens.FieldTypeDescriptor SyntaxType) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"syntaxType")) :: + Data.ProtoLens.FieldDescriptor Symbol + utf16CodeUnitSpan__field_descriptor + = Data.ProtoLens.FieldDescriptor + "utf16_code_unit_span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'utf16CodeUnitSpan")) :: + Data.ProtoLens.FieldDescriptor Symbol + byteRange__field_descriptor + = Data.ProtoLens.FieldDescriptor + "byte_range" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor ByteRange) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'byteRange")) :: + Data.ProtoLens.FieldDescriptor Symbol + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, symbol__field_descriptor), + (Data.ProtoLens.Tag 2, kind__field_descriptor), + (Data.ProtoLens.Tag 3, line__field_descriptor), + (Data.ProtoLens.Tag 4, span__field_descriptor), + (Data.ProtoLens.Tag 5, docs__field_descriptor), + (Data.ProtoLens.Tag 6, nodeType__field_descriptor), + (Data.ProtoLens.Tag 7, syntaxType__field_descriptor), + (Data.ProtoLens.Tag 8, utf16CodeUnitSpan__field_descriptor), + (Data.ProtoLens.Tag 9, byteRange__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _Symbol'_unknownFields + (\ x__ y__ -> x__ {_Symbol'_unknownFields = y__}) + defMessage + = Symbol'_constructor + {_Symbol'symbol = Data.ProtoLens.fieldDefault, + _Symbol'kind = Data.ProtoLens.fieldDefault, + _Symbol'line = Data.ProtoLens.fieldDefault, + _Symbol'span = Prelude.Nothing, _Symbol'docs = Prelude.Nothing, + _Symbol'nodeType = Data.ProtoLens.fieldDefault, + _Symbol'syntaxType = Data.ProtoLens.fieldDefault, + _Symbol'utf16CodeUnitSpan = Prelude.Nothing, + _Symbol'byteRange = Prelude.Nothing, _Symbol'_unknownFields = []} + parseMessage + = let + loop :: Symbol -> Data.ProtoLens.Encoding.Bytes.Parser Symbol + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () + else + Prelude.fail + ((Prelude.++) + "Missing required fields: " + (Prelude.show (missing :: [Prelude.String])))) + Prelude.return + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x) + else + do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt + case tag of + 10 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "symbol" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"symbol") y x) + 18 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "kind" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"kind") y x) + 26 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.getBytes + (Prelude.fromIntegral len) + Data.ProtoLens.Encoding.Bytes.runEither + (case Data.Text.Encoding.decodeUtf8' value of + (Prelude.Left err) + -> Prelude.Left (Prelude.show err) + (Prelude.Right r) -> Prelude.Right r)) + "line" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"line") y x) + 34 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) Data.ProtoLens.parseMessage) + "span" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y x) + 42 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) Data.ProtoLens.parseMessage) + "docs" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"docs") y x) + 48 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.toEnum + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt)) + "node_type" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"nodeType") y x) + 56 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.toEnum + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt)) + "syntax_type" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"syntaxType") y x) + 66 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) Data.ProtoLens.parseMessage) + "utf16_code_unit_span" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"utf16CodeUnitSpan") y x) + 74 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) Data.ProtoLens.parseMessage) + "byte_range" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"byteRange") y x) + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + in + (Data.ProtoLens.Encoding.Bytes.) + (do loop Data.ProtoLens.defMessage) "Symbol" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"symbol") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 10) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"kind") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 18) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"line") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 26) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'span") _x + of + Prelude.Nothing -> Data.Monoid.mempty + (Prelude.Just _v) + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 34) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + ((Data.Monoid.<>) + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'docs") _x + of + Prelude.Nothing -> Data.Monoid.mempty + (Prelude.Just _v) + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 42) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + ((Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"nodeType") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 48) + ((Prelude..) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt + Prelude.fromIntegral) + Prelude.fromEnum + _v)) + ((Data.Monoid.<>) + (let + _v + = Lens.Family2.view + (Data.ProtoLens.Field.field @"syntaxType") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 56) + ((Prelude..) + ((Prelude..) + Data.ProtoLens.Encoding.Bytes.putVarInt + Prelude.fromIntegral) + Prelude.fromEnum + _v)) + ((Data.Monoid.<>) + (case + Lens.Family2.view + (Data.ProtoLens.Field.field @"maybe'utf16CodeUnitSpan") _x + of + Prelude.Nothing -> Data.Monoid.mempty + (Prelude.Just _v) + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 66) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral + (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + ((Data.Monoid.<>) + (case + Lens.Family2.view + (Data.ProtoLens.Field.field @"maybe'byteRange") _x + of + Prelude.Nothing -> Data.Monoid.mempty + (Prelude.Just _v) + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 74) + ((Prelude..) + (\ bs + -> (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt + (Prelude.fromIntegral + (Data.ByteString.length bs))) + (Data.ProtoLens.Encoding.Bytes.putBytes + bs)) + Data.ProtoLens.encodeMessage + _v)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)))))))))) +instance Control.DeepSeq.NFData Symbol where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_Symbol'_unknownFields x__) + (Control.DeepSeq.deepseq + (_Symbol'symbol x__) + (Control.DeepSeq.deepseq + (_Symbol'kind x__) + (Control.DeepSeq.deepseq + (_Symbol'line x__) + (Control.DeepSeq.deepseq + (_Symbol'span x__) + (Control.DeepSeq.deepseq + (_Symbol'docs x__) + (Control.DeepSeq.deepseq + (_Symbol'nodeType x__) + (Control.DeepSeq.deepseq + (_Symbol'syntaxType x__) + (Control.DeepSeq.deepseq + (_Symbol'utf16CodeUnitSpan x__) + (Control.DeepSeq.deepseq (_Symbol'byteRange x__) ()))))))))) +newtype SyntaxType'UnrecognizedValue + = SyntaxType'UnrecognizedValue Data.Int.Int32 + deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show) +data SyntaxType + = FUNCTION | + METHOD | + CLASS | + MODULE | + CALL | + TYPE | + INTERFACE | + IMPLEMENTATION | + SyntaxType'Unrecognized !SyntaxType'UnrecognizedValue + deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord) +instance Data.ProtoLens.MessageEnum SyntaxType where + maybeToEnum 0 = Prelude.Just FUNCTION + maybeToEnum 1 = Prelude.Just METHOD + maybeToEnum 2 = Prelude.Just CLASS + maybeToEnum 3 = Prelude.Just MODULE + maybeToEnum 4 = Prelude.Just CALL + maybeToEnum 5 = Prelude.Just TYPE + maybeToEnum 6 = Prelude.Just INTERFACE + maybeToEnum 7 = Prelude.Just IMPLEMENTATION + maybeToEnum k + = Prelude.Just + (SyntaxType'Unrecognized + (SyntaxType'UnrecognizedValue (Prelude.fromIntegral k))) + showEnum FUNCTION = "FUNCTION" + showEnum METHOD = "METHOD" + showEnum CLASS = "CLASS" + showEnum MODULE = "MODULE" + showEnum CALL = "CALL" + showEnum TYPE = "TYPE" + showEnum INTERFACE = "INTERFACE" + showEnum IMPLEMENTATION = "IMPLEMENTATION" + showEnum (SyntaxType'Unrecognized (SyntaxType'UnrecognizedValue k)) + = Prelude.show k + readEnum k + | (Prelude.==) k "FUNCTION" = Prelude.Just FUNCTION + | (Prelude.==) k "METHOD" = Prelude.Just METHOD + | (Prelude.==) k "CLASS" = Prelude.Just CLASS + | (Prelude.==) k "MODULE" = Prelude.Just MODULE + | (Prelude.==) k "CALL" = Prelude.Just CALL + | (Prelude.==) k "TYPE" = Prelude.Just TYPE + | (Prelude.==) k "INTERFACE" = Prelude.Just INTERFACE + | (Prelude.==) k "IMPLEMENTATION" = Prelude.Just IMPLEMENTATION + | Prelude.otherwise + = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum +instance Prelude.Bounded SyntaxType where + minBound = FUNCTION + maxBound = IMPLEMENTATION +instance Prelude.Enum SyntaxType where + toEnum k__ + = Prelude.maybe + (Prelude.error + ((Prelude.++) + "toEnum: unknown value for enum SyntaxType: " (Prelude.show k__))) + Prelude.id + (Data.ProtoLens.maybeToEnum k__) + fromEnum FUNCTION = 0 + fromEnum METHOD = 1 + fromEnum CLASS = 2 + fromEnum MODULE = 3 + fromEnum CALL = 4 + fromEnum TYPE = 5 + fromEnum INTERFACE = 6 + fromEnum IMPLEMENTATION = 7 + fromEnum (SyntaxType'Unrecognized (SyntaxType'UnrecognizedValue k)) + = Prelude.fromIntegral k + succ IMPLEMENTATION + = Prelude.error + "SyntaxType.succ: bad argument IMPLEMENTATION. This value would be out of bounds." + succ FUNCTION = METHOD + succ METHOD = CLASS + succ CLASS = MODULE + succ MODULE = CALL + succ CALL = TYPE + succ TYPE = INTERFACE + succ INTERFACE = IMPLEMENTATION + succ (SyntaxType'Unrecognized _) + = Prelude.error "SyntaxType.succ: bad argument: unrecognized value" + pred FUNCTION + = Prelude.error + "SyntaxType.pred: bad argument FUNCTION. This value would be out of bounds." + pred METHOD = FUNCTION + pred CLASS = METHOD + pred MODULE = CLASS + pred CALL = MODULE + pred TYPE = CALL + pred INTERFACE = TYPE + pred IMPLEMENTATION = INTERFACE + pred (SyntaxType'Unrecognized _) + = Prelude.error "SyntaxType.pred: bad argument: unrecognized value" + enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom + enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo + enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen + enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo +instance Data.ProtoLens.FieldDefault SyntaxType where + fieldDefault = FUNCTION +instance Control.DeepSeq.NFData SyntaxType where + rnf x__ = Prelude.seq x__ () +packedFileDescriptor :: Data.ByteString.ByteString +packedFileDescriptor + = "\n\ + \\SOsemantic.proto\DC2\SIgithub.semantic\"'\n\ + \\vPingRequest\DC2\CAN\n\ + \\aservice\CAN\SOH \SOH(\tR\aservice\"r\n\ + \\fPingResponse\DC2\SYN\n\ + \\ACKstatus\CAN\SOH \SOH(\tR\ACKstatus\DC2\SUB\n\ + \\bhostname\CAN\STX \SOH(\tR\bhostname\DC2\FS\n\ + \\ttimestamp\CAN\ETX \SOH(\tR\ttimestamp\DC2\DLE\n\ + \\ETXsha\CAN\EOT \SOH(\tR\ETXsha\"?\n\ + \\DLEParseTreeRequest\DC2+\n\ + \\ENQblobs\CAN\SOH \ETX(\v2\NAK.github.semantic.BlobR\ENQblobs\"F\n\ + \\ETBParseTreeSymbolResponse\DC2+\n\ + \\ENQfiles\CAN\SOH \ETX(\v2\NAK.github.semantic.FileR\ENQfiles\"@\n\ + \\DC1StackGraphRequest\DC2+\n\ + \\ENQblobs\CAN\SOH \ETX(\v2\NAK.github.semantic.BlobR\ENQblobs\"K\n\ + \\DC2StackGraphResponse\DC25\n\ + \\ENQfiles\CAN\SOH \ETX(\v2\US.github.semantic.StackGraphFileR\ENQfiles\"\"\n\ + \\n\ + \ParseError\DC2\DC4\n\ + \\ENQerror\CAN\SOH \SOH(\tR\ENQerror\"P\n\ + \\EOTBlob\DC2\CAN\n\ + \\acontent\CAN\SOH \SOH(\tR\acontent\DC2\DC2\n\ + \\EOTpath\CAN\STX \SOH(\tR\EOTpath\DC2\SUB\n\ + \\blanguage\CAN\ETX \SOH(\tR\blanguage\"\185\SOH\n\ + \\EOTFile\DC2\DC2\n\ + \\EOTpath\CAN\SOH \SOH(\tR\EOTpath\DC2\SUB\n\ + \\blanguage\CAN\STX \SOH(\tR\blanguage\DC21\n\ + \\asymbols\CAN\ETX \ETX(\v2\ETB.github.semantic.SymbolR\asymbols\DC23\n\ + \\ACKerrors\CAN\EOT \ETX(\v2\ESC.github.semantic.ParseErrorR\ACKerrors\DC2\EM\n\ + \\bblob_oid\CAN\ENQ \SOH(\tR\ablobOid\"\156\ETX\n\ + \\ACKSymbol\DC2\SYN\n\ + \\ACKsymbol\CAN\SOH \SOH(\tR\ACKsymbol\DC2\DC2\n\ + \\EOTkind\CAN\STX \SOH(\tR\EOTkind\DC2\DC2\n\ + \\EOTline\CAN\ETX \SOH(\tR\EOTline\DC2)\n\ + \\EOTspan\CAN\EOT \SOH(\v2\NAK.github.semantic.SpanR\EOTspan\DC2.\n\ + \\EOTdocs\CAN\ENQ \SOH(\v2\SUB.github.semantic.DocstringR\EOTdocs\DC26\n\ + \\tnode_type\CAN\ACK \SOH(\SO2\EM.github.semantic.NodeTypeR\bnodeType\DC2<\n\ + \\vsyntax_type\CAN\a \SOH(\SO2\ESC.github.semantic.SyntaxTypeR\n\ + \syntaxType\DC2F\n\ + \\DC4utf16_code_unit_span\CAN\b \SOH(\v2\NAK.github.semantic.SpanR\DC1utf16CodeUnitSpan\DC29\n\ + \\n\ + \byte_range\CAN\t \SOH(\v2\SUB.github.semantic.ByteRangeR\tbyteRange\")\n\ + \\tDocstring\DC2\FS\n\ + \\tdocstring\CAN\SOH \SOH(\tR\tdocstring\"6\n\ + \\bPosition\DC2\DC2\n\ + \\EOTline\CAN\SOH \SOH(\ENQR\EOTline\DC2\SYN\n\ + \\ACKcolumn\CAN\STX \SOH(\ENQR\ACKcolumn\"d\n\ + \\EOTSpan\DC2/\n\ + \\ENQstart\CAN\SOH \SOH(\v2\EM.github.semantic.PositionR\ENQstart\DC2+\n\ + \\ETXend\CAN\STX \SOH(\v2\EM.github.semantic.PositionR\ETXend\"3\n\ + \\tByteRange\DC2\DC4\n\ + \\ENQstart\CAN\SOH \SOH(\ENQR\ENQstart\DC2\DLE\n\ + \\ETXend\CAN\STX \SOH(\ENQR\ETXend\"\227\SOH\n\ + \\SOStackGraphFile\DC2\DC2\n\ + \\EOTpath\CAN\SOH \SOH(\tR\EOTpath\DC2\SUB\n\ + \\blanguage\CAN\STX \SOH(\tR\blanguage\DC25\n\ + \\ENQnodes\CAN\ETX \ETX(\v2\US.github.semantic.StackGraphNodeR\ENQnodes\DC25\n\ + \\ENQpaths\CAN\EOT \ETX(\v2\US.github.semantic.StackGraphPathR\ENQpaths\DC23\n\ + \\ACKerrors\CAN\ENQ \ETX(\v2\ESC.github.semantic.ParseErrorR\ACKerrors\"\233\SOH\n\ + \\SOStackGraphNode\DC2\SO\n\ + \\STXid\CAN\SOH \SOH(\ETXR\STXid\DC2\DC2\n\ + \\EOTname\CAN\STX \SOH(\tR\EOTname\DC2\DC2\n\ + \\EOTline\CAN\ETX \SOH(\tR\EOTline\DC2)\n\ + \\EOTspan\CAN\EOT \SOH(\v2\NAK.github.semantic.SpanR\EOTspan\DC2<\n\ + \\vsyntax_type\CAN\ENQ \SOH(\SO2\ESC.github.semantic.SyntaxTypeR\n\ + \syntaxType\DC26\n\ + \\tnode_type\CAN\ACK \SOH(\SO2\EM.github.semantic.NodeTypeR\bnodeType\"\151\STX\n\ + \\SOStackGraphPath\DC22\n\ + \\NAKstarting_symbol_stack\CAN\SOH \ETX(\tR\DC3startingSymbolStack\DC29\n\ + \\EMstarting_scope_stack_size\CAN\STX \SOH(\ETXR\SYNstartingScopeStackSize\DC2\DC2\n\ + \\EOTfrom\CAN\ETX \SOH(\ETXR\EOTfrom\DC2\DC4\n\ + \\ENQedges\CAN\EOT \SOH(\tR\ENQedges\DC2\SO\n\ + \\STXto\CAN\ENQ \SOH(\ETXR\STXto\DC2,\n\ + \\DC2ending_scope_stack\CAN\ACK \ETX(\ETXR\DLEendingScopeStack\DC2.\n\ + \\DC3ending_symbol_stack\CAN\a \ETX(\tR\DC1endingSymbolStack*`\n\ + \\bNodeType\DC2\SO\n\ + \\n\ + \ROOT_SCOPE\DLE\NUL\DC2\DC1\n\ + \\rJUMP_TO_SCOPE\DLE\SOH\DC2\DC2\n\ + \\SOEXPORTED_SCOPE\DLE\STX\DC2\SO\n\ + \\n\ + \DEFINITION\DLE\ETX\DC2\r\n\ + \\tREFERENCE\DLE\EOT*t\n\ + \\n\ + \SyntaxType\DC2\f\n\ + \\bFUNCTION\DLE\NUL\DC2\n\ + \\n\ + \\ACKMETHOD\DLE\SOH\DC2\t\n\ + \\ENQCLASS\DLE\STX\DC2\n\ + \\n\ + \\ACKMODULE\DLE\ETX\DC2\b\n\ + \\EOTCALL\DLE\EOT\DC2\b\n\ + \\EOTTYPE\DLE\ENQ\DC2\r\n\ + \\tINTERFACE\DLE\ACK\DC2\DC2\n\ + \\SOIMPLEMENTATION\DLE\aB\DC2\234\STX\SISemantic::ProtoJ\186$\n\ + \\ACK\DC2\EOT\NUL\NUL~\SOH\n\ + \\b\n\ + \\SOH\f\DC2\ETX\NUL\NUL\DC2\n\ + \\b\n\ + \\SOH\STX\DC2\ETX\STX\NUL\CAN\n\ + \\b\n\ + \\SOH\b\DC2\ETX\EOT\NUL(\n\ + \\t\n\ + \\STX\b-\DC2\ETX\EOT\NUL(\n\ + \\n\ + \\n\ + \\STX\EOT\NUL\DC2\EOT\ACK\NUL\b\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\NUL\SOH\DC2\ETX\ACK\b\DC3\n\ + \\v\n\ + \\EOT\EOT\NUL\STX\NUL\DC2\ETX\a\STX\NAK\n\ + \\r\n\ + \\ENQ\EOT\NUL\STX\NUL\EOT\DC2\EOT\a\STX\ACK\NAK\n\ + \\f\n\ + \\ENQ\EOT\NUL\STX\NUL\ENQ\DC2\ETX\a\STX\b\n\ + \\f\n\ + \\ENQ\EOT\NUL\STX\NUL\SOH\DC2\ETX\a\t\DLE\n\ + \\f\n\ + \\ENQ\EOT\NUL\STX\NUL\ETX\DC2\ETX\a\DC3\DC4\n\ + \\n\ + \\n\ + \\STX\EOT\SOH\DC2\EOT\n\ + \\NUL\SI\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\SOH\SOH\DC2\ETX\n\ + \\b\DC4\n\ + \\v\n\ + \\EOT\EOT\SOH\STX\NUL\DC2\ETX\v\STX\DC4\n\ + \\r\n\ + \\ENQ\EOT\SOH\STX\NUL\EOT\DC2\EOT\v\STX\n\ + \\SYN\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\NUL\ENQ\DC2\ETX\v\STX\b\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\NUL\SOH\DC2\ETX\v\t\SI\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\NUL\ETX\DC2\ETX\v\DC2\DC3\n\ + \\v\n\ + \\EOT\EOT\SOH\STX\SOH\DC2\ETX\f\STX\SYN\n\ + \\r\n\ + \\ENQ\EOT\SOH\STX\SOH\EOT\DC2\EOT\f\STX\v\DC4\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\SOH\ENQ\DC2\ETX\f\STX\b\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\SOH\SOH\DC2\ETX\f\t\DC1\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\SOH\ETX\DC2\ETX\f\DC4\NAK\n\ + \\v\n\ + \\EOT\EOT\SOH\STX\STX\DC2\ETX\r\STX\ETB\n\ + \\r\n\ + \\ENQ\EOT\SOH\STX\STX\EOT\DC2\EOT\r\STX\f\SYN\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\STX\ENQ\DC2\ETX\r\STX\b\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\STX\SOH\DC2\ETX\r\t\DC2\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\STX\ETX\DC2\ETX\r\NAK\SYN\n\ + \\v\n\ + \\EOT\EOT\SOH\STX\ETX\DC2\ETX\SO\STX\DC1\n\ + \\r\n\ + \\ENQ\EOT\SOH\STX\ETX\EOT\DC2\EOT\SO\STX\r\ETB\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\ETX\ENQ\DC2\ETX\SO\STX\b\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\ETX\SOH\DC2\ETX\SO\t\f\n\ + \\f\n\ + \\ENQ\EOT\SOH\STX\ETX\ETX\DC2\ETX\SO\SI\DLE\n\ + \\n\ + \\n\ + \\STX\EOT\STX\DC2\EOT\DC1\NUL\DC3\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\STX\SOH\DC2\ETX\DC1\b\CAN\n\ + \\v\n\ + \\EOT\EOT\STX\STX\NUL\DC2\ETX\DC2\STX\SUB\n\ + \\f\n\ + \\ENQ\EOT\STX\STX\NUL\EOT\DC2\ETX\DC2\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\STX\STX\NUL\ACK\DC2\ETX\DC2\v\SI\n\ + \\f\n\ + \\ENQ\EOT\STX\STX\NUL\SOH\DC2\ETX\DC2\DLE\NAK\n\ + \\f\n\ + \\ENQ\EOT\STX\STX\NUL\ETX\DC2\ETX\DC2\CAN\EM\n\ + \\n\ + \\n\ + \\STX\EOT\ETX\DC2\EOT\NAK\NUL\ETB\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\ETX\SOH\DC2\ETX\NAK\b\US\n\ + \\v\n\ + \\EOT\EOT\ETX\STX\NUL\DC2\ETX\SYN\STX\SUB\n\ + \\f\n\ + \\ENQ\EOT\ETX\STX\NUL\EOT\DC2\ETX\SYN\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\ETX\STX\NUL\ACK\DC2\ETX\SYN\v\SI\n\ + \\f\n\ + \\ENQ\EOT\ETX\STX\NUL\SOH\DC2\ETX\SYN\DLE\NAK\n\ + \\f\n\ + \\ENQ\EOT\ETX\STX\NUL\ETX\DC2\ETX\SYN\CAN\EM\n\ + \\n\ + \\n\ + \\STX\EOT\EOT\DC2\EOT\EM\NUL\ESC\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\EOT\SOH\DC2\ETX\EM\b\EM\n\ + \\v\n\ + \\EOT\EOT\EOT\STX\NUL\DC2\ETX\SUB\STX\SUB\n\ + \\f\n\ + \\ENQ\EOT\EOT\STX\NUL\EOT\DC2\ETX\SUB\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\EOT\STX\NUL\ACK\DC2\ETX\SUB\v\SI\n\ + \\f\n\ + \\ENQ\EOT\EOT\STX\NUL\SOH\DC2\ETX\SUB\DLE\NAK\n\ + \\f\n\ + \\ENQ\EOT\EOT\STX\NUL\ETX\DC2\ETX\SUB\CAN\EM\n\ + \\n\ + \\n\ + \\STX\EOT\ENQ\DC2\EOT\GS\NUL\US\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\ENQ\SOH\DC2\ETX\GS\b\SUB\n\ + \\v\n\ + \\EOT\EOT\ENQ\STX\NUL\DC2\ETX\RS\STX$\n\ + \\f\n\ + \\ENQ\EOT\ENQ\STX\NUL\EOT\DC2\ETX\RS\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\ENQ\STX\NUL\ACK\DC2\ETX\RS\v\EM\n\ + \\f\n\ + \\ENQ\EOT\ENQ\STX\NUL\SOH\DC2\ETX\RS\SUB\US\n\ + \\f\n\ + \\ENQ\EOT\ENQ\STX\NUL\ETX\DC2\ETX\RS\"#\n\ + \\n\ + \\n\ + \\STX\EOT\ACK\DC2\EOT!\NUL#\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\ACK\SOH\DC2\ETX!\b\DC2\n\ + \\v\n\ + \\EOT\EOT\ACK\STX\NUL\DC2\ETX\"\STX\DC3\n\ + \\r\n\ + \\ENQ\EOT\ACK\STX\NUL\EOT\DC2\EOT\"\STX!\DC4\n\ + \\f\n\ + \\ENQ\EOT\ACK\STX\NUL\ENQ\DC2\ETX\"\STX\b\n\ + \\f\n\ + \\ENQ\EOT\ACK\STX\NUL\SOH\DC2\ETX\"\t\SO\n\ + \\f\n\ + \\ENQ\EOT\ACK\STX\NUL\ETX\DC2\ETX\"\DC1\DC2\n\ + \\n\ + \\n\ + \\STX\EOT\a\DC2\EOT%\NUL)\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\a\SOH\DC2\ETX%\b\f\n\ + \\v\n\ + \\EOT\EOT\a\STX\NUL\DC2\ETX&\STX\NAK\n\ + \\r\n\ + \\ENQ\EOT\a\STX\NUL\EOT\DC2\EOT&\STX%\SO\n\ + \\f\n\ + \\ENQ\EOT\a\STX\NUL\ENQ\DC2\ETX&\STX\b\n\ + \\f\n\ + \\ENQ\EOT\a\STX\NUL\SOH\DC2\ETX&\t\DLE\n\ + \\f\n\ + \\ENQ\EOT\a\STX\NUL\ETX\DC2\ETX&\DC3\DC4\n\ + \\v\n\ + \\EOT\EOT\a\STX\SOH\DC2\ETX'\STX\DC2\n\ + \\r\n\ + \\ENQ\EOT\a\STX\SOH\EOT\DC2\EOT'\STX&\NAK\n\ + \\f\n\ + \\ENQ\EOT\a\STX\SOH\ENQ\DC2\ETX'\STX\b\n\ + \\f\n\ + \\ENQ\EOT\a\STX\SOH\SOH\DC2\ETX'\t\r\n\ + \\f\n\ + \\ENQ\EOT\a\STX\SOH\ETX\DC2\ETX'\DLE\DC1\n\ + \\v\n\ + \\EOT\EOT\a\STX\STX\DC2\ETX(\STX\SYN\n\ + \\r\n\ + \\ENQ\EOT\a\STX\STX\EOT\DC2\EOT(\STX'\DC2\n\ + \\f\n\ + \\ENQ\EOT\a\STX\STX\ENQ\DC2\ETX(\STX\b\n\ + \\f\n\ + \\ENQ\EOT\a\STX\STX\SOH\DC2\ETX(\t\DC1\n\ + \\f\n\ + \\ENQ\EOT\a\STX\STX\ETX\DC2\ETX(\DC4\NAK\n\ + \\n\ + \\n\ + \\STX\EOT\b\DC2\EOT+\NUL1\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\b\SOH\DC2\ETX+\b\f\n\ + \\v\n\ + \\EOT\EOT\b\STX\NUL\DC2\ETX,\STX\DC2\n\ + \\r\n\ + \\ENQ\EOT\b\STX\NUL\EOT\DC2\EOT,\STX+\SO\n\ + \\f\n\ + \\ENQ\EOT\b\STX\NUL\ENQ\DC2\ETX,\STX\b\n\ + \\f\n\ + \\ENQ\EOT\b\STX\NUL\SOH\DC2\ETX,\t\r\n\ + \\f\n\ + \\ENQ\EOT\b\STX\NUL\ETX\DC2\ETX,\DLE\DC1\n\ + \\v\n\ + \\EOT\EOT\b\STX\SOH\DC2\ETX-\STX\SYN\n\ + \\r\n\ + \\ENQ\EOT\b\STX\SOH\EOT\DC2\EOT-\STX,\DC2\n\ + \\f\n\ + \\ENQ\EOT\b\STX\SOH\ENQ\DC2\ETX-\STX\b\n\ + \\f\n\ + \\ENQ\EOT\b\STX\SOH\SOH\DC2\ETX-\t\DC1\n\ + \\f\n\ + \\ENQ\EOT\b\STX\SOH\ETX\DC2\ETX-\DC4\NAK\n\ + \\v\n\ + \\EOT\EOT\b\STX\STX\DC2\ETX.\STX\RS\n\ + \\f\n\ + \\ENQ\EOT\b\STX\STX\EOT\DC2\ETX.\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\b\STX\STX\ACK\DC2\ETX.\v\DC1\n\ + \\f\n\ + \\ENQ\EOT\b\STX\STX\SOH\DC2\ETX.\DC2\EM\n\ + \\f\n\ + \\ENQ\EOT\b\STX\STX\ETX\DC2\ETX.\FS\GS\n\ + \\v\n\ + \\EOT\EOT\b\STX\ETX\DC2\ETX/\STX!\n\ + \\f\n\ + \\ENQ\EOT\b\STX\ETX\EOT\DC2\ETX/\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\b\STX\ETX\ACK\DC2\ETX/\v\NAK\n\ + \\f\n\ + \\ENQ\EOT\b\STX\ETX\SOH\DC2\ETX/\SYN\FS\n\ + \\f\n\ + \\ENQ\EOT\b\STX\ETX\ETX\DC2\ETX/\US \n\ + \\v\n\ + \\EOT\EOT\b\STX\EOT\DC2\ETX0\STX\SYN\n\ + \\r\n\ + \\ENQ\EOT\b\STX\EOT\EOT\DC2\EOT0\STX/!\n\ + \\f\n\ + \\ENQ\EOT\b\STX\EOT\ENQ\DC2\ETX0\STX\b\n\ + \\f\n\ + \\ENQ\EOT\b\STX\EOT\SOH\DC2\ETX0\t\DC1\n\ + \\f\n\ + \\ENQ\EOT\b\STX\EOT\ETX\DC2\ETX0\DC4\NAK\n\ + \\n\ + \\n\ + \\STX\EOT\t\DC2\EOT3\NUL=\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\t\SOH\DC2\ETX3\b\SO\n\ + \\v\n\ + \\EOT\EOT\t\STX\NUL\DC2\ETX4\STX\DC4\n\ + \\r\n\ + \\ENQ\EOT\t\STX\NUL\EOT\DC2\EOT4\STX3\DLE\n\ + \\f\n\ + \\ENQ\EOT\t\STX\NUL\ENQ\DC2\ETX4\STX\b\n\ + \\f\n\ + \\ENQ\EOT\t\STX\NUL\SOH\DC2\ETX4\t\SI\n\ + \\f\n\ + \\ENQ\EOT\t\STX\NUL\ETX\DC2\ETX4\DC2\DC3\n\ + \\v\n\ + \\EOT\EOT\t\STX\SOH\DC2\ETX5\STX\DC2\n\ + \\r\n\ + \\ENQ\EOT\t\STX\SOH\EOT\DC2\EOT5\STX4\DC4\n\ + \\f\n\ + \\ENQ\EOT\t\STX\SOH\ENQ\DC2\ETX5\STX\b\n\ + \\f\n\ + \\ENQ\EOT\t\STX\SOH\SOH\DC2\ETX5\t\r\n\ + \\f\n\ + \\ENQ\EOT\t\STX\SOH\ETX\DC2\ETX5\DLE\DC1\n\ + \\v\n\ + \\EOT\EOT\t\STX\STX\DC2\ETX6\STX\DC2\n\ + \\r\n\ + \\ENQ\EOT\t\STX\STX\EOT\DC2\EOT6\STX5\DC2\n\ + \\f\n\ + \\ENQ\EOT\t\STX\STX\ENQ\DC2\ETX6\STX\b\n\ + \\f\n\ + \\ENQ\EOT\t\STX\STX\SOH\DC2\ETX6\t\r\n\ + \\f\n\ + \\ENQ\EOT\t\STX\STX\ETX\DC2\ETX6\DLE\DC1\n\ + \\v\n\ + \\EOT\EOT\t\STX\ETX\DC2\ETX7\STX\DLE\n\ + \\r\n\ + \\ENQ\EOT\t\STX\ETX\EOT\DC2\EOT7\STX6\DC2\n\ + \\f\n\ + \\ENQ\EOT\t\STX\ETX\ACK\DC2\ETX7\STX\ACK\n\ + \\f\n\ + \\ENQ\EOT\t\STX\ETX\SOH\DC2\ETX7\a\v\n\ + \\f\n\ + \\ENQ\EOT\t\STX\ETX\ETX\DC2\ETX7\SO\SI\n\ + \\v\n\ + \\EOT\EOT\t\STX\EOT\DC2\ETX8\STX\NAK\n\ + \\r\n\ + \\ENQ\EOT\t\STX\EOT\EOT\DC2\EOT8\STX7\DLE\n\ + \\f\n\ + \\ENQ\EOT\t\STX\EOT\ACK\DC2\ETX8\STX\v\n\ + \\f\n\ + \\ENQ\EOT\t\STX\EOT\SOH\DC2\ETX8\f\DLE\n\ + \\f\n\ + \\ENQ\EOT\t\STX\EOT\ETX\DC2\ETX8\DC3\DC4\n\ + \\v\n\ + \\EOT\EOT\t\STX\ENQ\DC2\ETX9\STX\EM\n\ + \\r\n\ + \\ENQ\EOT\t\STX\ENQ\EOT\DC2\EOT9\STX8\NAK\n\ + \\f\n\ + \\ENQ\EOT\t\STX\ENQ\ACK\DC2\ETX9\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\t\STX\ENQ\SOH\DC2\ETX9\v\DC4\n\ + \\f\n\ + \\ENQ\EOT\t\STX\ENQ\ETX\DC2\ETX9\ETB\CAN\n\ + \\v\n\ + \\EOT\EOT\t\STX\ACK\DC2\ETX:\STX\GS\n\ + \\r\n\ + \\ENQ\EOT\t\STX\ACK\EOT\DC2\EOT:\STX9\EM\n\ + \\f\n\ + \\ENQ\EOT\t\STX\ACK\ACK\DC2\ETX:\STX\f\n\ + \\f\n\ + \\ENQ\EOT\t\STX\ACK\SOH\DC2\ETX:\r\CAN\n\ + \\f\n\ + \\ENQ\EOT\t\STX\ACK\ETX\DC2\ETX:\ESC\FS\n\ + \\v\n\ + \\EOT\EOT\t\STX\a\DC2\ETX;\STX \n\ + \\r\n\ + \\ENQ\EOT\t\STX\a\EOT\DC2\EOT;\STX:\GS\n\ + \\f\n\ + \\ENQ\EOT\t\STX\a\ACK\DC2\ETX;\STX\ACK\n\ + \\f\n\ + \\ENQ\EOT\t\STX\a\SOH\DC2\ETX;\a\ESC\n\ + \\f\n\ + \\ENQ\EOT\t\STX\a\ETX\DC2\ETX;\RS\US\n\ + \\v\n\ + \\EOT\EOT\t\STX\b\DC2\ETX<\STX\ESC\n\ + \\r\n\ + \\ENQ\EOT\t\STX\b\EOT\DC2\EOT<\STX; \n\ + \\f\n\ + \\ENQ\EOT\t\STX\b\ACK\DC2\ETX<\STX\v\n\ + \\f\n\ + \\ENQ\EOT\t\STX\b\SOH\DC2\ETX<\f\SYN\n\ + \\f\n\ + \\ENQ\EOT\t\STX\b\ETX\DC2\ETX<\EM\SUB\n\ + \\n\ + \\n\ + \\STX\EOT\n\ + \\DC2\EOT?\NULA\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\n\ + \\SOH\DC2\ETX?\b\DC1\n\ + \\v\n\ + \\EOT\EOT\n\ + \\STX\NUL\DC2\ETX@\STX\ETB\n\ + \\r\n\ + \\ENQ\EOT\n\ + \\STX\NUL\EOT\DC2\EOT@\STX?\DC3\n\ + \\f\n\ + \\ENQ\EOT\n\ + \\STX\NUL\ENQ\DC2\ETX@\STX\b\n\ + \\f\n\ + \\ENQ\EOT\n\ + \\STX\NUL\SOH\DC2\ETX@\t\DC2\n\ + \\f\n\ + \\ENQ\EOT\n\ + \\STX\NUL\ETX\DC2\ETX@\NAK\SYN\n\ + \\n\ + \\n\ + \\STX\EOT\v\DC2\EOTC\NULF\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\v\SOH\DC2\ETXC\b\DLE\n\ + \\v\n\ + \\EOT\EOT\v\STX\NUL\DC2\ETXD\STX\DC1\n\ + \\r\n\ + \\ENQ\EOT\v\STX\NUL\EOT\DC2\EOTD\STXC\DC2\n\ + \\f\n\ + \\ENQ\EOT\v\STX\NUL\ENQ\DC2\ETXD\STX\a\n\ + \\f\n\ + \\ENQ\EOT\v\STX\NUL\SOH\DC2\ETXD\b\f\n\ + \\f\n\ + \\ENQ\EOT\v\STX\NUL\ETX\DC2\ETXD\SI\DLE\n\ + \\v\n\ + \\EOT\EOT\v\STX\SOH\DC2\ETXE\STX\DC3\n\ + \\r\n\ + \\ENQ\EOT\v\STX\SOH\EOT\DC2\EOTE\STXD\DC1\n\ + \\f\n\ + \\ENQ\EOT\v\STX\SOH\ENQ\DC2\ETXE\STX\a\n\ + \\f\n\ + \\ENQ\EOT\v\STX\SOH\SOH\DC2\ETXE\b\SO\n\ + \\f\n\ + \\ENQ\EOT\v\STX\SOH\ETX\DC2\ETXE\DC1\DC2\n\ + \\n\ + \\n\ + \\STX\EOT\f\DC2\EOTH\NULK\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\f\SOH\DC2\ETXH\b\f\n\ + \\v\n\ + \\EOT\EOT\f\STX\NUL\DC2\ETXI\STX\NAK\n\ + \\r\n\ + \\ENQ\EOT\f\STX\NUL\EOT\DC2\EOTI\STXH\SO\n\ + \\f\n\ + \\ENQ\EOT\f\STX\NUL\ACK\DC2\ETXI\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\f\STX\NUL\SOH\DC2\ETXI\v\DLE\n\ + \\f\n\ + \\ENQ\EOT\f\STX\NUL\ETX\DC2\ETXI\DC3\DC4\n\ + \\v\n\ + \\EOT\EOT\f\STX\SOH\DC2\ETXJ\STX\DC3\n\ + \\r\n\ + \\ENQ\EOT\f\STX\SOH\EOT\DC2\EOTJ\STXI\NAK\n\ + \\f\n\ + \\ENQ\EOT\f\STX\SOH\ACK\DC2\ETXJ\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\f\STX\SOH\SOH\DC2\ETXJ\v\SO\n\ + \\f\n\ + \\ENQ\EOT\f\STX\SOH\ETX\DC2\ETXJ\DC1\DC2\n\ + \\n\ + \\n\ + \\STX\EOT\r\DC2\EOTM\NULP\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\r\SOH\DC2\ETXM\b\DC1\n\ + \\v\n\ + \\EOT\EOT\r\STX\NUL\DC2\ETXN\STX\DC2\n\ + \\r\n\ + \\ENQ\EOT\r\STX\NUL\EOT\DC2\EOTN\STXM\DC3\n\ + \\f\n\ + \\ENQ\EOT\r\STX\NUL\ENQ\DC2\ETXN\STX\a\n\ + \\f\n\ + \\ENQ\EOT\r\STX\NUL\SOH\DC2\ETXN\b\r\n\ + \\f\n\ + \\ENQ\EOT\r\STX\NUL\ETX\DC2\ETXN\DLE\DC1\n\ + \\v\n\ + \\EOT\EOT\r\STX\SOH\DC2\ETXO\STX\DLE\n\ + \\r\n\ + \\ENQ\EOT\r\STX\SOH\EOT\DC2\EOTO\STXN\DC2\n\ + \\f\n\ + \\ENQ\EOT\r\STX\SOH\ENQ\DC2\ETXO\STX\a\n\ + \\f\n\ + \\ENQ\EOT\r\STX\SOH\SOH\DC2\ETXO\b\v\n\ + \\f\n\ + \\ENQ\EOT\r\STX\SOH\ETX\DC2\ETXO\SO\SI\n\ + \\n\ + \\n\ + \\STX\EOT\SO\DC2\EOTR\NULX\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\SO\SOH\DC2\ETXR\b\SYN\n\ + \\v\n\ + \\EOT\EOT\SO\STX\NUL\DC2\ETXS\STX\DC2\n\ + \\r\n\ + \\ENQ\EOT\SO\STX\NUL\EOT\DC2\EOTS\STXR\CAN\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\NUL\ENQ\DC2\ETXS\STX\b\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\NUL\SOH\DC2\ETXS\t\r\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\NUL\ETX\DC2\ETXS\DLE\DC1\n\ + \\v\n\ + \\EOT\EOT\SO\STX\SOH\DC2\ETXT\STX\SYN\n\ + \\r\n\ + \\ENQ\EOT\SO\STX\SOH\EOT\DC2\EOTT\STXS\DC2\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\SOH\ENQ\DC2\ETXT\STX\b\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\SOH\SOH\DC2\ETXT\t\DC1\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\SOH\ETX\DC2\ETXT\DC4\NAK\n\ + \\v\n\ + \\EOT\EOT\SO\STX\STX\DC2\ETXU\STX$\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\STX\EOT\DC2\ETXU\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\STX\ACK\DC2\ETXU\v\EM\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\STX\SOH\DC2\ETXU\SUB\US\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\STX\ETX\DC2\ETXU\"#\n\ + \\v\n\ + \\EOT\EOT\SO\STX\ETX\DC2\ETXV\STX$\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\ETX\EOT\DC2\ETXV\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\ETX\ACK\DC2\ETXV\v\EM\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\ETX\SOH\DC2\ETXV\SUB\US\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\ETX\ETX\DC2\ETXV\"#\n\ + \\v\n\ + \\EOT\EOT\SO\STX\EOT\DC2\ETXW\STX!\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\EOT\EOT\DC2\ETXW\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\EOT\ACK\DC2\ETXW\v\NAK\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\EOT\SOH\DC2\ETXW\SYN\FS\n\ + \\f\n\ + \\ENQ\EOT\SO\STX\EOT\ETX\DC2\ETXW\US \n\ + \\n\ + \\n\ + \\STX\ENQ\NUL\DC2\EOTZ\NUL`\SOH\n\ + \\n\ + \\n\ + \\ETX\ENQ\NUL\SOH\DC2\ETXZ\ENQ\r\n\ + \\v\n\ + \\EOT\ENQ\NUL\STX\NUL\DC2\ETX[\STX\DC1\n\ + \\f\n\ + \\ENQ\ENQ\NUL\STX\NUL\SOH\DC2\ETX[\STX\f\n\ + \\f\n\ + \\ENQ\ENQ\NUL\STX\NUL\STX\DC2\ETX[\SI\DLE\n\ + \\v\n\ + \\EOT\ENQ\NUL\STX\SOH\DC2\ETX\\\STX\DC4\n\ + \\f\n\ + \\ENQ\ENQ\NUL\STX\SOH\SOH\DC2\ETX\\\STX\SI\n\ + \\f\n\ + \\ENQ\ENQ\NUL\STX\SOH\STX\DC2\ETX\\\DC2\DC3\n\ + \\v\n\ + \\EOT\ENQ\NUL\STX\STX\DC2\ETX]\STX\NAK\n\ + \\f\n\ + \\ENQ\ENQ\NUL\STX\STX\SOH\DC2\ETX]\STX\DLE\n\ + \\f\n\ + \\ENQ\ENQ\NUL\STX\STX\STX\DC2\ETX]\DC3\DC4\n\ + \\v\n\ + \\EOT\ENQ\NUL\STX\ETX\DC2\ETX^\STX\DC1\n\ + \\f\n\ + \\ENQ\ENQ\NUL\STX\ETX\SOH\DC2\ETX^\STX\f\n\ + \\f\n\ + \\ENQ\ENQ\NUL\STX\ETX\STX\DC2\ETX^\SI\DLE\n\ + \\v\n\ + \\EOT\ENQ\NUL\STX\EOT\DC2\ETX_\STX\DLE\n\ + \\f\n\ + \\ENQ\ENQ\NUL\STX\EOT\SOH\DC2\ETX_\STX\v\n\ + \\f\n\ + \\ENQ\ENQ\NUL\STX\EOT\STX\DC2\ETX_\SO\SI\n\ + \\n\ + \\n\ + \\STX\ENQ\SOH\DC2\EOTb\NULk\SOH\n\ + \\n\ + \\n\ + \\ETX\ENQ\SOH\SOH\DC2\ETXb\ENQ\SI\n\ + \\v\n\ + \\EOT\ENQ\SOH\STX\NUL\DC2\ETXc\STX\SI\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\NUL\SOH\DC2\ETXc\STX\n\ + \\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\NUL\STX\DC2\ETXc\r\SO\n\ + \\v\n\ + \\EOT\ENQ\SOH\STX\SOH\DC2\ETXd\STX\r\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\SOH\SOH\DC2\ETXd\STX\b\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\SOH\STX\DC2\ETXd\v\f\n\ + \\v\n\ + \\EOT\ENQ\SOH\STX\STX\DC2\ETXe\STX\f\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\STX\SOH\DC2\ETXe\STX\a\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\STX\STX\DC2\ETXe\n\ + \\v\n\ + \\v\n\ + \\EOT\ENQ\SOH\STX\ETX\DC2\ETXf\STX\r\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\ETX\SOH\DC2\ETXf\STX\b\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\ETX\STX\DC2\ETXf\v\f\n\ + \\v\n\ + \\EOT\ENQ\SOH\STX\EOT\DC2\ETXg\STX\v\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\EOT\SOH\DC2\ETXg\STX\ACK\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\EOT\STX\DC2\ETXg\t\n\ + \\n\ + \\v\n\ + \\EOT\ENQ\SOH\STX\ENQ\DC2\ETXh\STX\v\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\ENQ\SOH\DC2\ETXh\STX\ACK\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\ENQ\STX\DC2\ETXh\t\n\ + \\n\ + \\v\n\ + \\EOT\ENQ\SOH\STX\ACK\DC2\ETXi\STX\DLE\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\ACK\SOH\DC2\ETXi\STX\v\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\ACK\STX\DC2\ETXi\SO\SI\n\ + \\v\n\ + \\EOT\ENQ\SOH\STX\a\DC2\ETXj\STX\NAK\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\a\SOH\DC2\ETXj\STX\DLE\n\ + \\f\n\ + \\ENQ\ENQ\SOH\STX\a\STX\DC2\ETXj\DC3\DC4\n\ + \\n\ + \\n\ + \\STX\EOT\SI\DC2\EOTm\NULt\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\SI\SOH\DC2\ETXm\b\SYN\n\ + \\v\n\ + \\EOT\EOT\SI\STX\NUL\DC2\ETXn\STX\SI\n\ + \\r\n\ + \\ENQ\EOT\SI\STX\NUL\EOT\DC2\EOTn\STXm\CAN\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\NUL\ENQ\DC2\ETXn\STX\a\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\NUL\SOH\DC2\ETXn\b\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\NUL\ETX\DC2\ETXn\r\SO\n\ + \\v\n\ + \\EOT\EOT\SI\STX\SOH\DC2\ETXo\STX\DC2\n\ + \\r\n\ + \\ENQ\EOT\SI\STX\SOH\EOT\DC2\EOTo\STXn\SI\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\SOH\ENQ\DC2\ETXo\STX\b\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\SOH\SOH\DC2\ETXo\t\r\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\SOH\ETX\DC2\ETXo\DLE\DC1\n\ + \\v\n\ + \\EOT\EOT\SI\STX\STX\DC2\ETXp\STX\DC2\n\ + \\r\n\ + \\ENQ\EOT\SI\STX\STX\EOT\DC2\EOTp\STXo\DC2\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\STX\ENQ\DC2\ETXp\STX\b\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\STX\SOH\DC2\ETXp\t\r\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\STX\ETX\DC2\ETXp\DLE\DC1\n\ + \\v\n\ + \\EOT\EOT\SI\STX\ETX\DC2\ETXq\STX\DLE\n\ + \\r\n\ + \\ENQ\EOT\SI\STX\ETX\EOT\DC2\EOTq\STXp\DC2\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\ETX\ACK\DC2\ETXq\STX\ACK\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\ETX\SOH\DC2\ETXq\a\v\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\ETX\ETX\DC2\ETXq\SO\SI\n\ + \\v\n\ + \\EOT\EOT\SI\STX\EOT\DC2\ETXr\STX\GS\n\ + \\r\n\ + \\ENQ\EOT\SI\STX\EOT\EOT\DC2\EOTr\STXq\DLE\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\EOT\ACK\DC2\ETXr\STX\f\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\EOT\SOH\DC2\ETXr\r\CAN\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\EOT\ETX\DC2\ETXr\ESC\FS\n\ + \\v\n\ + \\EOT\EOT\SI\STX\ENQ\DC2\ETXs\STX\EM\n\ + \\r\n\ + \\ENQ\EOT\SI\STX\ENQ\EOT\DC2\EOTs\STXr\GS\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\ENQ\ACK\DC2\ETXs\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\ENQ\SOH\DC2\ETXs\v\DC4\n\ + \\f\n\ + \\ENQ\EOT\SI\STX\ENQ\ETX\DC2\ETXs\ETB\CAN\n\ + \\n\ + \\n\ + \\STX\EOT\DLE\DC2\EOTv\NUL~\SOH\n\ + \\n\ + \\n\ + \\ETX\EOT\DLE\SOH\DC2\ETXv\b\SYN\n\ + \\v\n\ + \\EOT\EOT\DLE\STX\NUL\DC2\ETXw\STX,\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\NUL\EOT\DC2\ETXw\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\NUL\ENQ\DC2\ETXw\v\DC1\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\NUL\SOH\DC2\ETXw\DC2'\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\NUL\ETX\DC2\ETXw*+\n\ + \\v\n\ + \\EOT\EOT\DLE\STX\SOH\DC2\ETXx\STX&\n\ + \\r\n\ + \\ENQ\EOT\DLE\STX\SOH\EOT\DC2\EOTx\STXw,\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\SOH\ENQ\DC2\ETXx\STX\a\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\SOH\SOH\DC2\ETXx\b!\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\SOH\ETX\DC2\ETXx$%\n\ + \\v\n\ + \\EOT\EOT\DLE\STX\STX\DC2\ETXy\STX\DC1\n\ + \\r\n\ + \\ENQ\EOT\DLE\STX\STX\EOT\DC2\EOTy\STXx&\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\STX\ENQ\DC2\ETXy\STX\a\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\STX\SOH\DC2\ETXy\b\f\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\STX\ETX\DC2\ETXy\SI\DLE\n\ + \\v\n\ + \\EOT\EOT\DLE\STX\ETX\DC2\ETXz\STX\DC3\n\ + \\r\n\ + \\ENQ\EOT\DLE\STX\ETX\EOT\DC2\EOTz\STXy\DC1\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ETX\ENQ\DC2\ETXz\STX\b\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ETX\SOH\DC2\ETXz\t\SO\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ETX\ETX\DC2\ETXz\DC1\DC2\n\ + \\v\n\ + \\EOT\EOT\DLE\STX\EOT\DC2\ETX{\STX\SI\n\ + \\r\n\ + \\ENQ\EOT\DLE\STX\EOT\EOT\DC2\EOT{\STXz\DC3\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\EOT\ENQ\DC2\ETX{\STX\a\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\EOT\SOH\DC2\ETX{\b\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\EOT\ETX\DC2\ETX{\r\SO\n\ + \\v\n\ + \\EOT\EOT\DLE\STX\ENQ\DC2\ETX|\STX(\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ENQ\EOT\DC2\ETX|\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ENQ\ENQ\DC2\ETX|\v\DLE\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ENQ\SOH\DC2\ETX|\DC1#\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ENQ\ETX\DC2\ETX|&'\n\ + \\v\n\ + \\EOT\EOT\DLE\STX\ACK\DC2\ETX}\STX*\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ACK\EOT\DC2\ETX}\STX\n\ + \\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ACK\ENQ\DC2\ETX}\v\DC1\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ACK\SOH\DC2\ETX}\DC2%\n\ + \\f\n\ + \\ENQ\EOT\DLE\STX\ACK\ETX\DC2\ETX}()b\ACKproto3" \ No newline at end of file diff --git a/semantic-proto/src/Proto/Semantic_Fields.hs b/semantic-proto/src/Proto/Semantic_Fields.hs new file mode 100644 index 0000000000..8c75146001 --- /dev/null +++ b/semantic-proto/src/Proto/Semantic_Fields.hs @@ -0,0 +1,327 @@ +{- This file was auto-generated from semantic.proto by the proto-lens-protoc program. -} +{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies, UndecidableInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, PatternSynonyms, MagicHash, NoImplicitPrelude, DataKinds, BangPatterns, TypeApplications, OverloadedStrings, DerivingStrategies#-} +{-# OPTIONS_GHC -Wno-unused-imports#-} +{-# OPTIONS_GHC -Wno-duplicate-exports#-} +{-# OPTIONS_GHC -Wno-dodgy-exports#-} +module Proto.Semantic_Fields where +import qualified Data.ProtoLens.Runtime.Prelude as Prelude +import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int +import qualified Data.ProtoLens.Runtime.Data.Monoid as Data.Monoid +import qualified Data.ProtoLens.Runtime.Data.Word as Data.Word +import qualified Data.ProtoLens.Runtime.Data.ProtoLens as Data.ProtoLens +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Bytes as Data.ProtoLens.Encoding.Bytes +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Growing as Data.ProtoLens.Encoding.Growing +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Parser.Unsafe as Data.ProtoLens.Encoding.Parser.Unsafe +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Wire as Data.ProtoLens.Encoding.Wire +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Field as Data.ProtoLens.Field +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Message.Enum as Data.ProtoLens.Message.Enum +import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Service.Types as Data.ProtoLens.Service.Types +import qualified Data.ProtoLens.Runtime.Lens.Family2 as Lens.Family2 +import qualified Data.ProtoLens.Runtime.Lens.Family2.Unchecked as Lens.Family2.Unchecked +import qualified Data.ProtoLens.Runtime.Data.Text as Data.Text +import qualified Data.ProtoLens.Runtime.Data.Map as Data.Map +import qualified Data.ProtoLens.Runtime.Data.ByteString as Data.ByteString +import qualified Data.ProtoLens.Runtime.Data.ByteString.Char8 as Data.ByteString.Char8 +import qualified Data.ProtoLens.Runtime.Data.Text.Encoding as Data.Text.Encoding +import qualified Data.ProtoLens.Runtime.Data.Vector as Data.Vector +import qualified Data.ProtoLens.Runtime.Data.Vector.Generic as Data.Vector.Generic +import qualified Data.ProtoLens.Runtime.Data.Vector.Unboxed as Data.Vector.Unboxed +import qualified Data.ProtoLens.Runtime.Text.Read as Text.Read +blobOid :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "blobOid" a) => + Lens.Family2.LensLike' f s a +blobOid = Data.ProtoLens.Field.field @"blobOid" +blobs :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "blobs" a) => + Lens.Family2.LensLike' f s a +blobs = Data.ProtoLens.Field.field @"blobs" +byteRange :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "byteRange" a) => + Lens.Family2.LensLike' f s a +byteRange = Data.ProtoLens.Field.field @"byteRange" +column :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "column" a) => + Lens.Family2.LensLike' f s a +column = Data.ProtoLens.Field.field @"column" +content :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "content" a) => + Lens.Family2.LensLike' f s a +content = Data.ProtoLens.Field.field @"content" +docs :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "docs" a) => + Lens.Family2.LensLike' f s a +docs = Data.ProtoLens.Field.field @"docs" +docstring :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "docstring" a) => + Lens.Family2.LensLike' f s a +docstring = Data.ProtoLens.Field.field @"docstring" +edges :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "edges" a) => + Lens.Family2.LensLike' f s a +edges = Data.ProtoLens.Field.field @"edges" +end :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "end" a) => + Lens.Family2.LensLike' f s a +end = Data.ProtoLens.Field.field @"end" +endingScopeStack :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "endingScopeStack" a) => + Lens.Family2.LensLike' f s a +endingScopeStack = Data.ProtoLens.Field.field @"endingScopeStack" +endingSymbolStack :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "endingSymbolStack" a) => + Lens.Family2.LensLike' f s a +endingSymbolStack = Data.ProtoLens.Field.field @"endingSymbolStack" +error :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "error" a) => + Lens.Family2.LensLike' f s a +error = Data.ProtoLens.Field.field @"error" +errors :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "errors" a) => + Lens.Family2.LensLike' f s a +errors = Data.ProtoLens.Field.field @"errors" +files :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "files" a) => + Lens.Family2.LensLike' f s a +files = Data.ProtoLens.Field.field @"files" +from :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "from" a) => + Lens.Family2.LensLike' f s a +from = Data.ProtoLens.Field.field @"from" +hostname :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "hostname" a) => + Lens.Family2.LensLike' f s a +hostname = Data.ProtoLens.Field.field @"hostname" +id :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "id" a) => + Lens.Family2.LensLike' f s a +id = Data.ProtoLens.Field.field @"id" +kind :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "kind" a) => + Lens.Family2.LensLike' f s a +kind = Data.ProtoLens.Field.field @"kind" +language :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "language" a) => + Lens.Family2.LensLike' f s a +language = Data.ProtoLens.Field.field @"language" +line :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "line" a) => + Lens.Family2.LensLike' f s a +line = Data.ProtoLens.Field.field @"line" +maybe'byteRange :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'byteRange" a) => + Lens.Family2.LensLike' f s a +maybe'byteRange = Data.ProtoLens.Field.field @"maybe'byteRange" +maybe'docs :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'docs" a) => + Lens.Family2.LensLike' f s a +maybe'docs = Data.ProtoLens.Field.field @"maybe'docs" +maybe'end :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'end" a) => + Lens.Family2.LensLike' f s a +maybe'end = Data.ProtoLens.Field.field @"maybe'end" +maybe'span :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'span" a) => + Lens.Family2.LensLike' f s a +maybe'span = Data.ProtoLens.Field.field @"maybe'span" +maybe'start :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'start" a) => + Lens.Family2.LensLike' f s a +maybe'start = Data.ProtoLens.Field.field @"maybe'start" +maybe'utf16CodeUnitSpan :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'utf16CodeUnitSpan" a) => + Lens.Family2.LensLike' f s a +maybe'utf16CodeUnitSpan + = Data.ProtoLens.Field.field @"maybe'utf16CodeUnitSpan" +name :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "name" a) => + Lens.Family2.LensLike' f s a +name = Data.ProtoLens.Field.field @"name" +nodeType :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "nodeType" a) => + Lens.Family2.LensLike' f s a +nodeType = Data.ProtoLens.Field.field @"nodeType" +nodes :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "nodes" a) => + Lens.Family2.LensLike' f s a +nodes = Data.ProtoLens.Field.field @"nodes" +path :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "path" a) => + Lens.Family2.LensLike' f s a +path = Data.ProtoLens.Field.field @"path" +paths :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "paths" a) => + Lens.Family2.LensLike' f s a +paths = Data.ProtoLens.Field.field @"paths" +service :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "service" a) => + Lens.Family2.LensLike' f s a +service = Data.ProtoLens.Field.field @"service" +sha :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "sha" a) => + Lens.Family2.LensLike' f s a +sha = Data.ProtoLens.Field.field @"sha" +span :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "span" a) => + Lens.Family2.LensLike' f s a +span = Data.ProtoLens.Field.field @"span" +start :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "start" a) => + Lens.Family2.LensLike' f s a +start = Data.ProtoLens.Field.field @"start" +startingScopeStackSize :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "startingScopeStackSize" a) => + Lens.Family2.LensLike' f s a +startingScopeStackSize + = Data.ProtoLens.Field.field @"startingScopeStackSize" +startingSymbolStack :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "startingSymbolStack" a) => + Lens.Family2.LensLike' f s a +startingSymbolStack + = Data.ProtoLens.Field.field @"startingSymbolStack" +status :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "status" a) => + Lens.Family2.LensLike' f s a +status = Data.ProtoLens.Field.field @"status" +symbol :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "symbol" a) => + Lens.Family2.LensLike' f s a +symbol = Data.ProtoLens.Field.field @"symbol" +symbols :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "symbols" a) => + Lens.Family2.LensLike' f s a +symbols = Data.ProtoLens.Field.field @"symbols" +syntaxType :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "syntaxType" a) => + Lens.Family2.LensLike' f s a +syntaxType = Data.ProtoLens.Field.field @"syntaxType" +timestamp :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "timestamp" a) => + Lens.Family2.LensLike' f s a +timestamp = Data.ProtoLens.Field.field @"timestamp" +to :: + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "to" a) => + Lens.Family2.LensLike' f s a +to = Data.ProtoLens.Field.field @"to" +utf16CodeUnitSpan :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "utf16CodeUnitSpan" a) => + Lens.Family2.LensLike' f s a +utf16CodeUnitSpan = Data.ProtoLens.Field.field @"utf16CodeUnitSpan" +vec'blobs :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'blobs" a) => + Lens.Family2.LensLike' f s a +vec'blobs = Data.ProtoLens.Field.field @"vec'blobs" +vec'endingScopeStack :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'endingScopeStack" a) => + Lens.Family2.LensLike' f s a +vec'endingScopeStack + = Data.ProtoLens.Field.field @"vec'endingScopeStack" +vec'endingSymbolStack :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'endingSymbolStack" a) => + Lens.Family2.LensLike' f s a +vec'endingSymbolStack + = Data.ProtoLens.Field.field @"vec'endingSymbolStack" +vec'errors :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'errors" a) => + Lens.Family2.LensLike' f s a +vec'errors = Data.ProtoLens.Field.field @"vec'errors" +vec'files :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'files" a) => + Lens.Family2.LensLike' f s a +vec'files = Data.ProtoLens.Field.field @"vec'files" +vec'nodes :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'nodes" a) => + Lens.Family2.LensLike' f s a +vec'nodes = Data.ProtoLens.Field.field @"vec'nodes" +vec'paths :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'paths" a) => + Lens.Family2.LensLike' f s a +vec'paths = Data.ProtoLens.Field.field @"vec'paths" +vec'startingSymbolStack :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'startingSymbolStack" a) => + Lens.Family2.LensLike' f s a +vec'startingSymbolStack + = Data.ProtoLens.Field.field @"vec'startingSymbolStack" +vec'symbols :: + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'symbols" a) => + Lens.Family2.LensLike' f s a +vec'symbols = Data.ProtoLens.Field.field @"vec'symbols" \ No newline at end of file diff --git a/semantic-proto/src/Proto/Semantic_JSON.hs b/semantic-proto/src/Proto/Semantic_JSON.hs new file mode 100644 index 0000000000..bd0223ea21 --- /dev/null +++ b/semantic-proto/src/Proto/Semantic_JSON.hs @@ -0,0 +1,555 @@ +-- Code generated by protoc-gen-jsonpb_haskell 0.1.0, DO NOT EDIT. +{-# OPTIONS_GHC -Wno-orphans -Wno-unused-imports -Wno-missing-export-lists #-} +module Proto.Semantic_JSON where + +import Prelude(($), (.), (<$>), pure, show, Maybe(..)) + +import Data.ProtoLens.Runtime.Lens.Family2 ((^.), (.~), (&)) +import Data.Monoid (mconcat) +import Control.Monad (msum) +import Data.ProtoLens (defMessage) +import qualified Data.Aeson as A +import qualified Data.Aeson.Encoding as E +import Data.ProtoLens.JSONPB as JSONPB +import qualified Data.Text as T + +import Proto.Semantic as P +import Proto.Semantic_Fields as P + +instance FromJSONPB PingRequest where + parseJSONPB = withObject "PingRequest" $ \obj -> do + service' <- obj .: "service" + pure $ defMessage + & P.service .~ service' + +instance ToJSONPB PingRequest where + toJSONPB x = object + [ "service" .= (x^.service) + ] + toEncodingPB x = pairs + [ "service" .= (x^.service) + ] + +instance FromJSON PingRequest where + parseJSON = parseJSONPB + +instance ToJSON PingRequest where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB PingResponse where + parseJSONPB = withObject "PingResponse" $ \obj -> do + status' <- obj .: "status" + hostname' <- obj .: "hostname" + timestamp' <- obj .: "timestamp" + sha' <- obj .: "sha" + pure $ defMessage + & P.status .~ status' + & P.hostname .~ hostname' + & P.timestamp .~ timestamp' + & P.sha .~ sha' + +instance ToJSONPB PingResponse where + toJSONPB x = object + [ "status" .= (x^.status) + , "hostname" .= (x^.hostname) + , "timestamp" .= (x^.timestamp) + , "sha" .= (x^.sha) + ] + toEncodingPB x = pairs + [ "status" .= (x^.status) + , "hostname" .= (x^.hostname) + , "timestamp" .= (x^.timestamp) + , "sha" .= (x^.sha) + ] + +instance FromJSON PingResponse where + parseJSON = parseJSONPB + +instance ToJSON PingResponse where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ParseTreeRequest where + parseJSONPB = withObject "ParseTreeRequest" $ \obj -> do + blobs' <- obj .: "blobs" + pure $ defMessage + & P.blobs .~ blobs' + +instance ToJSONPB ParseTreeRequest where + toJSONPB x = object + [ "blobs" .= (x^.blobs) + ] + toEncodingPB x = pairs + [ "blobs" .= (x^.blobs) + ] + +instance FromJSON ParseTreeRequest where + parseJSON = parseJSONPB + +instance ToJSON ParseTreeRequest where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ParseTreeSymbolResponse where + parseJSONPB = withObject "ParseTreeSymbolResponse" $ \obj -> do + files' <- obj .: "files" + pure $ defMessage + & P.files .~ files' + +instance ToJSONPB ParseTreeSymbolResponse where + toJSONPB x = object + [ "files" .= (x^.files) + ] + toEncodingPB x = pairs + [ "files" .= (x^.files) + ] + +instance FromJSON ParseTreeSymbolResponse where + parseJSON = parseJSONPB + +instance ToJSON ParseTreeSymbolResponse where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB StackGraphRequest where + parseJSONPB = withObject "StackGraphRequest" $ \obj -> do + blobs' <- obj .: "blobs" + pure $ defMessage + & P.blobs .~ blobs' + +instance ToJSONPB StackGraphRequest where + toJSONPB x = object + [ "blobs" .= (x^.blobs) + ] + toEncodingPB x = pairs + [ "blobs" .= (x^.blobs) + ] + +instance FromJSON StackGraphRequest where + parseJSON = parseJSONPB + +instance ToJSON StackGraphRequest where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB StackGraphResponse where + parseJSONPB = withObject "StackGraphResponse" $ \obj -> do + files' <- obj .: "files" + pure $ defMessage + & P.files .~ files' + +instance ToJSONPB StackGraphResponse where + toJSONPB x = object + [ "files" .= (x^.files) + ] + toEncodingPB x = pairs + [ "files" .= (x^.files) + ] + +instance FromJSON StackGraphResponse where + parseJSON = parseJSONPB + +instance ToJSON StackGraphResponse where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ParseError where + parseJSONPB = withObject "ParseError" $ \obj -> do + error' <- obj .: "error" + pure $ defMessage + & P.error .~ error' + +instance ToJSONPB ParseError where + toJSONPB x = object + [ "error" .= (x^.error) + ] + toEncodingPB x = pairs + [ "error" .= (x^.error) + ] + +instance FromJSON ParseError where + parseJSON = parseJSONPB + +instance ToJSON ParseError where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB Blob where + parseJSONPB = withObject "Blob" $ \obj -> do + content' <- obj .: "content" + path' <- obj .: "path" + language' <- obj .: "language" + pure $ defMessage + & P.content .~ content' + & P.path .~ path' + & P.language .~ language' + +instance ToJSONPB Blob where + toJSONPB x = object + [ "content" .= (x^.content) + , "path" .= (x^.path) + , "language" .= (x^.language) + ] + toEncodingPB x = pairs + [ "content" .= (x^.content) + , "path" .= (x^.path) + , "language" .= (x^.language) + ] + +instance FromJSON Blob where + parseJSON = parseJSONPB + +instance ToJSON Blob where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB File where + parseJSONPB = withObject "File" $ \obj -> do + path' <- obj .: "path" + language' <- obj .: "language" + symbols' <- obj .: "symbols" + errors' <- obj .: "errors" + blobOid' <- obj .: "blobOid" + pure $ defMessage + & P.path .~ path' + & P.language .~ language' + & P.symbols .~ symbols' + & P.errors .~ errors' + & P.blobOid .~ blobOid' + +instance ToJSONPB File where + toJSONPB x = object + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "symbols" .= (x^.symbols) + , "errors" .= (x^.errors) + , "blobOid" .= (x^.blobOid) + ] + toEncodingPB x = pairs + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "symbols" .= (x^.symbols) + , "errors" .= (x^.errors) + , "blobOid" .= (x^.blobOid) + ] + +instance FromJSON File where + parseJSON = parseJSONPB + +instance ToJSON File where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB Symbol where + parseJSONPB = withObject "Symbol" $ \obj -> do + symbol' <- obj .: "symbol" + kind' <- obj .: "kind" + line' <- obj .: "line" + span' <- obj A..:? "span" + docs' <- obj A..:? "docs" + nodeType' <- obj .: "nodeType" + syntaxType' <- obj .: "syntaxType" + utf16CodeUnitSpan' <- obj A..:? "utf16CodeUnitSpan" + byteRange' <- obj A..:? "byteRange" + pure $ defMessage + & P.symbol .~ symbol' + & P.kind .~ kind' + & P.line .~ line' + & P.maybe'span .~ span' + & P.maybe'docs .~ docs' + & P.nodeType .~ nodeType' + & P.syntaxType .~ syntaxType' + & P.maybe'utf16CodeUnitSpan .~ utf16CodeUnitSpan' + & P.maybe'byteRange .~ byteRange' + +instance ToJSONPB Symbol where + toJSONPB x = object + [ "symbol" .= (x^.symbol) + , "kind" .= (x^.kind) + , "line" .= (x^.line) + , "span" .= (x^.maybe'span) + , "docs" .= (x^.maybe'docs) + , "nodeType" .= (x^.nodeType) + , "syntaxType" .= (x^.syntaxType) + , "utf16CodeUnitSpan" .= (x^.maybe'utf16CodeUnitSpan) + , "byteRange" .= (x^.maybe'byteRange) + ] + toEncodingPB x = pairs + [ "symbol" .= (x^.symbol) + , "kind" .= (x^.kind) + , "line" .= (x^.line) + , "span" .= (x^.maybe'span) + , "docs" .= (x^.maybe'docs) + , "nodeType" .= (x^.nodeType) + , "syntaxType" .= (x^.syntaxType) + , "utf16CodeUnitSpan" .= (x^.maybe'utf16CodeUnitSpan) + , "byteRange" .= (x^.maybe'byteRange) + ] + +instance FromJSON Symbol where + parseJSON = parseJSONPB + +instance ToJSON Symbol where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB Docstring where + parseJSONPB = withObject "Docstring" $ \obj -> do + docstring' <- obj .: "docstring" + pure $ defMessage + & P.docstring .~ docstring' + +instance ToJSONPB Docstring where + toJSONPB x = object + [ "docstring" .= (x^.docstring) + ] + toEncodingPB x = pairs + [ "docstring" .= (x^.docstring) + ] + +instance FromJSON Docstring where + parseJSON = parseJSONPB + +instance ToJSON Docstring where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB Position where + parseJSONPB = withObject "Position" $ \obj -> do + line' <- obj .: "line" + column' <- obj .: "column" + pure $ defMessage + & P.line .~ line' + & P.column .~ column' + +instance ToJSONPB Position where + toJSONPB x = object + [ "line" .= (x^.line) + , "column" .= (x^.column) + ] + toEncodingPB x = pairs + [ "line" .= (x^.line) + , "column" .= (x^.column) + ] + +instance FromJSON Position where + parseJSON = parseJSONPB + +instance ToJSON Position where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB Span where + parseJSONPB = withObject "Span" $ \obj -> do + start' <- obj A..:? "start" + end' <- obj A..:? "end" + pure $ defMessage + & P.maybe'start .~ start' + & P.maybe'end .~ end' + +instance ToJSONPB Span where + toJSONPB x = object + [ "start" .= (x^.maybe'start) + , "end" .= (x^.maybe'end) + ] + toEncodingPB x = pairs + [ "start" .= (x^.maybe'start) + , "end" .= (x^.maybe'end) + ] + +instance FromJSON Span where + parseJSON = parseJSONPB + +instance ToJSON Span where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ByteRange where + parseJSONPB = withObject "ByteRange" $ \obj -> do + start' <- obj .: "start" + end' <- obj .: "end" + pure $ defMessage + & P.start .~ start' + & P.end .~ end' + +instance ToJSONPB ByteRange where + toJSONPB x = object + [ "start" .= (x^.start) + , "end" .= (x^.end) + ] + toEncodingPB x = pairs + [ "start" .= (x^.start) + , "end" .= (x^.end) + ] + +instance FromJSON ByteRange where + parseJSON = parseJSONPB + +instance ToJSON ByteRange where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB StackGraphFile where + parseJSONPB = withObject "StackGraphFile" $ \obj -> do + path' <- obj .: "path" + language' <- obj .: "language" + nodes' <- obj .: "nodes" + paths' <- obj .: "paths" + errors' <- obj .: "errors" + pure $ defMessage + & P.path .~ path' + & P.language .~ language' + & P.nodes .~ nodes' + & P.paths .~ paths' + & P.errors .~ errors' + +instance ToJSONPB StackGraphFile where + toJSONPB x = object + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "nodes" .= (x^.nodes) + , "paths" .= (x^.paths) + , "errors" .= (x^.errors) + ] + toEncodingPB x = pairs + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "nodes" .= (x^.nodes) + , "paths" .= (x^.paths) + , "errors" .= (x^.errors) + ] + +instance FromJSON StackGraphFile where + parseJSON = parseJSONPB + +instance ToJSON StackGraphFile where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB StackGraphNode where + parseJSONPB = withObject "StackGraphNode" $ \obj -> do + id' <- obj .: "id" + name' <- obj .: "name" + line' <- obj .: "line" + span' <- obj A..:? "span" + syntaxType' <- obj .: "syntaxType" + nodeType' <- obj .: "nodeType" + pure $ defMessage + & P.id .~ id' + & P.name .~ name' + & P.line .~ line' + & P.maybe'span .~ span' + & P.syntaxType .~ syntaxType' + & P.nodeType .~ nodeType' + +instance ToJSONPB StackGraphNode where + toJSONPB x = object + [ "id" .= (x^.id) + , "name" .= (x^.name) + , "line" .= (x^.line) + , "span" .= (x^.maybe'span) + , "syntaxType" .= (x^.syntaxType) + , "nodeType" .= (x^.nodeType) + ] + toEncodingPB x = pairs + [ "id" .= (x^.id) + , "name" .= (x^.name) + , "line" .= (x^.line) + , "span" .= (x^.maybe'span) + , "syntaxType" .= (x^.syntaxType) + , "nodeType" .= (x^.nodeType) + ] + +instance FromJSON StackGraphNode where + parseJSON = parseJSONPB + +instance ToJSON StackGraphNode where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB StackGraphPath where + parseJSONPB = withObject "StackGraphPath" $ \obj -> do + startingSymbolStack' <- obj .: "startingSymbolStack" + startingScopeStackSize' <- obj .: "startingScopeStackSize" + from' <- obj .: "from" + edges' <- obj .: "edges" + to' <- obj .: "to" + endingScopeStack' <- obj .: "endingScopeStack" + endingSymbolStack' <- obj .: "endingSymbolStack" + pure $ defMessage + & P.startingSymbolStack .~ startingSymbolStack' + & P.startingScopeStackSize .~ startingScopeStackSize' + & P.from .~ from' + & P.edges .~ edges' + & P.to .~ to' + & P.endingScopeStack .~ endingScopeStack' + & P.endingSymbolStack .~ endingSymbolStack' + +instance ToJSONPB StackGraphPath where + toJSONPB x = object + [ "startingSymbolStack" .= (x^.startingSymbolStack) + , "startingScopeStackSize" .= (x^.startingScopeStackSize) + , "from" .= (x^.from) + , "edges" .= (x^.edges) + , "to" .= (x^.to) + , "endingScopeStack" .= (x^.endingScopeStack) + , "endingSymbolStack" .= (x^.endingSymbolStack) + ] + toEncodingPB x = pairs + [ "startingSymbolStack" .= (x^.startingSymbolStack) + , "startingScopeStackSize" .= (x^.startingScopeStackSize) + , "from" .= (x^.from) + , "edges" .= (x^.edges) + , "to" .= (x^.to) + , "endingScopeStack" .= (x^.endingScopeStack) + , "endingSymbolStack" .= (x^.endingSymbolStack) + ] + +instance FromJSON StackGraphPath where + parseJSON = parseJSONPB + +instance ToJSON StackGraphPath where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB NodeType where + parseJSONPB (JSONPB.String "ROOT_SCOPE") = pure ROOT_SCOPE + parseJSONPB (JSONPB.String "JUMP_TO_SCOPE") = pure JUMP_TO_SCOPE + parseJSONPB (JSONPB.String "EXPORTED_SCOPE") = pure EXPORTED_SCOPE + parseJSONPB (JSONPB.String "DEFINITION") = pure DEFINITION + parseJSONPB (JSONPB.String "REFERENCE") = pure REFERENCE + parseJSONPB x = typeMismatch "NodeType" x + +instance ToJSONPB NodeType where + toJSONPB x _ = A.String . T.toUpper . T.pack $ show x + toEncodingPB x _ = E.text . T.toUpper . T.pack $ show x + +instance FromJSON NodeType where + parseJSON = parseJSONPB + +instance ToJSON NodeType where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB SyntaxType where + parseJSONPB (JSONPB.String "FUNCTION") = pure FUNCTION + parseJSONPB (JSONPB.String "METHOD") = pure METHOD + parseJSONPB (JSONPB.String "CLASS") = pure CLASS + parseJSONPB (JSONPB.String "MODULE") = pure MODULE + parseJSONPB (JSONPB.String "CALL") = pure CALL + parseJSONPB (JSONPB.String "TYPE") = pure TYPE + parseJSONPB (JSONPB.String "INTERFACE") = pure INTERFACE + parseJSONPB (JSONPB.String "IMPLEMENTATION") = pure IMPLEMENTATION + parseJSONPB x = typeMismatch "SyntaxType" x + +instance ToJSONPB SyntaxType where + toJSONPB x _ = A.String . T.toUpper . T.pack $ show x + toEncodingPB x _ = E.text . T.toUpper . T.pack $ show x + +instance FromJSON SyntaxType where + parseJSON = parseJSONPB + +instance ToJSON SyntaxType where + toJSON = toAesonValue + toEncoding = toAesonEncoding diff --git a/semantic-python/BUILD.bazel b/semantic-python/BUILD.bazel new file mode 100644 index 0000000000..fb0a60280d --- /dev/null +++ b/semantic-python/BUILD.bazel @@ -0,0 +1,38 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "//:build/common.bzl", + "semantic_language_library", + "semantic_language_parsing_test", +) +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_binary", +) + +semantic_language_library( + name = "semantic-python", + srcs = glob( + include = ["src/**/*.hs"], + exclude = [ + "src/Language/Python/Core.hs", + "src/Language/Python/Failure.hs", + "src/Language/Python/ScopeGraph.hs", + ], + ), + language = "python", +) + +semantic_language_parsing_test(language = "python") + +haskell_binary( + name = "bench", + srcs = glob(["bench/**/*.hs"]), + deps = [ + ":semantic-python", + "//:base", + "//:bytestring", + "//semantic-ast", + "@stackage//:gauge", + ], +) diff --git a/semantic-python/LICENSE b/semantic-python/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-python/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-python/README.md b/semantic-python/README.md new file mode 100644 index 0000000000..bc63a72d7a --- /dev/null +++ b/semantic-python/README.md @@ -0,0 +1,3 @@ +# Semantic support for Python + +This package implements `semantic` support for Python. diff --git a/semantic-python/Setup.hs b/semantic-python/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-python/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-python/bench/Bench.hs b/semantic-python/bench/Bench.hs new file mode 100644 index 0000000000..636c6b8914 --- /dev/null +++ b/semantic-python/bench/Bench.hs @@ -0,0 +1,20 @@ +{-# LANGUAGE TypeApplications #-} +module Main +( main +) where + +import Control.Monad +import qualified Data.ByteString as B +import Gauge +import System.Exit (die) +import System.Environment (getArgs) +import qualified Language.Python.AST as Py +import Language.Python.Grammar +import AST.Unmarshal + +main :: IO () +main = do + getArgs >>= defaultMain . map (bench <*> nfIO . (() <$) . parseFile) + +parseFile :: FilePath -> IO (Py.Module ()) +parseFile = either die pure <=< parseByteString @Py.Module @() tree_sitter_python <=< B.readFile diff --git a/semantic-python/semantic-python.cabal b/semantic-python/semantic-python.cabal new file mode 100644 index 0000000000..48a2ebe145 --- /dev/null +++ b/semantic-python/semantic-python.cabal @@ -0,0 +1,140 @@ +cabal-version: 2.4 + +name: semantic-python +version: 0.0.0.0 +synopsis: Semantic support for Python. +description: Semantic support for Python. +homepage: https://github.com/github/semantic/tree/master/semantic-python#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + cpp-options: + -DBAZEL_BUILD=0 + + +library + import: haskell + exposed-modules: + Language.Python + Language.Python.AST + -- Language.Python.Core + Language.Python.Grammar + -- Language.Python.Failure + Language.Python.Patterns + -- Language.Python.ScopeGraph + Language.Python.Tags + hs-source-dirs: src + build-depends: + , base >= 4.13 && < 5 + , fused-effects ^>= 1.1 + , semantic-analysis ^>= 0 + , semantic-ast + , semantic-proto ^>= 0 + , semantic-source ^>= 0.2 + , semantic-tags ^>= 0.0 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3 + , tree-sitter ^>= 0.9 + , tree-sitter-python ^>= 0.9.0.2 + +-- test-suite compiling +-- import: haskell +-- type: exitcode-stdio-1.0 +-- hs-source-dirs: test +-- main-is: CoreTest.hs +-- ghc-options: -threaded + + -- build-depends: semantic-python + -- , aeson ^>= 1.4.4 + -- , aeson-pretty ^>= 0.8.7 + -- , bytestring ^>= 0.10.8.2 + -- , containers ^>= 0.6 + -- , directory ^>= 1.3.3 + -- , exceptions ^>= 0.10.2 + -- , pretty-show ^>= 1.9.5 + -- , process ^>= 1.6.5 + -- , resourcet ^>= 1.2.2 + -- , semantic-analysis ^>= 0 + -- , streaming ^>= 0.2.2 + -- , streaming-process ^>= 0.1 + -- , streaming-bytestring ^>= 0.1.6 + -- , tasty ^>= 1.2.3 + -- , tasty-hunit ^>= 0.10.0.2 + -- , trifecta >= 2 && <3 + -- , unordered-containers ^>= 0.2.10 + + -- other-modules: + -- Instances + -- , Directive + +-- test-suite graphing +-- import: haskell +-- type: exitcode-stdio-1.0 +-- hs-source-dirs: test-graphing +-- main-is: GraphTest.hs +-- ghc-options: -threaded + + -- build-depends: base + -- , semantic-python + -- -- , semantic-scope-graph + -- , bytestring + -- , tasty + -- , tasty-hunit + + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: PreciseTest.hs + build-depends: + , base + , semantic-ast + , semantic-python + , tasty + , tree-sitter-python ^>= 0.9.0.2 + +executable benchmark + import: haskell + hs-source-dirs: bench + ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" + main-is: Bench.hs + build-depends: + , base + , bytestring + , gauge ^>= 0.2.5 + , semantic-ast + , semantic-python diff --git a/semantic-python/src/Language/Python.hs b/semantic-python/src/Language/Python.hs new file mode 100644 index 0000000000..c731347e17 --- /dev/null +++ b/semantic-python/src/Language/Python.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +-- | Semantic functionality for Python programs. +module Language.Python +( Term(..) +, Language.Python.Grammar.tree_sitter_python +) where + +import AST.Marshal.JSON +import qualified AST.Unmarshal as TS +import Data.Proxy +import qualified Language.Python.AST as Py +import qualified Language.Python.Grammar (tree_sitter_python) +-- import Language.Python.ScopeGraph +import qualified Language.Python.Tags as PyTags +-- import Scope.Graph.Convert +import qualified Tags.Tagging.Precise as Tags + +newtype Term a = Term { getTerm :: Py.Module a } + deriving MarshalJSON + +instance TS.SymbolMatching Term where + matchedSymbols _ = TS.matchedSymbols (Proxy :: Proxy Py.Module) + showFailure _ = TS.showFailure (Proxy :: Proxy Py.Module) + +instance TS.Unmarshal Term where + matchers = fmap (fmap (TS.hoist Term)) TS.matchers + +instance Tags.ToTags Term where + tags src = Tags.runTagging src . PyTags.tags . getTerm + +-- instance ToScopeGraph Term where +-- scopeGraph = scopeGraphModule . getTerm diff --git a/semantic-python/src/Language/Python/AST.hs b/semantic-python/src/Language/Python/AST.hs new file mode 100644 index 0000000000..6fbfc2d7e5 --- /dev/null +++ b/semantic-python/src/Language/Python/AST.hs @@ -0,0 +1,4844 @@ +-- Language definition for Python, generated by ast-generate. Do not edit! +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Language.Python.AST (module Language.Python.AST, getTestCorpusDir) where + +import qualified AST.Parse +import qualified AST.Token +import qualified AST.Traversable1.Class +import qualified AST.Unmarshal +import qualified Data.Foldable +import qualified Data.List as Data.OldList +import qualified Data.Maybe as GHC.Maybe +import qualified Data.Text.Internal +import qualified Data.Traversable +import qualified GHC.Base +import qualified GHC.Generics +import qualified GHC.Records +import qualified GHC.Show +import qualified TreeSitter.Node +import TreeSitter.Python (getTestCorpusDir) +import qualified Prelude as GHC.Classes + +debugSymbolNames :: [GHC.Base.String] +debugSymbolNames = debugSymbolNames_0 + +debugSymbolNames_0 :: [GHC.Base.String] +debugSymbolNames_0 = + [ "end", + "identifier", + "_import", + "_.", + "_from", + "___future__", + "_(", + "_)", + "_,", + "_as", + "_*", + "_print", + "_>>", + "_assert", + "_:=", + "_return", + "_del", + "_raise", + "_pass", + "_break", + "_continue", + "_if", + "_:", + "_elif", + "_else", + "_async", + "_for", + "_in", + "_while", + "_try", + "_except", + "_finally", + "_with", + "_def", + "_->", + "_=", + "_**", + "_global", + "_nonlocal", + "_exec", + "_class", + "_@", + "_not", + "_and", + "_or", + "_+", + "_-", + "_/", + "_%", + "_//", + "_|", + "_&", + "_^", + "_<<", + "_~", + "_<", + "_<=", + "_==", + "_!=", + "_>=", + "_>", + "_<>", + "_is", + "_lambda", + "_+=", + "_-=", + "_*=", + "_/=", + "_@=", + "_//=", + "_%=", + "_**=", + "_>>=", + "_<<=", + "_&=", + "_^=", + "_|=", + "_yield", + "_[", + "_]", + "ellipsis", + "_{", + "_}", + "escape_sequence", + "_not_escape_sequence", + "_format_specifier_token1", + "type_conversion", + "integer", + "float", + "true", + "false", + "none", + "_await", + "comment", + "_semicolon", + "_newline", + "_indent", + "_dedent", + "_\"", + "_string_content", + "_\"", + "module", + "_statement", + "_simple_statements", + "import_statement", + "import_prefix", + "relative_import", + "future_import_statement", + "import_from_statement", + "_import_list", + "aliased_import", + "wildcard_import", + "print_statement", + "chevron", + "assert_statement", + "expression_statement", + "named_expression", + "return_statement", + "delete_statement", + "raise_statement", + "pass_statement", + "break_statement", + "continue_statement", + "if_statement", + "elif_clause", + "else_clause", + "for_statement", + "while_statement", + "try_statement", + "except_clause", + "finally_clause", + "with_statement", + "with_item", + "function_definition", + "parameters", + "lambda_parameters", + "_parameters", + "default_parameter", + "typed_default_parameter", + "list_splat", + "dictionary_splat", + "global_statement", + "nonlocal_statement", + "exec_statement", + "class_definition", + "parenthesized_expression", + "argument_list", + "decorated_definition", + "decorator", + "block", + "variables", + "expression_list", + "dotted_name", + "_expression_within_for_in_clause", + "_expression", + "_primary_expression", + "not_operator", + "boolean_operator", + "binary_operator", + "unary_operator", + "comparison_operator", + "lambda", + "lambda", + "assignment", + "augmented_assignment", + "_right_hand_side", + "yield", + "attribute", + "subscript", + "slice", + "call", + "typed_parameter", + "type", + "keyword_argument", + "list", + "_comprehension_clauses", + "list_comprehension", + "dictionary", + "dictionary_comprehension", + "pair", + "set", + "set_comprehension", + "parenthesized_expression", + "tuple", + "generator_expression", + "for_in_clause", + "if_clause", + "conditional_expression", + "concatenated_string", + "string", + "interpolation", + "format_specifier", + "format_expression", + "await", + "_module_repeat1", + "__simple_statements_repeat1", + "_import_prefix_repeat1", + "__import_list_repeat1", + "_print_statement_repeat1", + "_assert_statement_repeat1", + "_if_statement_repeat1", + "_try_statement_repeat1", + "_with_statement_repeat1", + "__parameters_repeat1", + "_global_statement_repeat1", + "_argument_list_repeat1", + "_decorated_definition_repeat1", + "_variables_repeat1", + "_dotted_name_repeat1", + "_comparison_operator_repeat1", + "_subscript_repeat1", + "_list_repeat1", + "__comprehension_clauses_repeat1", + "_dictionary_repeat1", + "_tuple_repeat1", + "_for_in_clause_repeat1", + "_concatenated_string_repeat1", + "_string_repeat1", + "_format_specifier_repeat1" + ] + +newtype CompoundStatement a = CompoundStatement {getCompoundStatement :: ((ClassDefinition GHC.Generics.:+: DecoratedDefinition GHC.Generics.:+: ForStatement GHC.Generics.:+: FunctionDefinition GHC.Generics.:+: IfStatement GHC.Generics.:+: TryStatement GHC.Generics.:+: WhileStatement GHC.Generics.:+: WithStatement) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1. + AST.Traversable1.Class.Traversable1 a_1 + ) + +instance GHC.Records.HasField "ann" (CompoundStatement a_2) a_2 where + getField = AST.Unmarshal.gann GHC.Base.. getCompoundStatement + +deriving instance GHC.Classes.Eq a_3 => GHC.Classes.Eq (CompoundStatement a_3) + +deriving instance GHC.Classes.Ord a_4 => GHC.Classes.Ord (CompoundStatement a_4) + +deriving instance GHC.Show.Show a_5 => GHC.Show.Show (CompoundStatement a_5) + +instance AST.Unmarshal.Unmarshal CompoundStatement + +instance Data.Foldable.Foldable CompoundStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CompoundStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CompoundStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Expression a = Expression {getExpression :: ((PrimaryExpression GHC.Generics.:+: Await GHC.Generics.:+: BooleanOperator GHC.Generics.:+: ComparisonOperator GHC.Generics.:+: ConditionalExpression GHC.Generics.:+: Lambda GHC.Generics.:+: NamedExpression GHC.Generics.:+: NotOperator) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_6. + AST.Traversable1.Class.Traversable1 a_6 + ) + +instance GHC.Records.HasField "ann" (Expression a_7) a_7 where + getField = AST.Unmarshal.gann GHC.Base.. getExpression + +deriving instance GHC.Classes.Eq a_8 => GHC.Classes.Eq (Expression a_8) + +deriving instance GHC.Classes.Ord a_9 => GHC.Classes.Ord (Expression a_9) + +deriving instance GHC.Show.Show a_10 => GHC.Show.Show (Expression a_10) + +instance AST.Unmarshal.Unmarshal Expression + +instance Data.Foldable.Foldable Expression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Expression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Expression where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Parameter a = Parameter {getParameter :: ((DefaultParameter GHC.Generics.:+: DictionarySplat GHC.Generics.:+: Identifier GHC.Generics.:+: ListSplat GHC.Generics.:+: Tuple GHC.Generics.:+: TypedDefaultParameter GHC.Generics.:+: TypedParameter) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_11. + AST.Traversable1.Class.Traversable1 a_11 + ) + +instance GHC.Records.HasField "ann" (Parameter a_12) a_12 where + getField = AST.Unmarshal.gann GHC.Base.. getParameter + +deriving instance GHC.Classes.Eq a_13 => GHC.Classes.Eq (Parameter a_13) + +deriving instance GHC.Classes.Ord a_14 => GHC.Classes.Ord (Parameter a_14) + +deriving instance GHC.Show.Show a_15 => GHC.Show.Show (Parameter a_15) + +instance AST.Unmarshal.Unmarshal Parameter + +instance Data.Foldable.Foldable Parameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Parameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Parameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype PrimaryExpression a = PrimaryExpression {getPrimaryExpression :: ((Attribute GHC.Generics.:+: BinaryOperator GHC.Generics.:+: Call GHC.Generics.:+: ConcatenatedString GHC.Generics.:+: Dictionary GHC.Generics.:+: DictionaryComprehension GHC.Generics.:+: Ellipsis GHC.Generics.:+: False GHC.Generics.:+: Float GHC.Generics.:+: GeneratorExpression GHC.Generics.:+: Identifier GHC.Generics.:+: Integer GHC.Generics.:+: List GHC.Generics.:+: ListComprehension GHC.Generics.:+: None GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: Set GHC.Generics.:+: SetComprehension GHC.Generics.:+: String GHC.Generics.:+: Subscript GHC.Generics.:+: True GHC.Generics.:+: Tuple GHC.Generics.:+: UnaryOperator) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_16. + AST.Traversable1.Class.Traversable1 a_16 + ) + +instance GHC.Records.HasField "ann" (PrimaryExpression a_17) a_17 where + getField = AST.Unmarshal.gann GHC.Base.. getPrimaryExpression + +deriving instance GHC.Classes.Eq a_18 => GHC.Classes.Eq (PrimaryExpression a_18) + +deriving instance GHC.Classes.Ord a_19 => GHC.Classes.Ord (PrimaryExpression a_19) + +deriving instance GHC.Show.Show a_20 => GHC.Show.Show (PrimaryExpression a_20) + +instance AST.Unmarshal.Unmarshal PrimaryExpression + +instance Data.Foldable.Foldable PrimaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PrimaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PrimaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype SimpleStatement a = SimpleStatement {getSimpleStatement :: ((AssertStatement GHC.Generics.:+: BreakStatement GHC.Generics.:+: ContinueStatement GHC.Generics.:+: DeleteStatement GHC.Generics.:+: ExecStatement GHC.Generics.:+: ExpressionStatement GHC.Generics.:+: FutureImportStatement GHC.Generics.:+: GlobalStatement GHC.Generics.:+: ImportFromStatement GHC.Generics.:+: ImportStatement GHC.Generics.:+: NonlocalStatement GHC.Generics.:+: PassStatement GHC.Generics.:+: PrintStatement GHC.Generics.:+: RaiseStatement GHC.Generics.:+: ReturnStatement) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_21. + AST.Traversable1.Class.Traversable1 a_21 + ) + +instance GHC.Records.HasField "ann" (SimpleStatement a_22) a_22 where + getField = AST.Unmarshal.gann GHC.Base.. getSimpleStatement + +deriving instance GHC.Classes.Eq a_23 => GHC.Classes.Eq (SimpleStatement a_23) + +deriving instance GHC.Classes.Ord a_24 => GHC.Classes.Ord (SimpleStatement a_24) + +deriving instance GHC.Show.Show a_25 => GHC.Show.Show (SimpleStatement a_25) + +instance AST.Unmarshal.Unmarshal SimpleStatement + +instance Data.Foldable.Foldable SimpleStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SimpleStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SimpleStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AliasedImport a = AliasedImport + { ann :: a, + alias :: (AST.Parse.Err (Identifier a)), + name :: (AST.Parse.Err (DottedName a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_26. + AST.Traversable1.Class.Traversable1 a_26 + ) + +instance AST.Unmarshal.SymbolMatching AliasedImport where + matchedSymbols _ = [110] + showFailure _ node_27 = + "expected " + GHC.Base.<> ( "aliased_import" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_27 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_27) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_28 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_29 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_30 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_31 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_28 + c1_29 = TreeSitter.Node.nodeStartPoint node_27 + TreeSitter.Node.TSPoint + r2_30 + c2_31 = TreeSitter.Node.nodeEndPoint node_27 + +deriving instance GHC.Classes.Eq a_32 => GHC.Classes.Eq (AliasedImport a_32) + +deriving instance GHC.Classes.Ord a_33 => GHC.Classes.Ord (AliasedImport a_33) + +deriving instance GHC.Show.Show a_34 => GHC.Show.Show (AliasedImport a_34) + +instance AST.Unmarshal.Unmarshal AliasedImport + +instance Data.Foldable.Foldable AliasedImport where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AliasedImport where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AliasedImport where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArgumentList a = ArgumentList + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: DictionarySplat GHC.Generics.:+: KeywordArgument GHC.Generics.:+: ListSplat GHC.Generics.:+: ParenthesizedExpression) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_35. + AST.Traversable1.Class.Traversable1 a_35 + ) + +instance AST.Unmarshal.SymbolMatching ArgumentList where + matchedSymbols _ = [146] + showFailure _ node_36 = + "expected " + GHC.Base.<> ( "argument_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_36 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_36) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_37 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_38 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_39 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_40 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_37 + c1_38 = TreeSitter.Node.nodeStartPoint node_36 + TreeSitter.Node.TSPoint + r2_39 + c2_40 = TreeSitter.Node.nodeEndPoint node_36 + +deriving instance GHC.Classes.Eq a_41 => GHC.Classes.Eq (ArgumentList a_41) + +deriving instance GHC.Classes.Ord a_42 => GHC.Classes.Ord (ArgumentList a_42) + +deriving instance GHC.Show.Show a_43 => GHC.Show.Show (ArgumentList a_43) + +instance AST.Unmarshal.Unmarshal ArgumentList + +instance Data.Foldable.Foldable ArgumentList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArgumentList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArgumentList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AssertStatement a = AssertStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_44. + AST.Traversable1.Class.Traversable1 a_44 + ) + +instance AST.Unmarshal.SymbolMatching AssertStatement where + matchedSymbols _ = [114] + showFailure _ node_45 = + "expected " + GHC.Base.<> ( "assert_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_45 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_45) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_46 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_47 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_48 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_49 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_46 + c1_47 = TreeSitter.Node.nodeStartPoint node_45 + TreeSitter.Node.TSPoint + r2_48 + c2_49 = TreeSitter.Node.nodeEndPoint node_45 + +deriving instance GHC.Classes.Eq a_50 => GHC.Classes.Eq (AssertStatement a_50) + +deriving instance GHC.Classes.Ord a_51 => GHC.Classes.Ord (AssertStatement a_51) + +deriving instance GHC.Show.Show a_52 => GHC.Show.Show (AssertStatement a_52) + +instance AST.Unmarshal.Unmarshal AssertStatement + +instance Data.Foldable.Foldable AssertStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AssertStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AssertStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Assignment a = Assignment + { ann :: a, + left :: (AST.Parse.Err (ExpressionList a)), + right :: (GHC.Maybe.Maybe (AST.Parse.Err ((Assignment GHC.Generics.:+: AugmentedAssignment GHC.Generics.:+: ExpressionList GHC.Generics.:+: Yield) a))), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (Type a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_53. + AST.Traversable1.Class.Traversable1 a_53 + ) + +instance AST.Unmarshal.SymbolMatching Assignment where + matchedSymbols _ = [163] + showFailure _ node_54 = + "expected " + GHC.Base.<> ( "assignment" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_54 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_54) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_55 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_56 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_57 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_58 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_55 + c1_56 = TreeSitter.Node.nodeStartPoint node_54 + TreeSitter.Node.TSPoint + r2_57 + c2_58 = TreeSitter.Node.nodeEndPoint node_54 + +deriving instance GHC.Classes.Eq a_59 => GHC.Classes.Eq (Assignment a_59) + +deriving instance GHC.Classes.Ord a_60 => GHC.Classes.Ord (Assignment a_60) + +deriving instance GHC.Show.Show a_61 => GHC.Show.Show (Assignment a_61) + +instance AST.Unmarshal.Unmarshal Assignment + +instance Data.Foldable.Foldable Assignment where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Assignment where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Assignment where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Attribute a = Attribute + { ann :: a, + attribute :: (AST.Parse.Err (Identifier a)), + object :: (AST.Parse.Err (PrimaryExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_62. + AST.Traversable1.Class.Traversable1 a_62 + ) + +instance AST.Unmarshal.SymbolMatching Attribute where + matchedSymbols _ = [167] + showFailure _ node_63 = + "expected " + GHC.Base.<> ( "attribute" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_63 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_63) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_64 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_65 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_66 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_67 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_64 + c1_65 = TreeSitter.Node.nodeStartPoint node_63 + TreeSitter.Node.TSPoint + r2_66 + c2_67 = TreeSitter.Node.nodeEndPoint node_63 + +deriving instance GHC.Classes.Eq a_68 => GHC.Classes.Eq (Attribute a_68) + +deriving instance GHC.Classes.Ord a_69 => GHC.Classes.Ord (Attribute a_69) + +deriving instance GHC.Show.Show a_70 => GHC.Show.Show (Attribute a_70) + +instance AST.Unmarshal.Unmarshal Attribute + +instance Data.Foldable.Foldable Attribute where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Attribute where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Attribute where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AugmentedAssignment a = AugmentedAssignment + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousPercentEqual GHC.Generics.:+: AnonymousAmpersandEqual GHC.Generics.:+: AnonymousStarStarEqual GHC.Generics.:+: AnonymousStarEqual GHC.Generics.:+: AnonymousPlusEqual GHC.Generics.:+: AnonymousMinusEqual GHC.Generics.:+: AnonymousSlashSlashEqual GHC.Generics.:+: AnonymousSlashEqual GHC.Generics.:+: AnonymousLAngleLAngleEqual GHC.Generics.:+: AnonymousRAngleRAngleEqual GHC.Generics.:+: AnonymousAtEqual GHC.Generics.:+: AnonymousCaretEqual GHC.Generics.:+: AnonymousPipeEqual) a)), + left :: (AST.Parse.Err (ExpressionList a)), + right :: (AST.Parse.Err ((Assignment GHC.Generics.:+: AugmentedAssignment GHC.Generics.:+: ExpressionList GHC.Generics.:+: Yield) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_71. + AST.Traversable1.Class.Traversable1 a_71 + ) + +instance AST.Unmarshal.SymbolMatching AugmentedAssignment where + matchedSymbols _ = [164] + showFailure _ node_72 = + "expected " + GHC.Base.<> ( "augmented_assignment" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_72 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_72) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_73 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_74 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_75 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_76 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_73 + c1_74 = TreeSitter.Node.nodeStartPoint node_72 + TreeSitter.Node.TSPoint + r2_75 + c2_76 = TreeSitter.Node.nodeEndPoint node_72 + +deriving instance GHC.Classes.Eq a_77 => GHC.Classes.Eq (AugmentedAssignment a_77) + +deriving instance GHC.Classes.Ord a_78 => GHC.Classes.Ord (AugmentedAssignment a_78) + +deriving instance GHC.Show.Show a_79 => GHC.Show.Show (AugmentedAssignment a_79) + +instance AST.Unmarshal.Unmarshal AugmentedAssignment + +instance Data.Foldable.Foldable AugmentedAssignment where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AugmentedAssignment where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AugmentedAssignment where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Await a = Await {ann :: a, extraChildren :: (AST.Parse.Err (Expression a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_80. + AST.Traversable1.Class.Traversable1 a_80 + ) + +instance AST.Unmarshal.SymbolMatching Await where + matchedSymbols _ = [193] + showFailure _ node_81 = + "expected " + GHC.Base.<> ( "await" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_81 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_81) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_82 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_83 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_84 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_85 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_82 + c1_83 = TreeSitter.Node.nodeStartPoint node_81 + TreeSitter.Node.TSPoint + r2_84 + c2_85 = TreeSitter.Node.nodeEndPoint node_81 + +deriving instance GHC.Classes.Eq a_86 => GHC.Classes.Eq (Await a_86) + +deriving instance GHC.Classes.Ord a_87 => GHC.Classes.Ord (Await a_87) + +deriving instance GHC.Show.Show a_88 => GHC.Show.Show (Await a_88) + +instance AST.Unmarshal.Unmarshal Await + +instance Data.Foldable.Foldable Await where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Await where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Await where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BinaryOperator a = BinaryOperator + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousPercent GHC.Generics.:+: AnonymousAmpersand GHC.Generics.:+: AnonymousStar GHC.Generics.:+: AnonymousStarStar GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousSlash GHC.Generics.:+: AnonymousSlashSlash GHC.Generics.:+: AnonymousLAngleLAngle GHC.Generics.:+: AnonymousRAngleRAngle GHC.Generics.:+: AnonymousAt GHC.Generics.:+: AnonymousCaret GHC.Generics.:+: AnonymousPipe) a)), + left :: (AST.Parse.Err (PrimaryExpression a)), + right :: (AST.Parse.Err (PrimaryExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_89. + AST.Traversable1.Class.Traversable1 a_89 + ) + +instance AST.Unmarshal.SymbolMatching BinaryOperator where + matchedSymbols _ = [158] + showFailure _ node_90 = + "expected " + GHC.Base.<> ( "binary_operator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_90 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_90) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_91 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_92 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_93 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_94 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_91 + c1_92 = TreeSitter.Node.nodeStartPoint node_90 + TreeSitter.Node.TSPoint + r2_93 + c2_94 = TreeSitter.Node.nodeEndPoint node_90 + +deriving instance GHC.Classes.Eq a_95 => GHC.Classes.Eq (BinaryOperator a_95) + +deriving instance GHC.Classes.Ord a_96 => GHC.Classes.Ord (BinaryOperator a_96) + +deriving instance GHC.Show.Show a_97 => GHC.Show.Show (BinaryOperator a_97) + +instance AST.Unmarshal.Unmarshal BinaryOperator + +instance Data.Foldable.Foldable BinaryOperator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BinaryOperator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BinaryOperator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Block a = Block + { ann :: a, + extraChildren :: ([AST.Parse.Err ((CompoundStatement GHC.Generics.:+: SimpleStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_98. + AST.Traversable1.Class.Traversable1 a_98 + ) + +instance AST.Unmarshal.SymbolMatching Block where + matchedSymbols _ = [149] + showFailure _ node_99 = + "expected " + GHC.Base.<> ( "block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_99 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_99) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_100 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_101 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_102 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_103 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_100 + c1_101 = TreeSitter.Node.nodeStartPoint node_99 + TreeSitter.Node.TSPoint + r2_102 + c2_103 = TreeSitter.Node.nodeEndPoint node_99 + +deriving instance GHC.Classes.Eq a_104 => GHC.Classes.Eq (Block a_104) + +deriving instance GHC.Classes.Ord a_105 => GHC.Classes.Ord (Block a_105) + +deriving instance GHC.Show.Show a_106 => GHC.Show.Show (Block a_106) + +instance AST.Unmarshal.Unmarshal Block + +instance Data.Foldable.Foldable Block where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Block where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Block where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BooleanOperator a = BooleanOperator + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousAnd GHC.Generics.:+: AnonymousOr) a)), + left :: (AST.Parse.Err (Expression a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_107. + AST.Traversable1.Class.Traversable1 a_107 + ) + +instance AST.Unmarshal.SymbolMatching BooleanOperator where + matchedSymbols _ = [157] + showFailure _ node_108 = + "expected " + GHC.Base.<> ( "boolean_operator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_108 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_108) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_109 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_110 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_111 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_112 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_109 + c1_110 = TreeSitter.Node.nodeStartPoint node_108 + TreeSitter.Node.TSPoint + r2_111 + c2_112 = TreeSitter.Node.nodeEndPoint node_108 + +deriving instance GHC.Classes.Eq a_113 => GHC.Classes.Eq (BooleanOperator a_113) + +deriving instance GHC.Classes.Ord a_114 => GHC.Classes.Ord (BooleanOperator a_114) + +deriving instance GHC.Show.Show a_115 => GHC.Show.Show (BooleanOperator a_115) + +instance AST.Unmarshal.Unmarshal BooleanOperator + +instance Data.Foldable.Foldable BooleanOperator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BooleanOperator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BooleanOperator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BreakStatement a = BreakStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_116. + AST.Traversable1.Class.Traversable1 a_116 + ) + +instance AST.Unmarshal.SymbolMatching BreakStatement where + matchedSymbols _ = [121] + showFailure _ node_117 = + "expected " + GHC.Base.<> ( "break_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_117 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_117) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_118 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_119 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_120 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_121 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_118 + c1_119 = TreeSitter.Node.nodeStartPoint node_117 + TreeSitter.Node.TSPoint + r2_120 + c2_121 = TreeSitter.Node.nodeEndPoint node_117 + +deriving instance GHC.Classes.Eq a_122 => GHC.Classes.Eq (BreakStatement a_122) + +deriving instance GHC.Classes.Ord a_123 => GHC.Classes.Ord (BreakStatement a_123) + +deriving instance GHC.Show.Show a_124 => GHC.Show.Show (BreakStatement a_124) + +instance AST.Unmarshal.Unmarshal BreakStatement + +instance Data.Foldable.Foldable BreakStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BreakStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BreakStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Call a = Call + { ann :: a, + function :: (AST.Parse.Err (PrimaryExpression a)), + arguments :: (AST.Parse.Err ((ArgumentList GHC.Generics.:+: GeneratorExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_125. + AST.Traversable1.Class.Traversable1 a_125 + ) + +instance AST.Unmarshal.SymbolMatching Call where + matchedSymbols _ = [170] + showFailure _ node_126 = + "expected " + GHC.Base.<> ( "call" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_126 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_126) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_127 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_128 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_129 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_130 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_127 + c1_128 = TreeSitter.Node.nodeStartPoint node_126 + TreeSitter.Node.TSPoint + r2_129 + c2_130 = TreeSitter.Node.nodeEndPoint node_126 + +deriving instance GHC.Classes.Eq a_131 => GHC.Classes.Eq (Call a_131) + +deriving instance GHC.Classes.Ord a_132 => GHC.Classes.Ord (Call a_132) + +deriving instance GHC.Show.Show a_133 => GHC.Show.Show (Call a_133) + +instance AST.Unmarshal.Unmarshal Call + +instance Data.Foldable.Foldable Call where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Call where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Call where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Chevron a = Chevron + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_134. + AST.Traversable1.Class.Traversable1 a_134 + ) + +instance AST.Unmarshal.SymbolMatching Chevron where + matchedSymbols _ = [113] + showFailure _ node_135 = + "expected " + GHC.Base.<> ( "chevron" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_135 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_135) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_136 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_137 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_138 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_139 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_136 + c1_137 = TreeSitter.Node.nodeStartPoint node_135 + TreeSitter.Node.TSPoint + r2_138 + c2_139 = TreeSitter.Node.nodeEndPoint node_135 + +deriving instance GHC.Classes.Eq a_140 => GHC.Classes.Eq (Chevron a_140) + +deriving instance GHC.Classes.Ord a_141 => GHC.Classes.Ord (Chevron a_141) + +deriving instance GHC.Show.Show a_142 => GHC.Show.Show (Chevron a_142) + +instance AST.Unmarshal.Unmarshal Chevron + +instance Data.Foldable.Foldable Chevron where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Chevron where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Chevron where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassDefinition a = ClassDefinition + { ann :: a, + body :: (AST.Parse.Err (Block a)), + superclasses :: (GHC.Maybe.Maybe (AST.Parse.Err (ArgumentList a))), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_143. + AST.Traversable1.Class.Traversable1 a_143 + ) + +instance AST.Unmarshal.SymbolMatching ClassDefinition where + matchedSymbols _ = [144] + showFailure _ node_144 = + "expected " + GHC.Base.<> ( "class_definition" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_144 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_144) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_145 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_146 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_147 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_148 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_145 + c1_146 = TreeSitter.Node.nodeStartPoint node_144 + TreeSitter.Node.TSPoint + r2_147 + c2_148 = TreeSitter.Node.nodeEndPoint node_144 + +deriving instance GHC.Classes.Eq a_149 => GHC.Classes.Eq (ClassDefinition a_149) + +deriving instance GHC.Classes.Ord a_150 => GHC.Classes.Ord (ClassDefinition a_150) + +deriving instance GHC.Show.Show a_151 => GHC.Show.Show (ClassDefinition a_151) + +instance AST.Unmarshal.Unmarshal ClassDefinition + +instance Data.Foldable.Foldable ClassDefinition where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassDefinition where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassDefinition where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ComparisonOperator a = ComparisonOperator + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (PrimaryExpression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_152. + AST.Traversable1.Class.Traversable1 a_152 + ) + +instance AST.Unmarshal.SymbolMatching ComparisonOperator where + matchedSymbols _ = [160] + showFailure _ node_153 = + "expected " + GHC.Base.<> ( "comparison_operator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_153 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_153) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_154 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_155 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_156 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_157 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_154 + c1_155 = TreeSitter.Node.nodeStartPoint node_153 + TreeSitter.Node.TSPoint + r2_156 + c2_157 = TreeSitter.Node.nodeEndPoint node_153 + +deriving instance GHC.Classes.Eq a_158 => GHC.Classes.Eq (ComparisonOperator a_158) + +deriving instance GHC.Classes.Ord a_159 => GHC.Classes.Ord (ComparisonOperator a_159) + +deriving instance GHC.Show.Show a_160 => GHC.Show.Show (ComparisonOperator a_160) + +instance AST.Unmarshal.Unmarshal ComparisonOperator + +instance Data.Foldable.Foldable ComparisonOperator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ComparisonOperator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ComparisonOperator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConcatenatedString a = ConcatenatedString + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (String a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_161. + AST.Traversable1.Class.Traversable1 a_161 + ) + +instance AST.Unmarshal.SymbolMatching ConcatenatedString where + matchedSymbols _ = [188] + showFailure _ node_162 = + "expected " + GHC.Base.<> ( "concatenated_string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_162 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_162) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_163 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_164 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_165 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_166 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_163 + c1_164 = TreeSitter.Node.nodeStartPoint node_162 + TreeSitter.Node.TSPoint + r2_165 + c2_166 = TreeSitter.Node.nodeEndPoint node_162 + +deriving instance GHC.Classes.Eq a_167 => GHC.Classes.Eq (ConcatenatedString a_167) + +deriving instance GHC.Classes.Ord a_168 => GHC.Classes.Ord (ConcatenatedString a_168) + +deriving instance GHC.Show.Show a_169 => GHC.Show.Show (ConcatenatedString a_169) + +instance AST.Unmarshal.Unmarshal ConcatenatedString + +instance Data.Foldable.Foldable ConcatenatedString where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConcatenatedString where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConcatenatedString where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConditionalExpression a = ConditionalExpression + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_170. + AST.Traversable1.Class.Traversable1 a_170 + ) + +instance AST.Unmarshal.SymbolMatching ConditionalExpression where + matchedSymbols _ = [187] + showFailure _ node_171 = + "expected " + GHC.Base.<> ( "conditional_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_171 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_171) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_172 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_173 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_174 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_175 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_172 + c1_173 = TreeSitter.Node.nodeStartPoint node_171 + TreeSitter.Node.TSPoint + r2_174 + c2_175 = TreeSitter.Node.nodeEndPoint node_171 + +deriving instance GHC.Classes.Eq a_176 => GHC.Classes.Eq (ConditionalExpression a_176) + +deriving instance GHC.Classes.Ord a_177 => GHC.Classes.Ord (ConditionalExpression a_177) + +deriving instance GHC.Show.Show a_178 => GHC.Show.Show (ConditionalExpression a_178) + +instance AST.Unmarshal.Unmarshal ConditionalExpression + +instance Data.Foldable.Foldable ConditionalExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConditionalExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConditionalExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ContinueStatement a = ContinueStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_179. + AST.Traversable1.Class.Traversable1 a_179 + ) + +instance AST.Unmarshal.SymbolMatching ContinueStatement where + matchedSymbols _ = [122] + showFailure _ node_180 = + "expected " + GHC.Base.<> ( "continue_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_180 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_180) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_181 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_182 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_183 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_184 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_181 + c1_182 = TreeSitter.Node.nodeStartPoint node_180 + TreeSitter.Node.TSPoint + r2_183 + c2_184 = TreeSitter.Node.nodeEndPoint node_180 + +deriving instance GHC.Classes.Eq a_185 => GHC.Classes.Eq (ContinueStatement a_185) + +deriving instance GHC.Classes.Ord a_186 => GHC.Classes.Ord (ContinueStatement a_186) + +deriving instance GHC.Show.Show a_187 => GHC.Show.Show (ContinueStatement a_187) + +instance AST.Unmarshal.Unmarshal ContinueStatement + +instance Data.Foldable.Foldable ContinueStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ContinueStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ContinueStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DecoratedDefinition a = DecoratedDefinition + { ann :: a, + definition :: (AST.Parse.Err ((ClassDefinition GHC.Generics.:+: FunctionDefinition) a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Decorator a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_188. + AST.Traversable1.Class.Traversable1 a_188 + ) + +instance AST.Unmarshal.SymbolMatching DecoratedDefinition where + matchedSymbols _ = [147] + showFailure _ node_189 = + "expected " + GHC.Base.<> ( "decorated_definition" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_189 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_189) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_190 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_191 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_192 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_193 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_190 + c1_191 = TreeSitter.Node.nodeStartPoint node_189 + TreeSitter.Node.TSPoint + r2_192 + c2_193 = TreeSitter.Node.nodeEndPoint node_189 + +deriving instance GHC.Classes.Eq a_194 => GHC.Classes.Eq (DecoratedDefinition a_194) + +deriving instance GHC.Classes.Ord a_195 => GHC.Classes.Ord (DecoratedDefinition a_195) + +deriving instance GHC.Show.Show a_196 => GHC.Show.Show (DecoratedDefinition a_196) + +instance AST.Unmarshal.Unmarshal DecoratedDefinition + +instance Data.Foldable.Foldable DecoratedDefinition where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DecoratedDefinition where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DecoratedDefinition where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Decorator a = Decorator + { ann :: a, + arguments :: (GHC.Maybe.Maybe (AST.Parse.Err (ArgumentList a))), + extraChildren :: (AST.Parse.Err (DottedName a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_197. + AST.Traversable1.Class.Traversable1 a_197 + ) + +instance AST.Unmarshal.SymbolMatching Decorator where + matchedSymbols _ = [148] + showFailure _ node_198 = + "expected " + GHC.Base.<> ( "decorator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_198 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_198) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_199 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_200 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_201 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_202 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_199 + c1_200 = TreeSitter.Node.nodeStartPoint node_198 + TreeSitter.Node.TSPoint + r2_201 + c2_202 = TreeSitter.Node.nodeEndPoint node_198 + +deriving instance GHC.Classes.Eq a_203 => GHC.Classes.Eq (Decorator a_203) + +deriving instance GHC.Classes.Ord a_204 => GHC.Classes.Ord (Decorator a_204) + +deriving instance GHC.Show.Show a_205 => GHC.Show.Show (Decorator a_205) + +instance AST.Unmarshal.Unmarshal Decorator + +instance Data.Foldable.Foldable Decorator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Decorator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Decorator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DefaultParameter a = DefaultParameter + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_206. + AST.Traversable1.Class.Traversable1 a_206 + ) + +instance AST.Unmarshal.SymbolMatching DefaultParameter where + matchedSymbols _ = [137] + showFailure _ node_207 = + "expected " + GHC.Base.<> ( "default_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_207 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_207) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_208 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_209 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_210 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_211 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_208 + c1_209 = TreeSitter.Node.nodeStartPoint node_207 + TreeSitter.Node.TSPoint + r2_210 + c2_211 = TreeSitter.Node.nodeEndPoint node_207 + +deriving instance GHC.Classes.Eq a_212 => GHC.Classes.Eq (DefaultParameter a_212) + +deriving instance GHC.Classes.Ord a_213 => GHC.Classes.Ord (DefaultParameter a_213) + +deriving instance GHC.Show.Show a_214 => GHC.Show.Show (DefaultParameter a_214) + +instance AST.Unmarshal.Unmarshal DefaultParameter + +instance Data.Foldable.Foldable DefaultParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DefaultParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DefaultParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DeleteStatement a = DeleteStatement + { ann :: a, + extraChildren :: (AST.Parse.Err (ExpressionList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_215. + AST.Traversable1.Class.Traversable1 a_215 + ) + +instance AST.Unmarshal.SymbolMatching DeleteStatement where + matchedSymbols _ = [118] + showFailure _ node_216 = + "expected " + GHC.Base.<> ( "delete_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_216 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_216) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_217 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_218 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_219 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_220 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_217 + c1_218 = TreeSitter.Node.nodeStartPoint node_216 + TreeSitter.Node.TSPoint + r2_219 + c2_220 = TreeSitter.Node.nodeEndPoint node_216 + +deriving instance GHC.Classes.Eq a_221 => GHC.Classes.Eq (DeleteStatement a_221) + +deriving instance GHC.Classes.Ord a_222 => GHC.Classes.Ord (DeleteStatement a_222) + +deriving instance GHC.Show.Show a_223 => GHC.Show.Show (DeleteStatement a_223) + +instance AST.Unmarshal.Unmarshal DeleteStatement + +instance Data.Foldable.Foldable DeleteStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DeleteStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DeleteStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Dictionary a = Dictionary + { ann :: a, + extraChildren :: ([AST.Parse.Err ((DictionarySplat GHC.Generics.:+: Pair) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_224. + AST.Traversable1.Class.Traversable1 a_224 + ) + +instance AST.Unmarshal.SymbolMatching Dictionary where + matchedSymbols _ = [177] + showFailure _ node_225 = + "expected " + GHC.Base.<> ( "dictionary" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_225 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_225) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_226 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_227 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_228 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_229 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_226 + c1_227 = TreeSitter.Node.nodeStartPoint node_225 + TreeSitter.Node.TSPoint + r2_228 + c2_229 = TreeSitter.Node.nodeEndPoint node_225 + +deriving instance GHC.Classes.Eq a_230 => GHC.Classes.Eq (Dictionary a_230) + +deriving instance GHC.Classes.Ord a_231 => GHC.Classes.Ord (Dictionary a_231) + +deriving instance GHC.Show.Show a_232 => GHC.Show.Show (Dictionary a_232) + +instance AST.Unmarshal.Unmarshal Dictionary + +instance Data.Foldable.Foldable Dictionary where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Dictionary where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Dictionary where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DictionaryComprehension a = DictionaryComprehension + { ann :: a, + body :: (AST.Parse.Err (Pair a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ForInClause GHC.Generics.:+: IfClause) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_233. + AST.Traversable1.Class.Traversable1 a_233 + ) + +instance AST.Unmarshal.SymbolMatching DictionaryComprehension where + matchedSymbols _ = [178] + showFailure _ node_234 = + "expected " + GHC.Base.<> ( "dictionary_comprehension" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_234 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_234) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_235 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_236 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_237 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_238 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_235 + c1_236 = TreeSitter.Node.nodeStartPoint node_234 + TreeSitter.Node.TSPoint + r2_237 + c2_238 = TreeSitter.Node.nodeEndPoint node_234 + +deriving instance GHC.Classes.Eq a_239 => GHC.Classes.Eq (DictionaryComprehension a_239) + +deriving instance GHC.Classes.Ord a_240 => GHC.Classes.Ord (DictionaryComprehension a_240) + +deriving instance GHC.Show.Show a_241 => GHC.Show.Show (DictionaryComprehension a_241) + +instance AST.Unmarshal.Unmarshal DictionaryComprehension + +instance Data.Foldable.Foldable DictionaryComprehension where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DictionaryComprehension where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DictionaryComprehension where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DictionarySplat a = DictionarySplat + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_242. + AST.Traversable1.Class.Traversable1 a_242 + ) + +instance AST.Unmarshal.SymbolMatching DictionarySplat where + matchedSymbols _ = [140] + showFailure _ node_243 = + "expected " + GHC.Base.<> ( "dictionary_splat" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_243 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_243) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_244 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_245 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_246 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_247 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_244 + c1_245 = TreeSitter.Node.nodeStartPoint node_243 + TreeSitter.Node.TSPoint + r2_246 + c2_247 = TreeSitter.Node.nodeEndPoint node_243 + +deriving instance GHC.Classes.Eq a_248 => GHC.Classes.Eq (DictionarySplat a_248) + +deriving instance GHC.Classes.Ord a_249 => GHC.Classes.Ord (DictionarySplat a_249) + +deriving instance GHC.Show.Show a_250 => GHC.Show.Show (DictionarySplat a_250) + +instance AST.Unmarshal.Unmarshal DictionarySplat + +instance Data.Foldable.Foldable DictionarySplat where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DictionarySplat where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DictionarySplat where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DottedName a = DottedName + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_251. + AST.Traversable1.Class.Traversable1 a_251 + ) + +instance AST.Unmarshal.SymbolMatching DottedName where + matchedSymbols _ = [152] + showFailure _ node_252 = + "expected " + GHC.Base.<> ( "dotted_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_252 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_252) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_253 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_254 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_255 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_256 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_253 + c1_254 = TreeSitter.Node.nodeStartPoint node_252 + TreeSitter.Node.TSPoint + r2_255 + c2_256 = TreeSitter.Node.nodeEndPoint node_252 + +deriving instance GHC.Classes.Eq a_257 => GHC.Classes.Eq (DottedName a_257) + +deriving instance GHC.Classes.Ord a_258 => GHC.Classes.Ord (DottedName a_258) + +deriving instance GHC.Show.Show a_259 => GHC.Show.Show (DottedName a_259) + +instance AST.Unmarshal.Unmarshal DottedName + +instance Data.Foldable.Foldable DottedName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DottedName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DottedName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ElifClause a = ElifClause + { ann :: a, + consequence :: (AST.Parse.Err (Block a)), + condition :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_260. + AST.Traversable1.Class.Traversable1 a_260 + ) + +instance AST.Unmarshal.SymbolMatching ElifClause where + matchedSymbols _ = [124] + showFailure _ node_261 = + "expected " + GHC.Base.<> ( "elif_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_261 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_261) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_262 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_263 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_264 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_265 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_262 + c1_263 = TreeSitter.Node.nodeStartPoint node_261 + TreeSitter.Node.TSPoint + r2_264 + c2_265 = TreeSitter.Node.nodeEndPoint node_261 + +deriving instance GHC.Classes.Eq a_266 => GHC.Classes.Eq (ElifClause a_266) + +deriving instance GHC.Classes.Ord a_267 => GHC.Classes.Ord (ElifClause a_267) + +deriving instance GHC.Show.Show a_268 => GHC.Show.Show (ElifClause a_268) + +instance AST.Unmarshal.Unmarshal ElifClause + +instance Data.Foldable.Foldable ElifClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ElifClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ElifClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ElseClause a = ElseClause {ann :: a, body :: (AST.Parse.Err (Block a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_269. + AST.Traversable1.Class.Traversable1 a_269 + ) + +instance AST.Unmarshal.SymbolMatching ElseClause where + matchedSymbols _ = [125] + showFailure _ node_270 = + "expected " + GHC.Base.<> ( "else_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_270 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_270) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_271 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_272 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_273 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_274 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_271 + c1_272 = TreeSitter.Node.nodeStartPoint node_270 + TreeSitter.Node.TSPoint + r2_273 + c2_274 = TreeSitter.Node.nodeEndPoint node_270 + +deriving instance GHC.Classes.Eq a_275 => GHC.Classes.Eq (ElseClause a_275) + +deriving instance GHC.Classes.Ord a_276 => GHC.Classes.Ord (ElseClause a_276) + +deriving instance GHC.Show.Show a_277 => GHC.Show.Show (ElseClause a_277) + +instance AST.Unmarshal.Unmarshal ElseClause + +instance Data.Foldable.Foldable ElseClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ElseClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ElseClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExceptClause a = ExceptClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: Block) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_278. + AST.Traversable1.Class.Traversable1 a_278 + ) + +instance AST.Unmarshal.SymbolMatching ExceptClause where + matchedSymbols _ = [129] + showFailure _ node_279 = + "expected " + GHC.Base.<> ( "except_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_279 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_279) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_280 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_281 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_282 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_283 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_280 + c1_281 = TreeSitter.Node.nodeStartPoint node_279 + TreeSitter.Node.TSPoint + r2_282 + c2_283 = TreeSitter.Node.nodeEndPoint node_279 + +deriving instance GHC.Classes.Eq a_284 => GHC.Classes.Eq (ExceptClause a_284) + +deriving instance GHC.Classes.Ord a_285 => GHC.Classes.Ord (ExceptClause a_285) + +deriving instance GHC.Show.Show a_286 => GHC.Show.Show (ExceptClause a_286) + +instance AST.Unmarshal.Unmarshal ExceptClause + +instance Data.Foldable.Foldable ExceptClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExceptClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExceptClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExecStatement a = ExecStatement + { ann :: a, + code :: (AST.Parse.Err (String a)), + extraChildren :: ([AST.Parse.Err (Expression a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_287. + AST.Traversable1.Class.Traversable1 a_287 + ) + +instance AST.Unmarshal.SymbolMatching ExecStatement where + matchedSymbols _ = [143] + showFailure _ node_288 = + "expected " + GHC.Base.<> ( "exec_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_288 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_288) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_289 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_290 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_291 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_292 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_289 + c1_290 = TreeSitter.Node.nodeStartPoint node_288 + TreeSitter.Node.TSPoint + r2_291 + c2_292 = TreeSitter.Node.nodeEndPoint node_288 + +deriving instance GHC.Classes.Eq a_293 => GHC.Classes.Eq (ExecStatement a_293) + +deriving instance GHC.Classes.Ord a_294 => GHC.Classes.Ord (ExecStatement a_294) + +deriving instance GHC.Show.Show a_295 => GHC.Show.Show (ExecStatement a_295) + +instance AST.Unmarshal.Unmarshal ExecStatement + +instance Data.Foldable.Foldable ExecStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExecStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExecStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExpressionList a = ExpressionList + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_296. + AST.Traversable1.Class.Traversable1 a_296 + ) + +instance AST.Unmarshal.SymbolMatching ExpressionList where + matchedSymbols _ = [151] + showFailure _ node_297 = + "expected " + GHC.Base.<> ( "expression_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_297 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_297) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_298 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_299 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_300 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_301 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_298 + c1_299 = TreeSitter.Node.nodeStartPoint node_297 + TreeSitter.Node.TSPoint + r2_300 + c2_301 = TreeSitter.Node.nodeEndPoint node_297 + +deriving instance GHC.Classes.Eq a_302 => GHC.Classes.Eq (ExpressionList a_302) + +deriving instance GHC.Classes.Ord a_303 => GHC.Classes.Ord (ExpressionList a_303) + +deriving instance GHC.Show.Show a_304 => GHC.Show.Show (ExpressionList a_304) + +instance AST.Unmarshal.Unmarshal ExpressionList + +instance Data.Foldable.Foldable ExpressionList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExpressionList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExpressionList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExpressionStatement a = ExpressionStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: Assignment GHC.Generics.:+: AugmentedAssignment GHC.Generics.:+: Yield) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_305. + AST.Traversable1.Class.Traversable1 a_305 + ) + +instance AST.Unmarshal.SymbolMatching ExpressionStatement where + matchedSymbols _ = [115] + showFailure _ node_306 = + "expected " + GHC.Base.<> ( "expression_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_306 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_306) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_307 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_308 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_309 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_310 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_307 + c1_308 = TreeSitter.Node.nodeStartPoint node_306 + TreeSitter.Node.TSPoint + r2_309 + c2_310 = TreeSitter.Node.nodeEndPoint node_306 + +deriving instance GHC.Classes.Eq a_311 => GHC.Classes.Eq (ExpressionStatement a_311) + +deriving instance GHC.Classes.Ord a_312 => GHC.Classes.Ord (ExpressionStatement a_312) + +deriving instance GHC.Show.Show a_313 => GHC.Show.Show (ExpressionStatement a_313) + +instance AST.Unmarshal.Unmarshal ExpressionStatement + +instance Data.Foldable.Foldable ExpressionStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExpressionStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExpressionStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FinallyClause a = FinallyClause + { ann :: a, + extraChildren :: (AST.Parse.Err (Block a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_314. + AST.Traversable1.Class.Traversable1 a_314 + ) + +instance AST.Unmarshal.SymbolMatching FinallyClause where + matchedSymbols _ = [130] + showFailure _ node_315 = + "expected " + GHC.Base.<> ( "finally_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_315 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_315) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_316 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_317 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_318 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_319 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_316 + c1_317 = TreeSitter.Node.nodeStartPoint node_315 + TreeSitter.Node.TSPoint + r2_318 + c2_319 = TreeSitter.Node.nodeEndPoint node_315 + +deriving instance GHC.Classes.Eq a_320 => GHC.Classes.Eq (FinallyClause a_320) + +deriving instance GHC.Classes.Ord a_321 => GHC.Classes.Ord (FinallyClause a_321) + +deriving instance GHC.Show.Show a_322 => GHC.Show.Show (FinallyClause a_322) + +instance AST.Unmarshal.Unmarshal FinallyClause + +instance Data.Foldable.Foldable FinallyClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FinallyClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FinallyClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForInClause a = ForInClause + { ann :: a, + left :: (AST.Parse.Err (Variables a)), + right :: (GHC.Base.NonEmpty (AST.Parse.Err ((AnonymousComma GHC.Generics.:+: Expression GHC.Generics.:+: Lambda) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_323. + AST.Traversable1.Class.Traversable1 a_323 + ) + +instance AST.Unmarshal.SymbolMatching ForInClause where + matchedSymbols _ = [185] + showFailure _ node_324 = + "expected " + GHC.Base.<> ( "for_in_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_324 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_324) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_325 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_326 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_327 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_328 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_325 + c1_326 = TreeSitter.Node.nodeStartPoint node_324 + TreeSitter.Node.TSPoint + r2_327 + c2_328 = TreeSitter.Node.nodeEndPoint node_324 + +deriving instance GHC.Classes.Eq a_329 => GHC.Classes.Eq (ForInClause a_329) + +deriving instance GHC.Classes.Ord a_330 => GHC.Classes.Ord (ForInClause a_330) + +deriving instance GHC.Show.Show a_331 => GHC.Show.Show (ForInClause a_331) + +instance AST.Unmarshal.Unmarshal ForInClause + +instance Data.Foldable.Foldable ForInClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForInClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForInClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForStatement a = ForStatement + { ann :: a, + alternative :: (GHC.Maybe.Maybe (AST.Parse.Err (ElseClause a))), + body :: (AST.Parse.Err (Block a)), + left :: (AST.Parse.Err (Variables a)), + right :: (AST.Parse.Err (ExpressionList a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_332. + AST.Traversable1.Class.Traversable1 a_332 + ) + +instance AST.Unmarshal.SymbolMatching ForStatement where + matchedSymbols _ = [126] + showFailure _ node_333 = + "expected " + GHC.Base.<> ( "for_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_333 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_333) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_334 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_335 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_336 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_337 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_334 + c1_335 = TreeSitter.Node.nodeStartPoint node_333 + TreeSitter.Node.TSPoint + r2_336 + c2_337 = TreeSitter.Node.nodeEndPoint node_333 + +deriving instance GHC.Classes.Eq a_338 => GHC.Classes.Eq (ForStatement a_338) + +deriving instance GHC.Classes.Ord a_339 => GHC.Classes.Ord (ForStatement a_339) + +deriving instance GHC.Show.Show a_340 => GHC.Show.Show (ForStatement a_340) + +instance AST.Unmarshal.Unmarshal ForStatement + +instance Data.Foldable.Foldable ForStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FormatExpression a = FormatExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_341. + AST.Traversable1.Class.Traversable1 a_341 + ) + +instance AST.Unmarshal.SymbolMatching FormatExpression where + matchedSymbols _ = [192] + showFailure _ node_342 = + "expected " + GHC.Base.<> ( "format_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_342 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_342) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_343 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_344 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_345 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_346 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_343 + c1_344 = TreeSitter.Node.nodeStartPoint node_342 + TreeSitter.Node.TSPoint + r2_345 + c2_346 = TreeSitter.Node.nodeEndPoint node_342 + +deriving instance GHC.Classes.Eq a_347 => GHC.Classes.Eq (FormatExpression a_347) + +deriving instance GHC.Classes.Ord a_348 => GHC.Classes.Ord (FormatExpression a_348) + +deriving instance GHC.Show.Show a_349 => GHC.Show.Show (FormatExpression a_349) + +instance AST.Unmarshal.Unmarshal FormatExpression + +instance Data.Foldable.Foldable FormatExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FormatExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FormatExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FormatSpecifier a = FormatSpecifier + { ann :: a, + extraChildren :: ([AST.Parse.Err (FormatExpression a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_350. + AST.Traversable1.Class.Traversable1 a_350 + ) + +instance AST.Unmarshal.SymbolMatching FormatSpecifier where + matchedSymbols _ = [191] + showFailure _ node_351 = + "expected " + GHC.Base.<> ( "format_specifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_351 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_351) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_352 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_353 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_354 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_355 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_352 + c1_353 = TreeSitter.Node.nodeStartPoint node_351 + TreeSitter.Node.TSPoint + r2_354 + c2_355 = TreeSitter.Node.nodeEndPoint node_351 + +deriving instance GHC.Classes.Eq a_356 => GHC.Classes.Eq (FormatSpecifier a_356) + +deriving instance GHC.Classes.Ord a_357 => GHC.Classes.Ord (FormatSpecifier a_357) + +deriving instance GHC.Show.Show a_358 => GHC.Show.Show (FormatSpecifier a_358) + +instance AST.Unmarshal.Unmarshal FormatSpecifier + +instance Data.Foldable.Foldable FormatSpecifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FormatSpecifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FormatSpecifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionDefinition a = FunctionDefinition + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (Type a))), + body :: (AST.Parse.Err (Block a)), + name :: (AST.Parse.Err (Identifier a)), + parameters :: (AST.Parse.Err (Parameters a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_359. + AST.Traversable1.Class.Traversable1 a_359 + ) + +instance AST.Unmarshal.SymbolMatching FunctionDefinition where + matchedSymbols _ = [133] + showFailure _ node_360 = + "expected " + GHC.Base.<> ( "function_definition" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_360 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_360) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_361 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_362 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_363 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_364 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_361 + c1_362 = TreeSitter.Node.nodeStartPoint node_360 + TreeSitter.Node.TSPoint + r2_363 + c2_364 = TreeSitter.Node.nodeEndPoint node_360 + +deriving instance GHC.Classes.Eq a_365 => GHC.Classes.Eq (FunctionDefinition a_365) + +deriving instance GHC.Classes.Ord a_366 => GHC.Classes.Ord (FunctionDefinition a_366) + +deriving instance GHC.Show.Show a_367 => GHC.Show.Show (FunctionDefinition a_367) + +instance AST.Unmarshal.Unmarshal FunctionDefinition + +instance Data.Foldable.Foldable FunctionDefinition where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionDefinition where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionDefinition where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FutureImportStatement a = FutureImportStatement + { ann :: a, + name :: (GHC.Base.NonEmpty (AST.Parse.Err ((AliasedImport GHC.Generics.:+: DottedName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_368. + AST.Traversable1.Class.Traversable1 a_368 + ) + +instance AST.Unmarshal.SymbolMatching FutureImportStatement where + matchedSymbols _ = [107] + showFailure _ node_369 = + "expected " + GHC.Base.<> ( "future_import_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_369 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_369) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_370 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_371 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_372 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_373 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_370 + c1_371 = TreeSitter.Node.nodeStartPoint node_369 + TreeSitter.Node.TSPoint + r2_372 + c2_373 = TreeSitter.Node.nodeEndPoint node_369 + +deriving instance GHC.Classes.Eq a_374 => GHC.Classes.Eq (FutureImportStatement a_374) + +deriving instance GHC.Classes.Ord a_375 => GHC.Classes.Ord (FutureImportStatement a_375) + +deriving instance GHC.Show.Show a_376 => GHC.Show.Show (FutureImportStatement a_376) + +instance AST.Unmarshal.Unmarshal FutureImportStatement + +instance Data.Foldable.Foldable FutureImportStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FutureImportStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FutureImportStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GeneratorExpression a = GeneratorExpression + { ann :: a, + body :: (AST.Parse.Err (Expression a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ForInClause GHC.Generics.:+: IfClause) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_377. + AST.Traversable1.Class.Traversable1 a_377 + ) + +instance AST.Unmarshal.SymbolMatching GeneratorExpression where + matchedSymbols _ = [184] + showFailure _ node_378 = + "expected " + GHC.Base.<> ( "generator_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_378 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_378) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_379 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_380 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_381 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_382 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_379 + c1_380 = TreeSitter.Node.nodeStartPoint node_378 + TreeSitter.Node.TSPoint + r2_381 + c2_382 = TreeSitter.Node.nodeEndPoint node_378 + +deriving instance GHC.Classes.Eq a_383 => GHC.Classes.Eq (GeneratorExpression a_383) + +deriving instance GHC.Classes.Ord a_384 => GHC.Classes.Ord (GeneratorExpression a_384) + +deriving instance GHC.Show.Show a_385 => GHC.Show.Show (GeneratorExpression a_385) + +instance AST.Unmarshal.Unmarshal GeneratorExpression + +instance Data.Foldable.Foldable GeneratorExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GeneratorExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GeneratorExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GlobalStatement a = GlobalStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_386. + AST.Traversable1.Class.Traversable1 a_386 + ) + +instance AST.Unmarshal.SymbolMatching GlobalStatement where + matchedSymbols _ = [141] + showFailure _ node_387 = + "expected " + GHC.Base.<> ( "global_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_387 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_387) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_388 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_389 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_390 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_391 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_388 + c1_389 = TreeSitter.Node.nodeStartPoint node_387 + TreeSitter.Node.TSPoint + r2_390 + c2_391 = TreeSitter.Node.nodeEndPoint node_387 + +deriving instance GHC.Classes.Eq a_392 => GHC.Classes.Eq (GlobalStatement a_392) + +deriving instance GHC.Classes.Ord a_393 => GHC.Classes.Ord (GlobalStatement a_393) + +deriving instance GHC.Show.Show a_394 => GHC.Show.Show (GlobalStatement a_394) + +instance AST.Unmarshal.Unmarshal GlobalStatement + +instance Data.Foldable.Foldable GlobalStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GlobalStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GlobalStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IfClause a = IfClause + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_395. + AST.Traversable1.Class.Traversable1 a_395 + ) + +instance AST.Unmarshal.SymbolMatching IfClause where + matchedSymbols _ = [186] + showFailure _ node_396 = + "expected " + GHC.Base.<> ( "if_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_396 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_396) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_397 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_398 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_399 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_400 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_397 + c1_398 = TreeSitter.Node.nodeStartPoint node_396 + TreeSitter.Node.TSPoint + r2_399 + c2_400 = TreeSitter.Node.nodeEndPoint node_396 + +deriving instance GHC.Classes.Eq a_401 => GHC.Classes.Eq (IfClause a_401) + +deriving instance GHC.Classes.Ord a_402 => GHC.Classes.Ord (IfClause a_402) + +deriving instance GHC.Show.Show a_403 => GHC.Show.Show (IfClause a_403) + +instance AST.Unmarshal.Unmarshal IfClause + +instance Data.Foldable.Foldable IfClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IfClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IfClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IfStatement a = IfStatement + { ann :: a, + alternative :: ([AST.Parse.Err ((ElifClause GHC.Generics.:+: ElseClause) a)]), + consequence :: (AST.Parse.Err (Block a)), + condition :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_404. + AST.Traversable1.Class.Traversable1 a_404 + ) + +instance AST.Unmarshal.SymbolMatching IfStatement where + matchedSymbols _ = [123] + showFailure _ node_405 = + "expected " + GHC.Base.<> ( "if_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_405 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_405) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_406 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_407 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_408 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_409 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_406 + c1_407 = TreeSitter.Node.nodeStartPoint node_405 + TreeSitter.Node.TSPoint + r2_408 + c2_409 = TreeSitter.Node.nodeEndPoint node_405 + +deriving instance GHC.Classes.Eq a_410 => GHC.Classes.Eq (IfStatement a_410) + +deriving instance GHC.Classes.Ord a_411 => GHC.Classes.Ord (IfStatement a_411) + +deriving instance GHC.Show.Show a_412 => GHC.Show.Show (IfStatement a_412) + +instance AST.Unmarshal.Unmarshal IfStatement + +instance Data.Foldable.Foldable IfStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IfStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IfStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportFromStatement a = ImportFromStatement + { ann :: a, + name :: ([AST.Parse.Err ((AliasedImport GHC.Generics.:+: DottedName) a)]), + moduleName :: (AST.Parse.Err ((DottedName GHC.Generics.:+: RelativeImport) a)), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (WildcardImport a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_413. + AST.Traversable1.Class.Traversable1 a_413 + ) + +instance AST.Unmarshal.SymbolMatching ImportFromStatement where + matchedSymbols _ = [108] + showFailure _ node_414 = + "expected " + GHC.Base.<> ( "import_from_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_414 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_414) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_415 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_416 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_417 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_418 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_415 + c1_416 = TreeSitter.Node.nodeStartPoint node_414 + TreeSitter.Node.TSPoint + r2_417 + c2_418 = TreeSitter.Node.nodeEndPoint node_414 + +deriving instance GHC.Classes.Eq a_419 => GHC.Classes.Eq (ImportFromStatement a_419) + +deriving instance GHC.Classes.Ord a_420 => GHC.Classes.Ord (ImportFromStatement a_420) + +deriving instance GHC.Show.Show a_421 => GHC.Show.Show (ImportFromStatement a_421) + +instance AST.Unmarshal.Unmarshal ImportFromStatement + +instance Data.Foldable.Foldable ImportFromStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportFromStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportFromStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportPrefix a = ImportPrefix {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_422. + AST.Traversable1.Class.Traversable1 a_422 + ) + +instance AST.Unmarshal.SymbolMatching ImportPrefix where + matchedSymbols _ = [105] + showFailure _ node_423 = + "expected " + GHC.Base.<> ( "import_prefix" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_423 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_423) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_424 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_425 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_426 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_427 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_424 + c1_425 = TreeSitter.Node.nodeStartPoint node_423 + TreeSitter.Node.TSPoint + r2_426 + c2_427 = TreeSitter.Node.nodeEndPoint node_423 + +deriving instance GHC.Classes.Eq a_428 => GHC.Classes.Eq (ImportPrefix a_428) + +deriving instance GHC.Classes.Ord a_429 => GHC.Classes.Ord (ImportPrefix a_429) + +deriving instance GHC.Show.Show a_430 => GHC.Show.Show (ImportPrefix a_430) + +instance AST.Unmarshal.Unmarshal ImportPrefix + +instance Data.Foldable.Foldable ImportPrefix where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportPrefix where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportPrefix where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportStatement a = ImportStatement + { ann :: a, + name :: (GHC.Base.NonEmpty (AST.Parse.Err ((AliasedImport GHC.Generics.:+: DottedName) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_431. + AST.Traversable1.Class.Traversable1 a_431 + ) + +instance AST.Unmarshal.SymbolMatching ImportStatement where + matchedSymbols _ = [104] + showFailure _ node_432 = + "expected " + GHC.Base.<> ( "import_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_432 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_432) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_433 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_434 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_435 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_436 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_433 + c1_434 = TreeSitter.Node.nodeStartPoint node_432 + TreeSitter.Node.TSPoint + r2_435 + c2_436 = TreeSitter.Node.nodeEndPoint node_432 + +deriving instance GHC.Classes.Eq a_437 => GHC.Classes.Eq (ImportStatement a_437) + +deriving instance GHC.Classes.Ord a_438 => GHC.Classes.Ord (ImportStatement a_438) + +deriving instance GHC.Show.Show a_439 => GHC.Show.Show (ImportStatement a_439) + +instance AST.Unmarshal.Unmarshal ImportStatement + +instance Data.Foldable.Foldable ImportStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Interpolation a = Interpolation + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: FormatSpecifier GHC.Generics.:+: TypeConversion) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_440. + AST.Traversable1.Class.Traversable1 a_440 + ) + +instance AST.Unmarshal.SymbolMatching Interpolation where + matchedSymbols _ = [190] + showFailure _ node_441 = + "expected " + GHC.Base.<> ( "interpolation" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_441 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_441) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_442 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_443 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_444 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_445 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_442 + c1_443 = TreeSitter.Node.nodeStartPoint node_441 + TreeSitter.Node.TSPoint + r2_444 + c2_445 = TreeSitter.Node.nodeEndPoint node_441 + +deriving instance GHC.Classes.Eq a_446 => GHC.Classes.Eq (Interpolation a_446) + +deriving instance GHC.Classes.Ord a_447 => GHC.Classes.Ord (Interpolation a_447) + +deriving instance GHC.Show.Show a_448 => GHC.Show.Show (Interpolation a_448) + +instance AST.Unmarshal.Unmarshal Interpolation + +instance Data.Foldable.Foldable Interpolation where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Interpolation where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Interpolation where + traverse = AST.Traversable1.Class.traverseDefault1 + +data KeywordArgument a = KeywordArgument + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_449. + AST.Traversable1.Class.Traversable1 a_449 + ) + +instance AST.Unmarshal.SymbolMatching KeywordArgument where + matchedSymbols _ = [173] + showFailure _ node_450 = + "expected " + GHC.Base.<> ( "keyword_argument" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_450 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_450) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_451 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_452 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_453 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_454 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_451 + c1_452 = TreeSitter.Node.nodeStartPoint node_450 + TreeSitter.Node.TSPoint + r2_453 + c2_454 = TreeSitter.Node.nodeEndPoint node_450 + +deriving instance GHC.Classes.Eq a_455 => GHC.Classes.Eq (KeywordArgument a_455) + +deriving instance GHC.Classes.Ord a_456 => GHC.Classes.Ord (KeywordArgument a_456) + +deriving instance GHC.Show.Show a_457 => GHC.Show.Show (KeywordArgument a_457) + +instance AST.Unmarshal.Unmarshal KeywordArgument + +instance Data.Foldable.Foldable KeywordArgument where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor KeywordArgument where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable KeywordArgument where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Lambda a = Lambda + { ann :: a, + body :: (AST.Parse.Err ((Expression GHC.Generics.:+: Lambda) a)), + parameters :: (GHC.Maybe.Maybe (AST.Parse.Err (LambdaParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_458. + AST.Traversable1.Class.Traversable1 a_458 + ) + +instance AST.Unmarshal.SymbolMatching Lambda where + matchedSymbols _ = [161, 162] + showFailure _ node_459 = + "expected " + GHC.Base.<> ( "lambda, lambda" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_459 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_459) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_460 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_461 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_462 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_463 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_460 + c1_461 = TreeSitter.Node.nodeStartPoint node_459 + TreeSitter.Node.TSPoint + r2_462 + c2_463 = TreeSitter.Node.nodeEndPoint node_459 + +deriving instance GHC.Classes.Eq a_464 => GHC.Classes.Eq (Lambda a_464) + +deriving instance GHC.Classes.Ord a_465 => GHC.Classes.Ord (Lambda a_465) + +deriving instance GHC.Show.Show a_466 => GHC.Show.Show (Lambda a_466) + +instance AST.Unmarshal.Unmarshal Lambda + +instance Data.Foldable.Foldable Lambda where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Lambda where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Lambda where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LambdaParameters a = LambdaParameters + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Parameter a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_467. + AST.Traversable1.Class.Traversable1 a_467 + ) + +instance AST.Unmarshal.SymbolMatching LambdaParameters where + matchedSymbols _ = [135] + showFailure _ node_468 = + "expected " + GHC.Base.<> ( "lambda_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_468 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_468) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_469 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_470 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_471 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_472 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_469 + c1_470 = TreeSitter.Node.nodeStartPoint node_468 + TreeSitter.Node.TSPoint + r2_471 + c2_472 = TreeSitter.Node.nodeEndPoint node_468 + +deriving instance GHC.Classes.Eq a_473 => GHC.Classes.Eq (LambdaParameters a_473) + +deriving instance GHC.Classes.Ord a_474 => GHC.Classes.Ord (LambdaParameters a_474) + +deriving instance GHC.Show.Show a_475 => GHC.Show.Show (LambdaParameters a_475) + +instance AST.Unmarshal.Unmarshal LambdaParameters + +instance Data.Foldable.Foldable LambdaParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LambdaParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LambdaParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data List a = List + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: ListSplat) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_476. + AST.Traversable1.Class.Traversable1 a_476 + ) + +instance AST.Unmarshal.SymbolMatching List where + matchedSymbols _ = [174] + showFailure _ node_477 = + "expected " + GHC.Base.<> ( "list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_477 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_477) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_478 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_479 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_480 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_481 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_478 + c1_479 = TreeSitter.Node.nodeStartPoint node_477 + TreeSitter.Node.TSPoint + r2_480 + c2_481 = TreeSitter.Node.nodeEndPoint node_477 + +deriving instance GHC.Classes.Eq a_482 => GHC.Classes.Eq (List a_482) + +deriving instance GHC.Classes.Ord a_483 => GHC.Classes.Ord (List a_483) + +deriving instance GHC.Show.Show a_484 => GHC.Show.Show (List a_484) + +instance AST.Unmarshal.Unmarshal List + +instance Data.Foldable.Foldable List where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor List where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable List where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ListComprehension a = ListComprehension + { ann :: a, + body :: (AST.Parse.Err (Expression a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ForInClause GHC.Generics.:+: IfClause) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_485. + AST.Traversable1.Class.Traversable1 a_485 + ) + +instance AST.Unmarshal.SymbolMatching ListComprehension where + matchedSymbols _ = [176] + showFailure _ node_486 = + "expected " + GHC.Base.<> ( "list_comprehension" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_486 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_486) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_487 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_488 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_489 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_490 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_487 + c1_488 = TreeSitter.Node.nodeStartPoint node_486 + TreeSitter.Node.TSPoint + r2_489 + c2_490 = TreeSitter.Node.nodeEndPoint node_486 + +deriving instance GHC.Classes.Eq a_491 => GHC.Classes.Eq (ListComprehension a_491) + +deriving instance GHC.Classes.Ord a_492 => GHC.Classes.Ord (ListComprehension a_492) + +deriving instance GHC.Show.Show a_493 => GHC.Show.Show (ListComprehension a_493) + +instance AST.Unmarshal.Unmarshal ListComprehension + +instance Data.Foldable.Foldable ListComprehension where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ListComprehension where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ListComprehension where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ListSplat a = ListSplat + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_494. + AST.Traversable1.Class.Traversable1 a_494 + ) + +instance AST.Unmarshal.SymbolMatching ListSplat where + matchedSymbols _ = [139] + showFailure _ node_495 = + "expected " + GHC.Base.<> ( "list_splat" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_495 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_495) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_496 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_497 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_498 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_499 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_496 + c1_497 = TreeSitter.Node.nodeStartPoint node_495 + TreeSitter.Node.TSPoint + r2_498 + c2_499 = TreeSitter.Node.nodeEndPoint node_495 + +deriving instance GHC.Classes.Eq a_500 => GHC.Classes.Eq (ListSplat a_500) + +deriving instance GHC.Classes.Ord a_501 => GHC.Classes.Ord (ListSplat a_501) + +deriving instance GHC.Show.Show a_502 => GHC.Show.Show (ListSplat a_502) + +instance AST.Unmarshal.Unmarshal ListSplat + +instance Data.Foldable.Foldable ListSplat where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ListSplat where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ListSplat where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Module a = Module + { ann :: a, + extraChildren :: ([AST.Parse.Err ((CompoundStatement GHC.Generics.:+: SimpleStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_503. + AST.Traversable1.Class.Traversable1 a_503 + ) + +instance AST.Unmarshal.SymbolMatching Module where + matchedSymbols _ = [101] + showFailure _ node_504 = + "expected " + GHC.Base.<> ( "module" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_504 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_504) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_505 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_506 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_507 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_508 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_505 + c1_506 = TreeSitter.Node.nodeStartPoint node_504 + TreeSitter.Node.TSPoint + r2_507 + c2_508 = TreeSitter.Node.nodeEndPoint node_504 + +deriving instance GHC.Classes.Eq a_509 => GHC.Classes.Eq (Module a_509) + +deriving instance GHC.Classes.Ord a_510 => GHC.Classes.Ord (Module a_510) + +deriving instance GHC.Show.Show a_511 => GHC.Show.Show (Module a_511) + +instance AST.Unmarshal.Unmarshal Module + +instance Data.Foldable.Foldable Module where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Module where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Module where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamedExpression a = NamedExpression + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_512. + AST.Traversable1.Class.Traversable1 a_512 + ) + +instance AST.Unmarshal.SymbolMatching NamedExpression where + matchedSymbols _ = [116] + showFailure _ node_513 = + "expected " + GHC.Base.<> ( "named_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_513 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_513) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_514 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_515 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_516 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_517 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_514 + c1_515 = TreeSitter.Node.nodeStartPoint node_513 + TreeSitter.Node.TSPoint + r2_516 + c2_517 = TreeSitter.Node.nodeEndPoint node_513 + +deriving instance GHC.Classes.Eq a_518 => GHC.Classes.Eq (NamedExpression a_518) + +deriving instance GHC.Classes.Ord a_519 => GHC.Classes.Ord (NamedExpression a_519) + +deriving instance GHC.Show.Show a_520 => GHC.Show.Show (NamedExpression a_520) + +instance AST.Unmarshal.Unmarshal NamedExpression + +instance Data.Foldable.Foldable NamedExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamedExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamedExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NonlocalStatement a = NonlocalStatement + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_521. + AST.Traversable1.Class.Traversable1 a_521 + ) + +instance AST.Unmarshal.SymbolMatching NonlocalStatement where + matchedSymbols _ = [142] + showFailure _ node_522 = + "expected " + GHC.Base.<> ( "nonlocal_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_522 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_522) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_523 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_524 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_525 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_526 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_523 + c1_524 = TreeSitter.Node.nodeStartPoint node_522 + TreeSitter.Node.TSPoint + r2_525 + c2_526 = TreeSitter.Node.nodeEndPoint node_522 + +deriving instance GHC.Classes.Eq a_527 => GHC.Classes.Eq (NonlocalStatement a_527) + +deriving instance GHC.Classes.Ord a_528 => GHC.Classes.Ord (NonlocalStatement a_528) + +deriving instance GHC.Show.Show a_529 => GHC.Show.Show (NonlocalStatement a_529) + +instance AST.Unmarshal.Unmarshal NonlocalStatement + +instance Data.Foldable.Foldable NonlocalStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NonlocalStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NonlocalStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NotOperator a = NotOperator + { ann :: a, + argument :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_530. + AST.Traversable1.Class.Traversable1 a_530 + ) + +instance AST.Unmarshal.SymbolMatching NotOperator where + matchedSymbols _ = [156] + showFailure _ node_531 = + "expected " + GHC.Base.<> ( "not_operator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_531 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_531) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_532 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_533 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_534 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_535 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_532 + c1_533 = TreeSitter.Node.nodeStartPoint node_531 + TreeSitter.Node.TSPoint + r2_534 + c2_535 = TreeSitter.Node.nodeEndPoint node_531 + +deriving instance GHC.Classes.Eq a_536 => GHC.Classes.Eq (NotOperator a_536) + +deriving instance GHC.Classes.Ord a_537 => GHC.Classes.Ord (NotOperator a_537) + +deriving instance GHC.Show.Show a_538 => GHC.Show.Show (NotOperator a_538) + +instance AST.Unmarshal.Unmarshal NotOperator + +instance Data.Foldable.Foldable NotOperator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NotOperator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NotOperator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Pair a = Pair + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + key :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_539. + AST.Traversable1.Class.Traversable1 a_539 + ) + +instance AST.Unmarshal.SymbolMatching Pair where + matchedSymbols _ = [179] + showFailure _ node_540 = + "expected " + GHC.Base.<> ( "pair" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_540 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_540) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_541 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_542 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_543 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_544 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_541 + c1_542 = TreeSitter.Node.nodeStartPoint node_540 + TreeSitter.Node.TSPoint + r2_543 + c2_544 = TreeSitter.Node.nodeEndPoint node_540 + +deriving instance GHC.Classes.Eq a_545 => GHC.Classes.Eq (Pair a_545) + +deriving instance GHC.Classes.Ord a_546 => GHC.Classes.Ord (Pair a_546) + +deriving instance GHC.Show.Show a_547 => GHC.Show.Show (Pair a_547) + +instance AST.Unmarshal.Unmarshal Pair + +instance Data.Foldable.Foldable Pair where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Pair where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Pair where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Parameters a = Parameters + { ann :: a, + extraChildren :: ([AST.Parse.Err (Parameter a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_548. + AST.Traversable1.Class.Traversable1 a_548 + ) + +instance AST.Unmarshal.SymbolMatching Parameters where + matchedSymbols _ = [134] + showFailure _ node_549 = + "expected " + GHC.Base.<> ( "parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_549 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_549) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_550 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_551 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_552 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_553 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_550 + c1_551 = TreeSitter.Node.nodeStartPoint node_549 + TreeSitter.Node.TSPoint + r2_552 + c2_553 = TreeSitter.Node.nodeEndPoint node_549 + +deriving instance GHC.Classes.Eq a_554 => GHC.Classes.Eq (Parameters a_554) + +deriving instance GHC.Classes.Ord a_555 => GHC.Classes.Ord (Parameters a_555) + +deriving instance GHC.Show.Show a_556 => GHC.Show.Show (Parameters a_556) + +instance AST.Unmarshal.Unmarshal Parameters + +instance Data.Foldable.Foldable Parameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Parameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Parameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParenthesizedExpression a = ParenthesizedExpression + { ann :: a, + extraChildren :: (AST.Parse.Err ((Expression GHC.Generics.:+: ListSplat GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: Yield) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_557. + AST.Traversable1.Class.Traversable1 a_557 + ) + +instance AST.Unmarshal.SymbolMatching ParenthesizedExpression where + matchedSymbols _ = [145, 182] + showFailure _ node_558 = + "expected " + GHC.Base.<> ( "parenthesized_expression, parenthesized_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_558 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_558) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_559 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_560 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_561 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_562 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_559 + c1_560 = TreeSitter.Node.nodeStartPoint node_558 + TreeSitter.Node.TSPoint + r2_561 + c2_562 = TreeSitter.Node.nodeEndPoint node_558 + +deriving instance GHC.Classes.Eq a_563 => GHC.Classes.Eq (ParenthesizedExpression a_563) + +deriving instance GHC.Classes.Ord a_564 => GHC.Classes.Ord (ParenthesizedExpression a_564) + +deriving instance GHC.Show.Show a_565 => GHC.Show.Show (ParenthesizedExpression a_565) + +instance AST.Unmarshal.Unmarshal ParenthesizedExpression + +instance Data.Foldable.Foldable ParenthesizedExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParenthesizedExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParenthesizedExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PassStatement a = PassStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_566. + AST.Traversable1.Class.Traversable1 a_566 + ) + +instance AST.Unmarshal.SymbolMatching PassStatement where + matchedSymbols _ = [120] + showFailure _ node_567 = + "expected " + GHC.Base.<> ( "pass_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_567 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_567) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_568 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_569 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_570 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_571 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_568 + c1_569 = TreeSitter.Node.nodeStartPoint node_567 + TreeSitter.Node.TSPoint + r2_570 + c2_571 = TreeSitter.Node.nodeEndPoint node_567 + +deriving instance GHC.Classes.Eq a_572 => GHC.Classes.Eq (PassStatement a_572) + +deriving instance GHC.Classes.Ord a_573 => GHC.Classes.Ord (PassStatement a_573) + +deriving instance GHC.Show.Show a_574 => GHC.Show.Show (PassStatement a_574) + +instance AST.Unmarshal.Unmarshal PassStatement + +instance Data.Foldable.Foldable PassStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PassStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PassStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PrintStatement a = PrintStatement + { ann :: a, + argument :: ([AST.Parse.Err (Expression a)]), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Chevron a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_575. + AST.Traversable1.Class.Traversable1 a_575 + ) + +instance AST.Unmarshal.SymbolMatching PrintStatement where + matchedSymbols _ = [112] + showFailure _ node_576 = + "expected " + GHC.Base.<> ( "print_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_576 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_576) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_577 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_578 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_579 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_580 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_577 + c1_578 = TreeSitter.Node.nodeStartPoint node_576 + TreeSitter.Node.TSPoint + r2_579 + c2_580 = TreeSitter.Node.nodeEndPoint node_576 + +deriving instance GHC.Classes.Eq a_581 => GHC.Classes.Eq (PrintStatement a_581) + +deriving instance GHC.Classes.Ord a_582 => GHC.Classes.Ord (PrintStatement a_582) + +deriving instance GHC.Show.Show a_583 => GHC.Show.Show (PrintStatement a_583) + +instance AST.Unmarshal.Unmarshal PrintStatement + +instance Data.Foldable.Foldable PrintStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PrintStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PrintStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RaiseStatement a = RaiseStatement + { ann :: a, + cause :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ExpressionList a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_584. + AST.Traversable1.Class.Traversable1 a_584 + ) + +instance AST.Unmarshal.SymbolMatching RaiseStatement where + matchedSymbols _ = [119] + showFailure _ node_585 = + "expected " + GHC.Base.<> ( "raise_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_585 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_585) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_586 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_587 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_588 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_589 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_586 + c1_587 = TreeSitter.Node.nodeStartPoint node_585 + TreeSitter.Node.TSPoint + r2_588 + c2_589 = TreeSitter.Node.nodeEndPoint node_585 + +deriving instance GHC.Classes.Eq a_590 => GHC.Classes.Eq (RaiseStatement a_590) + +deriving instance GHC.Classes.Ord a_591 => GHC.Classes.Ord (RaiseStatement a_591) + +deriving instance GHC.Show.Show a_592 => GHC.Show.Show (RaiseStatement a_592) + +instance AST.Unmarshal.Unmarshal RaiseStatement + +instance Data.Foldable.Foldable RaiseStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RaiseStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RaiseStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RelativeImport a = RelativeImport + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((DottedName GHC.Generics.:+: ImportPrefix) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_593. + AST.Traversable1.Class.Traversable1 a_593 + ) + +instance AST.Unmarshal.SymbolMatching RelativeImport where + matchedSymbols _ = [106] + showFailure _ node_594 = + "expected " + GHC.Base.<> ( "relative_import" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_594 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_594) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_595 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_596 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_597 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_598 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_595 + c1_596 = TreeSitter.Node.nodeStartPoint node_594 + TreeSitter.Node.TSPoint + r2_597 + c2_598 = TreeSitter.Node.nodeEndPoint node_594 + +deriving instance GHC.Classes.Eq a_599 => GHC.Classes.Eq (RelativeImport a_599) + +deriving instance GHC.Classes.Ord a_600 => GHC.Classes.Ord (RelativeImport a_600) + +deriving instance GHC.Show.Show a_601 => GHC.Show.Show (RelativeImport a_601) + +instance AST.Unmarshal.Unmarshal RelativeImport + +instance Data.Foldable.Foldable RelativeImport where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RelativeImport where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RelativeImport where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ReturnStatement a = ReturnStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ExpressionList a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_602. + AST.Traversable1.Class.Traversable1 a_602 + ) + +instance AST.Unmarshal.SymbolMatching ReturnStatement where + matchedSymbols _ = [117] + showFailure _ node_603 = + "expected " + GHC.Base.<> ( "return_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_603 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_603) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_604 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_605 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_606 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_607 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_604 + c1_605 = TreeSitter.Node.nodeStartPoint node_603 + TreeSitter.Node.TSPoint + r2_606 + c2_607 = TreeSitter.Node.nodeEndPoint node_603 + +deriving instance GHC.Classes.Eq a_608 => GHC.Classes.Eq (ReturnStatement a_608) + +deriving instance GHC.Classes.Ord a_609 => GHC.Classes.Ord (ReturnStatement a_609) + +deriving instance GHC.Show.Show a_610 => GHC.Show.Show (ReturnStatement a_610) + +instance AST.Unmarshal.Unmarshal ReturnStatement + +instance Data.Foldable.Foldable ReturnStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ReturnStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ReturnStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Set a = Set + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: ListSplat) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_611. + AST.Traversable1.Class.Traversable1 a_611 + ) + +instance AST.Unmarshal.SymbolMatching Set where + matchedSymbols _ = [180] + showFailure _ node_612 = + "expected " + GHC.Base.<> ( "set" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_612 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_612) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_613 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_614 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_615 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_616 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_613 + c1_614 = TreeSitter.Node.nodeStartPoint node_612 + TreeSitter.Node.TSPoint + r2_615 + c2_616 = TreeSitter.Node.nodeEndPoint node_612 + +deriving instance GHC.Classes.Eq a_617 => GHC.Classes.Eq (Set a_617) + +deriving instance GHC.Classes.Ord a_618 => GHC.Classes.Ord (Set a_618) + +deriving instance GHC.Show.Show a_619 => GHC.Show.Show (Set a_619) + +instance AST.Unmarshal.Unmarshal Set + +instance Data.Foldable.Foldable Set where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Set where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Set where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SetComprehension a = SetComprehension + { ann :: a, + body :: (AST.Parse.Err (Expression a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ForInClause GHC.Generics.:+: IfClause) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_620. + AST.Traversable1.Class.Traversable1 a_620 + ) + +instance AST.Unmarshal.SymbolMatching SetComprehension where + matchedSymbols _ = [181] + showFailure _ node_621 = + "expected " + GHC.Base.<> ( "set_comprehension" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_621 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_621) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_622 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_623 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_624 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_625 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_622 + c1_623 = TreeSitter.Node.nodeStartPoint node_621 + TreeSitter.Node.TSPoint + r2_624 + c2_625 = TreeSitter.Node.nodeEndPoint node_621 + +deriving instance GHC.Classes.Eq a_626 => GHC.Classes.Eq (SetComprehension a_626) + +deriving instance GHC.Classes.Ord a_627 => GHC.Classes.Ord (SetComprehension a_627) + +deriving instance GHC.Show.Show a_628 => GHC.Show.Show (SetComprehension a_628) + +instance AST.Unmarshal.Unmarshal SetComprehension + +instance Data.Foldable.Foldable SetComprehension where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SetComprehension where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SetComprehension where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Slice a = Slice + { ann :: a, + extraChildren :: ([AST.Parse.Err (Expression a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_629. + AST.Traversable1.Class.Traversable1 a_629 + ) + +instance AST.Unmarshal.SymbolMatching Slice where + matchedSymbols _ = [169] + showFailure _ node_630 = + "expected " + GHC.Base.<> ( "slice" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_630 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_630) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_631 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_632 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_633 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_634 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_631 + c1_632 = TreeSitter.Node.nodeStartPoint node_630 + TreeSitter.Node.TSPoint + r2_633 + c2_634 = TreeSitter.Node.nodeEndPoint node_630 + +deriving instance GHC.Classes.Eq a_635 => GHC.Classes.Eq (Slice a_635) + +deriving instance GHC.Classes.Ord a_636 => GHC.Classes.Ord (Slice a_636) + +deriving instance GHC.Show.Show a_637 => GHC.Show.Show (Slice a_637) + +instance AST.Unmarshal.Unmarshal Slice + +instance Data.Foldable.Foldable Slice where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Slice where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Slice where + traverse = AST.Traversable1.Class.traverseDefault1 + +data String a = String + { ann :: a, + extraChildren :: ([AST.Parse.Err ((EscapeSequence GHC.Generics.:+: Interpolation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_638. + AST.Traversable1.Class.Traversable1 a_638 + ) + +instance AST.Unmarshal.SymbolMatching String where + matchedSymbols _ = [189] + showFailure _ node_639 = + "expected " + GHC.Base.<> ( "string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_639 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_639) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_640 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_641 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_642 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_643 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_640 + c1_641 = TreeSitter.Node.nodeStartPoint node_639 + TreeSitter.Node.TSPoint + r2_642 + c2_643 = TreeSitter.Node.nodeEndPoint node_639 + +deriving instance GHC.Classes.Eq a_644 => GHC.Classes.Eq (String a_644) + +deriving instance GHC.Classes.Ord a_645 => GHC.Classes.Ord (String a_645) + +deriving instance GHC.Show.Show a_646 => GHC.Show.Show (String a_646) + +instance AST.Unmarshal.Unmarshal String + +instance Data.Foldable.Foldable String where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor String where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable String where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Subscript a = Subscript + { ann :: a, + subscript :: (GHC.Base.NonEmpty (AST.Parse.Err ((AnonymousComma GHC.Generics.:+: Expression GHC.Generics.:+: Slice) a))), + value :: (AST.Parse.Err (PrimaryExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_647. + AST.Traversable1.Class.Traversable1 a_647 + ) + +instance AST.Unmarshal.SymbolMatching Subscript where + matchedSymbols _ = [168] + showFailure _ node_648 = + "expected " + GHC.Base.<> ( "subscript" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_648 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_648) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_649 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_650 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_651 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_652 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_649 + c1_650 = TreeSitter.Node.nodeStartPoint node_648 + TreeSitter.Node.TSPoint + r2_651 + c2_652 = TreeSitter.Node.nodeEndPoint node_648 + +deriving instance GHC.Classes.Eq a_653 => GHC.Classes.Eq (Subscript a_653) + +deriving instance GHC.Classes.Ord a_654 => GHC.Classes.Ord (Subscript a_654) + +deriving instance GHC.Show.Show a_655 => GHC.Show.Show (Subscript a_655) + +instance AST.Unmarshal.Unmarshal Subscript + +instance Data.Foldable.Foldable Subscript where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Subscript where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Subscript where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TryStatement a = TryStatement + { ann :: a, + body :: (AST.Parse.Err (Block a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ElseClause GHC.Generics.:+: ExceptClause GHC.Generics.:+: FinallyClause) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_656. + AST.Traversable1.Class.Traversable1 a_656 + ) + +instance AST.Unmarshal.SymbolMatching TryStatement where + matchedSymbols _ = [128] + showFailure _ node_657 = + "expected " + GHC.Base.<> ( "try_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_657 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_657) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_658 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_659 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_660 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_661 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_658 + c1_659 = TreeSitter.Node.nodeStartPoint node_657 + TreeSitter.Node.TSPoint + r2_660 + c2_661 = TreeSitter.Node.nodeEndPoint node_657 + +deriving instance GHC.Classes.Eq a_662 => GHC.Classes.Eq (TryStatement a_662) + +deriving instance GHC.Classes.Ord a_663 => GHC.Classes.Ord (TryStatement a_663) + +deriving instance GHC.Show.Show a_664 => GHC.Show.Show (TryStatement a_664) + +instance AST.Unmarshal.Unmarshal TryStatement + +instance Data.Foldable.Foldable TryStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TryStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TryStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Tuple a = Tuple + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: Yield) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_665. + AST.Traversable1.Class.Traversable1 a_665 + ) + +instance AST.Unmarshal.SymbolMatching Tuple where + matchedSymbols _ = [183] + showFailure _ node_666 = + "expected " + GHC.Base.<> ( "tuple" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_666 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_666) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_667 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_668 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_669 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_670 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_667 + c1_668 = TreeSitter.Node.nodeStartPoint node_666 + TreeSitter.Node.TSPoint + r2_669 + c2_670 = TreeSitter.Node.nodeEndPoint node_666 + +deriving instance GHC.Classes.Eq a_671 => GHC.Classes.Eq (Tuple a_671) + +deriving instance GHC.Classes.Ord a_672 => GHC.Classes.Ord (Tuple a_672) + +deriving instance GHC.Show.Show a_673 => GHC.Show.Show (Tuple a_673) + +instance AST.Unmarshal.Unmarshal Tuple + +instance Data.Foldable.Foldable Tuple where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Tuple where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Tuple where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Type a = Type {ann :: a, extraChildren :: (AST.Parse.Err (Expression a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_674. + AST.Traversable1.Class.Traversable1 a_674 + ) + +instance AST.Unmarshal.SymbolMatching Type where + matchedSymbols _ = [172] + showFailure _ node_675 = + "expected " + GHC.Base.<> ( "type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_675 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_675) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_676 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_677 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_678 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_679 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_676 + c1_677 = TreeSitter.Node.nodeStartPoint node_675 + TreeSitter.Node.TSPoint + r2_678 + c2_679 = TreeSitter.Node.nodeEndPoint node_675 + +deriving instance GHC.Classes.Eq a_680 => GHC.Classes.Eq (Type a_680) + +deriving instance GHC.Classes.Ord a_681 => GHC.Classes.Ord (Type a_681) + +deriving instance GHC.Show.Show a_682 => GHC.Show.Show (Type a_682) + +instance AST.Unmarshal.Unmarshal Type + +instance Data.Foldable.Foldable Type where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Type where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Type where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypedDefaultParameter a = TypedDefaultParameter + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + name :: (AST.Parse.Err (Identifier a)), + type' :: (AST.Parse.Err (Type a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_683. + AST.Traversable1.Class.Traversable1 a_683 + ) + +instance AST.Unmarshal.SymbolMatching TypedDefaultParameter where + matchedSymbols _ = [138] + showFailure _ node_684 = + "expected " + GHC.Base.<> ( "typed_default_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_684 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_684) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_685 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_686 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_687 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_688 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_685 + c1_686 = TreeSitter.Node.nodeStartPoint node_684 + TreeSitter.Node.TSPoint + r2_687 + c2_688 = TreeSitter.Node.nodeEndPoint node_684 + +deriving instance GHC.Classes.Eq a_689 => GHC.Classes.Eq (TypedDefaultParameter a_689) + +deriving instance GHC.Classes.Ord a_690 => GHC.Classes.Ord (TypedDefaultParameter a_690) + +deriving instance GHC.Show.Show a_691 => GHC.Show.Show (TypedDefaultParameter a_691) + +instance AST.Unmarshal.Unmarshal TypedDefaultParameter + +instance Data.Foldable.Foldable TypedDefaultParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypedDefaultParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypedDefaultParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypedParameter a = TypedParameter + { ann :: a, + type' :: (AST.Parse.Err (Type a)), + extraChildren :: (AST.Parse.Err ((DictionarySplat GHC.Generics.:+: Identifier GHC.Generics.:+: ListSplat) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_692. + AST.Traversable1.Class.Traversable1 a_692 + ) + +instance AST.Unmarshal.SymbolMatching TypedParameter where + matchedSymbols _ = [171] + showFailure _ node_693 = + "expected " + GHC.Base.<> ( "typed_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_693 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_693) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_694 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_695 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_696 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_697 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_694 + c1_695 = TreeSitter.Node.nodeStartPoint node_693 + TreeSitter.Node.TSPoint + r2_696 + c2_697 = TreeSitter.Node.nodeEndPoint node_693 + +deriving instance GHC.Classes.Eq a_698 => GHC.Classes.Eq (TypedParameter a_698) + +deriving instance GHC.Classes.Ord a_699 => GHC.Classes.Ord (TypedParameter a_699) + +deriving instance GHC.Show.Show a_700 => GHC.Show.Show (TypedParameter a_700) + +instance AST.Unmarshal.Unmarshal TypedParameter + +instance Data.Foldable.Foldable TypedParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypedParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypedParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnaryOperator a = UnaryOperator + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousTilde) a)), + argument :: (AST.Parse.Err (PrimaryExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_701. + AST.Traversable1.Class.Traversable1 a_701 + ) + +instance AST.Unmarshal.SymbolMatching UnaryOperator where + matchedSymbols _ = [159] + showFailure _ node_702 = + "expected " + GHC.Base.<> ( "unary_operator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_702 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_702) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_703 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_704 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_705 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_706 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_703 + c1_704 = TreeSitter.Node.nodeStartPoint node_702 + TreeSitter.Node.TSPoint + r2_705 + c2_706 = TreeSitter.Node.nodeEndPoint node_702 + +deriving instance GHC.Classes.Eq a_707 => GHC.Classes.Eq (UnaryOperator a_707) + +deriving instance GHC.Classes.Ord a_708 => GHC.Classes.Ord (UnaryOperator a_708) + +deriving instance GHC.Show.Show a_709 => GHC.Show.Show (UnaryOperator a_709) + +instance AST.Unmarshal.Unmarshal UnaryOperator + +instance Data.Foldable.Foldable UnaryOperator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnaryOperator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnaryOperator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Variables a = Variables + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (PrimaryExpression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_710. + AST.Traversable1.Class.Traversable1 a_710 + ) + +instance AST.Unmarshal.SymbolMatching Variables where + matchedSymbols _ = [150] + showFailure _ node_711 = + "expected " + GHC.Base.<> ( "variables" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_711 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_711) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_712 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_713 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_714 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_715 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_712 + c1_713 = TreeSitter.Node.nodeStartPoint node_711 + TreeSitter.Node.TSPoint + r2_714 + c2_715 = TreeSitter.Node.nodeEndPoint node_711 + +deriving instance GHC.Classes.Eq a_716 => GHC.Classes.Eq (Variables a_716) + +deriving instance GHC.Classes.Ord a_717 => GHC.Classes.Ord (Variables a_717) + +deriving instance GHC.Show.Show a_718 => GHC.Show.Show (Variables a_718) + +instance AST.Unmarshal.Unmarshal Variables + +instance Data.Foldable.Foldable Variables where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Variables where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Variables where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WhileStatement a = WhileStatement + { ann :: a, + alternative :: (GHC.Maybe.Maybe (AST.Parse.Err (ElseClause a))), + body :: (AST.Parse.Err (Block a)), + condition :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_719. + AST.Traversable1.Class.Traversable1 a_719 + ) + +instance AST.Unmarshal.SymbolMatching WhileStatement where + matchedSymbols _ = [127] + showFailure _ node_720 = + "expected " + GHC.Base.<> ( "while_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_720 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_720) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_721 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_722 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_723 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_724 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_721 + c1_722 = TreeSitter.Node.nodeStartPoint node_720 + TreeSitter.Node.TSPoint + r2_723 + c2_724 = TreeSitter.Node.nodeEndPoint node_720 + +deriving instance GHC.Classes.Eq a_725 => GHC.Classes.Eq (WhileStatement a_725) + +deriving instance GHC.Classes.Ord a_726 => GHC.Classes.Ord (WhileStatement a_726) + +deriving instance GHC.Show.Show a_727 => GHC.Show.Show (WhileStatement a_727) + +instance AST.Unmarshal.Unmarshal WhileStatement + +instance Data.Foldable.Foldable WhileStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WhileStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WhileStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WildcardImport a = WildcardImport {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_728. + AST.Traversable1.Class.Traversable1 a_728 + ) + +instance AST.Unmarshal.SymbolMatching WildcardImport where + matchedSymbols _ = [111] + showFailure _ node_729 = + "expected " + GHC.Base.<> ( "wildcard_import" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_729 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_729) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_730 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_731 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_732 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_733 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_730 + c1_731 = TreeSitter.Node.nodeStartPoint node_729 + TreeSitter.Node.TSPoint + r2_732 + c2_733 = TreeSitter.Node.nodeEndPoint node_729 + +deriving instance GHC.Classes.Eq a_734 => GHC.Classes.Eq (WildcardImport a_734) + +deriving instance GHC.Classes.Ord a_735 => GHC.Classes.Ord (WildcardImport a_735) + +deriving instance GHC.Show.Show a_736 => GHC.Show.Show (WildcardImport a_736) + +instance AST.Unmarshal.Unmarshal WildcardImport + +instance Data.Foldable.Foldable WildcardImport where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WildcardImport where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WildcardImport where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WithItem a = WithItem + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + alias :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_737. + AST.Traversable1.Class.Traversable1 a_737 + ) + +instance AST.Unmarshal.SymbolMatching WithItem where + matchedSymbols _ = [132] + showFailure _ node_738 = + "expected " + GHC.Base.<> ( "with_item" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_738 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_738) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_739 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_740 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_741 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_742 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_739 + c1_740 = TreeSitter.Node.nodeStartPoint node_738 + TreeSitter.Node.TSPoint + r2_741 + c2_742 = TreeSitter.Node.nodeEndPoint node_738 + +deriving instance GHC.Classes.Eq a_743 => GHC.Classes.Eq (WithItem a_743) + +deriving instance GHC.Classes.Ord a_744 => GHC.Classes.Ord (WithItem a_744) + +deriving instance GHC.Show.Show a_745 => GHC.Show.Show (WithItem a_745) + +instance AST.Unmarshal.Unmarshal WithItem + +instance Data.Foldable.Foldable WithItem where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WithItem where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WithItem where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WithStatement a = WithStatement + { ann :: a, + body :: (AST.Parse.Err (Block a)), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (WithItem a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_746. + AST.Traversable1.Class.Traversable1 a_746 + ) + +instance AST.Unmarshal.SymbolMatching WithStatement where + matchedSymbols _ = [131] + showFailure _ node_747 = + "expected " + GHC.Base.<> ( "with_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_747 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_747) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_748 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_749 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_750 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_751 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_748 + c1_749 = TreeSitter.Node.nodeStartPoint node_747 + TreeSitter.Node.TSPoint + r2_750 + c2_751 = TreeSitter.Node.nodeEndPoint node_747 + +deriving instance GHC.Classes.Eq a_752 => GHC.Classes.Eq (WithStatement a_752) + +deriving instance GHC.Classes.Ord a_753 => GHC.Classes.Ord (WithStatement a_753) + +deriving instance GHC.Show.Show a_754 => GHC.Show.Show (WithStatement a_754) + +instance AST.Unmarshal.Unmarshal WithStatement + +instance Data.Foldable.Foldable WithStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WithStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WithStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Yield a = Yield + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: ExpressionList) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_755. + AST.Traversable1.Class.Traversable1 a_755 + ) + +instance AST.Unmarshal.SymbolMatching Yield where + matchedSymbols _ = [166] + showFailure _ node_756 = + "expected " + GHC.Base.<> ( "yield" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_756 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_756) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_757 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_758 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_759 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_760 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_757 + c1_758 = TreeSitter.Node.nodeStartPoint node_756 + TreeSitter.Node.TSPoint + r2_759 + c2_760 = TreeSitter.Node.nodeEndPoint node_756 + +deriving instance GHC.Classes.Eq a_761 => GHC.Classes.Eq (Yield a_761) + +deriving instance GHC.Classes.Ord a_762 => GHC.Classes.Ord (Yield a_762) + +deriving instance GHC.Show.Show a_763 => GHC.Show.Show (Yield a_763) + +instance AST.Unmarshal.Unmarshal Yield + +instance Data.Foldable.Foldable Yield where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Yield where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Yield where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousBangEqual = AST.Token.Token "!=" 58 + +type AnonymousPercent = AST.Token.Token "%" 48 + +type AnonymousPercentEqual = AST.Token.Token "%=" 70 + +type AnonymousAmpersand = AST.Token.Token "&" 51 + +type AnonymousAmpersandEqual = AST.Token.Token "&=" 74 + +type AnonymousLParen = AST.Token.Token "(" 6 + +type AnonymousRParen = AST.Token.Token ")" 7 + +type AnonymousStar = AST.Token.Token "*" 10 + +type AnonymousStarStar = AST.Token.Token "**" 36 + +type AnonymousStarStarEqual = AST.Token.Token "**=" 71 + +type AnonymousStarEqual = AST.Token.Token "*=" 66 + +type AnonymousPlus = AST.Token.Token "+" 45 + +type AnonymousPlusEqual = AST.Token.Token "+=" 64 + +type AnonymousComma = AST.Token.Token "," 8 + +type AnonymousMinus = AST.Token.Token "-" 46 + +type AnonymousMinusEqual = AST.Token.Token "-=" 65 + +type AnonymousMinusRAngle = AST.Token.Token "->" 34 + +type AnonymousDot = AST.Token.Token "." 3 + +type AnonymousSlash = AST.Token.Token "/" 47 + +type AnonymousSlashSlash = AST.Token.Token "//" 49 + +type AnonymousSlashSlashEqual = AST.Token.Token "//=" 69 + +type AnonymousSlashEqual = AST.Token.Token "/=" 67 + +type AnonymousColon = AST.Token.Token ":" 22 + +type AnonymousColonEqual = AST.Token.Token ":=" 14 + +type AnonymousLAngle = AST.Token.Token "<" 55 + +type AnonymousLAngleLAngle = AST.Token.Token "<<" 53 + +type AnonymousLAngleLAngleEqual = AST.Token.Token "<<=" 73 + +type AnonymousLAngleEqual = AST.Token.Token "<=" 56 + +type AnonymousLAngleRAngle = AST.Token.Token "<>" 61 + +type AnonymousEqual = AST.Token.Token "=" 35 + +type AnonymousEqualEqual = AST.Token.Token "==" 57 + +type AnonymousRAngle = AST.Token.Token ">" 60 + +type AnonymousRAngleEqual = AST.Token.Token ">=" 59 + +type AnonymousRAngleRAngle = AST.Token.Token ">>" 12 + +type AnonymousRAngleRAngleEqual = AST.Token.Token ">>=" 72 + +type AnonymousAt = AST.Token.Token "@" 41 + +type AnonymousAtEqual = AST.Token.Token "@=" 68 + +type AnonymousLBracket = AST.Token.Token "[" 78 + +type AnonymousRBracket = AST.Token.Token "]" 79 + +type AnonymousCaret = AST.Token.Token "^" 52 + +type AnonymousCaretEqual = AST.Token.Token "^=" 75 + +type AnonymousUnderscorefutureUnderscore = + AST.Token.Token + "__future__" + 5 + +type AnonymousAnd = AST.Token.Token "and" 43 + +type AnonymousAs = AST.Token.Token "as" 9 + +type AnonymousAssert = AST.Token.Token "assert" 13 + +type AnonymousAsync = AST.Token.Token "async" 25 + +type AnonymousAwait = AST.Token.Token "await" 92 + +type AnonymousBreak = AST.Token.Token "break" 19 + +type AnonymousClass = AST.Token.Token "class" 40 + +type AnonymousContinue = AST.Token.Token "continue" 20 + +type AnonymousDef = AST.Token.Token "def" 33 + +type AnonymousDel = AST.Token.Token "del" 16 + +type AnonymousElif = AST.Token.Token "elif" 23 + +data Ellipsis a = Ellipsis {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_764. + AST.Traversable1.Class.Traversable1 a_764 + ) + +instance AST.Unmarshal.SymbolMatching Ellipsis where + matchedSymbols _ = [80] + showFailure _ node_765 = + "expected " + GHC.Base.<> ( "ellipsis" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_765 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_765) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_766 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_767 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_768 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_769 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_766 + c1_767 = TreeSitter.Node.nodeStartPoint node_765 + TreeSitter.Node.TSPoint + r2_768 + c2_769 = TreeSitter.Node.nodeEndPoint node_765 + +deriving instance GHC.Classes.Eq a_770 => GHC.Classes.Eq (Ellipsis a_770) + +deriving instance GHC.Classes.Ord a_771 => GHC.Classes.Ord (Ellipsis a_771) + +deriving instance GHC.Show.Show a_772 => GHC.Show.Show (Ellipsis a_772) + +instance AST.Unmarshal.Unmarshal Ellipsis + +instance Data.Foldable.Foldable Ellipsis where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Ellipsis where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Ellipsis where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousElse = AST.Token.Token "else" 24 + +data EscapeSequence a = EscapeSequence {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_773. + AST.Traversable1.Class.Traversable1 a_773 + ) + +instance AST.Unmarshal.SymbolMatching EscapeSequence where + matchedSymbols _ = [83] + showFailure _ node_774 = + "expected " + GHC.Base.<> ( "escape_sequence" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_774 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_774) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_775 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_776 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_777 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_778 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_775 + c1_776 = TreeSitter.Node.nodeStartPoint node_774 + TreeSitter.Node.TSPoint + r2_777 + c2_778 = TreeSitter.Node.nodeEndPoint node_774 + +deriving instance GHC.Classes.Eq a_779 => GHC.Classes.Eq (EscapeSequence a_779) + +deriving instance GHC.Classes.Ord a_780 => GHC.Classes.Ord (EscapeSequence a_780) + +deriving instance GHC.Show.Show a_781 => GHC.Show.Show (EscapeSequence a_781) + +instance AST.Unmarshal.Unmarshal EscapeSequence + +instance Data.Foldable.Foldable EscapeSequence where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EscapeSequence where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EscapeSequence where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousExcept = AST.Token.Token "except" 30 + +type AnonymousExec = AST.Token.Token "exec" 39 + +data False a = False {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_782. + AST.Traversable1.Class.Traversable1 a_782 + ) + +instance AST.Unmarshal.SymbolMatching False where + matchedSymbols _ = [90] + showFailure _ node_783 = + "expected " + GHC.Base.<> ( "false" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_783 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_783) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_784 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_785 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_786 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_787 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_784 + c1_785 = TreeSitter.Node.nodeStartPoint node_783 + TreeSitter.Node.TSPoint + r2_786 + c2_787 = TreeSitter.Node.nodeEndPoint node_783 + +deriving instance GHC.Classes.Eq a_788 => GHC.Classes.Eq (False a_788) + +deriving instance GHC.Classes.Ord a_789 => GHC.Classes.Ord (False a_789) + +deriving instance GHC.Show.Show a_790 => GHC.Show.Show (False a_790) + +instance AST.Unmarshal.Unmarshal False + +instance Data.Foldable.Foldable False where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor False where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable False where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFinally = AST.Token.Token "finally" 31 + +data Float a = Float {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_791. + AST.Traversable1.Class.Traversable1 a_791 + ) + +instance AST.Unmarshal.SymbolMatching Float where + matchedSymbols _ = [88] + showFailure _ node_792 = + "expected " + GHC.Base.<> ( "float" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_792 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_792) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_793 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_794 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_795 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_796 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_793 + c1_794 = TreeSitter.Node.nodeStartPoint node_792 + TreeSitter.Node.TSPoint + r2_795 + c2_796 = TreeSitter.Node.nodeEndPoint node_792 + +deriving instance GHC.Classes.Eq a_797 => GHC.Classes.Eq (Float a_797) + +deriving instance GHC.Classes.Ord a_798 => GHC.Classes.Ord (Float a_798) + +deriving instance GHC.Show.Show a_799 => GHC.Show.Show (Float a_799) + +instance AST.Unmarshal.Unmarshal Float + +instance Data.Foldable.Foldable Float where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Float where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Float where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFor = AST.Token.Token "for" 26 + +type AnonymousFrom = AST.Token.Token "from" 4 + +type AnonymousGlobal = AST.Token.Token "global" 37 + +data Identifier a = Identifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_800. + AST.Traversable1.Class.Traversable1 a_800 + ) + +instance AST.Unmarshal.SymbolMatching Identifier where + matchedSymbols _ = [1] + showFailure _ node_801 = + "expected " + GHC.Base.<> ( "identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_801 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_801) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_802 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_803 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_804 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_805 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_802 + c1_803 = TreeSitter.Node.nodeStartPoint node_801 + TreeSitter.Node.TSPoint + r2_804 + c2_805 = TreeSitter.Node.nodeEndPoint node_801 + +deriving instance GHC.Classes.Eq a_806 => GHC.Classes.Eq (Identifier a_806) + +deriving instance GHC.Classes.Ord a_807 => GHC.Classes.Ord (Identifier a_807) + +deriving instance GHC.Show.Show a_808 => GHC.Show.Show (Identifier a_808) + +instance AST.Unmarshal.Unmarshal Identifier + +instance Data.Foldable.Foldable Identifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Identifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Identifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousIf = AST.Token.Token "if" 21 + +type AnonymousImport = AST.Token.Token "import" 2 + +type AnonymousIn = AST.Token.Token "in" 27 + +data Integer a = Integer {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_809. + AST.Traversable1.Class.Traversable1 a_809 + ) + +instance AST.Unmarshal.SymbolMatching Integer where + matchedSymbols _ = [87] + showFailure _ node_810 = + "expected " + GHC.Base.<> ( "integer" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_810 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_810) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_811 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_812 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_813 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_814 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_811 + c1_812 = TreeSitter.Node.nodeStartPoint node_810 + TreeSitter.Node.TSPoint + r2_813 + c2_814 = TreeSitter.Node.nodeEndPoint node_810 + +deriving instance GHC.Classes.Eq a_815 => GHC.Classes.Eq (Integer a_815) + +deriving instance GHC.Classes.Ord a_816 => GHC.Classes.Ord (Integer a_816) + +deriving instance GHC.Show.Show a_817 => GHC.Show.Show (Integer a_817) + +instance AST.Unmarshal.Unmarshal Integer + +instance Data.Foldable.Foldable Integer where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Integer where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Integer where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousIs = AST.Token.Token "is" 62 + +type AnonymousLambda = AST.Token.Token "lambda" 63 + +data None a = None {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_818. + AST.Traversable1.Class.Traversable1 a_818 + ) + +instance AST.Unmarshal.SymbolMatching None where + matchedSymbols _ = [91] + showFailure _ node_819 = + "expected " + GHC.Base.<> ( "none" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_819 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_819) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_820 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_821 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_822 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_823 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_820 + c1_821 = TreeSitter.Node.nodeStartPoint node_819 + TreeSitter.Node.TSPoint + r2_822 + c2_823 = TreeSitter.Node.nodeEndPoint node_819 + +deriving instance GHC.Classes.Eq a_824 => GHC.Classes.Eq (None a_824) + +deriving instance GHC.Classes.Ord a_825 => GHC.Classes.Ord (None a_825) + +deriving instance GHC.Show.Show a_826 => GHC.Show.Show (None a_826) + +instance AST.Unmarshal.Unmarshal None + +instance Data.Foldable.Foldable None where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor None where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable None where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousNonlocal = AST.Token.Token "nonlocal" 38 + +type AnonymousNot = AST.Token.Token "not" 42 + +type AnonymousOr = AST.Token.Token "or" 44 + +type AnonymousPass = AST.Token.Token "pass" 18 + +type AnonymousPrint = AST.Token.Token "print" 11 + +type AnonymousRaise = AST.Token.Token "raise" 17 + +type AnonymousReturn = AST.Token.Token "return" 15 + +data True a = True {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_827. + AST.Traversable1.Class.Traversable1 a_827 + ) + +instance AST.Unmarshal.SymbolMatching True where + matchedSymbols _ = [89] + showFailure _ node_828 = + "expected " + GHC.Base.<> ( "true" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_828 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_828) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_829 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_830 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_831 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_832 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_829 + c1_830 = TreeSitter.Node.nodeStartPoint node_828 + TreeSitter.Node.TSPoint + r2_831 + c2_832 = TreeSitter.Node.nodeEndPoint node_828 + +deriving instance GHC.Classes.Eq a_833 => GHC.Classes.Eq (True a_833) + +deriving instance GHC.Classes.Ord a_834 => GHC.Classes.Ord (True a_834) + +deriving instance GHC.Show.Show a_835 => GHC.Show.Show (True a_835) + +instance AST.Unmarshal.Unmarshal True + +instance Data.Foldable.Foldable True where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor True where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable True where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousTry = AST.Token.Token "try" 29 + +data TypeConversion a = TypeConversion {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_836. + AST.Traversable1.Class.Traversable1 a_836 + ) + +instance AST.Unmarshal.SymbolMatching TypeConversion where + matchedSymbols _ = [86] + showFailure _ node_837 = + "expected " + GHC.Base.<> ( "type_conversion" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_837 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_837) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_838 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_839 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_840 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_841 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_838 + c1_839 = TreeSitter.Node.nodeStartPoint node_837 + TreeSitter.Node.TSPoint + r2_840 + c2_841 = TreeSitter.Node.nodeEndPoint node_837 + +deriving instance GHC.Classes.Eq a_842 => GHC.Classes.Eq (TypeConversion a_842) + +deriving instance GHC.Classes.Ord a_843 => GHC.Classes.Ord (TypeConversion a_843) + +deriving instance GHC.Show.Show a_844 => GHC.Show.Show (TypeConversion a_844) + +instance AST.Unmarshal.Unmarshal TypeConversion + +instance Data.Foldable.Foldable TypeConversion where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeConversion where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeConversion where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousWhile = AST.Token.Token "while" 28 + +type AnonymousWith = AST.Token.Token "with" 32 + +type AnonymousYield = AST.Token.Token "yield" 77 + +type AnonymousLBrace = AST.Token.Token "{" 81 + +type AnonymousPipe = AST.Token.Token "|" 50 + +type AnonymousPipeEqual = AST.Token.Token "|=" 76 + +type AnonymousRBrace = AST.Token.Token "}" 82 + +type AnonymousTilde = AST.Token.Token "~" 54 diff --git a/semantic-python/src/Language/Python/Core.hs b/semantic-python/src/Language/Python/Core.hs new file mode 100644 index 0000000000..9e5bd48fa7 --- /dev/null +++ b/semantic-python/src/Language/Python/Core.hs @@ -0,0 +1,419 @@ +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedLists #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE ViewPatterns #-} + +-- NOTE: This file needs to be updated to accommodate new AST shapes. +-- A portion of instances have been updated to include the Err functor; +-- remaining instances are to be updated once this is stable. + +module Language.Python.Core +( toplevelCompile +, Bindings +) where + +import Prelude hiding (fail) + +import AST.Element +import Control.Algebra hiding ((:+:)) +import Control.Effect.Reader +import Core.Core as Core +import Core.Name as Name +import Data.Coerce +import Data.Foldable +import Data.Function +import Data.List.NonEmpty (NonEmpty (..)) +import Data.Maybe +import GHC.Records +import qualified Language.Python.AST as Py +import Language.Python.Failure +import Language.Python.Patterns +import Source.Span (Span) +import Syntax.Stack (Stack (..)) +import qualified Syntax.Stack as Stack + +-- | Keeps track of the current scope's bindings (so that we can, when +-- compiling a class or module, return the list of bound variables as +-- a Core record so that all immediate definitions are exposed) +newtype Bindings = Bindings { unBindings :: Stack Name } + deriving (Eq, Monoid, Semigroup, Show) + +def :: Name -> Bindings -> Bindings +def n = coerce (Stack.:> n) + +prelude :: Has Core sig t => [Name] -> t Name +prelude = foldl' (...) (pure "__semantic_prelude") + +-- We leave the representation of Core syntax abstract so that it's not +-- possible for us to 'cheat' by pattern-matching on or eliminating a +-- compiled term. +type CoreSyntax sig t = ( Has Core sig t + , Has (Ann Span) sig t + , Has Failure sig t + , Foldable t + ) + +class Compile (py :: * -> *) where + compile :: ( CoreSyntax syn t + , Has (Reader Bindings) sig m + ) + => py Span + -> (t Name -> m (t Name)) + -> (t Name -> m (t Name)) + + default compile :: (Applicative m, Has Failure syn t, Show (py Span)) => py Span -> (t Name -> m (t Name)) -> (t Name -> m (t Name)) + compile a _ _ = defaultCompile a + +toplevelCompile :: ( CoreSyntax syn t + , Has (Reader Bindings) sig m + ) + => Py.Module Span + -> m (t Name) +toplevelCompile py = compile py pure none + +-- | TODO: This is not right, it should be a reference to a Preluded +-- NoneType instance, but it will do for now. +none :: Has Core sig t => t Name +none = unit + +locate :: ( HasField "ann" syntax Span + , CoreSyntax syn t + ) + => syntax + -> t a + -> t a +locate syn = Core.annAt (getField @"ann" syn) + +defaultCompile :: (Applicative m, Has Failure syn t, Show py) => py -> m (t Name) +defaultCompile = pure . unimplemented + + +instance (Compile l, Compile r) => Compile (l :+: r) where + compile (L1 l) cc = compile l cc + compile (R1 r) cc = compile r cc + +instance Compile Py.AssertStatement +instance Compile Py.Attribute + +-- Assignment compilation. Assignments are an uneasy hybrid of expressions +-- (since they appear to have values, i.e. `a = b = c`) and statements (because +-- they introduce bindings). For that reason, they deserve special attention. +-- +-- The correct desugaring for the expression above looks like, given a continuation @cont@: +-- @ +-- (b :<- c) >>>= (a :<- b) >>>= cont +-- @ +-- The tree structure that we get out of tree-sitter is not particulary conducive to expressing +-- this naturally, so we engage in a small desugaring step so that we can turn a list [a, b, c] +-- into a sequenced Core expression using >>>= and a fold through which informationβ€”specifically +-- the LHS to assignβ€”flows. + +-- RHS represents the right-hand-side of an assignment that we get out of tree-sitter. +-- Desugared is the "terminal" node in a sequence of assignments, i.e. given a = b = c, +-- c will be the terminal node. It is never an assignment. +type RHS = (Py.Assignment :+: Py.AugmentedAssignment) :+: Desugared +type Desugared = Py.ExpressionList :+: Py.Yield + +-- We have to pair locations and names, and tuple syntax is harder to +-- read in this case than a happy little constructor. +data Located a = Located Span a + +-- Desugaring an RHS involves walking as deeply as possible into an +-- assignment, storing the names we encounter as we go and eventually +-- returning a terminal expression. We have to keep track of which +desugar :: [Located Name] + -> RHS Span + -> Either String ([Located Name], Desugared Span) +desugar acc = \case + Prj Py.Assignment { left = SingleIdentifier name, right = Just rhs, ann} -> + desugar (Located ann name : acc) rhs + R1 any -> pure (acc, any) + other -> Left ("desugar: couldn't desugar RHS " <> show other) + +-- This is an algebra that is invoked from a left fold but that +-- returns a function (the 'difference' pattern) so that we can pass +-- information about what RHS we need down the chain: unlike most fold +-- functions, it has four parameters, not three (since our fold +-- returns a function). There's some pun to be made on "collapsing +-- sugar", like "icing" or "sugar water" but I'll leave that as an +-- exercise to the reader. +collapseDesugared :: (CoreSyntax syn t, Has (Reader Bindings) sig m) + => Located Name -- The current LHS to which to assign + -> (t Name -> m (t Name)) -- A meta-continuation: it takes a name and returns a continuation + -> t Name -- The current RHS to which to assign, yielded from an outer continuation + -> m (t Name) -- The properly-sequenced resolut +collapseDesugared (Located loc n) cont rem = + let assigning = fmap (Core.annAt loc . ((Name.named' n :<- rem) >>>=)) + in assigning (local (def n) (cont (pure n))) -- gotta call local here to record this assignment + +instance Compile Py.Assignment where + compile it@Py.Assignment + { left = SingleIdentifier name + , right = Just rhs + , ann + } cc next = case desugar [Located ann name] rhs of + Right (names, val) -> compile val pure next >>= foldr collapseDesugared cc names >>= pure . locate it + Left msg -> pure $ unimplemented msg + + + + compile other _ _ = pure $ invariantViolated ("Unhandled assignment case: " <> show other) + +-- End assignment compilation + +instance Compile Py.AugmentedAssignment +instance Compile Py.Await +instance Compile Py.BinaryOperator + +instance Compile Py.Block where + compile it@Py.Block{ Py.extraChildren = body} cc + = fmap (locate it) + . foldr compile cc body + +instance Compile Py.BooleanOperator +instance Compile Py.BreakStatement + +instance Compile Py.Call where + compile it@Py.Call + { function + , arguments = L1 Py.ArgumentList { extraChildren = args } + } cc next = do + func <- compile function pure next + let compileArg = \case + Prj expr -> compile (expr :: Py.Expression Span) pure next + other -> pure . invariantViolated $ "Can't compile non-expression function argument: " <> show other + + -- Python function arguments are defined to evaluate left to right. + args <- traverse compileArg args + locate it (func $$* args) & cc + compile it _ _ = pure . invariantViolated $ "can't compile Call node with generator expression: " <> show it + +instance Compile Py.ClassDefinition where + compile it@Py.ClassDefinition { body = pybody, name = Py.Identifier _ann (Name.name -> n) } cc next = do + let buildTypeCall _ = do + bindings <- asks @Bindings (toList . unBindings) + let buildName n = (n, pure n) + contents = record . fmap buildName $ bindings + typefn = prelude ["type"] + object = prelude ["object"] + + pure (typefn $$ Core.string (formatName n) $$ object $$ contents) + + body <- compile pybody buildTypeCall next + let coreName = Name.named' n + assignClass = coreName :<- rec coreName body + continuing = fmap (locate it . (assignClass >>>=)) + continuing (local (def n) (cc next)) + +instance Compile Py.ComparisonOperator + +deriving instance Compile Py.CompoundStatement + +instance Compile Py.ConcatenatedString +instance Compile Py.ConditionalExpression +instance Compile Py.ContinueStatement + +instance Compile Py.DecoratedDefinition where + compile it@Py.DecoratedDefinition + { definition + , extraChildren = [ Py.Decorator { extraChildren } ] + } cc next = do + let thenReassign item = do + bindings <- asks unBindings + case bindings of + _ :> lastbound -> do + tocall <- compile extraChildren pure next + let callit go = (pure lastbound .= (tocall $$ pure lastbound)) >>> go + fmap callit (cc item) + _ -> pure . invariantViolated $ "Encountered a decorated definition without a corresponding function" + locate it <$> compile definition thenReassign next + compile it _ _ = pure . invariantViolated $ "Can't figure out decorated definition " <> show it +instance Compile Py.DeleteStatement +instance Compile Py.Dictionary +instance Compile Py.DictionaryComprehension + +instance Compile Py.DottedName where + compile it@Py.DottedName + { extraChildren = Py.Identifier { text } :| rest + } cc _next = do + let aggregate Py.Identifier { text = inner } x = x ... Name.name inner + composite = foldr aggregate (pure (Name.name text)) rest + locate it composite & cc + + +instance Compile Py.Ellipsis +instance Compile Py.ExecStatement + +deriving instance Compile Py.Expression + +instance Compile Py.ExpressionStatement where + compile it@Py.ExpressionStatement { Py.extraChildren = children } cc + = fmap (locate it) + . foldr compile cc children + +instance Compile Py.ExpressionList where + compile it@Py.ExpressionList { Py.extraChildren = [child] } cc + = fmap (locate it) + . compile child cc + compile Py.ExpressionList { Py.extraChildren = items } _ + = const . pure . unimplemented $ "ExpressionList of length " <> show items + + +instance Compile Py.False where + compile it cc _ = cc $ locate it (bool False) + +instance Compile Py.Float +instance Compile Py.ForStatement + +instance Compile Py.FunctionDefinition where + compile it@Py.FunctionDefinition + { name = Py.Identifier _ann1 name + , parameters = Py.Parameters _ann2 parameters + , body + } cc next = do + -- Compile each of the parameters, then the body. + let parameterMs = fmap param parameters + if any isNothing parameterMs + then pure . invariantViolated $ "Couldn't extract parameters" + else do + let parameters' = catMaybes parameterMs + body' <- compile body pure next + -- Build a lambda. + let located = locate it (rec (Name.named' (Name.name name)) (lams parameters' body')) + -- Give it a name (below), then augment the current continuation + -- with the new name (with 'def'), so that calling contexts know + -- that we have built an exportable definition. + assigning located <$> local (def (Name.name name)) (cc next) + where param (Py.Parameter (Prj (Py.Identifier _pann pname))) = Just . named' . Name.name $ pname + param _ = Nothing + assigning item f = (Name.named' (Name.name name) :<- item) >>>= f + +instance Compile Py.FutureImportStatement +instance Compile Py.GeneratorExpression +instance Compile Py.GlobalStatement + +instance Compile Py.Identifier where + compile Py.Identifier { text } cc _ = cc . pure . Name.name $ text + +instance Compile Py.IfStatement where + compile it@Py.IfStatement{ condition, consequence, alternative} cc next = + locate it <$> (if' <$> compile condition pure next + <*> compile consequence cc next + <*> foldr clause (cc next) alternative) + where clause (R1 Py.ElseClause{ body }) _ = compile body cc next + clause (L1 Py.ElifClause{ condition, consequence }) rest = + if' <$> compile condition pure next <*> compile consequence cc next <*> rest + + +instance Compile Py.ImportFromStatement +instance Compile Py.ImportStatement +instance Compile Py.Integer + +instance Compile Py.Lambda where + compile it@Py.Lambda + { body + , parameters + } cc next = do + let unparams (Py.LambdaParameters _ ps) = toList ps + unparam (Py.Parameter (Prj (Py.Identifier _pann pname))) = Just . named' . Name.name $ pname + unparam _ = Nothing + body' <- compile body cc next + let params = maybe [] unparams parameters + pure . locate it . lams (catMaybes (fmap unparam params)) $ body' + +instance Compile Py.List +instance Compile Py.ListComprehension +instance Compile Py.ListSplat + +instance Compile Py.Module where + compile it@Py.Module { Py.extraChildren = stmts } _cc = + -- This action gets passed to compile, which means it is the + -- final action taken after the compiling fold finishes. It takes + -- care of listening for the current set of bound variables (which + -- is augmented by assignments and function definitions) and + -- creating a record corresponding to those bindings. + let buildRecord _ = do + bindings <- asks @Bindings (toList . unBindings) + let buildName n = (n, pure n) + pure . record . fmap buildName $ bindings + in fmap (locate it) . foldr compile buildRecord stmts + +instance Compile Py.NamedExpression + +instance Compile Py.None where + -- None is not an lvalue, and thus always points to the prelude's None. + compile _it cc _ = cc (prelude ["None"]) + +instance Compile Py.NonlocalStatement + +instance Compile Py.NotOperator where + compile _it@Py.NotOperator{ argument } cc next = do + val <- compile argument pure next + cc (prelude ["not"] $$ val) + +instance Compile Py.ParenthesizedExpression where + compile it@Py.ParenthesizedExpression { extraChildren } cc + = fmap (locate it) + . compile extraChildren cc + +instance Compile Py.PassStatement where + compile it@Py.PassStatement {} cc _ = cc $ locate it Core.unit + +deriving instance Compile Py.PrimaryExpression + +instance Compile Py.PrintStatement + +instance Compile Py.ReturnStatement where + compile it@Py.ReturnStatement { Py.extraChildren = vals } _ next = locate it <$> case vals of + Nothing -> pure none + Just Py.ExpressionList { extraChildren = [val] } -> compile val pure next + Just Py.ExpressionList { extraChildren = vals } -> pure (invariantViolated ("unimplemented: return statement returning " <> show (length vals) <> " values")) + + +instance Compile Py.RaiseStatement +instance Compile Py.Set +instance Compile Py.SetComprehension + +deriving instance Compile Py.SimpleStatement + +instance Compile Py.String where + compile it@Py.String { extraChildren } cc _ = do + let extract = \case + Prj Py.EscapeSequence { text } -> Just text + _other -> Nothing + + let contents = fmap extract extraChildren + + if any isNothing contents + then pure . invariantViolated $ "Couldn't string-desugar " <> show it + else let new = prelude ["str", "__slots", "__new__"] + in cc $ locate it (new $$ Core.string (mconcat (catMaybes contents))) + +instance Compile Py.Subscript + +instance Compile Py.True where + compile it cc _next = cc $ locate it (bool True) + +instance Compile Py.TryStatement + +instance Compile Py.Tuple where + compile it@Py.Tuple { Py.extraChildren = [] } cc _ = cc $ locate it unit + + compile it _ _ = pure $ unimplemented it + +instance Compile Py.UnaryOperator +instance Compile Py.WhileStatement +instance Compile Py.WithStatement +instance Compile Py.Yield diff --git a/semantic-python/src/Language/Python/Failure.hs b/semantic-python/src/Language/Python/Failure.hs new file mode 100644 index 0000000000..0ff5fca9d1 --- /dev/null +++ b/semantic-python/src/Language/Python/Failure.hs @@ -0,0 +1,65 @@ +{-# LANGUAGE DeriveFoldable #-} +{-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE ExistentialQuantification #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TypeOperators #-} + +module Language.Python.Failure + ( Failure (..) + , unimplemented + , invariantViolated + , eliminateFailures + ) where + +import Prelude hiding (fail) + +import Control.Monad.Fail +import Data.Coerce +import Data.Kind +import GHC.Generics (Generic1) +import Syntax.Algebra +import Syntax.Foldable +import Syntax.Functor +import Syntax.Module +import Syntax.Sum +import Syntax.Term +import Syntax.Traversable + +data Failure (f :: Type -> Type) a + = Unimplemented String + | InvariantViolated String + deriving Generic1 + +instance Show (Failure f a) where + show (Unimplemented a) = "unimplemented: " <> a + show (InvariantViolated a) = "invariant violated: " <> a + +deriving instance Functor (Failure f) +deriving instance Foldable (Failure f) +deriving instance Traversable (Failure f) + +instance HFunctor Failure +instance HFoldable Failure +instance HTraversable Failure + +instance RightModule Failure where + a >>=* _ = coerce a + + +unimplemented :: (Show ast, Has Failure sig m) => ast -> m a +unimplemented = send . Unimplemented . show + +invariantViolated :: Has Failure sig m => String -> m a +invariantViolated = send . InvariantViolated + +eliminateFailures :: (MonadFail m, HTraversable sig, RightModule sig) + => Term (Failure :+: sig) a + -> m (Term sig a) +eliminateFailures = Syntax.Term.handle (pure . pure) (fail . show) diff --git a/semantic-python/src/Language/Python/Grammar.hs b/semantic-python/src/Language/Python/Grammar.hs new file mode 100644 index 0000000000..fabfafc49d --- /dev/null +++ b/semantic-python/src/Language/Python/Grammar.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} +module Language.Python.Grammar +( tree_sitter_python +, Grammar(..) +) where + +import AST.Grammar.TH +import Language.Haskell.TH +import TreeSitter.Python (tree_sitter_python) + +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData (mkName "Grammar") tree_sitter_python diff --git a/semantic-python/src/Language/Python/Patterns.hs b/semantic-python/src/Language/Python/Patterns.hs new file mode 100644 index 0000000000..099af40096 --- /dev/null +++ b/semantic-python/src/Language/Python/Patterns.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE OverloadedLists #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE ViewPatterns #-} + +module Language.Python.Patterns + ( pattern SingleIdentifier + ) where + +import AST.Element +import qualified AST.Parse as Parse +import qualified Analysis.Name +import qualified Language.Python.AST as Py + +-- | Useful pattern synonym for extracting a single identifier from +-- a Python ExpressionList. Easier than pattern-matching every time. +-- TODO: when this is finished, we won't need this pattern, as we'll +-- handle ExpressionLists the smart way every time. +pattern SingleIdentifier :: Analysis.Name.Name -> Py.ExpressionList a +pattern SingleIdentifier n <- Py.ExpressionList + { Py.extraChildren = + [ Parse.Success (Py.Expression (Prj (Py.PrimaryExpression (Prj Py.Identifier { text = Analysis.Name.name -> n })))) + ] + } diff --git a/semantic-python/src/Language/Python/ScopeGraph.hs b/semantic-python/src/Language/Python/ScopeGraph.hs new file mode 100644 index 0000000000..538f27f96e --- /dev/null +++ b/semantic-python/src/Language/Python/ScopeGraph.hs @@ -0,0 +1,331 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} + +-- NOTE: This file needs to be updated to accommodate new AST shapes. +-- A portion of instances have been updated to include the Err functor; +-- remaining instances are to be updated once this is stable. + +module Language.Python.ScopeGraph + ( scopeGraphModule + ) where + +import qualified Analysis.Name as Name +import AST.Element +import qualified AST.Parse as Parse +import Control.Effect.ScopeGraph +import qualified Control.Effect.ScopeGraph.Properties.Declaration as Props +import qualified Control.Effect.ScopeGraph.Properties.Function as Props +import qualified Control.Effect.ScopeGraph.Properties.Reference as Props +import Control.Lens (set, (^.)) +import Data.Foldable +import Data.List.NonEmpty (NonEmpty (..)) +import Data.Maybe +import Data.Monoid +import qualified Data.ScopeGraph as ScopeGraph +import Data.Traversable +import GHC.Records +import GHC.TypeLits +import qualified Language.Python.AST as Py +import Language.Python.Patterns +import Scope.Graph.Convert (Result (..), complete, todo) +import Scope.Types +import Source.Loc (Loc) +import Source.Span (Span, Pos (..), span_, point) + +-- This typeclass is internal-only, though it shares the same interface +-- as the one defined in semantic-scope-graph. The somewhat-unconventional +-- quantified constraint is to avoid having to define Show1 instances for +-- every single Python AST type. +class (forall a . Show a => Show (t a)) => ToScopeGraph t where + scopeGraph :: + ( ScopeGraphEff sig m + , Monoid (m Result) + ) + => t Loc + -> m Result + +instance (ToScopeGraph l, ToScopeGraph r) => ToScopeGraph (l :+: r) where + scopeGraph (L1 l) = scopeGraph l + scopeGraph (R1 r) = scopeGraph r + +onField :: + forall (field :: Symbol) syn sig m r . + ( ScopeGraphEff sig m + , HasField field (r Loc) (syn Loc) + , ToScopeGraph syn + , Monoid (m Result) + ) + => r Loc + -> m Result +onField + = scopeGraph @syn + . getField @field + +onChildren :: + ( Traversable t + , ToScopeGraph syn + , ScopeGraphEff sig m + , HasField "extraChildren" (r Loc) (t (syn Loc)) + , Monoid (m Result) + ) + => r Loc + -> m Result +onChildren + = fmap fold + . traverse scopeGraph + . getField @"extraChildren" + +scopeGraphModule :: ScopeGraphEff sig m => Py.Module Loc -> m Result +scopeGraphModule = getAp . scopeGraph + +instance ToScopeGraph Py.AssertStatement where scopeGraph = onChildren + +instance ToScopeGraph Py.Assignment where + scopeGraph (Py.Assignment ann (Parse.Success (SingleIdentifier t)) val _typ) = do + declare t Props.Declaration + { Props.kind = ScopeGraph.Assignment + , Props.relation = ScopeGraph.Default + , Props.associatedScope = Nothing + , Props.span = ann^.span_ + } + maybe complete scopeGraph val + scopeGraph x = todo x + +instance ToScopeGraph Py.Await where + scopeGraph (Py.Await _ a) = scopeGraph a + +instance ToScopeGraph Py.BooleanOperator where + scopeGraph (Py.BooleanOperator _ _ left right) = scopeGraph left <> scopeGraph right + +instance ToScopeGraph Py.BinaryOperator where + scopeGraph (Py.BinaryOperator _ _ left right) = scopeGraph left <> scopeGraph right + +instance ToScopeGraph Py.AugmentedAssignment where scopeGraph = onField @"right" + +instance ToScopeGraph Py.Attribute where scopeGraph = todo + +instance ToScopeGraph Py.Block where scopeGraph = onChildren + +instance ToScopeGraph Py.BreakStatement where scopeGraph = mempty + +instance ToScopeGraph Py.Call where + scopeGraph Py.Call + { function = Parse.Success f + , arguments = Parse.Success (L1 Py.ArgumentList { extraChildren = args }) + } = do + result <- scopeGraph f + let scopeGraphArg = \case + EPrj expr -> scopeGraph @Py.Expression expr + other -> todo other + args <- traverse scopeGraphArg args + pure (result <> mconcat args) + scopeGraph it = todo it + + +instance ToScopeGraph Py.ClassDefinition where scopeGraph = todo + +instance ToScopeGraph Py.ConcatenatedString where scopeGraph = mempty + +deriving instance ToScopeGraph Py.CompoundStatement + +instance ToScopeGraph Py.ConditionalExpression where scopeGraph = onChildren + +instance ToScopeGraph Py.ContinueStatement where scopeGraph = mempty + +instance ToScopeGraph Py.DecoratedDefinition where scopeGraph = todo + +instance ToScopeGraph Py.ComparisonOperator where scopeGraph = onChildren + +instance ToScopeGraph Py.DeleteStatement where scopeGraph = mempty + +instance ToScopeGraph Py.Dictionary where scopeGraph = onChildren + +instance ToScopeGraph Py.DictionaryComprehension where scopeGraph = todo + +instance ToScopeGraph Py.DictionarySplat where scopeGraph = todo + +deriving instance ToScopeGraph Py.Expression + +instance ToScopeGraph Py.ElseClause where scopeGraph = onField @"body" + +instance ToScopeGraph Py.ElifClause where + scopeGraph (Py.ElifClause _ (Parse.Success body) (Parse.Success condition)) = scopeGraph condition <> scopeGraph body + +instance ToScopeGraph Py.Ellipsis where scopeGraph = mempty + +instance ToScopeGraph Py.ExceptClause where scopeGraph = onChildren + +instance ToScopeGraph Py.ExecStatement where scopeGraph = mempty + +instance ToScopeGraph Py.ExpressionStatement where scopeGraph = onChildren + +instance ToScopeGraph Py.ExpressionList where scopeGraph = onChildren + +instance ToScopeGraph Py.False where scopeGraph _ = pure mempty + +instance ToScopeGraph Py.FinallyClause where scopeGraph = onField @"extraChildren" + +instance ToScopeGraph Py.Float where scopeGraph = mempty + +instance ToScopeGraph Py.ForStatement where scopeGraph = todo + +instance ToScopeGraph Py.FunctionDefinition where + scopeGraph Py.FunctionDefinition + { ann + , name = Parse.Success (Py.Identifier _ann1 name) + , parameters = Parse.Success (Py.Parameters _ann2 parameters) + , body = Parse.Success b + } = do + (_, associatedScope) <- declareFunction (Just $ Name.name name) Props.Function + { Props.kind = ScopeGraph.Function + , Props.span = ann^.span_ + } + withScope (CurrentScope associatedScope) $ do + let declProps = Props.Declaration + { Props.kind = ScopeGraph.Parameter + , Props.relation = ScopeGraph.Default + , Props.associatedScope = Nothing + , Props.span = point (Pos 0 0) + } + let param (Py.Parameter (Prj (Py.Identifier pann pname))) = Just (pann, Name.name pname) + param _ = Nothing + let parameterMs = fmap param parameters + if any isNothing parameterMs + then todo parameterMs + else do + let parameters' = catMaybes parameterMs + paramDeclarations <- for parameters' $ \(pos, parameter) -> + complete <* declare parameter (set span_ (pos^.span_) declProps) + bodyResult <- scopeGraph b + pure (mconcat paramDeclarations <> bodyResult) + +instance ToScopeGraph Py.FutureImportStatement where scopeGraph = todo + +instance ToScopeGraph Py.GeneratorExpression where scopeGraph = todo + +instance ToScopeGraph Py.Identifier where + scopeGraph (Py.Identifier ann name) = do + let refProps = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (ann^.span_ :: Span) + newReference (Name.name name) refProps + complete + +instance ToScopeGraph Py.IfStatement where + scopeGraph (Py.IfStatement _ alternative (Parse.Success body) (Parse.Success condition)) + = scopeGraph condition + <> scopeGraph body + <> foldMap scopeGraph alternative + +instance ToScopeGraph Py.GlobalStatement where scopeGraph = todo + +instance ToScopeGraph Py.Integer where scopeGraph = mempty + +instance ToScopeGraph Py.ImportStatement where + scopeGraph (Py.ImportStatement _ ((R1 (Py.DottedName _ names@((Py.Identifier ann name) :| _))) :| [])) = do + let toName (Py.Identifier _ name) = Name.name name + newEdge ScopeGraph.Import (toName <$> names) + + let referenceProps = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (ann^.span_ :: Span) + newReference (Name.name name) referenceProps + + let pairs = zip (toList names) (tail $ toList names) + for_ pairs $ \pair -> do + case pair of + (scopeIdentifier, referenceIdentifier@(Py.Identifier ann2 _)) -> do + withScope (CurrentScope (toName scopeIdentifier)) $ do + let referenceProps = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (ann2^.span_ :: Span) + newReference (toName referenceIdentifier) referenceProps + + complete + scopeGraph term = todo (show term) + +instance ToScopeGraph Py.ImportFromStatement where + scopeGraph (Py.ImportFromStatement _ [] (L1 (Py.DottedName _ names)) (Just (Py.WildcardImport _ _))) = do + let toName (Py.Identifier _ name) = Name.name name + complete <* newEdge ScopeGraph.Import (toName <$> names) + scopeGraph impossibleTerm@(Py.ImportFromStatement _ [] (L1 (Py.DottedName _ _)) Nothing) = + todo impossibleTerm + scopeGraph term = todo term + + +instance ToScopeGraph Py.Lambda where scopeGraph = todo + +instance ToScopeGraph Py.List where scopeGraph = onChildren + +instance ToScopeGraph Py.ListComprehension where scopeGraph = todo + +instance ToScopeGraph Py.ListSplat where scopeGraph = onChildren + +instance ToScopeGraph Py.NamedExpression where scopeGraph = todo + +instance ToScopeGraph Py.None where scopeGraph = mempty + +instance ToScopeGraph Py.NonlocalStatement where scopeGraph = todo + +instance ToScopeGraph Py.Module where scopeGraph = onChildren + +instance ToScopeGraph Py.ReturnStatement where + scopeGraph (Py.ReturnStatement _ mVal) = maybe (pure mempty) scopeGraph mVal + +instance ToScopeGraph Py.True where scopeGraph = mempty + +instance ToScopeGraph Py.NotOperator where scopeGraph = onField @"argument" + +instance ToScopeGraph Py.Pair where + scopeGraph (Py.Pair _ value key) = scopeGraph key <> scopeGraph value + +instance ToScopeGraph Py.ParenthesizedExpression where scopeGraph = onField @"extraChildren" + +instance ToScopeGraph Py.PassStatement where scopeGraph = mempty + +instance ToScopeGraph Py.PrintStatement where + scopeGraph (Py.PrintStatement _ args _chevron) = foldMap scopeGraph args + +deriving instance ToScopeGraph Py.PrimaryExpression + +deriving instance ToScopeGraph Py.SimpleStatement + +instance ToScopeGraph Py.RaiseStatement where scopeGraph = todo + +instance ToScopeGraph Py.Set where scopeGraph = onChildren + +instance ToScopeGraph Py.SetComprehension where scopeGraph = todo + +instance ToScopeGraph Py.String where scopeGraph = mempty + +instance ToScopeGraph Py.Subscript where scopeGraph = todo + +instance ToScopeGraph Py.Tuple where scopeGraph = onChildren + +instance ToScopeGraph Py.TryStatement where + scopeGraph (Py.TryStatement _ body elseClauses) + = scopeGraph body + <> foldMap scopeGraph elseClauses + +instance ToScopeGraph Py.UnaryOperator where scopeGraph = onField @"argument" + +instance ToScopeGraph Py.WhileStatement where + scopeGraph Py.WhileStatement{ alternative, body, condition } + = scopeGraph condition + <> scopeGraph body + <> foldMap scopeGraph alternative + +instance ToScopeGraph Py.WithStatement where + scopeGraph = todo + +instance ToScopeGraph Py.Yield where scopeGraph = onChildren diff --git a/semantic-python/src/Language/Python/Tags.hs b/semantic-python/src/Language/Python/Tags.hs new file mode 100644 index 0000000000..68ad72a2c0 --- /dev/null +++ b/semantic-python/src/Language/Python/Tags.hs @@ -0,0 +1,239 @@ +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module Language.Python.Tags + ( ToTags (..), + ) +where + +import AST.Element +import qualified AST.Parse as Parse +import AST.Token +import AST.Traversable1 +import Control.Effect.Reader +import Control.Effect.Writer +import Control.Effect.State +import Data.Foldable +import Data.Text as Text +import qualified Language.Python.AST as Py +import Proto.Semantic as P +import Source.Loc +import Source.Range +import Source.Source as Source +import qualified Tags.Tagging.Precise as Tags + +class ToTags t where + tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m + ) => + t Loc -> + m () + default tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () + tags = gtags + +instance (ToTags l, ToTags r) => ToTags (l :+: r) where + tags (L1 l) = tags l + tags (R1 r) = tags r + +instance ToTags (Token sym n) where tags _ = pure () + +keywordFunctionCall :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + Loc -> + Range -> + Text -> + m () +keywordFunctionCall t loc range name = Tags.yield name P.FUNCTION P.DEFINITION loc range >> gtags t + +instance ToTags Py.String where + tags Py.String {extraChildren} = for_ extraChildren $ \x -> case x of + Parse.Success (Prj t@Py.Interpolation {}) -> tags t + _ -> pure () + +instance ToTags Py.Interpolation where + tags Py.Interpolation {extraChildren} = for_ extraChildren $ \x -> case x of + Parse.Success (Prj (Py.Expression expr)) -> tags expr + _ -> pure () + +instance ToTags Py.AssertStatement where + tags t@Py.AssertStatement {ann = loc@Loc {byteRange}} = keywordFunctionCall t loc byteRange "assert" + +instance ToTags Py.Await where + tags t@Py.Await {ann = loc@Loc {byteRange}} = keywordFunctionCall t loc byteRange "await" + +instance ToTags Py.DeleteStatement where + tags t@Py.DeleteStatement {ann = loc@Loc {byteRange}} = keywordFunctionCall t loc byteRange "del" + +instance ToTags Py.ExecStatement where + tags t@Py.ExecStatement {ann = loc@Loc {byteRange}} = keywordFunctionCall t loc byteRange "exec" + +instance ToTags Py.GlobalStatement where + tags t@Py.GlobalStatement {ann = loc@Loc {byteRange}} = keywordFunctionCall t loc byteRange "global" + +instance ToTags Py.NonlocalStatement where + tags t@Py.NonlocalStatement {ann = loc@Loc {byteRange}} = keywordFunctionCall t loc byteRange "nonlocal" + +instance ToTags Py.PrintStatement where + tags t@Py.PrintStatement {ann = loc@Loc {byteRange}} = keywordFunctionCall t loc byteRange "print" + +instance ToTags Py.FunctionDefinition where + tags + t@Py.FunctionDefinition + { ann = Loc {byteRange = Range {start}}, + name = Parse.Success (Py.Identifier {text, ann}), + body = Parse.Success (Py.Block {ann = Loc Range {start = end} _}) + } = do + Tags.yield text P.FUNCTION P.DEFINITION ann (Range start end) >> gtags t + tags _ = pure () + +instance ToTags Py.ClassDefinition where + tags + t@Py.ClassDefinition + { ann = Loc {byteRange = Range {start}}, + name = Parse.Success (Py.Identifier {text, ann}), + body = Parse.Success (Py.Block {ann = Loc Range {start = end} _}) + } = do + Tags.yield text P.CLASS P.DEFINITION ann (Range start end) >> gtags t + tags _ = pure () + +instance ToTags Py.Call where + tags + t@Py.Call + { ann = Loc {byteRange}, + function = Parse.Success (Py.PrimaryExpression expr) + } = match expr + where + match expr = case expr of + Prj Py.Attribute {attribute = Parse.Success (Py.Identifier {text, ann})} -> yield text ann + Prj Py.Identifier {text, ann} -> yield text ann + Prj Py.Call {function = Parse.Success (Py.PrimaryExpression expr')} -> match expr' -- Nested call expression like this in Python represent creating an instance of a class and calling it: e.g. AClass()() + Prj (Py.ParenthesizedExpression _ (Parse.Success (Prj (Py.Expression (Prj (Py.PrimaryExpression expr')))))) -> match expr' -- Parenthesized expressions + _ -> gtags t + yield name loc = Tags.yield name P.CALL P.REFERENCE loc byteRange >> gtags t + tags _ = pure () + +gtags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () +gtags = traverse1_ @ToTags (const (pure ())) tags + + +instance ToTags Py.AliasedImport +instance ToTags Py.ArgumentList +-- instance ToTags Py.AssertStatement +instance ToTags Py.Assignment +instance ToTags Py.Attribute +instance ToTags Py.AugmentedAssignment +-- instance ToTags Py.Await +instance ToTags Py.BinaryOperator +instance ToTags Py.Block +instance ToTags Py.BooleanOperator +instance ToTags Py.BreakStatement +-- instance ToTags Py.Call +instance ToTags Py.Chevron +-- instance ToTags Py.ClassDefinition +instance ToTags Py.ComparisonOperator +instance ToTags Py.CompoundStatement +instance ToTags Py.ConcatenatedString +instance ToTags Py.ConditionalExpression +instance ToTags Py.ContinueStatement +instance ToTags Py.DecoratedDefinition +instance ToTags Py.Decorator +instance ToTags Py.DefaultParameter +-- instance ToTags Py.DeleteStatement +instance ToTags Py.Dictionary +instance ToTags Py.DictionaryComprehension +instance ToTags Py.DictionarySplat +instance ToTags Py.DottedName +instance ToTags Py.ElifClause +instance ToTags Py.Ellipsis +instance ToTags Py.ElseClause +instance ToTags Py.EscapeSequence +instance ToTags Py.ExceptClause +-- instance ToTags Py.ExecStatement +instance ToTags Py.Expression +instance ToTags Py.ExpressionList +instance ToTags Py.ExpressionStatement +instance ToTags Py.False +instance ToTags Py.FinallyClause +instance ToTags Py.Float +instance ToTags Py.ForInClause +instance ToTags Py.ForStatement +instance ToTags Py.FormatExpression +instance ToTags Py.FormatSpecifier +-- instance ToTags Py.FunctionDefinition +instance ToTags Py.FutureImportStatement +instance ToTags Py.GeneratorExpression +-- instance ToTags Py.GlobalStatement +instance ToTags Py.Identifier +instance ToTags Py.IfClause +instance ToTags Py.IfStatement +instance ToTags Py.ImportFromStatement +instance ToTags Py.ImportPrefix +instance ToTags Py.ImportStatement +instance ToTags Py.Integer +-- instance ToTags Py.Interpolation +instance ToTags Py.KeywordArgument +instance ToTags Py.Lambda +instance ToTags Py.LambdaParameters +instance ToTags Py.List +instance ToTags Py.ListComprehension +instance ToTags Py.ListSplat +instance ToTags Py.Module +instance ToTags Py.NamedExpression +instance ToTags Py.None +-- instance ToTags Py.NonlocalStatement +instance ToTags Py.NotOperator +instance ToTags Py.Pair +instance ToTags Py.Parameter +instance ToTags Py.Parameters +instance ToTags Py.ParenthesizedExpression +instance ToTags Py.PassStatement +instance ToTags Py.PrimaryExpression +-- instance ToTags Py.PrintStatement +instance ToTags Py.RaiseStatement +instance ToTags Py.RelativeImport +instance ToTags Py.ReturnStatement +instance ToTags Py.Set +instance ToTags Py.SetComprehension +instance ToTags Py.SimpleStatement +instance ToTags Py.Slice +instance ToTags Py.Subscript +instance ToTags Py.True +instance ToTags Py.TryStatement +instance ToTags Py.Tuple +instance ToTags Py.Type +instance ToTags Py.TypeConversion +instance ToTags Py.TypedDefaultParameter +instance ToTags Py.TypedParameter +instance ToTags Py.UnaryOperator +instance ToTags Py.Variables +instance ToTags Py.WhileStatement +instance ToTags Py.WildcardImport +instance ToTags Py.WithItem +instance ToTags Py.WithStatement +instance ToTags Py.Yield diff --git a/semantic-python/src/Prelude.score b/semantic-python/src/Prelude.score new file mode 100644 index 0000000000..53130556e3 --- /dev/null +++ b/semantic-python/src/Prelude.score @@ -0,0 +1,30 @@ +{ + type <- \name -> \super -> \slots -> + #record { __name: name, __super: super, __slots: slots }; + + instance <- \class -> \prim -> \slots -> + #record { __super: class, __prim: prim, __slots: slots }; + + // object's superclass is type itself + object <- type "object" type #record{}; + + str <- type "str" object #record { __new__: \prim -> instance #unit prim #record{} }; + + // We will fill in the actual definition of these operators + // pending the presence of more eliminators. + not <- \val -> if val then #false else #true; + + NoneType <- type "None" object #record { __new__: \prim -> instance #unit prim #record{} }; + None <- NoneType.__slots.__new__ #unit; + + getitem <- \super -> \item -> \attr -> + if item.slots.?attr then item.slots.attr else #unit; + + #record { type: type + , object: object + , str: str + , not: not + , NoneType: NoneType + , None: None + , getitem: getitem} +} diff --git a/semantic-python/test-graphing/GraphTest.hs b/semantic-python/test-graphing/GraphTest.hs new file mode 100644 index 0000000000..9dfc0f1867 --- /dev/null +++ b/semantic-python/test-graphing/GraphTest.hs @@ -0,0 +1,196 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +module Main (main) where + +import Analysis.Name (Name) +import qualified Analysis.Name as Name +import qualified AST.Unmarshal as TS +import Control.Algebra +import Control.Carrier.Lift +import Control.Carrier.Sketch.ScopeGraph +import qualified Control.Effect.ScopeGraph.Properties.Declaration as Props +import qualified Control.Effect.ScopeGraph.Properties.Function as Props +import qualified Control.Effect.ScopeGraph.Properties.Reference as Props +import Control.Monad +import qualified Data.ByteString as ByteString +import qualified Data.List.NonEmpty as NonEmpty +import Data.Module (ModuleInfo (..)) +import qualified Data.ScopeGraph as ScopeGraph +import qualified Language.Python () +import qualified Language.Python as Py (Term) +import qualified Language.Python.Grammar as TSP +import Scope.Graph.Convert +import Scope.Types +import Source.Loc +import qualified Source.Source as Source +import Source.Span +import System.Exit (die) +import System.Path (()) +import qualified System.Path as Path +import qualified System.Path.Directory as Path +import qualified Test.Tasty as Tasty +import qualified Test.Tasty.HUnit as HUnit + +{- + +The Python code here is + +hello = () +goodbye = () + +The graph should be + + 🏁 + | + 1️⃣----"hello" + | + | + | + | + 2️⃣----"goodbye" + +-} + + +runScopeGraph :: ToScopeGraph t => Path.AbsRelFile -> Source.Source -> t Loc -> (ScopeGraph.ScopeGraph Name, Result) +runScopeGraph p _src item = run . runSketch info $ scopeGraph item + where + info = ModuleInfo p "Python" mempty + +sampleGraphThing :: ScopeGraphEff sig m => m Result +sampleGraphThing = do + declare "hello" (Props.Declaration ScopeGraph.Assignment ScopeGraph.Default Nothing (Span (Pos 2 0) (Pos 2 10))) + declare "goodbye" (Props.Declaration ScopeGraph.Assignment ScopeGraph.Default Nothing (Span (Pos 3 0) (Pos 3 12))) + pure Complete + +graphFile :: Path.AbsRelFile -> IO (ScopeGraph.ScopeGraph Name, Result) +graphFile fp = do + file <- ByteString.readFile $ Path.toString fp + tree <- TS.parseByteString @Py.Term @Loc TSP.tree_sitter_python file + pyModule <- either die pure tree + pure $ runScopeGraph fp (Source.fromUTF8 file) pyModule + + +assertSimpleAssignment :: HUnit.Assertion +assertSimpleAssignment = do + let path = Path.absRel "semantic-python/test/fixtures/1-04-toplevel-assignment.py" + (result, Complete) <- graphFile path + (expecto, Complete) <- runM $ runSketch (ModuleInfo path "Python" mempty) sampleGraphThing + HUnit.assertEqual "Should work for simple case" expecto result + +assertSimpleReference :: HUnit.Assertion +assertSimpleReference = do + let path = Path.absRel "semantic-python/test/fixtures/5-01-simple-reference.py" + (result, Complete) <- graphFile path + (expecto, Complete) <- runM $ runSketch (ModuleInfo path "Python" mempty) expectedReference + + HUnit.assertEqual "Should work for simple case" expecto result + +expectedReference :: ScopeGraphEff sig m => m Result +expectedReference = do + declare "x" (Props.Declaration ScopeGraph.Assignment ScopeGraph.Default Nothing (Span (Pos 0 0) (Pos 0 5))) + let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 1 0) (Pos 1 1)) + newReference "x" refProperties + pure Complete + +expectedQualifiedImport :: ScopeGraphEff sig m => m Result +expectedQualifiedImport = do + newEdge ScopeGraph.Import (NonEmpty.fromList ["cheese", "ints"]) + + let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 0 7) (Pos 0 13)) + newReference (Name.name "cheese") refProperties + + withScope (CurrentScope "cheese") $ do + let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 0 14) (Pos 0 18)) + newReference (Name.name "ints") refProperties + pure Complete + +expectedImportHole :: ScopeGraphEff sig m => m Result +expectedImportHole = do + newEdge ScopeGraph.Import (NonEmpty.fromList ["cheese", "ints"]) + pure Complete + +assertLexicalScope :: HUnit.Assertion +assertLexicalScope = do + let path = Path.absRel "semantic-python/test/fixtures/5-02-simple-function.py" + let info = ModuleInfo path "Python" mempty + (graph, _) <- graphFile path + case run (runSketch info expectedLexicalScope) of + (expecto, Complete) -> HUnit.assertEqual "Should work for simple case" expecto graph + (_, Todo msg) -> HUnit.assertFailure ("Failed to complete:" <> show msg) + +expectedLexicalScope :: ScopeGraphEff sig m => m Result +expectedLexicalScope = do + _ <- declareFunction (Just $ Name.name "foo") (Props.Function ScopeGraph.Function (Span (Pos 0 0) (Pos 1 24))) + let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 3 0) (Pos 3 3)) + newReference "foo" refProperties + pure Complete + + +assertFunctionArg :: HUnit.Assertion +assertFunctionArg = do + let path = Path.absRel "semantic-python/test/fixtures/5-03-function-argument.py" + (graph, _) <- graphFile path + let info = ModuleInfo path "Python" mempty + case run (runSketch info expectedFunctionArg) of + (expecto, Complete) -> HUnit.assertEqual "Should work for simple case" expecto graph + (_, Todo msg) -> HUnit.assertFailure ("Failed to complete:" <> show msg) + +expectedFunctionArg :: ScopeGraphEff sig m => m Result +expectedFunctionArg = do + (_, associatedScope) <- declareFunction (Just $ Name.name "foo") (Props.Function ScopeGraph.Function (Span (Pos 0 0) (Pos 1 12))) + withScope (CurrentScope associatedScope) $ do + declare "x" (Props.Declaration ScopeGraph.Parameter ScopeGraph.Default Nothing (Span (Pos 0 8) (Pos 0 9))) + let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 1 11) (Pos 1 12)) + newReference "x" refProperties + pure () + let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 3 0) (Pos 3 3)) + newReference "foo" refProperties + pure Complete + + +assertImportHole :: HUnit.Assertion +assertImportHole = do + let path = Path.absRel "semantic-python/test/fixtures/cheese/6-01-imports.py" + (graph, _) <- graphFile path + let info = ModuleInfo path "Python" mempty + case run (runSketch info expectedImportHole) of + (expecto, Complete) -> HUnit.assertEqual "Should work for simple case" expecto graph + (_, Todo msg) -> HUnit.assertFailure ("Failed to complete:" <> show msg) + +assertQualifiedImport :: HUnit.Assertion +assertQualifiedImport = do + let path = Path.absRel "semantic-python/test/fixtures/cheese/6-01-qualified-imports.py" + (graph, _) <- graphFile path + let info = ModuleInfo path "Python" mempty + case run (runSketch info expectedQualifiedImport) of + (expecto, Complete) -> HUnit.assertEqual "Should work for simple case" expecto graph + (_, Todo msg) -> HUnit.assertFailure ("Failed to complete:" <> show msg) + +main :: IO () +main = do + -- make sure we're in the root directory so the paths resolve properly + cwd <- Path.getCurrentDirectory + when (Path.takeDirName cwd == Just (Path.relDir "semantic-python")) + (Path.setCurrentDirectory (cwd Path.relDir "..")) + + Tasty.defaultMain $ + Tasty.testGroup "Tests" [ + Tasty.testGroup "declare" [ + HUnit.testCase "toplevel assignment" assertSimpleAssignment + ], + Tasty.testGroup "reference" [ + HUnit.testCase "simple reference" assertSimpleReference + ], + Tasty.testGroup "lexical scopes" [ + HUnit.testCase "simple function scope" assertLexicalScope + , HUnit.testCase "simple function argument" assertFunctionArg + ], + Tasty.testGroup "imports" [ + HUnit.testCase "simple function argument" assertImportHole + , HUnit.testCase "qualified imports" assertQualifiedImport + ] + ] diff --git a/semantic-python/test/CoreTest.hs b/semantic-python/test/CoreTest.hs new file mode 100644 index 0000000000..5b0788f1f3 --- /dev/null +++ b/semantic-python/test/CoreTest.hs @@ -0,0 +1,121 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} +module Main (main) where + +import Analysis.Concrete (Concrete) +import qualified Analysis.Concrete as Concrete +import Analysis.File +import Control.Algebra +import Control.Carrier.Fail.Either +import Control.Carrier.Reader +import Control.Monad hiding (fail) +import Control.Monad.IO.Class +-- import Core.Core +-- import qualified Core.Eval as Eval +-- import Core.Name +-- import qualified Core.Parser +-- import Core.Pretty +import qualified Data.ByteString.Char8 as ByteString +import Data.Foldable +import Data.Function +import qualified Data.IntMap as IntMap +import Data.List (sort) +import qualified Data.Map as Map +import Data.Maybe +import Data.Text (Text) +import GHC.Stack +-- import qualified Language.Python.Core as Py +import Language.Python.Failure +import Prelude hiding (fail) +import Source.Span +import Syntax.Term +import Syntax.Var (closed) +import System.Directory +import System.Exit +import System.Path (()) +import qualified System.Path as Path +import qualified System.Path.Directory as Path +import qualified Text.Trifecta as Trifecta +import qualified Language.Python.Grammar as TSP +import qualified AST.Unmarshal as TS + +import qualified Test.Tasty as Tasty +import qualified Test.Tasty.HUnit as HUnit + +-- import qualified Directive +import Instances () + +parsePrelude :: IO (Term (Ann Span :+: Core) Name) +parsePrelude = do + preludesrc <- ByteString.readFile "semantic-python/src/Prelude.score" + let ePrelude = Trifecta.parseByteString (Core.Parser.core <* Trifecta.eof) mempty preludesrc + case Trifecta.foldResult (Left . show) Right ePrelude of + Right r -> pure r + Left s -> HUnit.assertFailure ("Couldn't parse prelude: " <> s) + +-- handles CHECK-RESULT directives +assertEvaluatesTo :: Term (Ann Span :+: Core) Name -> Text -> Concrete (Term (Ann Span :+: Core)) -> HUnit.Assertion +assertEvaluatesTo core k val = do + prelude <- parsePrelude + let withPrelude = (named' "__semantic_prelude" :<- prelude) >>>= core + allTogether <- maybe (HUnit.assertFailure ("Can’t evaluate open term: " <> showCore (stripAnnotations withPrelude))) pure (closed withPrelude) + let filius = [File (Path.absRel "") (Span (Pos 1 1) (Pos 1 1)) allTogether] + + (heap, env) <- case Concrete.concrete Eval.eval filius of + (heap, [File _ _ (Right (Concrete.Record env))]) -> + pure (heap, env) + (_, [File _ _ (Left (_, span, err))]) -> + HUnit.assertFailure ("Failed evaluation (" <> show span <> "): " <> err) + (_, files) -> + HUnit.assertFailure ("Unexpected number of files: " <> show (length files)) + + let found = Map.lookup (name k) env >>= flip IntMap.lookup heap + found HUnit.@?= Just val +{-# HLINT ignore assertEvaluatesTo #-} + +-- handles CHECK-TREE directives +assertTreeEqual :: Term Core Name -> Term Core Name -> HUnit.Assertion +assertTreeEqual t item = HUnit.assertEqual ("got (pretty)" <> showCore item) t item + + +checkPythonFile :: HasCallStack => Path.RelFile -> Tasty.TestTree +checkPythonFile fp = HUnit.testCaseSteps (Path.toString fp) $ \step -> withFrozenCallStack $ do + -- Extract the directives and the core associated with the provided file + let fullPath = Path.relDir "semantic-python/test/fixtures" fp + directives <- Directive.readDirectivesFromFile fullPath + result <- ByteString.readFile (Path.toString fullPath) >>= TS.parseByteString TSP.tree_sitter_python + + -- Run the compiler + let coreResult = Control.Algebra.run + . runFail + . eliminateFailures + . Control.Algebra.run + . runReader @Py.Bindings mempty + . Py.toplevelCompile @(Failure :+: Ann Span :+: Core) @(Term _) + <$> result + + -- Dispatch based on the result-directive pair + for_ directives $ \directive -> do + step (Directive.describe directive) + case (coreResult, directive) of + (Right (Left _), Directive.Fails) -> pure () + (Left err, _) -> HUnit.assertFailure ("Parsing failed: " <> err) + (Right (Left err), _) -> HUnit.assertFailure ("Compilation failed: " <> err) + (Right (Right _), Directive.Fails) -> HUnit.assertFailure "Expected translation to fail" + (Right (Right item), Directive.Result k v) -> assertEvaluatesTo item k v + (Right (Right item), Directive.Tree t) -> assertTreeEqual (stripAnnotations item) t + +milestoneFixtures :: IO Tasty.TestTree +milestoneFixtures = buildTests <$> readFiles + where + readFiles = liftIO . Path.filesInDir . Path.relDir $ "semantic-python/test/fixtures" + buildTests = Tasty.testGroup "Python" . fmap checkPythonFile . sort . filter (Path.hasExtension ".py") + +main :: IO () +main = do + jq <- findExecutable "jq" + when (isNothing jq) (die "Error: jq(1) not found in $PATH.") + milestoneFixtures >>= Tasty.defaultMain diff --git a/semantic-python/test/Directive.hs b/semantic-python/test/Directive.hs new file mode 100644 index 0000000000..6ea016d695 --- /dev/null +++ b/semantic-python/test/Directive.hs @@ -0,0 +1,108 @@ +{-# LANGUAGE TypeApplications, TypeOperators #-} + +-- | FileCheck-style directives for testing Core compilers. +module Directive ( Directive (..) + , readDirectivesFromFile + , describe + ) where + +import Analysis.Concrete (Concrete (..)) +import Control.Algebra +import Control.Monad +import Control.Monad.Trans.Resource (ResourceT, runResourceT) +-- import Core.Core (Core) +-- import qualified Core.Core as Core +-- import Core.Name (Name) +-- import qualified Core.Parser +-- import qualified Core.Pretty +import Data.ByteString.Char8 (ByteString) +import qualified Data.ByteString.Char8 as ByteString +import qualified Data.ByteString.Streaming.Char8 as ByteStream +import Data.Text (Text) +import qualified Data.Text as T +import qualified Source.Span as Source +import qualified Streaming.Prelude as Stream +import Syntax.Term (Term) +import qualified System.Path as Path +import qualified System.Path.PartClass as Path.Class +import qualified Text.Parser.Token.Style as Style +import Text.Trifecta (CharParsing, TokenParsing (..)) +import qualified Text.Trifecta as Trifecta + +{- | + +Directives are parsed from magic comments in test files and +describe to the test suite how to query the results of a given test +case. A directive that looks like this: + +@ + # CHECK-RESULT: key: value +@ + +would test that the value for @key@ in the result evaluates to the given +concrete value. + +This syntax was inspired by LLVM's +[FileCheck](https://llvm.org/docs/CommandGuide/FileCheck.html). This +approach is less direct than tests that pattern-match over an AST, but +enable us to keep the text of test cases in close proximity to the +assertions we want to make, which improves maintainability +significantly and has been a successful strategy for the LLVM and Rust +projects. + +-} +data Directive = Tree (Term Core Name) -- | @# CHECK-TREE: core@ + | Result Text (Concrete (Term (Core.Ann Source.Span :+: Core))) -- | @# CHECK-RESULT key: expected + | Fails -- | @# CHECK-FAILS@ fails unless translation fails. + deriving (Eq, Show) + +-- | Extract all directives from a file. +readDirectivesFromFile :: Path.Class.AbsRel ar => Path.File ar -> IO [Directive] +readDirectivesFromFile + = runResourceT + . Stream.toList_ + . Stream.mapM (either perish pure . parseDirective) + . Stream.takeWhile isComment + . Stream.mapped ByteStream.toStrict + . ByteStream.lines + . ByteStream.readFile @(ResourceT IO) + . Path.toString + where + perish s = fail ("Directive parsing error: " <> s) + isComment = (== Just '#') . fmap fst . ByteString.uncons + + +describe :: Directive -> String +describe Fails = "" +describe (Tree t) = Core.Pretty.showCore t +describe (Result t e) = T.unpack t <> ": " <> show e + +fails :: CharParsing m => m Directive +fails = Fails <$ Trifecta.string "# CHECK-FAILS" + +tree :: (Monad m, TokenParsing m) => m Directive +tree = do + void $ Trifecta.string "# CHECK-TREE: " + Tree <$> Core.Parser.core + +result :: (Monad m, TokenParsing m) => m Directive +result = do + void $ Trifecta.string "# CHECK-RESULT " + key <- Trifecta.ident Style.haskellIdents + void $ Trifecta.symbolic ':' + Result key <$> concrete + +concrete :: TokenParsing m => m (Concrete term) +concrete = Trifecta.choice + [ String <$> Trifecta.stringLiteral + , Bool True <$ Trifecta.symbol "#true" + , Bool False <$ Trifecta.symbol "#false" + , Unit <$ Trifecta.symbol "#unit" + ] + +directive :: (Monad m, TokenParsing m) => m Directive +directive = Trifecta.choice [ fails, result, tree ] + +parseDirective :: ByteString -> Either String Directive +parseDirective = Trifecta.foldResult (Left . show) Right + . Trifecta.parseByteString (directive <* Trifecta.eof) mempty diff --git a/semantic-python/test/Instances.hs b/semantic-python/test/Instances.hs new file mode 100644 index 0000000000..d851f3f408 --- /dev/null +++ b/semantic-python/test/Instances.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} + +module Instances () where + +import Analysis.File +import Data.Aeson +import Data.Text (pack) +import qualified System.Path as Path + +instance ToJSON a => ToJSON (File a) where + toJSON File{filePath, fileSpan, fileBody} = object + [ "path" .= filePath + , "span" .= fileSpan + , "body" .= fileBody + ] + +instance ToJSON Path.AbsRelFile where + toJSON p = toJSON (pack (Path.toString p)) diff --git a/semantic-python/test/PreciseTest.hs b/semantic-python/test/PreciseTest.hs new file mode 100644 index 0000000000..9f247908b5 --- /dev/null +++ b/semantic-python/test/PreciseTest.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-unused-imports #-} +module Main (main) where + +import AST.TestHelpers +import AST.Unmarshal +import qualified Language.Python.AST as Py +import qualified System.Path.Fixture as Fixture +import Test.Tasty +import TreeSitter.Python + +main :: IO () +main = do +#if BAZEL_BUILD + rf <- Fixture.create + let ?project = "external/tree-sitter-python" + ?runfiles = rf + let dirs = Fixture.absRelDir "test/corpus" +#else + dirs <- Py.getTestCorpusDir +#endif + + let parse = parseByteString @Py.Module @() tree_sitter_python + + readCorpusFiles' dirs + >>= traverse (testCorpus parse) + >>= defaultMain . tests + +tests :: [TestTree] -> TestTree +tests = testGroup "tree-sitter-python corpus tests" diff --git a/test/fixtures/cli/blank.json b/semantic-python/test/fixtures/1-01-empty-module.py similarity index 100% rename from test/fixtures/cli/blank.json rename to semantic-python/test/fixtures/1-01-empty-module.py diff --git a/test/fixtures/python/corpus/pass-statement.A.py b/semantic-python/test/fixtures/1-02-pass-statement.py similarity index 100% rename from test/fixtures/python/corpus/pass-statement.A.py rename to semantic-python/test/fixtures/1-02-pass-statement.py diff --git a/semantic-python/test/fixtures/1-03-empty-tuple.py b/semantic-python/test/fixtures/1-03-empty-tuple.py new file mode 100644 index 0000000000..404f14e6e9 --- /dev/null +++ b/semantic-python/test/fixtures/1-03-empty-tuple.py @@ -0,0 +1,2 @@ +# CHECK-TREE: #record{} +() diff --git a/semantic-python/test/fixtures/1-04-toplevel-assignment.py b/semantic-python/test/fixtures/1-04-toplevel-assignment.py new file mode 100644 index 0000000000..995157e5fe --- /dev/null +++ b/semantic-python/test/fixtures/1-04-toplevel-assignment.py @@ -0,0 +1,4 @@ +# CHECK-TREE: { hello <- #unit; goodbye <- #unit; #record { hello: hello, goodbye: goodbye }} +# CHECK-RESULT hello: #unit +hello = () +goodbye = () diff --git a/semantic-python/test/fixtures/1-05-exec-statement-fails.py b/semantic-python/test/fixtures/1-05-exec-statement-fails.py new file mode 100644 index 0000000000..6a42da01bd --- /dev/null +++ b/semantic-python/test/fixtures/1-05-exec-statement-fails.py @@ -0,0 +1,2 @@ +# CHECK-FAILS +exec "'We will never support exec statements.'" diff --git a/semantic-python/test/fixtures/2-01-return-statement.py b/semantic-python/test/fixtures/2-01-return-statement.py new file mode 100644 index 0000000000..be1c0f5ff2 --- /dev/null +++ b/semantic-python/test/fixtures/2-01-return-statement.py @@ -0,0 +1,3 @@ +# CHECK-TREE: { foo <- rec foo = \a -> a; #record { foo: foo } } +def foo(a): + return a diff --git a/semantic-python/test/fixtures/2-02-return-doesnt-translate.py b/semantic-python/test/fixtures/2-02-return-doesnt-translate.py new file mode 100644 index 0000000000..4afb99d675 --- /dev/null +++ b/semantic-python/test/fixtures/2-02-return-doesnt-translate.py @@ -0,0 +1,6 @@ +# CHECK-TREE: { foo <- rec foo = (\a -> a); #record { foo: foo } } + +def foo(a): + return a + a + () diff --git a/semantic-python/test/fixtures/2-03-return-in-if-statement.py b/semantic-python/test/fixtures/2-03-return-in-if-statement.py new file mode 100644 index 0000000000..0dba31b75b --- /dev/null +++ b/semantic-python/test/fixtures/2-03-return-in-if-statement.py @@ -0,0 +1,6 @@ +# CHECK-TREE: { foo <- rec foo = \a -> if a then a else #unit; #record { foo: foo } } + +def foo(a): + if a: return a + return () + () diff --git a/semantic-python/test/fixtures/2-04-multiple-assign.py b/semantic-python/test/fixtures/2-04-multiple-assign.py new file mode 100644 index 0000000000..0581fd874d --- /dev/null +++ b/semantic-python/test/fixtures/2-04-multiple-assign.py @@ -0,0 +1,2 @@ +# CHECK-TREE: { z <- #true; y <- z; x <- y; #record { z : z, y : y, x : x }} +x = y = z = True diff --git a/semantic-python/test/fixtures/2-05-function-call.py b/semantic-python/test/fixtures/2-05-function-call.py new file mode 100644 index 0000000000..51bbd42bbc --- /dev/null +++ b/semantic-python/test/fixtures/2-05-function-call.py @@ -0,0 +1,4 @@ +# CHECK-TREE: { const <- rec const = \x -> \y -> x; y <- const #true #true; z <- const #false #false; #record { const: const, y : y, z: z, }} +def const(x, y): return x +y = const(True, True) +z = const(False, False) diff --git a/semantic-python/test/fixtures/2-06-nested-function-definition.py b/semantic-python/test/fixtures/2-06-nested-function-definition.py new file mode 100644 index 0000000000..fbeb1df2e0 --- /dev/null +++ b/semantic-python/test/fixtures/2-06-nested-function-definition.py @@ -0,0 +1,7 @@ +# CHECK-TREE: { const <- rec const = \a -> \b -> { identity <- rec identity = \x -> x; identity a }; #record{ const: const }} + +def const(a, b): + def identity(x): + return x + + return identity(a) diff --git a/semantic-python/test/fixtures/2-07-closure-over-scope.py b/semantic-python/test/fixtures/2-07-closure-over-scope.py new file mode 100644 index 0000000000..582b7b89c3 --- /dev/null +++ b/semantic-python/test/fixtures/2-07-closure-over-scope.py @@ -0,0 +1,9 @@ + +def const(a, b): + def result(): + return a + + def zilch(b): + return b + + return result() diff --git a/semantic-python/test/fixtures/2-08-function-decorator.py b/semantic-python/test/fixtures/2-08-function-decorator.py new file mode 100644 index 0000000000..c5e258a265 --- /dev/null +++ b/semantic-python/test/fixtures/2-08-function-decorator.py @@ -0,0 +1,7 @@ +# CHECK-TREE: { passthru <- rec passthru = \x -> x; decorated <- rec decorated = \x -> x; decorated = passthru(decorated); #record { passthru: passthru, decorated: decorated }} +def passthru(x): + return x + +@passthru +def decorated(x): + return x diff --git a/semantic-python/test/fixtures/3-01-empty-class-definition.py b/semantic-python/test/fixtures/3-01-empty-class-definition.py new file mode 100644 index 0000000000..2886d18cb9 --- /dev/null +++ b/semantic-python/test/fixtures/3-01-empty-class-definition.py @@ -0,0 +1,3 @@ +# CHECK-TREE: { Foo <- rec Foo = __semantic_prelude.type "Foo" __semantic_prelude.object #record {}; #record { Foo: Foo }} +class Foo(): + pass diff --git a/semantic-python/test/fixtures/3-02-defining-instance-method.py b/semantic-python/test/fixtures/3-02-defining-instance-method.py new file mode 100644 index 0000000000..304afd9728 --- /dev/null +++ b/semantic-python/test/fixtures/3-02-defining-instance-method.py @@ -0,0 +1,5 @@ +# CHECK-TREE: { Foo <- rec Foo = { identity <- rec identity = \self -> \x -> x; __semantic_prelude.type "Foo" __semantic_prelude.object #record { identity: identity } }; #record { Foo: Foo } } + +class Foo(): + def identity(self, x): + return x diff --git a/semantic-python/test/fixtures/3-03-functions-know-their-own-names.py b/semantic-python/test/fixtures/3-03-functions-know-their-own-names.py new file mode 100644 index 0000000000..ac4f65b5de --- /dev/null +++ b/semantic-python/test/fixtures/3-03-functions-know-their-own-names.py @@ -0,0 +1,2 @@ +# CHECK-TREE: { recursive <- rec recursive = \a -> recursive; #record { recursive: recursive }} +def recursive(a): return recursive diff --git a/semantic-python/test/fixtures/4-01-lambda-literals.py b/semantic-python/test/fixtures/4-01-lambda-literals.py new file mode 100644 index 0000000000..b9e36baa14 --- /dev/null +++ b/semantic-python/test/fixtures/4-01-lambda-literals.py @@ -0,0 +1,4 @@ +# CHECK-TREE: { const <- \x -> \y -> x; y <- const #true #true; z <- const #false #false; #record { const: const, y : y, z: z, }} +const = lambda x, y: x +y = const(True, True) +z = const(False, False) diff --git a/semantic-python/test/fixtures/4-02-nonetype.py b/semantic-python/test/fixtures/4-02-nonetype.py new file mode 100644 index 0000000000..c1cf44039a --- /dev/null +++ b/semantic-python/test/fixtures/4-02-nonetype.py @@ -0,0 +1,2 @@ +# CHECK-TREE: { x <- __semantic_prelude.None; #record { x : x }} +x = None diff --git a/semantic-python/test/fixtures/4-03-not-expression.py b/semantic-python/test/fixtures/4-03-not-expression.py new file mode 100644 index 0000000000..47c903f416 --- /dev/null +++ b/semantic-python/test/fixtures/4-03-not-expression.py @@ -0,0 +1,2 @@ +# CHECK-TREE: { x <- __semantic_prelude.not #true; #record { x: x }} +x = not True diff --git a/semantic-python/test/fixtures/5-01-simple-reference.py b/semantic-python/test/fixtures/5-01-simple-reference.py new file mode 100644 index 0000000000..f5d88f2f06 --- /dev/null +++ b/semantic-python/test/fixtures/5-01-simple-reference.py @@ -0,0 +1,2 @@ +x = 5 +x diff --git a/semantic-python/test/fixtures/5-02-simple-function.py b/semantic-python/test/fixtures/5-02-simple-function.py new file mode 100644 index 0000000000..db3da31d01 --- /dev/null +++ b/semantic-python/test/fixtures/5-02-simple-function.py @@ -0,0 +1,4 @@ +def foo(): + return "hello world" + +foo() diff --git a/semantic-python/test/fixtures/5-03-function-argument.py b/semantic-python/test/fixtures/5-03-function-argument.py new file mode 100644 index 0000000000..f225f3206a --- /dev/null +++ b/semantic-python/test/fixtures/5-03-function-argument.py @@ -0,0 +1,4 @@ +def foo(x): + return x + +foo(1) diff --git a/semantic-python/test/fixtures/cheese/6-01-imports.py b/semantic-python/test/fixtures/cheese/6-01-imports.py new file mode 100644 index 0000000000..5ce8582d63 --- /dev/null +++ b/semantic-python/test/fixtures/cheese/6-01-imports.py @@ -0,0 +1 @@ +from cheese.ints import * diff --git a/semantic-python/test/fixtures/cheese/6-01-qualified-imports.py b/semantic-python/test/fixtures/cheese/6-01-qualified-imports.py new file mode 100644 index 0000000000..54a062518b --- /dev/null +++ b/semantic-python/test/fixtures/cheese/6-01-qualified-imports.py @@ -0,0 +1 @@ +import cheese.ints diff --git a/semantic-python/test/fixtures/cheese/ints.py b/semantic-python/test/fixtures/cheese/ints.py new file mode 100644 index 0000000000..cd81106f3b --- /dev/null +++ b/semantic-python/test/fixtures/cheese/ints.py @@ -0,0 +1,5 @@ +def one(): + return 1 + +def two(): + return 2 diff --git a/semantic-ruby/BUILD.bazel b/semantic-ruby/BUILD.bazel new file mode 100644 index 0000000000..9947c21cc7 --- /dev/null +++ b/semantic-ruby/BUILD.bazel @@ -0,0 +1,16 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "//:build/common.bzl", + "semantic_language_library", + "semantic_language_parsing_test", +) + +semantic_language_library( + name = "semantic-ruby", + srcs = glob(["src/**/*.hs"]), + language = "ruby", + nodetypes = "@tree-sitter-ruby//:src/node-types.json", +) + +semantic_language_parsing_test(language = "ruby") diff --git a/semantic-ruby/LICENSE b/semantic-ruby/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-ruby/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-ruby/README.md b/semantic-ruby/README.md new file mode 100644 index 0000000000..1def6ff9cd --- /dev/null +++ b/semantic-ruby/README.md @@ -0,0 +1,3 @@ +# Semantic support for Ruby + +This package implements `semantic` support for Ruby. diff --git a/semantic-ruby/Setup.hs b/semantic-ruby/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-ruby/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-ruby/app/Main.hs b/semantic-ruby/app/Main.hs new file mode 100644 index 0000000000..727c7f9b38 --- /dev/null +++ b/semantic-ruby/app/Main.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE TypeApplications #-} +module Main +( main +) where + +import Control.Monad +import qualified Data.ByteString as B +import Data.Foldable (traverse_) +import System.Exit (die) +import System.Environment (getArgs) +import Language.Ruby +import qualified Language.Ruby.AST as Rb +import AST.Unmarshal + +main :: IO () +main = getArgs >>= traverse_ (print <=< parseFile) + +parseFile :: FilePath -> IO (Rb.Program ()) +parseFile = either die pure <=< parseByteString @Rb.Program @() tree_sitter_ruby <=< B.readFile diff --git a/semantic-ruby/bench/Main.hs b/semantic-ruby/bench/Main.hs new file mode 100644 index 0000000000..ee16f9e8bd --- /dev/null +++ b/semantic-ruby/bench/Main.hs @@ -0,0 +1,7 @@ +module Main (main) where + +import Gauge +import qualified Parsing + +main :: IO () +main = defaultMain [ Parsing.benchmarks ] diff --git a/semantic-ruby/bench/Parsing.hs b/semantic-ruby/bench/Parsing.hs new file mode 100644 index 0000000000..0ab269a4ae --- /dev/null +++ b/semantic-ruby/bench/Parsing.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE TypeApplications #-} + +module Parsing (benchmarks) where + +import AST.Unmarshal +import Control.Monad +import qualified Data.ByteString as B +import Data.Foldable +import Gauge +import Language.Ruby +import qualified Language.Ruby.AST as Rb +import System.Exit (die) +import System.FilePath.Glob + +benchmarks :: Benchmark +benchmarks = bgroup "parsing" [ rubyBenchmarks ] + +rubyBenchmarks :: Benchmark +rubyBenchmarks = bench "ruby" $ parseAllFiles dir "*.rb" + where dir = "../semantic/tmp/ruby-examples/ruby_spec/command_line" + +parseAllFiles :: FilePath -> String -> Benchmarkable +parseAllFiles dir glob = nfIO $ do + paths <- globDir1 (compile glob) dir + when (null paths) (die $ "No files found in " <> dir) + for_ paths $ \ file -> do + -- print (Path.toString file) + contents <- B.readFile file + either die pure =<< parseByteString @Rb.Program @() tree_sitter_ruby contents diff --git a/semantic-ruby/semantic-ruby.cabal b/semantic-ruby/semantic-ruby.cabal new file mode 100644 index 0000000000..ae6e161403 --- /dev/null +++ b/semantic-ruby/semantic-ruby.cabal @@ -0,0 +1,103 @@ +cabal-version: 2.4 + +name: semantic-ruby +version: 0.0.0.0 +synopsis: Semantic support for Ruby. +description: Semantic support for Ruby. +homepage: https://github.com/github/semantic/tree/master/semantic-ruby#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + cpp-options: + -DBAZEL_BUILD=0 + +library + import: haskell + exposed-modules: + Language.Ruby + Language.Ruby.AST + Language.Ruby.Grammar + Language.Ruby.Tags + hs-source-dirs: src + build-depends: + , base >= 4.13 && < 5 + , fused-effects ^>= 1.1 + , semantic-ast + , semantic-proto ^>= 0 + , semantic-source ^>= 0.2 + , semantic-tags ^>= 0.0 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3 + , tree-sitter ^>= 0.9 + , tree-sitter-ruby ^>= 0.5.0.2 + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: PreciseTest.hs + build-depends: + , base + , semantic-ast + , semantic-ruby + , tasty + , tree-sitter-ruby ^>= 0.5.0.2 + +executable benchmarks + import: haskell + hs-source-dirs: bench + -- type: exitcode-stdio-1.0 + main-is: Main.hs + other-modules: Parsing + ghc-options: -static -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" + build-depends: + , base + , bytestring + , gauge ^>= 0.2.5 + , Glob + , semantic-ast + , semantic-ruby + +executable tree-sitter-ruby + import: haskell + hs-source-dirs: app + ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" + main-is: Main.hs + build-depends: + , base + , bytestring + , semantic-ast + , semantic-ruby diff --git a/semantic-ruby/src/Language/Ruby.hs b/semantic-ruby/src/Language/Ruby.hs new file mode 100644 index 0000000000..423aa789a7 --- /dev/null +++ b/semantic-ruby/src/Language/Ruby.hs @@ -0,0 +1,31 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeApplications #-} + +-- | Semantic functionality for Ruby programs. +module Language.Ruby +( Term(..) +, Language.Ruby.Grammar.tree_sitter_ruby +) where + +import AST.Marshal.JSON +import qualified AST.Unmarshal as TS +import Control.Carrier.State.Strict +import Data.Proxy +import Data.Text (Text) +import qualified Language.Ruby.AST as Rb +import qualified Language.Ruby.Grammar (tree_sitter_ruby) +import qualified Language.Ruby.Tags as RbTags +import qualified Tags.Tagging.Precise as Tags + +newtype Term a = Term { getTerm :: Rb.Program a } + deriving MarshalJSON + +instance TS.SymbolMatching Term where + matchedSymbols _ = TS.matchedSymbols (Proxy :: Proxy Rb.Program) + showFailure _ = TS.showFailure (Proxy :: Proxy Rb.Program) + +instance TS.Unmarshal Term where + matchers = fmap (fmap (TS.hoist Term)) TS.matchers + +instance Tags.ToTags Term where + tags src = Tags.runTagging src . evalState @[Text] [] . RbTags.tags . getTerm diff --git a/semantic-ruby/src/Language/Ruby/AST.hs b/semantic-ruby/src/Language/Ruby/AST.hs new file mode 100644 index 0000000000..b0ba07cb45 --- /dev/null +++ b/semantic-ruby/src/Language/Ruby/AST.hs @@ -0,0 +1,5647 @@ +-- Language definition for Ruby, generated by ast-generate. Do not edit! +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Language.Ruby.AST (module Language.Ruby.AST, getTestCorpusDir) where + +import qualified AST.Parse +import qualified AST.Token +import qualified AST.Traversable1.Class +import qualified AST.Unmarshal +import qualified Data.Foldable +import qualified Data.List as Data.OldList +import qualified Data.Maybe as GHC.Maybe +import qualified Data.Text.Internal +import qualified Data.Traversable +import qualified GHC.Base +import qualified GHC.Generics +import qualified GHC.Records +import qualified GHC.Show +import qualified TreeSitter.Node +import TreeSitter.Ruby (getTestCorpusDir) +import qualified Prelude as GHC.Classes + +debugSymbolNames :: [GHC.Base.String] +debugSymbolNames = debugSymbolNames_0 + +debugSymbolNames_0 :: [GHC.Base.String] +debugSymbolNames_0 = + [ "end", + "identifier", + "___END__", + "uninterpreted", + "_BEGIN", + "_{", + "_}", + "_END", + "_def", + "_(", + "_)", + "_.", + "_::", + "_,", + "_|", + "_;", + "_*", + "_**", + "_&", + "_:", + "_=", + "_class", + "_<", + "_module", + "_end", + "_return", + "_yield", + "_break", + "_next", + "_redo", + "_retry", + "_if", + "_unless", + "_while", + "_until", + "_rescue", + "_for", + "_in", + "_do", + "_case", + "_when", + "_elsif", + "_else", + "_then", + "_begin", + "_ensure", + "_=>", + "_[", + "_]", + "_::", + "_&.", + "_(", + "_+=", + "_-=", + "_*=", + "_**=", + "_/=", + "_||=", + "_|=", + "_&&=", + "_&=", + "_%=", + "_>>=", + "_<<=", + "_^=", + "_?", + "_:", + "_..", + "_...", + "_and", + "_or", + "_||", + "_&&", + "_<<", + "_>>", + "_<=", + "_>", + "_>=", + "_^", + "_+", + "_/", + "_%", + "_==", + "_!=", + "_===", + "_<=>", + "_=~", + "_!~", + "_defined?", + "_not", + "_!", + "_~", + "_-", + "_+@", + "_-@", + "_[]", + "_[]=", + "_`", + "_undef", + "_alias", + "comment", + "integer", + "float", + "complex", + "_r", + "super", + "self", + "true", + "false", + "nil", + "constant", + "instance_variable", + "class_variable", + "global_variable", + "character", + "_#{", + "_string_array_token1", + "escape_sequence", + "_[", + "_->", + "_line_break", + "_simple_symbol", + "_\"", + "_:\"", + "_`", + "_/", + "_%w(", + "_%i(", + "_heredoc_body_start", + "_string_content", + "_heredoc_content", + "_string_end", + "heredoc_end", + "heredoc_beginning", + "_&", + "_*", + "_-", + "_-", + "_*", + "_<<", + "symbol", + "program", + "_statements", + "begin_block", + "end_block", + "_statement", + "method", + "singleton_method", + "_method_rest", + "parameters", + "bare_parameters", + "block_parameters", + "_formal_parameter", + "_simple_formal_parameter", + "splat_parameter", + "hash_splat_parameter", + "block_parameter", + "keyword_parameter", + "optional_parameter", + "class", + "superclass", + "singleton_class", + "module", + "return", + "yield", + "break", + "next", + "return", + "yield", + "break", + "next", + "redo", + "retry", + "if_modifier", + "unless_modifier", + "while_modifier", + "until_modifier", + "rescue_modifier", + "while", + "until", + "for", + "in", + "do", + "case", + "when", + "pattern", + "if", + "unless", + "elsif", + "else", + "then", + "begin", + "ensure", + "rescue", + "exceptions", + "exception_variable", + "_body_statement", + "_expression", + "_arg", + "_primary", + "parenthesized_statements", + "element_reference", + "scope_resolution", + "call", + "method_call", + "method_call", + "argument_list", + "argument_list", + "_argument_list_with_trailing_comma", + "_argument", + "splat_argument", + "hash_splat_argument", + "block_argument", + "do_block", + "block", + "assignment", + "assignment", + "operator_assignment", + "operator_assignment", + "conditional", + "range", + "binary", + "binary", + "unary", + "unary", + "unary", + "right_assignment_list", + "left_assignment_list", + "_mlhs", + "destructured_left_assignment", + "rest_assignment", + "_lhs", + "_variable", + "operator", + "_method_name", + "setter", + "undef", + "alias", + "rational", + "chained_string", + "interpolation", + "string", + "subshell", + "string_array", + "symbol_array", + "symbol", + "regex", + "heredoc_body", + "__literal_contents", + "array", + "hash", + "pair", + "lambda", + "empty_statement", + "_terminator", + "__statements_repeat1", + "_parameters_repeat1", + "_block_parameters_repeat1", + "_for_repeat1", + "_case_repeat1", + "_case_repeat2", + "_when_repeat1", + "_exceptions_repeat1", + "__body_statement_repeat1", + "_command_argument_list_repeat1", + "__mlhs_repeat1", + "_undef_repeat1", + "_chained_string_repeat1", + "_string_array_repeat1", + "_symbol_array_repeat1", + "_heredoc_body_repeat1", + "_hash_repeat1", + "_\"", + "bare_string", + "bare_symbol", + "destructured_parameter", + "lambda_parameters", + "method_parameters" + ] + +newtype Arg a = Arg {getArg :: ((Primary GHC.Generics.:+: Assignment GHC.Generics.:+: Binary GHC.Generics.:+: Conditional GHC.Generics.:+: OperatorAssignment GHC.Generics.:+: Range GHC.Generics.:+: Unary) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1. + AST.Traversable1.Class.Traversable1 a_1 + ) + +instance GHC.Records.HasField "ann" (Arg a_2) a_2 where + getField = AST.Unmarshal.gann GHC.Base.. getArg + +deriving instance GHC.Classes.Eq a_3 => GHC.Classes.Eq (Arg a_3) + +deriving instance GHC.Classes.Ord a_4 => GHC.Classes.Ord (Arg a_4) + +deriving instance GHC.Show.Show a_5 => GHC.Show.Show (Arg a_5) + +instance AST.Unmarshal.Unmarshal Arg + +instance Data.Foldable.Foldable Arg where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Arg where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Arg where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Lhs a = Lhs {getLhs :: ((Variable GHC.Generics.:+: Call GHC.Generics.:+: ElementReference GHC.Generics.:+: False GHC.Generics.:+: MethodCall GHC.Generics.:+: Nil GHC.Generics.:+: ScopeResolution GHC.Generics.:+: True) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_6. + AST.Traversable1.Class.Traversable1 a_6 + ) + +instance GHC.Records.HasField "ann" (Lhs a_7) a_7 where + getField = AST.Unmarshal.gann GHC.Base.. getLhs + +deriving instance GHC.Classes.Eq a_8 => GHC.Classes.Eq (Lhs a_8) + +deriving instance GHC.Classes.Ord a_9 => GHC.Classes.Ord (Lhs a_9) + +deriving instance GHC.Show.Show a_10 => GHC.Show.Show (Lhs a_10) + +instance AST.Unmarshal.Unmarshal Lhs + +instance Data.Foldable.Foldable Lhs where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Lhs where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Lhs where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype MethodName a = MethodName {getMethodName :: ((ClassVariable GHC.Generics.:+: Constant GHC.Generics.:+: GlobalVariable GHC.Generics.:+: Identifier GHC.Generics.:+: InstanceVariable GHC.Generics.:+: Operator GHC.Generics.:+: Setter GHC.Generics.:+: Symbol) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_11. + AST.Traversable1.Class.Traversable1 a_11 + ) + +instance GHC.Records.HasField "ann" (MethodName a_12) a_12 where + getField = AST.Unmarshal.gann GHC.Base.. getMethodName + +deriving instance GHC.Classes.Eq a_13 => GHC.Classes.Eq (MethodName a_13) + +deriving instance GHC.Classes.Ord a_14 => GHC.Classes.Ord (MethodName a_14) + +deriving instance GHC.Show.Show a_15 => GHC.Show.Show (MethodName a_15) + +instance AST.Unmarshal.Unmarshal MethodName + +instance Data.Foldable.Foldable MethodName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodName where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Primary a = Primary {getPrimary :: ((Lhs GHC.Generics.:+: Array GHC.Generics.:+: Begin GHC.Generics.:+: Break GHC.Generics.:+: Case GHC.Generics.:+: ChainedString GHC.Generics.:+: Character GHC.Generics.:+: Class GHC.Generics.:+: Complex GHC.Generics.:+: Float GHC.Generics.:+: For GHC.Generics.:+: Hash GHC.Generics.:+: HeredocBeginning GHC.Generics.:+: If GHC.Generics.:+: Integer GHC.Generics.:+: Lambda GHC.Generics.:+: Method GHC.Generics.:+: Module GHC.Generics.:+: Next GHC.Generics.:+: ParenthesizedStatements GHC.Generics.:+: Rational GHC.Generics.:+: Redo GHC.Generics.:+: Regex GHC.Generics.:+: Retry GHC.Generics.:+: Return GHC.Generics.:+: SingletonClass GHC.Generics.:+: SingletonMethod GHC.Generics.:+: String GHC.Generics.:+: StringArray GHC.Generics.:+: Subshell GHC.Generics.:+: Symbol GHC.Generics.:+: SymbolArray GHC.Generics.:+: Unary GHC.Generics.:+: Unless GHC.Generics.:+: Until GHC.Generics.:+: While GHC.Generics.:+: Yield) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_16. + AST.Traversable1.Class.Traversable1 a_16 + ) + +instance GHC.Records.HasField "ann" (Primary a_17) a_17 where + getField = AST.Unmarshal.gann GHC.Base.. getPrimary + +deriving instance GHC.Classes.Eq a_18 => GHC.Classes.Eq (Primary a_18) + +deriving instance GHC.Classes.Ord a_19 => GHC.Classes.Ord (Primary a_19) + +deriving instance GHC.Show.Show a_20 => GHC.Show.Show (Primary a_20) + +instance AST.Unmarshal.Unmarshal Primary + +instance Data.Foldable.Foldable Primary where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Primary where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Primary where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Statement a = Statement {getStatement :: ((Arg GHC.Generics.:+: Alias GHC.Generics.:+: Assignment GHC.Generics.:+: BeginBlock GHC.Generics.:+: Binary GHC.Generics.:+: Break GHC.Generics.:+: EndBlock GHC.Generics.:+: IfModifier GHC.Generics.:+: MethodCall GHC.Generics.:+: Next GHC.Generics.:+: OperatorAssignment GHC.Generics.:+: RescueModifier GHC.Generics.:+: Return GHC.Generics.:+: Undef GHC.Generics.:+: UnlessModifier GHC.Generics.:+: UntilModifier GHC.Generics.:+: WhileModifier GHC.Generics.:+: Yield) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_21. + AST.Traversable1.Class.Traversable1 a_21 + ) + +instance GHC.Records.HasField "ann" (Statement a_22) a_22 where + getField = AST.Unmarshal.gann GHC.Base.. getStatement + +deriving instance GHC.Classes.Eq a_23 => GHC.Classes.Eq (Statement a_23) + +deriving instance GHC.Classes.Ord a_24 => GHC.Classes.Ord (Statement a_24) + +deriving instance GHC.Show.Show a_25 => GHC.Show.Show (Statement a_25) + +instance AST.Unmarshal.Unmarshal Statement + +instance Data.Foldable.Foldable Statement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Statement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Statement where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Variable a = Variable {getVariable :: ((ClassVariable GHC.Generics.:+: Constant GHC.Generics.:+: GlobalVariable GHC.Generics.:+: Identifier GHC.Generics.:+: InstanceVariable GHC.Generics.:+: Self GHC.Generics.:+: Super) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_26. + AST.Traversable1.Class.Traversable1 a_26 + ) + +instance GHC.Records.HasField "ann" (Variable a_27) a_27 where + getField = AST.Unmarshal.gann GHC.Base.. getVariable + +deriving instance GHC.Classes.Eq a_28 => GHC.Classes.Eq (Variable a_28) + +deriving instance GHC.Classes.Ord a_29 => GHC.Classes.Ord (Variable a_29) + +deriving instance GHC.Show.Show a_30 => GHC.Show.Show (Variable a_30) + +instance AST.Unmarshal.Unmarshal Variable + +instance Data.Foldable.Foldable Variable where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Variable where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Variable where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Alias a = Alias + { ann :: a, + alias :: (AST.Parse.Err (MethodName a)), + name :: (AST.Parse.Err (MethodName a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_31. + AST.Traversable1.Class.Traversable1 a_31 + ) + +instance AST.Unmarshal.SymbolMatching Alias where + matchedSymbols _ = [237] + showFailure _ node_32 = + "expected " + GHC.Base.<> ( "alias" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_32 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_32) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_33 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_34 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_35 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_36 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_33 + c1_34 = TreeSitter.Node.nodeStartPoint node_32 + TreeSitter.Node.TSPoint + r2_35 + c2_36 = TreeSitter.Node.nodeEndPoint node_32 + +deriving instance GHC.Classes.Eq a_37 => GHC.Classes.Eq (Alias a_37) + +deriving instance GHC.Classes.Ord a_38 => GHC.Classes.Ord (Alias a_38) + +deriving instance GHC.Show.Show a_39 => GHC.Show.Show (Alias a_39) + +instance AST.Unmarshal.Unmarshal Alias + +instance Data.Foldable.Foldable Alias where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Alias where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Alias where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArgumentList a = ArgumentList + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Arg GHC.Generics.:+: BlockArgument GHC.Generics.:+: HashSplatArgument GHC.Generics.:+: MethodCall GHC.Generics.:+: Pair GHC.Generics.:+: SplatArgument) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_40. + AST.Traversable1.Class.Traversable1 a_40 + ) + +instance AST.Unmarshal.SymbolMatching ArgumentList where + matchedSymbols _ = [206, 207] + showFailure _ node_41 = + "expected " + GHC.Base.<> ( "argument_list, argument_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_41 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_41) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_42 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_43 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_44 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_45 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_42 + c1_43 = TreeSitter.Node.nodeStartPoint node_41 + TreeSitter.Node.TSPoint + r2_44 + c2_45 = TreeSitter.Node.nodeEndPoint node_41 + +deriving instance GHC.Classes.Eq a_46 => GHC.Classes.Eq (ArgumentList a_46) + +deriving instance GHC.Classes.Ord a_47 => GHC.Classes.Ord (ArgumentList a_47) + +deriving instance GHC.Show.Show a_48 => GHC.Show.Show (ArgumentList a_48) + +instance AST.Unmarshal.Unmarshal ArgumentList + +instance Data.Foldable.Foldable ArgumentList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArgumentList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArgumentList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Array a = Array + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Arg GHC.Generics.:+: BlockArgument GHC.Generics.:+: HashSplatArgument GHC.Generics.:+: Pair GHC.Generics.:+: SplatArgument) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_49. + AST.Traversable1.Class.Traversable1 a_49 + ) + +instance AST.Unmarshal.SymbolMatching Array where + matchedSymbols _ = [249] + showFailure _ node_50 = + "expected " + GHC.Base.<> ( "array" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_50 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_50) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_51 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_52 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_53 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_54 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_51 + c1_52 = TreeSitter.Node.nodeStartPoint node_50 + TreeSitter.Node.TSPoint + r2_53 + c2_54 = TreeSitter.Node.nodeEndPoint node_50 + +deriving instance GHC.Classes.Eq a_55 => GHC.Classes.Eq (Array a_55) + +deriving instance GHC.Classes.Ord a_56 => GHC.Classes.Ord (Array a_56) + +deriving instance GHC.Show.Show a_57 => GHC.Show.Show (Array a_57) + +instance AST.Unmarshal.Unmarshal Array + +instance Data.Foldable.Foldable Array where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Array where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Array where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Assignment a = Assignment + { ann :: a, + left :: (AST.Parse.Err ((Lhs GHC.Generics.:+: LeftAssignmentList) a)), + right :: (AST.Parse.Err ((Arg GHC.Generics.:+: Break GHC.Generics.:+: MethodCall GHC.Generics.:+: Next GHC.Generics.:+: Return GHC.Generics.:+: RightAssignmentList GHC.Generics.:+: SplatArgument GHC.Generics.:+: Yield) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_58. + AST.Traversable1.Class.Traversable1 a_58 + ) + +instance AST.Unmarshal.SymbolMatching Assignment where + matchedSymbols _ = [215, 216] + showFailure _ node_59 = + "expected " + GHC.Base.<> ( "assignment, assignment" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_59 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_59) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_60 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_61 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_62 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_63 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_60 + c1_61 = TreeSitter.Node.nodeStartPoint node_59 + TreeSitter.Node.TSPoint + r2_62 + c2_63 = TreeSitter.Node.nodeEndPoint node_59 + +deriving instance GHC.Classes.Eq a_64 => GHC.Classes.Eq (Assignment a_64) + +deriving instance GHC.Classes.Ord a_65 => GHC.Classes.Ord (Assignment a_65) + +deriving instance GHC.Show.Show a_66 => GHC.Show.Show (Assignment a_66) + +instance AST.Unmarshal.Unmarshal Assignment + +instance Data.Foldable.Foldable Assignment where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Assignment where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Assignment where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BareString a = BareString + { ann :: a, + extraChildren :: ([AST.Parse.Err ((EscapeSequence GHC.Generics.:+: Interpolation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_67. + AST.Traversable1.Class.Traversable1 a_67 + ) + +instance AST.Unmarshal.SymbolMatching BareString where + matchedSymbols _ = [273] + showFailure _ node_68 = + "expected " + GHC.Base.<> ( "bare_string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_68 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_68) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_69 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_70 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_71 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_72 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_69 + c1_70 = TreeSitter.Node.nodeStartPoint node_68 + TreeSitter.Node.TSPoint + r2_71 + c2_72 = TreeSitter.Node.nodeEndPoint node_68 + +deriving instance GHC.Classes.Eq a_73 => GHC.Classes.Eq (BareString a_73) + +deriving instance GHC.Classes.Ord a_74 => GHC.Classes.Ord (BareString a_74) + +deriving instance GHC.Show.Show a_75 => GHC.Show.Show (BareString a_75) + +instance AST.Unmarshal.Unmarshal BareString + +instance Data.Foldable.Foldable BareString where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BareString where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BareString where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BareSymbol a = BareSymbol + { ann :: a, + extraChildren :: ([AST.Parse.Err ((EscapeSequence GHC.Generics.:+: Interpolation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_76. + AST.Traversable1.Class.Traversable1 a_76 + ) + +instance AST.Unmarshal.SymbolMatching BareSymbol where + matchedSymbols _ = [274] + showFailure _ node_77 = + "expected " + GHC.Base.<> ( "bare_symbol" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_77 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_77) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_78 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_79 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_80 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_81 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_78 + c1_79 = TreeSitter.Node.nodeStartPoint node_77 + TreeSitter.Node.TSPoint + r2_80 + c2_81 = TreeSitter.Node.nodeEndPoint node_77 + +deriving instance GHC.Classes.Eq a_82 => GHC.Classes.Eq (BareSymbol a_82) + +deriving instance GHC.Classes.Ord a_83 => GHC.Classes.Ord (BareSymbol a_83) + +deriving instance GHC.Show.Show a_84 => GHC.Show.Show (BareSymbol a_84) + +instance AST.Unmarshal.Unmarshal BareSymbol + +instance Data.Foldable.Foldable BareSymbol where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BareSymbol where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BareSymbol where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Begin a = Begin + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: Else GHC.Generics.:+: EmptyStatement GHC.Generics.:+: Ensure GHC.Generics.:+: Rescue) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_85. + AST.Traversable1.Class.Traversable1 a_85 + ) + +instance AST.Unmarshal.SymbolMatching Begin where + matchedSymbols _ = [191] + showFailure _ node_86 = + "expected " + GHC.Base.<> ( "begin" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_86 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_86) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_87 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_88 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_89 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_90 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_87 + c1_88 = TreeSitter.Node.nodeStartPoint node_86 + TreeSitter.Node.TSPoint + r2_89 + c2_90 = TreeSitter.Node.nodeEndPoint node_86 + +deriving instance GHC.Classes.Eq a_91 => GHC.Classes.Eq (Begin a_91) + +deriving instance GHC.Classes.Ord a_92 => GHC.Classes.Ord (Begin a_92) + +deriving instance GHC.Show.Show a_93 => GHC.Show.Show (Begin a_93) + +instance AST.Unmarshal.Unmarshal Begin + +instance Data.Foldable.Foldable Begin where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Begin where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Begin where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BeginBlock a = BeginBlock + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: EmptyStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_94. + AST.Traversable1.Class.Traversable1 a_94 + ) + +instance AST.Unmarshal.SymbolMatching BeginBlock where + matchedSymbols _ = [143] + showFailure _ node_95 = + "expected " + GHC.Base.<> ( "begin_block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_95 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_95) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_96 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_97 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_98 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_99 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_96 + c1_97 = TreeSitter.Node.nodeStartPoint node_95 + TreeSitter.Node.TSPoint + r2_98 + c2_99 = TreeSitter.Node.nodeEndPoint node_95 + +deriving instance GHC.Classes.Eq a_100 => GHC.Classes.Eq (BeginBlock a_100) + +deriving instance GHC.Classes.Ord a_101 => GHC.Classes.Ord (BeginBlock a_101) + +deriving instance GHC.Show.Show a_102 => GHC.Show.Show (BeginBlock a_102) + +instance AST.Unmarshal.Unmarshal BeginBlock + +instance Data.Foldable.Foldable BeginBlock where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BeginBlock where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BeginBlock where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Binary a = Binary + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousBangEqual GHC.Generics.:+: AnonymousBangTilde GHC.Generics.:+: AnonymousPercent GHC.Generics.:+: AnonymousAmpersand GHC.Generics.:+: AnonymousAmpersandAmpersand GHC.Generics.:+: AnonymousStar GHC.Generics.:+: AnonymousStarStar GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousSlash GHC.Generics.:+: AnonymousLAngle GHC.Generics.:+: AnonymousLAngleLAngle GHC.Generics.:+: AnonymousLAngleEqual GHC.Generics.:+: AnonymousLAngleEqualRAngle GHC.Generics.:+: AnonymousEqualEqual GHC.Generics.:+: AnonymousEqualEqualEqual GHC.Generics.:+: AnonymousEqualTilde GHC.Generics.:+: AnonymousRAngle GHC.Generics.:+: AnonymousRAngleEqual GHC.Generics.:+: AnonymousRAngleRAngle GHC.Generics.:+: AnonymousCaret GHC.Generics.:+: AnonymousAnd GHC.Generics.:+: AnonymousOr GHC.Generics.:+: AnonymousPipe GHC.Generics.:+: AnonymousPipePipe) a)), + left :: (AST.Parse.Err ((Arg GHC.Generics.:+: Break GHC.Generics.:+: MethodCall GHC.Generics.:+: Next GHC.Generics.:+: Return GHC.Generics.:+: Yield) a)), + right :: (AST.Parse.Err ((Arg GHC.Generics.:+: Break GHC.Generics.:+: MethodCall GHC.Generics.:+: Next GHC.Generics.:+: Return GHC.Generics.:+: Yield) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_103. + AST.Traversable1.Class.Traversable1 a_103 + ) + +instance AST.Unmarshal.SymbolMatching Binary where + matchedSymbols _ = [221, 222] + showFailure _ node_104 = + "expected " + GHC.Base.<> ( "binary, binary" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_104 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_104) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_105 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_106 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_107 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_108 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_105 + c1_106 = TreeSitter.Node.nodeStartPoint node_104 + TreeSitter.Node.TSPoint + r2_107 + c2_108 = TreeSitter.Node.nodeEndPoint node_104 + +deriving instance GHC.Classes.Eq a_109 => GHC.Classes.Eq (Binary a_109) + +deriving instance GHC.Classes.Ord a_110 => GHC.Classes.Ord (Binary a_110) + +deriving instance GHC.Show.Show a_111 => GHC.Show.Show (Binary a_111) + +instance AST.Unmarshal.Unmarshal Binary + +instance Data.Foldable.Foldable Binary where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Binary where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Binary where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Block a = Block + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: BlockParameters GHC.Generics.:+: EmptyStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_112. + AST.Traversable1.Class.Traversable1 a_112 + ) + +instance AST.Unmarshal.SymbolMatching Block where + matchedSymbols _ = [214] + showFailure _ node_113 = + "expected " + GHC.Base.<> ( "block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_113 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_113) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_114 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_115 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_116 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_117 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_114 + c1_115 = TreeSitter.Node.nodeStartPoint node_113 + TreeSitter.Node.TSPoint + r2_116 + c2_117 = TreeSitter.Node.nodeEndPoint node_113 + +deriving instance GHC.Classes.Eq a_118 => GHC.Classes.Eq (Block a_118) + +deriving instance GHC.Classes.Ord a_119 => GHC.Classes.Ord (Block a_119) + +deriving instance GHC.Show.Show a_120 => GHC.Show.Show (Block a_120) + +instance AST.Unmarshal.Unmarshal Block + +instance Data.Foldable.Foldable Block where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Block where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Block where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BlockArgument a = BlockArgument + { ann :: a, + extraChildren :: (AST.Parse.Err (Arg a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_121. + AST.Traversable1.Class.Traversable1 a_121 + ) + +instance AST.Unmarshal.SymbolMatching BlockArgument where + matchedSymbols _ = [212] + showFailure _ node_122 = + "expected " + GHC.Base.<> ( "block_argument" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_122 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_122) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_123 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_124 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_125 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_126 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_123 + c1_124 = TreeSitter.Node.nodeStartPoint node_122 + TreeSitter.Node.TSPoint + r2_125 + c2_126 = TreeSitter.Node.nodeEndPoint node_122 + +deriving instance GHC.Classes.Eq a_127 => GHC.Classes.Eq (BlockArgument a_127) + +deriving instance GHC.Classes.Ord a_128 => GHC.Classes.Ord (BlockArgument a_128) + +deriving instance GHC.Show.Show a_129 => GHC.Show.Show (BlockArgument a_129) + +instance AST.Unmarshal.Unmarshal BlockArgument + +instance Data.Foldable.Foldable BlockArgument where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BlockArgument where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BlockArgument where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BlockParameter a = BlockParameter {ann :: a, name :: (AST.Parse.Err (Identifier a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_130. + AST.Traversable1.Class.Traversable1 a_130 + ) + +instance AST.Unmarshal.SymbolMatching BlockParameter where + matchedSymbols _ = [156] + showFailure _ node_131 = + "expected " + GHC.Base.<> ( "block_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_131 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_131) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_132 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_133 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_134 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_135 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_132 + c1_133 = TreeSitter.Node.nodeStartPoint node_131 + TreeSitter.Node.TSPoint + r2_134 + c2_135 = TreeSitter.Node.nodeEndPoint node_131 + +deriving instance GHC.Classes.Eq a_136 => GHC.Classes.Eq (BlockParameter a_136) + +deriving instance GHC.Classes.Ord a_137 => GHC.Classes.Ord (BlockParameter a_137) + +deriving instance GHC.Show.Show a_138 => GHC.Show.Show (BlockParameter a_138) + +instance AST.Unmarshal.Unmarshal BlockParameter + +instance Data.Foldable.Foldable BlockParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BlockParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BlockParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BlockParameters a = BlockParameters + { ann :: a, + extraChildren :: ([AST.Parse.Err ((BlockParameter GHC.Generics.:+: DestructuredParameter GHC.Generics.:+: HashSplatParameter GHC.Generics.:+: Identifier GHC.Generics.:+: KeywordParameter GHC.Generics.:+: OptionalParameter GHC.Generics.:+: SplatParameter) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_139. + AST.Traversable1.Class.Traversable1 a_139 + ) + +instance AST.Unmarshal.SymbolMatching BlockParameters where + matchedSymbols _ = [151] + showFailure _ node_140 = + "expected " + GHC.Base.<> ( "block_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_140 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_140) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_141 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_142 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_143 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_144 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_141 + c1_142 = TreeSitter.Node.nodeStartPoint node_140 + TreeSitter.Node.TSPoint + r2_143 + c2_144 = TreeSitter.Node.nodeEndPoint node_140 + +deriving instance GHC.Classes.Eq a_145 => GHC.Classes.Eq (BlockParameters a_145) + +deriving instance GHC.Classes.Ord a_146 => GHC.Classes.Ord (BlockParameters a_146) + +deriving instance GHC.Show.Show a_147 => GHC.Show.Show (BlockParameters a_147) + +instance AST.Unmarshal.Unmarshal BlockParameters + +instance Data.Foldable.Foldable BlockParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BlockParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BlockParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Break a = Break + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ArgumentList a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_148. + AST.Traversable1.Class.Traversable1 a_148 + ) + +instance AST.Unmarshal.SymbolMatching Break where + matchedSymbols _ = [165, 169] + showFailure _ node_149 = + "expected " + GHC.Base.<> ( "break, break" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_149 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_149) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_150 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_151 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_152 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_153 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_150 + c1_151 = TreeSitter.Node.nodeStartPoint node_149 + TreeSitter.Node.TSPoint + r2_152 + c2_153 = TreeSitter.Node.nodeEndPoint node_149 + +deriving instance GHC.Classes.Eq a_154 => GHC.Classes.Eq (Break a_154) + +deriving instance GHC.Classes.Ord a_155 => GHC.Classes.Ord (Break a_155) + +deriving instance GHC.Show.Show a_156 => GHC.Show.Show (Break a_156) + +instance AST.Unmarshal.Unmarshal Break + +instance Data.Foldable.Foldable Break where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Break where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Break where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Call a = Call + { ann :: a, + receiver :: (AST.Parse.Err (Primary a)), + method :: (AST.Parse.Err ((ArgumentList GHC.Generics.:+: Constant GHC.Generics.:+: Identifier GHC.Generics.:+: Operator) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_157. + AST.Traversable1.Class.Traversable1 a_157 + ) + +instance AST.Unmarshal.SymbolMatching Call where + matchedSymbols _ = [203] + showFailure _ node_158 = + "expected " + GHC.Base.<> ( "call" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_158 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_158) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_159 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_160 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_161 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_162 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_159 + c1_160 = TreeSitter.Node.nodeStartPoint node_158 + TreeSitter.Node.TSPoint + r2_161 + c2_162 = TreeSitter.Node.nodeEndPoint node_158 + +deriving instance GHC.Classes.Eq a_163 => GHC.Classes.Eq (Call a_163) + +deriving instance GHC.Classes.Ord a_164 => GHC.Classes.Ord (Call a_164) + +deriving instance GHC.Show.Show a_165 => GHC.Show.Show (Call a_165) + +instance AST.Unmarshal.Unmarshal Call + +instance Data.Foldable.Foldable Call where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Call where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Call where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Case a = Case + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Arg a))), + extraChildren :: ([AST.Parse.Err ((Else GHC.Generics.:+: When) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_166. + AST.Traversable1.Class.Traversable1 a_166 + ) + +instance AST.Unmarshal.SymbolMatching Case where + matchedSymbols _ = [183] + showFailure _ node_167 = + "expected " + GHC.Base.<> ( "case" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_167 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_167) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_168 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_169 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_170 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_171 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_168 + c1_169 = TreeSitter.Node.nodeStartPoint node_167 + TreeSitter.Node.TSPoint + r2_170 + c2_171 = TreeSitter.Node.nodeEndPoint node_167 + +deriving instance GHC.Classes.Eq a_172 => GHC.Classes.Eq (Case a_172) + +deriving instance GHC.Classes.Ord a_173 => GHC.Classes.Ord (Case a_173) + +deriving instance GHC.Show.Show a_174 => GHC.Show.Show (Case a_174) + +instance AST.Unmarshal.Unmarshal Case + +instance Data.Foldable.Foldable Case where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Case where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Case where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ChainedString a = ChainedString + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (String a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_175. + AST.Traversable1.Class.Traversable1 a_175 + ) + +instance AST.Unmarshal.SymbolMatching ChainedString where + matchedSymbols _ = [239] + showFailure _ node_176 = + "expected " + GHC.Base.<> ( "chained_string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_176 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_176) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_177 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_178 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_179 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_180 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_177 + c1_178 = TreeSitter.Node.nodeStartPoint node_176 + TreeSitter.Node.TSPoint + r2_179 + c2_180 = TreeSitter.Node.nodeEndPoint node_176 + +deriving instance GHC.Classes.Eq a_181 => GHC.Classes.Eq (ChainedString a_181) + +deriving instance GHC.Classes.Ord a_182 => GHC.Classes.Ord (ChainedString a_182) + +deriving instance GHC.Show.Show a_183 => GHC.Show.Show (ChainedString a_183) + +instance AST.Unmarshal.Unmarshal ChainedString + +instance Data.Foldable.Foldable ChainedString where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ChainedString where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ChainedString where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Class a = Class + { ann :: a, + name :: (AST.Parse.Err ((Constant GHC.Generics.:+: ScopeResolution) a)), + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: Else GHC.Generics.:+: EmptyStatement GHC.Generics.:+: Ensure GHC.Generics.:+: Rescue GHC.Generics.:+: Superclass) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_184. + AST.Traversable1.Class.Traversable1 a_184 + ) + +instance AST.Unmarshal.SymbolMatching Class where + matchedSymbols _ = [159] + showFailure _ node_185 = + "expected " + GHC.Base.<> ( "class" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_185 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_185) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_186 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_187 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_188 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_189 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_186 + c1_187 = TreeSitter.Node.nodeStartPoint node_185 + TreeSitter.Node.TSPoint + r2_188 + c2_189 = TreeSitter.Node.nodeEndPoint node_185 + +deriving instance GHC.Classes.Eq a_190 => GHC.Classes.Eq (Class a_190) + +deriving instance GHC.Classes.Ord a_191 => GHC.Classes.Ord (Class a_191) + +deriving instance GHC.Show.Show a_192 => GHC.Show.Show (Class a_192) + +instance AST.Unmarshal.Unmarshal Class + +instance Data.Foldable.Foldable Class where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Class where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Class where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Conditional a = Conditional + { ann :: a, + alternative :: (AST.Parse.Err (Arg a)), + consequence :: (AST.Parse.Err (Arg a)), + condition :: (AST.Parse.Err (Arg a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_193. + AST.Traversable1.Class.Traversable1 a_193 + ) + +instance AST.Unmarshal.SymbolMatching Conditional where + matchedSymbols _ = [219] + showFailure _ node_194 = + "expected " + GHC.Base.<> ( "conditional" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_194 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_194) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_195 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_196 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_197 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_198 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_195 + c1_196 = TreeSitter.Node.nodeStartPoint node_194 + TreeSitter.Node.TSPoint + r2_197 + c2_198 = TreeSitter.Node.nodeEndPoint node_194 + +deriving instance GHC.Classes.Eq a_199 => GHC.Classes.Eq (Conditional a_199) + +deriving instance GHC.Classes.Ord a_200 => GHC.Classes.Ord (Conditional a_200) + +deriving instance GHC.Show.Show a_201 => GHC.Show.Show (Conditional a_201) + +instance AST.Unmarshal.Unmarshal Conditional + +instance Data.Foldable.Foldable Conditional where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Conditional where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Conditional where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DestructuredLeftAssignment a = DestructuredLeftAssignment + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Lhs GHC.Generics.:+: DestructuredLeftAssignment GHC.Generics.:+: RestAssignment) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_202. + AST.Traversable1.Class.Traversable1 a_202 + ) + +instance AST.Unmarshal.SymbolMatching DestructuredLeftAssignment where + matchedSymbols _ = [229] + showFailure _ node_203 = + "expected " + GHC.Base.<> ( "destructured_left_assignment" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_203 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_203) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_204 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_205 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_206 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_207 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_204 + c1_205 = TreeSitter.Node.nodeStartPoint node_203 + TreeSitter.Node.TSPoint + r2_206 + c2_207 = TreeSitter.Node.nodeEndPoint node_203 + +deriving instance GHC.Classes.Eq a_208 => GHC.Classes.Eq (DestructuredLeftAssignment a_208) + +deriving instance GHC.Classes.Ord a_209 => GHC.Classes.Ord (DestructuredLeftAssignment a_209) + +deriving instance GHC.Show.Show a_210 => GHC.Show.Show (DestructuredLeftAssignment a_210) + +instance AST.Unmarshal.Unmarshal DestructuredLeftAssignment + +instance Data.Foldable.Foldable DestructuredLeftAssignment where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DestructuredLeftAssignment where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DestructuredLeftAssignment where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DestructuredParameter a = DestructuredParameter + { ann :: a, + extraChildren :: ([AST.Parse.Err ((BlockParameter GHC.Generics.:+: DestructuredParameter GHC.Generics.:+: HashSplatParameter GHC.Generics.:+: Identifier GHC.Generics.:+: KeywordParameter GHC.Generics.:+: OptionalParameter GHC.Generics.:+: SplatParameter) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_211. + AST.Traversable1.Class.Traversable1 a_211 + ) + +instance AST.Unmarshal.SymbolMatching DestructuredParameter where + matchedSymbols _ = [275] + showFailure _ node_212 = + "expected " + GHC.Base.<> ( "destructured_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_212 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_212) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_213 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_214 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_215 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_216 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_213 + c1_214 = TreeSitter.Node.nodeStartPoint node_212 + TreeSitter.Node.TSPoint + r2_215 + c2_216 = TreeSitter.Node.nodeEndPoint node_212 + +deriving instance GHC.Classes.Eq a_217 => GHC.Classes.Eq (DestructuredParameter a_217) + +deriving instance GHC.Classes.Ord a_218 => GHC.Classes.Ord (DestructuredParameter a_218) + +deriving instance GHC.Show.Show a_219 => GHC.Show.Show (DestructuredParameter a_219) + +instance AST.Unmarshal.Unmarshal DestructuredParameter + +instance Data.Foldable.Foldable DestructuredParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DestructuredParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DestructuredParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Do a = Do + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: EmptyStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_220. + AST.Traversable1.Class.Traversable1 a_220 + ) + +instance AST.Unmarshal.SymbolMatching Do where + matchedSymbols _ = [182] + showFailure _ node_221 = + "expected " + GHC.Base.<> ( "do" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_221 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_221) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_222 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_223 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_224 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_225 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_222 + c1_223 = TreeSitter.Node.nodeStartPoint node_221 + TreeSitter.Node.TSPoint + r2_224 + c2_225 = TreeSitter.Node.nodeEndPoint node_221 + +deriving instance GHC.Classes.Eq a_226 => GHC.Classes.Eq (Do a_226) + +deriving instance GHC.Classes.Ord a_227 => GHC.Classes.Ord (Do a_227) + +deriving instance GHC.Show.Show a_228 => GHC.Show.Show (Do a_228) + +instance AST.Unmarshal.Unmarshal Do + +instance Data.Foldable.Foldable Do where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Do where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Do where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DoBlock a = DoBlock + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: BlockParameters GHC.Generics.:+: Else GHC.Generics.:+: EmptyStatement GHC.Generics.:+: Ensure GHC.Generics.:+: Rescue) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_229. + AST.Traversable1.Class.Traversable1 a_229 + ) + +instance AST.Unmarshal.SymbolMatching DoBlock where + matchedSymbols _ = [213] + showFailure _ node_230 = + "expected " + GHC.Base.<> ( "do_block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_230 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_230) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_231 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_232 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_233 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_234 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_231 + c1_232 = TreeSitter.Node.nodeStartPoint node_230 + TreeSitter.Node.TSPoint + r2_233 + c2_234 = TreeSitter.Node.nodeEndPoint node_230 + +deriving instance GHC.Classes.Eq a_235 => GHC.Classes.Eq (DoBlock a_235) + +deriving instance GHC.Classes.Ord a_236 => GHC.Classes.Ord (DoBlock a_236) + +deriving instance GHC.Show.Show a_237 => GHC.Show.Show (DoBlock a_237) + +instance AST.Unmarshal.Unmarshal DoBlock + +instance Data.Foldable.Foldable DoBlock where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DoBlock where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DoBlock where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ElementReference a = ElementReference + { ann :: a, + object :: (AST.Parse.Err (Primary a)), + extraChildren :: ([AST.Parse.Err ((Arg GHC.Generics.:+: BlockArgument GHC.Generics.:+: HashSplatArgument GHC.Generics.:+: Pair GHC.Generics.:+: SplatArgument) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_238. + AST.Traversable1.Class.Traversable1 a_238 + ) + +instance AST.Unmarshal.SymbolMatching ElementReference where + matchedSymbols _ = [201] + showFailure _ node_239 = + "expected " + GHC.Base.<> ( "element_reference" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_239 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_239) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_240 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_241 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_242 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_243 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_240 + c1_241 = TreeSitter.Node.nodeStartPoint node_239 + TreeSitter.Node.TSPoint + r2_242 + c2_243 = TreeSitter.Node.nodeEndPoint node_239 + +deriving instance GHC.Classes.Eq a_244 => GHC.Classes.Eq (ElementReference a_244) + +deriving instance GHC.Classes.Ord a_245 => GHC.Classes.Ord (ElementReference a_245) + +deriving instance GHC.Show.Show a_246 => GHC.Show.Show (ElementReference a_246) + +instance AST.Unmarshal.Unmarshal ElementReference + +instance Data.Foldable.Foldable ElementReference where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ElementReference where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ElementReference where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Else a = Else + { ann :: a, + condition :: (GHC.Maybe.Maybe (AST.Parse.Err (AnonymousSemicolon a))), + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: EmptyStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_247. + AST.Traversable1.Class.Traversable1 a_247 + ) + +instance AST.Unmarshal.SymbolMatching Else where + matchedSymbols _ = [189] + showFailure _ node_248 = + "expected " + GHC.Base.<> ( "else" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_248 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_248) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_249 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_250 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_251 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_252 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_249 + c1_250 = TreeSitter.Node.nodeStartPoint node_248 + TreeSitter.Node.TSPoint + r2_251 + c2_252 = TreeSitter.Node.nodeEndPoint node_248 + +deriving instance GHC.Classes.Eq a_253 => GHC.Classes.Eq (Else a_253) + +deriving instance GHC.Classes.Ord a_254 => GHC.Classes.Ord (Else a_254) + +deriving instance GHC.Show.Show a_255 => GHC.Show.Show (Else a_255) + +instance AST.Unmarshal.Unmarshal Else + +instance Data.Foldable.Foldable Else where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Else where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Else where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Elsif a = Elsif + { ann :: a, + alternative :: (GHC.Maybe.Maybe (AST.Parse.Err ((Else GHC.Generics.:+: Elsif) a))), + consequence :: (GHC.Maybe.Maybe (AST.Parse.Err (Then a))), + condition :: (AST.Parse.Err (Statement a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_256. + AST.Traversable1.Class.Traversable1 a_256 + ) + +instance AST.Unmarshal.SymbolMatching Elsif where + matchedSymbols _ = [188] + showFailure _ node_257 = + "expected " + GHC.Base.<> ( "elsif" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_257 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_257) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_258 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_259 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_260 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_261 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_258 + c1_259 = TreeSitter.Node.nodeStartPoint node_257 + TreeSitter.Node.TSPoint + r2_260 + c2_261 = TreeSitter.Node.nodeEndPoint node_257 + +deriving instance GHC.Classes.Eq a_262 => GHC.Classes.Eq (Elsif a_262) + +deriving instance GHC.Classes.Ord a_263 => GHC.Classes.Ord (Elsif a_263) + +deriving instance GHC.Show.Show a_264 => GHC.Show.Show (Elsif a_264) + +instance AST.Unmarshal.Unmarshal Elsif + +instance Data.Foldable.Foldable Elsif where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Elsif where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Elsif where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EmptyStatement a = EmptyStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_265. + AST.Traversable1.Class.Traversable1 a_265 + ) + +instance AST.Unmarshal.SymbolMatching EmptyStatement where + matchedSymbols _ = [253] + showFailure _ node_266 = + "expected " + GHC.Base.<> ( "empty_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_266 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_266) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_267 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_268 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_269 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_270 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_267 + c1_268 = TreeSitter.Node.nodeStartPoint node_266 + TreeSitter.Node.TSPoint + r2_269 + c2_270 = TreeSitter.Node.nodeEndPoint node_266 + +deriving instance GHC.Classes.Eq a_271 => GHC.Classes.Eq (EmptyStatement a_271) + +deriving instance GHC.Classes.Ord a_272 => GHC.Classes.Ord (EmptyStatement a_272) + +deriving instance GHC.Show.Show a_273 => GHC.Show.Show (EmptyStatement a_273) + +instance AST.Unmarshal.Unmarshal EmptyStatement + +instance Data.Foldable.Foldable EmptyStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EmptyStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EmptyStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EndBlock a = EndBlock + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: EmptyStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_274. + AST.Traversable1.Class.Traversable1 a_274 + ) + +instance AST.Unmarshal.SymbolMatching EndBlock where + matchedSymbols _ = [144] + showFailure _ node_275 = + "expected " + GHC.Base.<> ( "end_block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_275 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_275) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_276 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_277 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_278 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_279 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_276 + c1_277 = TreeSitter.Node.nodeStartPoint node_275 + TreeSitter.Node.TSPoint + r2_278 + c2_279 = TreeSitter.Node.nodeEndPoint node_275 + +deriving instance GHC.Classes.Eq a_280 => GHC.Classes.Eq (EndBlock a_280) + +deriving instance GHC.Classes.Ord a_281 => GHC.Classes.Ord (EndBlock a_281) + +deriving instance GHC.Show.Show a_282 => GHC.Show.Show (EndBlock a_282) + +instance AST.Unmarshal.Unmarshal EndBlock + +instance Data.Foldable.Foldable EndBlock where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EndBlock where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EndBlock where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Ensure a = Ensure + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: EmptyStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_283. + AST.Traversable1.Class.Traversable1 a_283 + ) + +instance AST.Unmarshal.SymbolMatching Ensure where + matchedSymbols _ = [192] + showFailure _ node_284 = + "expected " + GHC.Base.<> ( "ensure" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_284 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_284) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_285 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_286 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_287 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_288 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_285 + c1_286 = TreeSitter.Node.nodeStartPoint node_284 + TreeSitter.Node.TSPoint + r2_287 + c2_288 = TreeSitter.Node.nodeEndPoint node_284 + +deriving instance GHC.Classes.Eq a_289 => GHC.Classes.Eq (Ensure a_289) + +deriving instance GHC.Classes.Ord a_290 => GHC.Classes.Ord (Ensure a_290) + +deriving instance GHC.Show.Show a_291 => GHC.Show.Show (Ensure a_291) + +instance AST.Unmarshal.Unmarshal Ensure + +instance Data.Foldable.Foldable Ensure where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Ensure where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Ensure where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExceptionVariable a = ExceptionVariable + { ann :: a, + extraChildren :: (AST.Parse.Err (Lhs a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_292. + AST.Traversable1.Class.Traversable1 a_292 + ) + +instance AST.Unmarshal.SymbolMatching ExceptionVariable where + matchedSymbols _ = [195] + showFailure _ node_293 = + "expected " + GHC.Base.<> ( "exception_variable" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_293 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_293) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_294 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_295 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_296 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_297 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_294 + c1_295 = TreeSitter.Node.nodeStartPoint node_293 + TreeSitter.Node.TSPoint + r2_296 + c2_297 = TreeSitter.Node.nodeEndPoint node_293 + +deriving instance GHC.Classes.Eq a_298 => GHC.Classes.Eq (ExceptionVariable a_298) + +deriving instance GHC.Classes.Ord a_299 => GHC.Classes.Ord (ExceptionVariable a_299) + +deriving instance GHC.Show.Show a_300 => GHC.Show.Show (ExceptionVariable a_300) + +instance AST.Unmarshal.Unmarshal ExceptionVariable + +instance Data.Foldable.Foldable ExceptionVariable where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExceptionVariable where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExceptionVariable where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Exceptions a = Exceptions + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Arg GHC.Generics.:+: SplatArgument) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_301. + AST.Traversable1.Class.Traversable1 a_301 + ) + +instance AST.Unmarshal.SymbolMatching Exceptions where + matchedSymbols _ = [194] + showFailure _ node_302 = + "expected " + GHC.Base.<> ( "exceptions" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_302 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_302) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_303 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_304 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_305 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_306 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_303 + c1_304 = TreeSitter.Node.nodeStartPoint node_302 + TreeSitter.Node.TSPoint + r2_305 + c2_306 = TreeSitter.Node.nodeEndPoint node_302 + +deriving instance GHC.Classes.Eq a_307 => GHC.Classes.Eq (Exceptions a_307) + +deriving instance GHC.Classes.Ord a_308 => GHC.Classes.Ord (Exceptions a_308) + +deriving instance GHC.Show.Show a_309 => GHC.Show.Show (Exceptions a_309) + +instance AST.Unmarshal.Unmarshal Exceptions + +instance Data.Foldable.Foldable Exceptions where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Exceptions where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Exceptions where + traverse = AST.Traversable1.Class.traverseDefault1 + +data For a = For + { ann :: a, + pattern :: (GHC.Base.NonEmpty (AST.Parse.Err ((Lhs GHC.Generics.:+: DestructuredLeftAssignment GHC.Generics.:+: RestAssignment) a))), + body :: (AST.Parse.Err (Do a)), + value :: (AST.Parse.Err (In a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_310. + AST.Traversable1.Class.Traversable1 a_310 + ) + +instance AST.Unmarshal.SymbolMatching For where + matchedSymbols _ = [180] + showFailure _ node_311 = + "expected " + GHC.Base.<> ( "for" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_311 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_311) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_312 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_313 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_314 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_315 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_312 + c1_313 = TreeSitter.Node.nodeStartPoint node_311 + TreeSitter.Node.TSPoint + r2_314 + c2_315 = TreeSitter.Node.nodeEndPoint node_311 + +deriving instance GHC.Classes.Eq a_316 => GHC.Classes.Eq (For a_316) + +deriving instance GHC.Classes.Ord a_317 => GHC.Classes.Ord (For a_317) + +deriving instance GHC.Show.Show a_318 => GHC.Show.Show (For a_318) + +instance AST.Unmarshal.Unmarshal For + +instance Data.Foldable.Foldable For where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor For where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable For where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Hash a = Hash + { ann :: a, + extraChildren :: ([AST.Parse.Err ((HashSplatArgument GHC.Generics.:+: Pair) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_319. + AST.Traversable1.Class.Traversable1 a_319 + ) + +instance AST.Unmarshal.SymbolMatching Hash where + matchedSymbols _ = [250] + showFailure _ node_320 = + "expected " + GHC.Base.<> ( "hash" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_320 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_320) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_321 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_322 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_323 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_324 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_321 + c1_322 = TreeSitter.Node.nodeStartPoint node_320 + TreeSitter.Node.TSPoint + r2_323 + c2_324 = TreeSitter.Node.nodeEndPoint node_320 + +deriving instance GHC.Classes.Eq a_325 => GHC.Classes.Eq (Hash a_325) + +deriving instance GHC.Classes.Ord a_326 => GHC.Classes.Ord (Hash a_326) + +deriving instance GHC.Show.Show a_327 => GHC.Show.Show (Hash a_327) + +instance AST.Unmarshal.Unmarshal Hash + +instance Data.Foldable.Foldable Hash where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Hash where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Hash where + traverse = AST.Traversable1.Class.traverseDefault1 + +data HashSplatArgument a = HashSplatArgument + { ann :: a, + extraChildren :: (AST.Parse.Err (Arg a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_328. + AST.Traversable1.Class.Traversable1 a_328 + ) + +instance AST.Unmarshal.SymbolMatching HashSplatArgument where + matchedSymbols _ = [211] + showFailure _ node_329 = + "expected " + GHC.Base.<> ( "hash_splat_argument" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_329 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_329) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_330 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_331 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_332 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_333 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_330 + c1_331 = TreeSitter.Node.nodeStartPoint node_329 + TreeSitter.Node.TSPoint + r2_332 + c2_333 = TreeSitter.Node.nodeEndPoint node_329 + +deriving instance GHC.Classes.Eq a_334 => GHC.Classes.Eq (HashSplatArgument a_334) + +deriving instance GHC.Classes.Ord a_335 => GHC.Classes.Ord (HashSplatArgument a_335) + +deriving instance GHC.Show.Show a_336 => GHC.Show.Show (HashSplatArgument a_336) + +instance AST.Unmarshal.Unmarshal HashSplatArgument + +instance Data.Foldable.Foldable HashSplatArgument where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor HashSplatArgument where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable HashSplatArgument where + traverse = AST.Traversable1.Class.traverseDefault1 + +data HashSplatParameter a = HashSplatParameter + { ann :: a, + name :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_337. + AST.Traversable1.Class.Traversable1 a_337 + ) + +instance AST.Unmarshal.SymbolMatching HashSplatParameter where + matchedSymbols _ = [155] + showFailure _ node_338 = + "expected " + GHC.Base.<> ( "hash_splat_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_338 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_338) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_339 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_340 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_341 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_342 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_339 + c1_340 = TreeSitter.Node.nodeStartPoint node_338 + TreeSitter.Node.TSPoint + r2_341 + c2_342 = TreeSitter.Node.nodeEndPoint node_338 + +deriving instance GHC.Classes.Eq a_343 => GHC.Classes.Eq (HashSplatParameter a_343) + +deriving instance GHC.Classes.Ord a_344 => GHC.Classes.Ord (HashSplatParameter a_344) + +deriving instance GHC.Show.Show a_345 => GHC.Show.Show (HashSplatParameter a_345) + +instance AST.Unmarshal.Unmarshal HashSplatParameter + +instance Data.Foldable.Foldable HashSplatParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor HashSplatParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable HashSplatParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data If a = If + { ann :: a, + alternative :: (GHC.Maybe.Maybe (AST.Parse.Err ((Else GHC.Generics.:+: Elsif) a))), + consequence :: (GHC.Maybe.Maybe (AST.Parse.Err (Then a))), + condition :: (AST.Parse.Err (Statement a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_346. + AST.Traversable1.Class.Traversable1 a_346 + ) + +instance AST.Unmarshal.SymbolMatching If where + matchedSymbols _ = [186] + showFailure _ node_347 = + "expected " + GHC.Base.<> ( "if" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_347 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_347) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_348 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_349 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_350 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_351 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_348 + c1_349 = TreeSitter.Node.nodeStartPoint node_347 + TreeSitter.Node.TSPoint + r2_350 + c2_351 = TreeSitter.Node.nodeEndPoint node_347 + +deriving instance GHC.Classes.Eq a_352 => GHC.Classes.Eq (If a_352) + +deriving instance GHC.Classes.Ord a_353 => GHC.Classes.Ord (If a_353) + +deriving instance GHC.Show.Show a_354 => GHC.Show.Show (If a_354) + +instance AST.Unmarshal.Unmarshal If + +instance Data.Foldable.Foldable If where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor If where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable If where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IfModifier a = IfModifier + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err ((Arg GHC.Generics.:+: Break GHC.Generics.:+: MethodCall GHC.Generics.:+: Next GHC.Generics.:+: Return GHC.Generics.:+: Yield) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_355. + AST.Traversable1.Class.Traversable1 a_355 + ) + +instance AST.Unmarshal.SymbolMatching IfModifier where + matchedSymbols _ = [173] + showFailure _ node_356 = + "expected " + GHC.Base.<> ( "if_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_356 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_356) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_357 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_358 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_359 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_360 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_357 + c1_358 = TreeSitter.Node.nodeStartPoint node_356 + TreeSitter.Node.TSPoint + r2_359 + c2_360 = TreeSitter.Node.nodeEndPoint node_356 + +deriving instance GHC.Classes.Eq a_361 => GHC.Classes.Eq (IfModifier a_361) + +deriving instance GHC.Classes.Ord a_362 => GHC.Classes.Ord (IfModifier a_362) + +deriving instance GHC.Show.Show a_363 => GHC.Show.Show (IfModifier a_363) + +instance AST.Unmarshal.Unmarshal IfModifier + +instance Data.Foldable.Foldable IfModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IfModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IfModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data In a = In {ann :: a, extraChildren :: (AST.Parse.Err (Arg a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_364. + AST.Traversable1.Class.Traversable1 a_364 + ) + +instance AST.Unmarshal.SymbolMatching In where + matchedSymbols _ = [181] + showFailure _ node_365 = + "expected " + GHC.Base.<> ( "in" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_365 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_365) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_366 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_367 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_368 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_369 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_366 + c1_367 = TreeSitter.Node.nodeStartPoint node_365 + TreeSitter.Node.TSPoint + r2_368 + c2_369 = TreeSitter.Node.nodeEndPoint node_365 + +deriving instance GHC.Classes.Eq a_370 => GHC.Classes.Eq (In a_370) + +deriving instance GHC.Classes.Ord a_371 => GHC.Classes.Ord (In a_371) + +deriving instance GHC.Show.Show a_372 => GHC.Show.Show (In a_372) + +instance AST.Unmarshal.Unmarshal In + +instance Data.Foldable.Foldable In where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor In where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable In where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Interpolation a = Interpolation + { ann :: a, + extraChildren :: (AST.Parse.Err (Statement a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_373. + AST.Traversable1.Class.Traversable1 a_373 + ) + +instance AST.Unmarshal.SymbolMatching Interpolation where + matchedSymbols _ = [240] + showFailure _ node_374 = + "expected " + GHC.Base.<> ( "interpolation" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_374 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_374) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_375 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_376 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_377 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_378 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_375 + c1_376 = TreeSitter.Node.nodeStartPoint node_374 + TreeSitter.Node.TSPoint + r2_377 + c2_378 = TreeSitter.Node.nodeEndPoint node_374 + +deriving instance GHC.Classes.Eq a_379 => GHC.Classes.Eq (Interpolation a_379) + +deriving instance GHC.Classes.Ord a_380 => GHC.Classes.Ord (Interpolation a_380) + +deriving instance GHC.Show.Show a_381 => GHC.Show.Show (Interpolation a_381) + +instance AST.Unmarshal.Unmarshal Interpolation + +instance Data.Foldable.Foldable Interpolation where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Interpolation where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Interpolation where + traverse = AST.Traversable1.Class.traverseDefault1 + +data KeywordParameter a = KeywordParameter + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Arg a))), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_382. + AST.Traversable1.Class.Traversable1 a_382 + ) + +instance AST.Unmarshal.SymbolMatching KeywordParameter where + matchedSymbols _ = [157] + showFailure _ node_383 = + "expected " + GHC.Base.<> ( "keyword_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_383 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_383) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_384 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_385 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_386 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_387 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_384 + c1_385 = TreeSitter.Node.nodeStartPoint node_383 + TreeSitter.Node.TSPoint + r2_386 + c2_387 = TreeSitter.Node.nodeEndPoint node_383 + +deriving instance GHC.Classes.Eq a_388 => GHC.Classes.Eq (KeywordParameter a_388) + +deriving instance GHC.Classes.Ord a_389 => GHC.Classes.Ord (KeywordParameter a_389) + +deriving instance GHC.Show.Show a_390 => GHC.Show.Show (KeywordParameter a_390) + +instance AST.Unmarshal.Unmarshal KeywordParameter + +instance Data.Foldable.Foldable KeywordParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor KeywordParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable KeywordParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Lambda a = Lambda + { ann :: a, + body :: (AST.Parse.Err ((Block GHC.Generics.:+: DoBlock) a)), + parameters :: (GHC.Maybe.Maybe (AST.Parse.Err (LambdaParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_391. + AST.Traversable1.Class.Traversable1 a_391 + ) + +instance AST.Unmarshal.SymbolMatching Lambda where + matchedSymbols _ = [252] + showFailure _ node_392 = + "expected " + GHC.Base.<> ( "lambda" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_392 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_392) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_393 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_394 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_395 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_396 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_393 + c1_394 = TreeSitter.Node.nodeStartPoint node_392 + TreeSitter.Node.TSPoint + r2_395 + c2_396 = TreeSitter.Node.nodeEndPoint node_392 + +deriving instance GHC.Classes.Eq a_397 => GHC.Classes.Eq (Lambda a_397) + +deriving instance GHC.Classes.Ord a_398 => GHC.Classes.Ord (Lambda a_398) + +deriving instance GHC.Show.Show a_399 => GHC.Show.Show (Lambda a_399) + +instance AST.Unmarshal.Unmarshal Lambda + +instance Data.Foldable.Foldable Lambda where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Lambda where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Lambda where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LambdaParameters a = LambdaParameters + { ann :: a, + extraChildren :: ([AST.Parse.Err ((BlockParameter GHC.Generics.:+: DestructuredParameter GHC.Generics.:+: HashSplatParameter GHC.Generics.:+: Identifier GHC.Generics.:+: KeywordParameter GHC.Generics.:+: OptionalParameter GHC.Generics.:+: SplatParameter) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_400. + AST.Traversable1.Class.Traversable1 a_400 + ) + +instance AST.Unmarshal.SymbolMatching LambdaParameters where + matchedSymbols _ = [276] + showFailure _ node_401 = + "expected " + GHC.Base.<> ( "lambda_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_401 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_401) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_402 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_403 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_404 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_405 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_402 + c1_403 = TreeSitter.Node.nodeStartPoint node_401 + TreeSitter.Node.TSPoint + r2_404 + c2_405 = TreeSitter.Node.nodeEndPoint node_401 + +deriving instance GHC.Classes.Eq a_406 => GHC.Classes.Eq (LambdaParameters a_406) + +deriving instance GHC.Classes.Ord a_407 => GHC.Classes.Ord (LambdaParameters a_407) + +deriving instance GHC.Show.Show a_408 => GHC.Show.Show (LambdaParameters a_408) + +instance AST.Unmarshal.Unmarshal LambdaParameters + +instance Data.Foldable.Foldable LambdaParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LambdaParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LambdaParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LeftAssignmentList a = LeftAssignmentList + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Lhs GHC.Generics.:+: DestructuredLeftAssignment GHC.Generics.:+: RestAssignment) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_409. + AST.Traversable1.Class.Traversable1 a_409 + ) + +instance AST.Unmarshal.SymbolMatching LeftAssignmentList where + matchedSymbols _ = [227] + showFailure _ node_410 = + "expected " + GHC.Base.<> ( "left_assignment_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_410 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_410) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_411 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_412 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_413 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_414 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_411 + c1_412 = TreeSitter.Node.nodeStartPoint node_410 + TreeSitter.Node.TSPoint + r2_413 + c2_414 = TreeSitter.Node.nodeEndPoint node_410 + +deriving instance GHC.Classes.Eq a_415 => GHC.Classes.Eq (LeftAssignmentList a_415) + +deriving instance GHC.Classes.Ord a_416 => GHC.Classes.Ord (LeftAssignmentList a_416) + +deriving instance GHC.Show.Show a_417 => GHC.Show.Show (LeftAssignmentList a_417) + +instance AST.Unmarshal.Unmarshal LeftAssignmentList + +instance Data.Foldable.Foldable LeftAssignmentList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LeftAssignmentList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LeftAssignmentList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Method a = Method + { ann :: a, + name :: (AST.Parse.Err (MethodName a)), + parameters :: (GHC.Maybe.Maybe (AST.Parse.Err (MethodParameters a))), + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: Else GHC.Generics.:+: EmptyStatement GHC.Generics.:+: Ensure GHC.Generics.:+: Rescue) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_418. + AST.Traversable1.Class.Traversable1 a_418 + ) + +instance AST.Unmarshal.SymbolMatching Method where + matchedSymbols _ = [146] + showFailure _ node_419 = + "expected " + GHC.Base.<> ( "method" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_419 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_419) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_420 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_421 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_422 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_423 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_420 + c1_421 = TreeSitter.Node.nodeStartPoint node_419 + TreeSitter.Node.TSPoint + r2_422 + c2_423 = TreeSitter.Node.nodeEndPoint node_419 + +deriving instance GHC.Classes.Eq a_424 => GHC.Classes.Eq (Method a_424) + +deriving instance GHC.Classes.Ord a_425 => GHC.Classes.Ord (Method a_425) + +deriving instance GHC.Show.Show a_426 => GHC.Show.Show (Method a_426) + +instance AST.Unmarshal.Unmarshal Method + +instance Data.Foldable.Foldable Method where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Method where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Method where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodCall a = MethodCall + { ann :: a, + arguments :: (GHC.Maybe.Maybe (AST.Parse.Err (ArgumentList a))), + block :: (GHC.Maybe.Maybe (AST.Parse.Err ((Block GHC.Generics.:+: DoBlock) a))), + method :: (AST.Parse.Err ((Variable GHC.Generics.:+: Call GHC.Generics.:+: ScopeResolution) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_427. + AST.Traversable1.Class.Traversable1 a_427 + ) + +instance AST.Unmarshal.SymbolMatching MethodCall where + matchedSymbols _ = [204, 205] + showFailure _ node_428 = + "expected " + GHC.Base.<> ( "method_call, method_call" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_428 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_428) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_429 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_430 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_431 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_432 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_429 + c1_430 = TreeSitter.Node.nodeStartPoint node_428 + TreeSitter.Node.TSPoint + r2_431 + c2_432 = TreeSitter.Node.nodeEndPoint node_428 + +deriving instance GHC.Classes.Eq a_433 => GHC.Classes.Eq (MethodCall a_433) + +deriving instance GHC.Classes.Ord a_434 => GHC.Classes.Ord (MethodCall a_434) + +deriving instance GHC.Show.Show a_435 => GHC.Show.Show (MethodCall a_435) + +instance AST.Unmarshal.Unmarshal MethodCall + +instance Data.Foldable.Foldable MethodCall where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodCall where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodCall where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodParameters a = MethodParameters + { ann :: a, + extraChildren :: ([AST.Parse.Err ((BlockParameter GHC.Generics.:+: DestructuredParameter GHC.Generics.:+: HashSplatParameter GHC.Generics.:+: Identifier GHC.Generics.:+: KeywordParameter GHC.Generics.:+: OptionalParameter GHC.Generics.:+: SplatParameter) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_436. + AST.Traversable1.Class.Traversable1 a_436 + ) + +instance AST.Unmarshal.SymbolMatching MethodParameters where + matchedSymbols _ = [277] + showFailure _ node_437 = + "expected " + GHC.Base.<> ( "method_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_437 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_437) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_438 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_439 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_440 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_441 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_438 + c1_439 = TreeSitter.Node.nodeStartPoint node_437 + TreeSitter.Node.TSPoint + r2_440 + c2_441 = TreeSitter.Node.nodeEndPoint node_437 + +deriving instance GHC.Classes.Eq a_442 => GHC.Classes.Eq (MethodParameters a_442) + +deriving instance GHC.Classes.Ord a_443 => GHC.Classes.Ord (MethodParameters a_443) + +deriving instance GHC.Show.Show a_444 => GHC.Show.Show (MethodParameters a_444) + +instance AST.Unmarshal.Unmarshal MethodParameters + +instance Data.Foldable.Foldable MethodParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Module a = Module + { ann :: a, + name :: (AST.Parse.Err ((Constant GHC.Generics.:+: ScopeResolution) a)), + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: Else GHC.Generics.:+: EmptyStatement GHC.Generics.:+: Ensure GHC.Generics.:+: Rescue) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_445. + AST.Traversable1.Class.Traversable1 a_445 + ) + +instance AST.Unmarshal.SymbolMatching Module where + matchedSymbols _ = [162] + showFailure _ node_446 = + "expected " + GHC.Base.<> ( "module" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_446 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_446) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_447 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_448 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_449 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_450 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_447 + c1_448 = TreeSitter.Node.nodeStartPoint node_446 + TreeSitter.Node.TSPoint + r2_449 + c2_450 = TreeSitter.Node.nodeEndPoint node_446 + +deriving instance GHC.Classes.Eq a_451 => GHC.Classes.Eq (Module a_451) + +deriving instance GHC.Classes.Ord a_452 => GHC.Classes.Ord (Module a_452) + +deriving instance GHC.Show.Show a_453 => GHC.Show.Show (Module a_453) + +instance AST.Unmarshal.Unmarshal Module + +instance Data.Foldable.Foldable Module where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Module where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Module where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Next a = Next + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ArgumentList a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_454. + AST.Traversable1.Class.Traversable1 a_454 + ) + +instance AST.Unmarshal.SymbolMatching Next where + matchedSymbols _ = [166, 170] + showFailure _ node_455 = + "expected " + GHC.Base.<> ( "next, next" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_455 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_455) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_456 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_457 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_458 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_459 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_456 + c1_457 = TreeSitter.Node.nodeStartPoint node_455 + TreeSitter.Node.TSPoint + r2_458 + c2_459 = TreeSitter.Node.nodeEndPoint node_455 + +deriving instance GHC.Classes.Eq a_460 => GHC.Classes.Eq (Next a_460) + +deriving instance GHC.Classes.Ord a_461 => GHC.Classes.Ord (Next a_461) + +deriving instance GHC.Show.Show a_462 => GHC.Show.Show (Next a_462) + +instance AST.Unmarshal.Unmarshal Next + +instance Data.Foldable.Foldable Next where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Next where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Next where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Operator a = Operator {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_463. + AST.Traversable1.Class.Traversable1 a_463 + ) + +instance AST.Unmarshal.SymbolMatching Operator where + matchedSymbols _ = [233] + showFailure _ node_464 = + "expected " + GHC.Base.<> ( "operator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_464 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_464) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_465 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_466 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_467 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_468 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_465 + c1_466 = TreeSitter.Node.nodeStartPoint node_464 + TreeSitter.Node.TSPoint + r2_467 + c2_468 = TreeSitter.Node.nodeEndPoint node_464 + +deriving instance GHC.Classes.Eq a_469 => GHC.Classes.Eq (Operator a_469) + +deriving instance GHC.Classes.Ord a_470 => GHC.Classes.Ord (Operator a_470) + +deriving instance GHC.Show.Show a_471 => GHC.Show.Show (Operator a_471) + +instance AST.Unmarshal.Unmarshal Operator + +instance Data.Foldable.Foldable Operator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Operator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Operator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data OperatorAssignment a = OperatorAssignment + { ann :: a, + left :: (AST.Parse.Err (Lhs a)), + right :: (AST.Parse.Err ((Arg GHC.Generics.:+: Break GHC.Generics.:+: MethodCall GHC.Generics.:+: Next GHC.Generics.:+: Return GHC.Generics.:+: Yield) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_472. + AST.Traversable1.Class.Traversable1 a_472 + ) + +instance AST.Unmarshal.SymbolMatching OperatorAssignment where + matchedSymbols _ = [217, 218] + showFailure _ node_473 = + "expected " + GHC.Base.<> ( "operator_assignment, operator_assignment" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_473 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_473) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_474 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_475 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_476 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_477 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_474 + c1_475 = TreeSitter.Node.nodeStartPoint node_473 + TreeSitter.Node.TSPoint + r2_476 + c2_477 = TreeSitter.Node.nodeEndPoint node_473 + +deriving instance GHC.Classes.Eq a_478 => GHC.Classes.Eq (OperatorAssignment a_478) + +deriving instance GHC.Classes.Ord a_479 => GHC.Classes.Ord (OperatorAssignment a_479) + +deriving instance GHC.Show.Show a_480 => GHC.Show.Show (OperatorAssignment a_480) + +instance AST.Unmarshal.Unmarshal OperatorAssignment + +instance Data.Foldable.Foldable OperatorAssignment where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor OperatorAssignment where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable OperatorAssignment where + traverse = AST.Traversable1.Class.traverseDefault1 + +data OptionalParameter a = OptionalParameter + { ann :: a, + value :: (AST.Parse.Err (Arg a)), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_481. + AST.Traversable1.Class.Traversable1 a_481 + ) + +instance AST.Unmarshal.SymbolMatching OptionalParameter where + matchedSymbols _ = [158] + showFailure _ node_482 = + "expected " + GHC.Base.<> ( "optional_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_482 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_482) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_483 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_484 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_485 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_486 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_483 + c1_484 = TreeSitter.Node.nodeStartPoint node_482 + TreeSitter.Node.TSPoint + r2_485 + c2_486 = TreeSitter.Node.nodeEndPoint node_482 + +deriving instance GHC.Classes.Eq a_487 => GHC.Classes.Eq (OptionalParameter a_487) + +deriving instance GHC.Classes.Ord a_488 => GHC.Classes.Ord (OptionalParameter a_488) + +deriving instance GHC.Show.Show a_489 => GHC.Show.Show (OptionalParameter a_489) + +instance AST.Unmarshal.Unmarshal OptionalParameter + +instance Data.Foldable.Foldable OptionalParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor OptionalParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable OptionalParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Pair a = Pair + { ann :: a, + value :: (AST.Parse.Err (Arg a)), + key :: (AST.Parse.Err ((Arg GHC.Generics.:+: String GHC.Generics.:+: Symbol) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_490. + AST.Traversable1.Class.Traversable1 a_490 + ) + +instance AST.Unmarshal.SymbolMatching Pair where + matchedSymbols _ = [251] + showFailure _ node_491 = + "expected " + GHC.Base.<> ( "pair" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_491 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_491) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_492 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_493 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_494 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_495 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_492 + c1_493 = TreeSitter.Node.nodeStartPoint node_491 + TreeSitter.Node.TSPoint + r2_494 + c2_495 = TreeSitter.Node.nodeEndPoint node_491 + +deriving instance GHC.Classes.Eq a_496 => GHC.Classes.Eq (Pair a_496) + +deriving instance GHC.Classes.Ord a_497 => GHC.Classes.Ord (Pair a_497) + +deriving instance GHC.Show.Show a_498 => GHC.Show.Show (Pair a_498) + +instance AST.Unmarshal.Unmarshal Pair + +instance Data.Foldable.Foldable Pair where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Pair where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Pair where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParenthesizedStatements a = ParenthesizedStatements + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: EmptyStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_499. + AST.Traversable1.Class.Traversable1 a_499 + ) + +instance AST.Unmarshal.SymbolMatching ParenthesizedStatements where + matchedSymbols _ = [200] + showFailure _ node_500 = + "expected " + GHC.Base.<> ( "parenthesized_statements" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_500 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_500) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_501 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_502 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_503 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_504 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_501 + c1_502 = TreeSitter.Node.nodeStartPoint node_500 + TreeSitter.Node.TSPoint + r2_503 + c2_504 = TreeSitter.Node.nodeEndPoint node_500 + +deriving instance GHC.Classes.Eq a_505 => GHC.Classes.Eq (ParenthesizedStatements a_505) + +deriving instance GHC.Classes.Ord a_506 => GHC.Classes.Ord (ParenthesizedStatements a_506) + +deriving instance GHC.Show.Show a_507 => GHC.Show.Show (ParenthesizedStatements a_507) + +instance AST.Unmarshal.Unmarshal ParenthesizedStatements + +instance Data.Foldable.Foldable ParenthesizedStatements where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParenthesizedStatements where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParenthesizedStatements where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Pattern a = Pattern + { ann :: a, + extraChildren :: (AST.Parse.Err ((Arg GHC.Generics.:+: SplatArgument) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_508. + AST.Traversable1.Class.Traversable1 a_508 + ) + +instance AST.Unmarshal.SymbolMatching Pattern where + matchedSymbols _ = [185] + showFailure _ node_509 = + "expected " + GHC.Base.<> ( "pattern" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_509 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_509) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_510 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_511 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_512 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_513 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_510 + c1_511 = TreeSitter.Node.nodeStartPoint node_509 + TreeSitter.Node.TSPoint + r2_512 + c2_513 = TreeSitter.Node.nodeEndPoint node_509 + +deriving instance GHC.Classes.Eq a_514 => GHC.Classes.Eq (Pattern a_514) + +deriving instance GHC.Classes.Ord a_515 => GHC.Classes.Ord (Pattern a_515) + +deriving instance GHC.Show.Show a_516 => GHC.Show.Show (Pattern a_516) + +instance AST.Unmarshal.Unmarshal Pattern + +instance Data.Foldable.Foldable Pattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Pattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Pattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Program a = Program + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: EmptyStatement GHC.Generics.:+: Uninterpreted) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_517. + AST.Traversable1.Class.Traversable1 a_517 + ) + +instance AST.Unmarshal.SymbolMatching Program where + matchedSymbols _ = [141] + showFailure _ node_518 = + "expected " + GHC.Base.<> ( "program" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_518 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_518) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_519 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_520 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_521 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_522 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_519 + c1_520 = TreeSitter.Node.nodeStartPoint node_518 + TreeSitter.Node.TSPoint + r2_521 + c2_522 = TreeSitter.Node.nodeEndPoint node_518 + +deriving instance GHC.Classes.Eq a_523 => GHC.Classes.Eq (Program a_523) + +deriving instance GHC.Classes.Ord a_524 => GHC.Classes.Ord (Program a_524) + +deriving instance GHC.Show.Show a_525 => GHC.Show.Show (Program a_525) + +instance AST.Unmarshal.Unmarshal Program + +instance Data.Foldable.Foldable Program where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Program where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Program where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Range a = Range + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Arg a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_526. + AST.Traversable1.Class.Traversable1 a_526 + ) + +instance AST.Unmarshal.SymbolMatching Range where + matchedSymbols _ = [220] + showFailure _ node_527 = + "expected " + GHC.Base.<> ( "range" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_527 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_527) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_528 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_529 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_530 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_531 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_528 + c1_529 = TreeSitter.Node.nodeStartPoint node_527 + TreeSitter.Node.TSPoint + r2_530 + c2_531 = TreeSitter.Node.nodeEndPoint node_527 + +deriving instance GHC.Classes.Eq a_532 => GHC.Classes.Eq (Range a_532) + +deriving instance GHC.Classes.Ord a_533 => GHC.Classes.Ord (Range a_533) + +deriving instance GHC.Show.Show a_534 => GHC.Show.Show (Range a_534) + +instance AST.Unmarshal.Unmarshal Range + +instance Data.Foldable.Foldable Range where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Range where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Range where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Rational a = Rational {ann :: a, extraChildren :: (AST.Parse.Err (Integer a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_535. + AST.Traversable1.Class.Traversable1 a_535 + ) + +instance AST.Unmarshal.SymbolMatching Rational where + matchedSymbols _ = [238] + showFailure _ node_536 = + "expected " + GHC.Base.<> ( "rational" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_536 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_536) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_537 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_538 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_539 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_540 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_537 + c1_538 = TreeSitter.Node.nodeStartPoint node_536 + TreeSitter.Node.TSPoint + r2_539 + c2_540 = TreeSitter.Node.nodeEndPoint node_536 + +deriving instance GHC.Classes.Eq a_541 => GHC.Classes.Eq (Rational a_541) + +deriving instance GHC.Classes.Ord a_542 => GHC.Classes.Ord (Rational a_542) + +deriving instance GHC.Show.Show a_543 => GHC.Show.Show (Rational a_543) + +instance AST.Unmarshal.Unmarshal Rational + +instance Data.Foldable.Foldable Rational where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Rational where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Rational where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Redo a = Redo + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ArgumentList a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_544. + AST.Traversable1.Class.Traversable1 a_544 + ) + +instance AST.Unmarshal.SymbolMatching Redo where + matchedSymbols _ = [171] + showFailure _ node_545 = + "expected " + GHC.Base.<> ( "redo" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_545 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_545) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_546 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_547 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_548 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_549 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_546 + c1_547 = TreeSitter.Node.nodeStartPoint node_545 + TreeSitter.Node.TSPoint + r2_548 + c2_549 = TreeSitter.Node.nodeEndPoint node_545 + +deriving instance GHC.Classes.Eq a_550 => GHC.Classes.Eq (Redo a_550) + +deriving instance GHC.Classes.Ord a_551 => GHC.Classes.Ord (Redo a_551) + +deriving instance GHC.Show.Show a_552 => GHC.Show.Show (Redo a_552) + +instance AST.Unmarshal.Unmarshal Redo + +instance Data.Foldable.Foldable Redo where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Redo where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Redo where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Regex a = Regex + { ann :: a, + extraChildren :: ([AST.Parse.Err ((EscapeSequence GHC.Generics.:+: Interpolation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_553. + AST.Traversable1.Class.Traversable1 a_553 + ) + +instance AST.Unmarshal.SymbolMatching Regex where + matchedSymbols _ = [246] + showFailure _ node_554 = + "expected " + GHC.Base.<> ( "regex" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_554 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_554) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_555 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_556 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_557 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_558 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_555 + c1_556 = TreeSitter.Node.nodeStartPoint node_554 + TreeSitter.Node.TSPoint + r2_557 + c2_558 = TreeSitter.Node.nodeEndPoint node_554 + +deriving instance GHC.Classes.Eq a_559 => GHC.Classes.Eq (Regex a_559) + +deriving instance GHC.Classes.Ord a_560 => GHC.Classes.Ord (Regex a_560) + +deriving instance GHC.Show.Show a_561 => GHC.Show.Show (Regex a_561) + +instance AST.Unmarshal.Unmarshal Regex + +instance Data.Foldable.Foldable Regex where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Regex where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Regex where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Rescue a = Rescue + { ann :: a, + exceptions :: (GHC.Maybe.Maybe (AST.Parse.Err (Exceptions a))), + body :: (GHC.Maybe.Maybe (AST.Parse.Err (Then a))), + variable :: (GHC.Maybe.Maybe (AST.Parse.Err (ExceptionVariable a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_562. + AST.Traversable1.Class.Traversable1 a_562 + ) + +instance AST.Unmarshal.SymbolMatching Rescue where + matchedSymbols _ = [193] + showFailure _ node_563 = + "expected " + GHC.Base.<> ( "rescue" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_563 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_563) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_564 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_565 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_566 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_567 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_564 + c1_565 = TreeSitter.Node.nodeStartPoint node_563 + TreeSitter.Node.TSPoint + r2_566 + c2_567 = TreeSitter.Node.nodeEndPoint node_563 + +deriving instance GHC.Classes.Eq a_568 => GHC.Classes.Eq (Rescue a_568) + +deriving instance GHC.Classes.Ord a_569 => GHC.Classes.Ord (Rescue a_569) + +deriving instance GHC.Show.Show a_570 => GHC.Show.Show (Rescue a_570) + +instance AST.Unmarshal.Unmarshal Rescue + +instance Data.Foldable.Foldable Rescue where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Rescue where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Rescue where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RescueModifier a = RescueModifier + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + handler :: (AST.Parse.Err ((Arg GHC.Generics.:+: Break GHC.Generics.:+: MethodCall GHC.Generics.:+: Next GHC.Generics.:+: Return GHC.Generics.:+: Yield) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_571. + AST.Traversable1.Class.Traversable1 a_571 + ) + +instance AST.Unmarshal.SymbolMatching RescueModifier where + matchedSymbols _ = [177] + showFailure _ node_572 = + "expected " + GHC.Base.<> ( "rescue_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_572 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_572) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_573 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_574 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_575 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_576 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_573 + c1_574 = TreeSitter.Node.nodeStartPoint node_572 + TreeSitter.Node.TSPoint + r2_575 + c2_576 = TreeSitter.Node.nodeEndPoint node_572 + +deriving instance GHC.Classes.Eq a_577 => GHC.Classes.Eq (RescueModifier a_577) + +deriving instance GHC.Classes.Ord a_578 => GHC.Classes.Ord (RescueModifier a_578) + +deriving instance GHC.Show.Show a_579 => GHC.Show.Show (RescueModifier a_579) + +instance AST.Unmarshal.Unmarshal RescueModifier + +instance Data.Foldable.Foldable RescueModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RescueModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RescueModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RestAssignment a = RestAssignment + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Lhs a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_580. + AST.Traversable1.Class.Traversable1 a_580 + ) + +instance AST.Unmarshal.SymbolMatching RestAssignment where + matchedSymbols _ = [230] + showFailure _ node_581 = + "expected " + GHC.Base.<> ( "rest_assignment" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_581 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_581) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_582 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_583 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_584 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_585 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_582 + c1_583 = TreeSitter.Node.nodeStartPoint node_581 + TreeSitter.Node.TSPoint + r2_584 + c2_585 = TreeSitter.Node.nodeEndPoint node_581 + +deriving instance GHC.Classes.Eq a_586 => GHC.Classes.Eq (RestAssignment a_586) + +deriving instance GHC.Classes.Ord a_587 => GHC.Classes.Ord (RestAssignment a_587) + +deriving instance GHC.Show.Show a_588 => GHC.Show.Show (RestAssignment a_588) + +instance AST.Unmarshal.Unmarshal RestAssignment + +instance Data.Foldable.Foldable RestAssignment where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RestAssignment where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RestAssignment where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Retry a = Retry + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ArgumentList a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_589. + AST.Traversable1.Class.Traversable1 a_589 + ) + +instance AST.Unmarshal.SymbolMatching Retry where + matchedSymbols _ = [172] + showFailure _ node_590 = + "expected " + GHC.Base.<> ( "retry" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_590 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_590) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_591 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_592 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_593 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_594 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_591 + c1_592 = TreeSitter.Node.nodeStartPoint node_590 + TreeSitter.Node.TSPoint + r2_593 + c2_594 = TreeSitter.Node.nodeEndPoint node_590 + +deriving instance GHC.Classes.Eq a_595 => GHC.Classes.Eq (Retry a_595) + +deriving instance GHC.Classes.Ord a_596 => GHC.Classes.Ord (Retry a_596) + +deriving instance GHC.Show.Show a_597 => GHC.Show.Show (Retry a_597) + +instance AST.Unmarshal.Unmarshal Retry + +instance Data.Foldable.Foldable Retry where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Retry where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Retry where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Return a = Return + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ArgumentList a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_598. + AST.Traversable1.Class.Traversable1 a_598 + ) + +instance AST.Unmarshal.SymbolMatching Return where + matchedSymbols _ = [163, 167] + showFailure _ node_599 = + "expected " + GHC.Base.<> ( "return, return" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_599 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_599) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_600 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_601 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_602 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_603 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_600 + c1_601 = TreeSitter.Node.nodeStartPoint node_599 + TreeSitter.Node.TSPoint + r2_602 + c2_603 = TreeSitter.Node.nodeEndPoint node_599 + +deriving instance GHC.Classes.Eq a_604 => GHC.Classes.Eq (Return a_604) + +deriving instance GHC.Classes.Ord a_605 => GHC.Classes.Ord (Return a_605) + +deriving instance GHC.Show.Show a_606 => GHC.Show.Show (Return a_606) + +instance AST.Unmarshal.Unmarshal Return + +instance Data.Foldable.Foldable Return where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Return where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Return where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RightAssignmentList a = RightAssignmentList + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Arg GHC.Generics.:+: SplatArgument) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_607. + AST.Traversable1.Class.Traversable1 a_607 + ) + +instance AST.Unmarshal.SymbolMatching RightAssignmentList where + matchedSymbols _ = [226] + showFailure _ node_608 = + "expected " + GHC.Base.<> ( "right_assignment_list" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_608 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_608) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_609 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_610 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_611 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_612 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_609 + c1_610 = TreeSitter.Node.nodeStartPoint node_608 + TreeSitter.Node.TSPoint + r2_611 + c2_612 = TreeSitter.Node.nodeEndPoint node_608 + +deriving instance GHC.Classes.Eq a_613 => GHC.Classes.Eq (RightAssignmentList a_613) + +deriving instance GHC.Classes.Ord a_614 => GHC.Classes.Ord (RightAssignmentList a_614) + +deriving instance GHC.Show.Show a_615 => GHC.Show.Show (RightAssignmentList a_615) + +instance AST.Unmarshal.Unmarshal RightAssignmentList + +instance Data.Foldable.Foldable RightAssignmentList where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RightAssignmentList where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RightAssignmentList where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ScopeResolution a = ScopeResolution + { ann :: a, + name :: (AST.Parse.Err ((Constant GHC.Generics.:+: Identifier) a)), + scope :: (GHC.Maybe.Maybe (AST.Parse.Err (Primary a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_616. + AST.Traversable1.Class.Traversable1 a_616 + ) + +instance AST.Unmarshal.SymbolMatching ScopeResolution where + matchedSymbols _ = [202] + showFailure _ node_617 = + "expected " + GHC.Base.<> ( "scope_resolution" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_617 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_617) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_618 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_619 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_620 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_621 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_618 + c1_619 = TreeSitter.Node.nodeStartPoint node_617 + TreeSitter.Node.TSPoint + r2_620 + c2_621 = TreeSitter.Node.nodeEndPoint node_617 + +deriving instance GHC.Classes.Eq a_622 => GHC.Classes.Eq (ScopeResolution a_622) + +deriving instance GHC.Classes.Ord a_623 => GHC.Classes.Ord (ScopeResolution a_623) + +deriving instance GHC.Show.Show a_624 => GHC.Show.Show (ScopeResolution a_624) + +instance AST.Unmarshal.Unmarshal ScopeResolution + +instance Data.Foldable.Foldable ScopeResolution where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ScopeResolution where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ScopeResolution where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Setter a = Setter + { ann :: a, + extraChildren :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_625. + AST.Traversable1.Class.Traversable1 a_625 + ) + +instance AST.Unmarshal.SymbolMatching Setter where + matchedSymbols _ = [235] + showFailure _ node_626 = + "expected " + GHC.Base.<> ( "setter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_626 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_626) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_627 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_628 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_629 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_630 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_627 + c1_628 = TreeSitter.Node.nodeStartPoint node_626 + TreeSitter.Node.TSPoint + r2_629 + c2_630 = TreeSitter.Node.nodeEndPoint node_626 + +deriving instance GHC.Classes.Eq a_631 => GHC.Classes.Eq (Setter a_631) + +deriving instance GHC.Classes.Ord a_632 => GHC.Classes.Ord (Setter a_632) + +deriving instance GHC.Show.Show a_633 => GHC.Show.Show (Setter a_633) + +instance AST.Unmarshal.Unmarshal Setter + +instance Data.Foldable.Foldable Setter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Setter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Setter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SingletonClass a = SingletonClass + { ann :: a, + value :: (AST.Parse.Err (Arg a)), + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: Else GHC.Generics.:+: EmptyStatement GHC.Generics.:+: Ensure GHC.Generics.:+: Rescue) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_634. + AST.Traversable1.Class.Traversable1 a_634 + ) + +instance AST.Unmarshal.SymbolMatching SingletonClass where + matchedSymbols _ = [161] + showFailure _ node_635 = + "expected " + GHC.Base.<> ( "singleton_class" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_635 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_635) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_636 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_637 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_638 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_639 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_636 + c1_637 = TreeSitter.Node.nodeStartPoint node_635 + TreeSitter.Node.TSPoint + r2_638 + c2_639 = TreeSitter.Node.nodeEndPoint node_635 + +deriving instance GHC.Classes.Eq a_640 => GHC.Classes.Eq (SingletonClass a_640) + +deriving instance GHC.Classes.Ord a_641 => GHC.Classes.Ord (SingletonClass a_641) + +deriving instance GHC.Show.Show a_642 => GHC.Show.Show (SingletonClass a_642) + +instance AST.Unmarshal.Unmarshal SingletonClass + +instance Data.Foldable.Foldable SingletonClass where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SingletonClass where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SingletonClass where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SingletonMethod a = SingletonMethod + { ann :: a, + name :: (AST.Parse.Err (MethodName a)), + parameters :: (GHC.Maybe.Maybe (AST.Parse.Err (MethodParameters a))), + object :: (AST.Parse.Err ((Arg GHC.Generics.:+: Variable) a)), + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: Else GHC.Generics.:+: EmptyStatement GHC.Generics.:+: Ensure GHC.Generics.:+: Rescue) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_643. + AST.Traversable1.Class.Traversable1 a_643 + ) + +instance AST.Unmarshal.SymbolMatching SingletonMethod where + matchedSymbols _ = [147] + showFailure _ node_644 = + "expected " + GHC.Base.<> ( "singleton_method" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_644 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_644) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_645 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_646 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_647 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_648 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_645 + c1_646 = TreeSitter.Node.nodeStartPoint node_644 + TreeSitter.Node.TSPoint + r2_647 + c2_648 = TreeSitter.Node.nodeEndPoint node_644 + +deriving instance GHC.Classes.Eq a_649 => GHC.Classes.Eq (SingletonMethod a_649) + +deriving instance GHC.Classes.Ord a_650 => GHC.Classes.Ord (SingletonMethod a_650) + +deriving instance GHC.Show.Show a_651 => GHC.Show.Show (SingletonMethod a_651) + +instance AST.Unmarshal.Unmarshal SingletonMethod + +instance Data.Foldable.Foldable SingletonMethod where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SingletonMethod where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SingletonMethod where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SplatArgument a = SplatArgument + { ann :: a, + extraChildren :: (AST.Parse.Err (Arg a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_652. + AST.Traversable1.Class.Traversable1 a_652 + ) + +instance AST.Unmarshal.SymbolMatching SplatArgument where + matchedSymbols _ = [210] + showFailure _ node_653 = + "expected " + GHC.Base.<> ( "splat_argument" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_653 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_653) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_654 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_655 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_656 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_657 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_654 + c1_655 = TreeSitter.Node.nodeStartPoint node_653 + TreeSitter.Node.TSPoint + r2_656 + c2_657 = TreeSitter.Node.nodeEndPoint node_653 + +deriving instance GHC.Classes.Eq a_658 => GHC.Classes.Eq (SplatArgument a_658) + +deriving instance GHC.Classes.Ord a_659 => GHC.Classes.Ord (SplatArgument a_659) + +deriving instance GHC.Show.Show a_660 => GHC.Show.Show (SplatArgument a_660) + +instance AST.Unmarshal.Unmarshal SplatArgument + +instance Data.Foldable.Foldable SplatArgument where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SplatArgument where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SplatArgument where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SplatParameter a = SplatParameter + { ann :: a, + name :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_661. + AST.Traversable1.Class.Traversable1 a_661 + ) + +instance AST.Unmarshal.SymbolMatching SplatParameter where + matchedSymbols _ = [154] + showFailure _ node_662 = + "expected " + GHC.Base.<> ( "splat_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_662 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_662) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_663 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_664 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_665 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_666 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_663 + c1_664 = TreeSitter.Node.nodeStartPoint node_662 + TreeSitter.Node.TSPoint + r2_665 + c2_666 = TreeSitter.Node.nodeEndPoint node_662 + +deriving instance GHC.Classes.Eq a_667 => GHC.Classes.Eq (SplatParameter a_667) + +deriving instance GHC.Classes.Ord a_668 => GHC.Classes.Ord (SplatParameter a_668) + +deriving instance GHC.Show.Show a_669 => GHC.Show.Show (SplatParameter a_669) + +instance AST.Unmarshal.Unmarshal SplatParameter + +instance Data.Foldable.Foldable SplatParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SplatParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SplatParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data String a = String + { ann :: a, + extraChildren :: ([AST.Parse.Err ((EscapeSequence GHC.Generics.:+: Interpolation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_670. + AST.Traversable1.Class.Traversable1 a_670 + ) + +instance AST.Unmarshal.SymbolMatching String where + matchedSymbols _ = [241] + showFailure _ node_671 = + "expected " + GHC.Base.<> ( "string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_671 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_671) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_672 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_673 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_674 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_675 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_672 + c1_673 = TreeSitter.Node.nodeStartPoint node_671 + TreeSitter.Node.TSPoint + r2_674 + c2_675 = TreeSitter.Node.nodeEndPoint node_671 + +deriving instance GHC.Classes.Eq a_676 => GHC.Classes.Eq (String a_676) + +deriving instance GHC.Classes.Ord a_677 => GHC.Classes.Ord (String a_677) + +deriving instance GHC.Show.Show a_678 => GHC.Show.Show (String a_678) + +instance AST.Unmarshal.Unmarshal String + +instance Data.Foldable.Foldable String where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor String where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable String where + traverse = AST.Traversable1.Class.traverseDefault1 + +data StringArray a = StringArray + { ann :: a, + extraChildren :: ([AST.Parse.Err (BareString a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_679. + AST.Traversable1.Class.Traversable1 a_679 + ) + +instance AST.Unmarshal.SymbolMatching StringArray where + matchedSymbols _ = [243] + showFailure _ node_680 = + "expected " + GHC.Base.<> ( "string_array" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_680 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_680) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_681 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_682 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_683 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_684 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_681 + c1_682 = TreeSitter.Node.nodeStartPoint node_680 + TreeSitter.Node.TSPoint + r2_683 + c2_684 = TreeSitter.Node.nodeEndPoint node_680 + +deriving instance GHC.Classes.Eq a_685 => GHC.Classes.Eq (StringArray a_685) + +deriving instance GHC.Classes.Ord a_686 => GHC.Classes.Ord (StringArray a_686) + +deriving instance GHC.Show.Show a_687 => GHC.Show.Show (StringArray a_687) + +instance AST.Unmarshal.Unmarshal StringArray + +instance Data.Foldable.Foldable StringArray where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StringArray where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StringArray where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Subshell a = Subshell + { ann :: a, + extraChildren :: ([AST.Parse.Err ((EscapeSequence GHC.Generics.:+: Interpolation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_688. + AST.Traversable1.Class.Traversable1 a_688 + ) + +instance AST.Unmarshal.SymbolMatching Subshell where + matchedSymbols _ = [242] + showFailure _ node_689 = + "expected " + GHC.Base.<> ( "subshell" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_689 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_689) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_690 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_691 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_692 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_693 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_690 + c1_691 = TreeSitter.Node.nodeStartPoint node_689 + TreeSitter.Node.TSPoint + r2_692 + c2_693 = TreeSitter.Node.nodeEndPoint node_689 + +deriving instance GHC.Classes.Eq a_694 => GHC.Classes.Eq (Subshell a_694) + +deriving instance GHC.Classes.Ord a_695 => GHC.Classes.Ord (Subshell a_695) + +deriving instance GHC.Show.Show a_696 => GHC.Show.Show (Subshell a_696) + +instance AST.Unmarshal.Unmarshal Subshell + +instance Data.Foldable.Foldable Subshell where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Subshell where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Subshell where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Superclass a = Superclass {ann :: a, extraChildren :: (AST.Parse.Err (Arg a))} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_697. + AST.Traversable1.Class.Traversable1 a_697 + ) + +instance AST.Unmarshal.SymbolMatching Superclass where + matchedSymbols _ = [160] + showFailure _ node_698 = + "expected " + GHC.Base.<> ( "superclass" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_698 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_698) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_699 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_700 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_701 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_702 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_699 + c1_700 = TreeSitter.Node.nodeStartPoint node_698 + TreeSitter.Node.TSPoint + r2_701 + c2_702 = TreeSitter.Node.nodeEndPoint node_698 + +deriving instance GHC.Classes.Eq a_703 => GHC.Classes.Eq (Superclass a_703) + +deriving instance GHC.Classes.Ord a_704 => GHC.Classes.Ord (Superclass a_704) + +deriving instance GHC.Show.Show a_705 => GHC.Show.Show (Superclass a_705) + +instance AST.Unmarshal.Unmarshal Superclass + +instance Data.Foldable.Foldable Superclass where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Superclass where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Superclass where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Symbol a = Symbol + { ann :: a, + extraChildren :: ([AST.Parse.Err ((EscapeSequence GHC.Generics.:+: Interpolation) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_706. + AST.Traversable1.Class.Traversable1 a_706 + ) + +instance AST.Unmarshal.SymbolMatching Symbol where + matchedSymbols _ = [140, 245] + showFailure _ node_707 = + "expected " + GHC.Base.<> ( "symbol, symbol" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_707 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_707) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_708 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_709 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_710 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_711 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_708 + c1_709 = TreeSitter.Node.nodeStartPoint node_707 + TreeSitter.Node.TSPoint + r2_710 + c2_711 = TreeSitter.Node.nodeEndPoint node_707 + +deriving instance GHC.Classes.Eq a_712 => GHC.Classes.Eq (Symbol a_712) + +deriving instance GHC.Classes.Ord a_713 => GHC.Classes.Ord (Symbol a_713) + +deriving instance GHC.Show.Show a_714 => GHC.Show.Show (Symbol a_714) + +instance AST.Unmarshal.Unmarshal Symbol + +instance Data.Foldable.Foldable Symbol where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Symbol where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Symbol where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SymbolArray a = SymbolArray + { ann :: a, + extraChildren :: ([AST.Parse.Err (BareSymbol a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_715. + AST.Traversable1.Class.Traversable1 a_715 + ) + +instance AST.Unmarshal.SymbolMatching SymbolArray where + matchedSymbols _ = [244] + showFailure _ node_716 = + "expected " + GHC.Base.<> ( "symbol_array" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_716 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_716) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_717 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_718 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_719 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_720 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_717 + c1_718 = TreeSitter.Node.nodeStartPoint node_716 + TreeSitter.Node.TSPoint + r2_719 + c2_720 = TreeSitter.Node.nodeEndPoint node_716 + +deriving instance GHC.Classes.Eq a_721 => GHC.Classes.Eq (SymbolArray a_721) + +deriving instance GHC.Classes.Ord a_722 => GHC.Classes.Ord (SymbolArray a_722) + +deriving instance GHC.Show.Show a_723 => GHC.Show.Show (SymbolArray a_723) + +instance AST.Unmarshal.Unmarshal SymbolArray + +instance Data.Foldable.Foldable SymbolArray where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SymbolArray where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SymbolArray where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Then a = Then + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: EmptyStatement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_724. + AST.Traversable1.Class.Traversable1 a_724 + ) + +instance AST.Unmarshal.SymbolMatching Then where + matchedSymbols _ = [190] + showFailure _ node_725 = + "expected " + GHC.Base.<> ( "then" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_725 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_725) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_726 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_727 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_728 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_729 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_726 + c1_727 = TreeSitter.Node.nodeStartPoint node_725 + TreeSitter.Node.TSPoint + r2_728 + c2_729 = TreeSitter.Node.nodeEndPoint node_725 + +deriving instance GHC.Classes.Eq a_730 => GHC.Classes.Eq (Then a_730) + +deriving instance GHC.Classes.Ord a_731 => GHC.Classes.Ord (Then a_731) + +deriving instance GHC.Show.Show a_732 => GHC.Show.Show (Then a_732) + +instance AST.Unmarshal.Unmarshal Then + +instance Data.Foldable.Foldable Then where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Then where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Then where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Unary a = Unary + { ann :: a, + extraChildren :: (AST.Parse.Err ((Arg GHC.Generics.:+: Float GHC.Generics.:+: Integer GHC.Generics.:+: ParenthesizedStatements) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_733. + AST.Traversable1.Class.Traversable1 a_733 + ) + +instance AST.Unmarshal.SymbolMatching Unary where + matchedSymbols _ = [223, 224, 225] + showFailure _ node_734 = + "expected " + GHC.Base.<> ( "unary, unary, unary" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_734 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_734) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_735 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_736 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_737 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_738 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_735 + c1_736 = TreeSitter.Node.nodeStartPoint node_734 + TreeSitter.Node.TSPoint + r2_737 + c2_738 = TreeSitter.Node.nodeEndPoint node_734 + +deriving instance GHC.Classes.Eq a_739 => GHC.Classes.Eq (Unary a_739) + +deriving instance GHC.Classes.Ord a_740 => GHC.Classes.Ord (Unary a_740) + +deriving instance GHC.Show.Show a_741 => GHC.Show.Show (Unary a_741) + +instance AST.Unmarshal.Unmarshal Unary + +instance Data.Foldable.Foldable Unary where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Unary where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Unary where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Undef a = Undef + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (MethodName a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_742. + AST.Traversable1.Class.Traversable1 a_742 + ) + +instance AST.Unmarshal.SymbolMatching Undef where + matchedSymbols _ = [236] + showFailure _ node_743 = + "expected " + GHC.Base.<> ( "undef" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_743 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_743) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_744 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_745 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_746 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_747 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_744 + c1_745 = TreeSitter.Node.nodeStartPoint node_743 + TreeSitter.Node.TSPoint + r2_746 + c2_747 = TreeSitter.Node.nodeEndPoint node_743 + +deriving instance GHC.Classes.Eq a_748 => GHC.Classes.Eq (Undef a_748) + +deriving instance GHC.Classes.Ord a_749 => GHC.Classes.Ord (Undef a_749) + +deriving instance GHC.Show.Show a_750 => GHC.Show.Show (Undef a_750) + +instance AST.Unmarshal.Unmarshal Undef + +instance Data.Foldable.Foldable Undef where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Undef where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Undef where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Unless a = Unless + { ann :: a, + alternative :: (GHC.Maybe.Maybe (AST.Parse.Err ((Else GHC.Generics.:+: Elsif) a))), + consequence :: (GHC.Maybe.Maybe (AST.Parse.Err (Then a))), + condition :: (AST.Parse.Err (Statement a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_751. + AST.Traversable1.Class.Traversable1 a_751 + ) + +instance AST.Unmarshal.SymbolMatching Unless where + matchedSymbols _ = [187] + showFailure _ node_752 = + "expected " + GHC.Base.<> ( "unless" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_752 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_752) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_753 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_754 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_755 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_756 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_753 + c1_754 = TreeSitter.Node.nodeStartPoint node_752 + TreeSitter.Node.TSPoint + r2_755 + c2_756 = TreeSitter.Node.nodeEndPoint node_752 + +deriving instance GHC.Classes.Eq a_757 => GHC.Classes.Eq (Unless a_757) + +deriving instance GHC.Classes.Ord a_758 => GHC.Classes.Ord (Unless a_758) + +deriving instance GHC.Show.Show a_759 => GHC.Show.Show (Unless a_759) + +instance AST.Unmarshal.Unmarshal Unless + +instance Data.Foldable.Foldable Unless where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Unless where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Unless where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnlessModifier a = UnlessModifier + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err ((Arg GHC.Generics.:+: Break GHC.Generics.:+: MethodCall GHC.Generics.:+: Next GHC.Generics.:+: Return GHC.Generics.:+: Yield) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_760. + AST.Traversable1.Class.Traversable1 a_760 + ) + +instance AST.Unmarshal.SymbolMatching UnlessModifier where + matchedSymbols _ = [174] + showFailure _ node_761 = + "expected " + GHC.Base.<> ( "unless_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_761 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_761) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_762 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_763 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_764 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_765 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_762 + c1_763 = TreeSitter.Node.nodeStartPoint node_761 + TreeSitter.Node.TSPoint + r2_764 + c2_765 = TreeSitter.Node.nodeEndPoint node_761 + +deriving instance GHC.Classes.Eq a_766 => GHC.Classes.Eq (UnlessModifier a_766) + +deriving instance GHC.Classes.Ord a_767 => GHC.Classes.Ord (UnlessModifier a_767) + +deriving instance GHC.Show.Show a_768 => GHC.Show.Show (UnlessModifier a_768) + +instance AST.Unmarshal.Unmarshal UnlessModifier + +instance Data.Foldable.Foldable UnlessModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnlessModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnlessModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Until a = Until + { ann :: a, + body :: (AST.Parse.Err (Do a)), + condition :: (AST.Parse.Err (Arg a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_769. + AST.Traversable1.Class.Traversable1 a_769 + ) + +instance AST.Unmarshal.SymbolMatching Until where + matchedSymbols _ = [179] + showFailure _ node_770 = + "expected " + GHC.Base.<> ( "until" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_770 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_770) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_771 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_772 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_773 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_774 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_771 + c1_772 = TreeSitter.Node.nodeStartPoint node_770 + TreeSitter.Node.TSPoint + r2_773 + c2_774 = TreeSitter.Node.nodeEndPoint node_770 + +deriving instance GHC.Classes.Eq a_775 => GHC.Classes.Eq (Until a_775) + +deriving instance GHC.Classes.Ord a_776 => GHC.Classes.Ord (Until a_776) + +deriving instance GHC.Show.Show a_777 => GHC.Show.Show (Until a_777) + +instance AST.Unmarshal.Unmarshal Until + +instance Data.Foldable.Foldable Until where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Until where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Until where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UntilModifier a = UntilModifier + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err ((Arg GHC.Generics.:+: Break GHC.Generics.:+: MethodCall GHC.Generics.:+: Next GHC.Generics.:+: Return GHC.Generics.:+: Yield) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_778. + AST.Traversable1.Class.Traversable1 a_778 + ) + +instance AST.Unmarshal.SymbolMatching UntilModifier where + matchedSymbols _ = [176] + showFailure _ node_779 = + "expected " + GHC.Base.<> ( "until_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_779 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_779) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_780 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_781 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_782 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_783 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_780 + c1_781 = TreeSitter.Node.nodeStartPoint node_779 + TreeSitter.Node.TSPoint + r2_782 + c2_783 = TreeSitter.Node.nodeEndPoint node_779 + +deriving instance GHC.Classes.Eq a_784 => GHC.Classes.Eq (UntilModifier a_784) + +deriving instance GHC.Classes.Ord a_785 => GHC.Classes.Ord (UntilModifier a_785) + +deriving instance GHC.Show.Show a_786 => GHC.Show.Show (UntilModifier a_786) + +instance AST.Unmarshal.Unmarshal UntilModifier + +instance Data.Foldable.Foldable UntilModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UntilModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UntilModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data When a = When + { ann :: a, + pattern :: (GHC.Base.NonEmpty (AST.Parse.Err ((AnonymousComma GHC.Generics.:+: Pattern) a))), + body :: (GHC.Maybe.Maybe (AST.Parse.Err (Then a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_787. + AST.Traversable1.Class.Traversable1 a_787 + ) + +instance AST.Unmarshal.SymbolMatching When where + matchedSymbols _ = [184] + showFailure _ node_788 = + "expected " + GHC.Base.<> ( "when" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_788 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_788) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_789 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_790 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_791 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_792 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_789 + c1_790 = TreeSitter.Node.nodeStartPoint node_788 + TreeSitter.Node.TSPoint + r2_791 + c2_792 = TreeSitter.Node.nodeEndPoint node_788 + +deriving instance GHC.Classes.Eq a_793 => GHC.Classes.Eq (When a_793) + +deriving instance GHC.Classes.Ord a_794 => GHC.Classes.Ord (When a_794) + +deriving instance GHC.Show.Show a_795 => GHC.Show.Show (When a_795) + +instance AST.Unmarshal.Unmarshal When + +instance Data.Foldable.Foldable When where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor When where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable When where + traverse = AST.Traversable1.Class.traverseDefault1 + +data While a = While + { ann :: a, + body :: (AST.Parse.Err (Do a)), + condition :: (AST.Parse.Err (Arg a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_796. + AST.Traversable1.Class.Traversable1 a_796 + ) + +instance AST.Unmarshal.SymbolMatching While where + matchedSymbols _ = [178] + showFailure _ node_797 = + "expected " + GHC.Base.<> ( "while" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_797 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_797) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_798 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_799 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_800 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_801 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_798 + c1_799 = TreeSitter.Node.nodeStartPoint node_797 + TreeSitter.Node.TSPoint + r2_800 + c2_801 = TreeSitter.Node.nodeEndPoint node_797 + +deriving instance GHC.Classes.Eq a_802 => GHC.Classes.Eq (While a_802) + +deriving instance GHC.Classes.Ord a_803 => GHC.Classes.Ord (While a_803) + +deriving instance GHC.Show.Show a_804 => GHC.Show.Show (While a_804) + +instance AST.Unmarshal.Unmarshal While + +instance Data.Foldable.Foldable While where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor While where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable While where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WhileModifier a = WhileModifier + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err ((Arg GHC.Generics.:+: Break GHC.Generics.:+: MethodCall GHC.Generics.:+: Next GHC.Generics.:+: Return GHC.Generics.:+: Yield) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_805. + AST.Traversable1.Class.Traversable1 a_805 + ) + +instance AST.Unmarshal.SymbolMatching WhileModifier where + matchedSymbols _ = [175] + showFailure _ node_806 = + "expected " + GHC.Base.<> ( "while_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_806 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_806) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_807 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_808 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_809 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_810 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_807 + c1_808 = TreeSitter.Node.nodeStartPoint node_806 + TreeSitter.Node.TSPoint + r2_809 + c2_810 = TreeSitter.Node.nodeEndPoint node_806 + +deriving instance GHC.Classes.Eq a_811 => GHC.Classes.Eq (WhileModifier a_811) + +deriving instance GHC.Classes.Ord a_812 => GHC.Classes.Ord (WhileModifier a_812) + +deriving instance GHC.Show.Show a_813 => GHC.Show.Show (WhileModifier a_813) + +instance AST.Unmarshal.Unmarshal WhileModifier + +instance Data.Foldable.Foldable WhileModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WhileModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WhileModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Yield a = Yield + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ArgumentList a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_814. + AST.Traversable1.Class.Traversable1 a_814 + ) + +instance AST.Unmarshal.SymbolMatching Yield where + matchedSymbols _ = [164, 168] + showFailure _ node_815 = + "expected " + GHC.Base.<> ( "yield, yield" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_815 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_815) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_816 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_817 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_818 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_819 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_816 + c1_817 = TreeSitter.Node.nodeStartPoint node_815 + TreeSitter.Node.TSPoint + r2_818 + c2_819 = TreeSitter.Node.nodeEndPoint node_815 + +deriving instance GHC.Classes.Eq a_820 => GHC.Classes.Eq (Yield a_820) + +deriving instance GHC.Classes.Ord a_821 => GHC.Classes.Ord (Yield a_821) + +deriving instance GHC.Show.Show a_822 => GHC.Show.Show (Yield a_822) + +instance AST.Unmarshal.Unmarshal Yield + +instance Data.Foldable.Foldable Yield where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Yield where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Yield where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousBang = AST.Token.Token "!" 90 + +type AnonymousBangEqual = AST.Token.Token "!=" 83 + +type AnonymousBangTilde = AST.Token.Token "!~" 87 + +type AnonymousDQuote = AST.Token.Token "\"" 122 + +type AnonymousHashLBrace = AST.Token.Token "#{" 115 + +type AnonymousPercent = AST.Token.Token "%" 81 + +type AnonymousPercentEqual = AST.Token.Token "%=" 61 + +type AnonymousPercentiLParen = AST.Token.Token "%i(" 127 + +type AnonymousPercentwLParen = AST.Token.Token "%w(" 126 + +type AnonymousAmpersand = AST.Token.Token "&" 18 + +type AnonymousAmpersandAmpersand = AST.Token.Token "&&" 72 + +type AnonymousAmpersandAmpersandEqual = AST.Token.Token "&&=" 59 + +type AnonymousAmpersandDot = AST.Token.Token "&." 50 + +type AnonymousAmpersandEqual = AST.Token.Token "&=" 60 + +type AnonymousLParen = AST.Token.Token "(" 9 + +type AnonymousRParen = AST.Token.Token ")" 10 + +type AnonymousStar = AST.Token.Token "*" 16 + +type AnonymousStarStar = AST.Token.Token "**" 17 + +type AnonymousStarStarEqual = AST.Token.Token "**=" 55 + +type AnonymousStarEqual = AST.Token.Token "*=" 54 + +type AnonymousPlus = AST.Token.Token "+" 79 + +type AnonymousPlusEqual = AST.Token.Token "+=" 52 + +type AnonymousPlusAt = AST.Token.Token "+@" 93 + +type AnonymousComma = AST.Token.Token "," 13 + +type AnonymousMinus = AST.Token.Token "-" 92 + +type AnonymousMinusEqual = AST.Token.Token "-=" 53 + +type AnonymousMinusRAngle = AST.Token.Token "->" 119 + +type AnonymousMinusAt = AST.Token.Token "-@" 94 + +type AnonymousDot = AST.Token.Token "." 11 + +type AnonymousDotDot = AST.Token.Token ".." 67 + +type AnonymousDotDotDot = AST.Token.Token "..." 68 + +type AnonymousSlash = AST.Token.Token "/" 80 + +type AnonymousSlashEqual = AST.Token.Token "/=" 56 + +type AnonymousColon = AST.Token.Token ":" 19 + +type AnonymousColonDQuote = AST.Token.Token ":\"" 123 + +type AnonymousColonColon = AST.Token.Token "::" 12 + +type AnonymousSemicolon = AST.Token.Token ";" 15 + +type AnonymousLAngle = AST.Token.Token "<" 22 + +type AnonymousLAngleLAngle = AST.Token.Token "<<" 73 + +type AnonymousLAngleLAngleEqual = AST.Token.Token "<<=" 63 + +type AnonymousLAngleEqual = AST.Token.Token "<=" 75 + +type AnonymousLAngleEqualRAngle = AST.Token.Token "<=>" 85 + +type AnonymousEqual = AST.Token.Token "=" 20 + +type AnonymousEqualEqual = AST.Token.Token "==" 82 + +type AnonymousEqualEqualEqual = AST.Token.Token "===" 84 + +type AnonymousEqualRAngle = AST.Token.Token "=>" 46 + +type AnonymousEqualTilde = AST.Token.Token "=~" 86 + +type AnonymousRAngle = AST.Token.Token ">" 76 + +type AnonymousRAngleEqual = AST.Token.Token ">=" 77 + +type AnonymousRAngleRAngle = AST.Token.Token ">>" 74 + +type AnonymousRAngleRAngleEqual = AST.Token.Token ">>=" 62 + +type AnonymousQuestion = AST.Token.Token "?" 65 + +type AnonymousBEGIN = AST.Token.Token "BEGIN" 4 + +type AnonymousEND = AST.Token.Token "END" 7 + +type AnonymousLBracket = AST.Token.Token "[" 47 + +type AnonymousLBracketRBracket = AST.Token.Token "[]" 95 + +type AnonymousLBracketRBracketEqual = AST.Token.Token "[]=" 96 + +type AnonymousRBracket = AST.Token.Token "]" 48 + +type AnonymousCaret = AST.Token.Token "^" 78 + +type AnonymousCaretEqual = AST.Token.Token "^=" 64 + +type AnonymousUnderscoreENDUnderscore = AST.Token.Token "__END__" 2 + +type AnonymousBacktick = AST.Token.Token "`" 97 + +type AnonymousAlias = AST.Token.Token "alias" 99 + +type AnonymousAnd = AST.Token.Token "and" 69 + +type AnonymousBegin = AST.Token.Token "begin" 44 + +type AnonymousBreak = AST.Token.Token "break" 27 + +type AnonymousCase = AST.Token.Token "case" 39 + +data Character a = Character {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_823. + AST.Traversable1.Class.Traversable1 a_823 + ) + +instance AST.Unmarshal.SymbolMatching Character where + matchedSymbols _ = [114] + showFailure _ node_824 = + "expected " + GHC.Base.<> ( "character" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_824 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_824) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_825 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_826 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_827 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_828 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_825 + c1_826 = TreeSitter.Node.nodeStartPoint node_824 + TreeSitter.Node.TSPoint + r2_827 + c2_828 = TreeSitter.Node.nodeEndPoint node_824 + +deriving instance GHC.Classes.Eq a_829 => GHC.Classes.Eq (Character a_829) + +deriving instance GHC.Classes.Ord a_830 => GHC.Classes.Ord (Character a_830) + +deriving instance GHC.Show.Show a_831 => GHC.Show.Show (Character a_831) + +instance AST.Unmarshal.Unmarshal Character + +instance Data.Foldable.Foldable Character where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Character where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Character where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousClass = AST.Token.Token "class" 21 + +data ClassVariable a = ClassVariable {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_832. + AST.Traversable1.Class.Traversable1 a_832 + ) + +instance AST.Unmarshal.SymbolMatching ClassVariable where + matchedSymbols _ = [112] + showFailure _ node_833 = + "expected " + GHC.Base.<> ( "class_variable" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_833 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_833) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_834 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_835 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_836 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_837 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_834 + c1_835 = TreeSitter.Node.nodeStartPoint node_833 + TreeSitter.Node.TSPoint + r2_836 + c2_837 = TreeSitter.Node.nodeEndPoint node_833 + +deriving instance GHC.Classes.Eq a_838 => GHC.Classes.Eq (ClassVariable a_838) + +deriving instance GHC.Classes.Ord a_839 => GHC.Classes.Ord (ClassVariable a_839) + +deriving instance GHC.Show.Show a_840 => GHC.Show.Show (ClassVariable a_840) + +instance AST.Unmarshal.Unmarshal ClassVariable + +instance Data.Foldable.Foldable ClassVariable where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassVariable where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassVariable where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Complex a = Complex {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_841. + AST.Traversable1.Class.Traversable1 a_841 + ) + +instance AST.Unmarshal.SymbolMatching Complex where + matchedSymbols _ = [103] + showFailure _ node_842 = + "expected " + GHC.Base.<> ( "complex" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_842 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_842) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_843 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_844 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_845 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_846 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_843 + c1_844 = TreeSitter.Node.nodeStartPoint node_842 + TreeSitter.Node.TSPoint + r2_845 + c2_846 = TreeSitter.Node.nodeEndPoint node_842 + +deriving instance GHC.Classes.Eq a_847 => GHC.Classes.Eq (Complex a_847) + +deriving instance GHC.Classes.Ord a_848 => GHC.Classes.Ord (Complex a_848) + +deriving instance GHC.Show.Show a_849 => GHC.Show.Show (Complex a_849) + +instance AST.Unmarshal.Unmarshal Complex + +instance Data.Foldable.Foldable Complex where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Complex where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Complex where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Constant a = Constant {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_850. + AST.Traversable1.Class.Traversable1 a_850 + ) + +instance AST.Unmarshal.SymbolMatching Constant where + matchedSymbols _ = [110] + showFailure _ node_851 = + "expected " + GHC.Base.<> ( "constant" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_851 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_851) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_852 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_853 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_854 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_855 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_852 + c1_853 = TreeSitter.Node.nodeStartPoint node_851 + TreeSitter.Node.TSPoint + r2_854 + c2_855 = TreeSitter.Node.nodeEndPoint node_851 + +deriving instance GHC.Classes.Eq a_856 => GHC.Classes.Eq (Constant a_856) + +deriving instance GHC.Classes.Ord a_857 => GHC.Classes.Ord (Constant a_857) + +deriving instance GHC.Show.Show a_858 => GHC.Show.Show (Constant a_858) + +instance AST.Unmarshal.Unmarshal Constant + +instance Data.Foldable.Foldable Constant where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Constant where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Constant where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousDef = AST.Token.Token "def" 8 + +type AnonymousDefinedQuestion = AST.Token.Token "defined?" 88 + +type AnonymousDo = AST.Token.Token "do" 38 + +type AnonymousElse = AST.Token.Token "else" 42 + +type AnonymousElsif = AST.Token.Token "elsif" 41 + +type AnonymousEnd = AST.Token.Token "end" 24 + +type AnonymousEnsure = AST.Token.Token "ensure" 45 + +data EscapeSequence a = EscapeSequence {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_859. + AST.Traversable1.Class.Traversable1 a_859 + ) + +instance AST.Unmarshal.SymbolMatching EscapeSequence where + matchedSymbols _ = [117] + showFailure _ node_860 = + "expected " + GHC.Base.<> ( "escape_sequence" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_860 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_860) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_861 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_862 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_863 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_864 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_861 + c1_862 = TreeSitter.Node.nodeStartPoint node_860 + TreeSitter.Node.TSPoint + r2_863 + c2_864 = TreeSitter.Node.nodeEndPoint node_860 + +deriving instance GHC.Classes.Eq a_865 => GHC.Classes.Eq (EscapeSequence a_865) + +deriving instance GHC.Classes.Ord a_866 => GHC.Classes.Ord (EscapeSequence a_866) + +deriving instance GHC.Show.Show a_867 => GHC.Show.Show (EscapeSequence a_867) + +instance AST.Unmarshal.Unmarshal EscapeSequence + +instance Data.Foldable.Foldable EscapeSequence where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EscapeSequence where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EscapeSequence where + traverse = AST.Traversable1.Class.traverseDefault1 + +data False a = False {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_868. + AST.Traversable1.Class.Traversable1 a_868 + ) + +instance AST.Unmarshal.SymbolMatching False where + matchedSymbols _ = [108] + showFailure _ node_869 = + "expected " + GHC.Base.<> ( "false" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_869 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_869) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_870 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_871 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_872 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_873 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_870 + c1_871 = TreeSitter.Node.nodeStartPoint node_869 + TreeSitter.Node.TSPoint + r2_872 + c2_873 = TreeSitter.Node.nodeEndPoint node_869 + +deriving instance GHC.Classes.Eq a_874 => GHC.Classes.Eq (False a_874) + +deriving instance GHC.Classes.Ord a_875 => GHC.Classes.Ord (False a_875) + +deriving instance GHC.Show.Show a_876 => GHC.Show.Show (False a_876) + +instance AST.Unmarshal.Unmarshal False + +instance Data.Foldable.Foldable False where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor False where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable False where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Float a = Float {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_877. + AST.Traversable1.Class.Traversable1 a_877 + ) + +instance AST.Unmarshal.SymbolMatching Float where + matchedSymbols _ = [102] + showFailure _ node_878 = + "expected " + GHC.Base.<> ( "float" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_878 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_878) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_879 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_880 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_881 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_882 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_879 + c1_880 = TreeSitter.Node.nodeStartPoint node_878 + TreeSitter.Node.TSPoint + r2_881 + c2_882 = TreeSitter.Node.nodeEndPoint node_878 + +deriving instance GHC.Classes.Eq a_883 => GHC.Classes.Eq (Float a_883) + +deriving instance GHC.Classes.Ord a_884 => GHC.Classes.Ord (Float a_884) + +deriving instance GHC.Show.Show a_885 => GHC.Show.Show (Float a_885) + +instance AST.Unmarshal.Unmarshal Float + +instance Data.Foldable.Foldable Float where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Float where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Float where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFor = AST.Token.Token "for" 36 + +data GlobalVariable a = GlobalVariable {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_886. + AST.Traversable1.Class.Traversable1 a_886 + ) + +instance AST.Unmarshal.SymbolMatching GlobalVariable where + matchedSymbols _ = [113] + showFailure _ node_887 = + "expected " + GHC.Base.<> ( "global_variable" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_887 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_887) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_888 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_889 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_890 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_891 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_888 + c1_889 = TreeSitter.Node.nodeStartPoint node_887 + TreeSitter.Node.TSPoint + r2_890 + c2_891 = TreeSitter.Node.nodeEndPoint node_887 + +deriving instance GHC.Classes.Eq a_892 => GHC.Classes.Eq (GlobalVariable a_892) + +deriving instance GHC.Classes.Ord a_893 => GHC.Classes.Ord (GlobalVariable a_893) + +deriving instance GHC.Show.Show a_894 => GHC.Show.Show (GlobalVariable a_894) + +instance AST.Unmarshal.Unmarshal GlobalVariable + +instance Data.Foldable.Foldable GlobalVariable where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GlobalVariable where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GlobalVariable where + traverse = AST.Traversable1.Class.traverseDefault1 + +data HeredocBeginning a = HeredocBeginning {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_895. + AST.Traversable1.Class.Traversable1 a_895 + ) + +instance AST.Unmarshal.SymbolMatching HeredocBeginning where + matchedSymbols _ = [133] + showFailure _ node_896 = + "expected " + GHC.Base.<> ( "heredoc_beginning" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_896 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_896) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_897 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_898 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_899 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_900 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_897 + c1_898 = TreeSitter.Node.nodeStartPoint node_896 + TreeSitter.Node.TSPoint + r2_899 + c2_900 = TreeSitter.Node.nodeEndPoint node_896 + +deriving instance GHC.Classes.Eq a_901 => GHC.Classes.Eq (HeredocBeginning a_901) + +deriving instance GHC.Classes.Ord a_902 => GHC.Classes.Ord (HeredocBeginning a_902) + +deriving instance GHC.Show.Show a_903 => GHC.Show.Show (HeredocBeginning a_903) + +instance AST.Unmarshal.Unmarshal HeredocBeginning + +instance Data.Foldable.Foldable HeredocBeginning where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor HeredocBeginning where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable HeredocBeginning where + traverse = AST.Traversable1.Class.traverseDefault1 + +data HeredocEnd a = HeredocEnd {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_904. + AST.Traversable1.Class.Traversable1 a_904 + ) + +instance AST.Unmarshal.SymbolMatching HeredocEnd where + matchedSymbols _ = [132] + showFailure _ node_905 = + "expected " + GHC.Base.<> ( "heredoc_end" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_905 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_905) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_906 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_907 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_908 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_909 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_906 + c1_907 = TreeSitter.Node.nodeStartPoint node_905 + TreeSitter.Node.TSPoint + r2_908 + c2_909 = TreeSitter.Node.nodeEndPoint node_905 + +deriving instance GHC.Classes.Eq a_910 => GHC.Classes.Eq (HeredocEnd a_910) + +deriving instance GHC.Classes.Ord a_911 => GHC.Classes.Ord (HeredocEnd a_911) + +deriving instance GHC.Show.Show a_912 => GHC.Show.Show (HeredocEnd a_912) + +instance AST.Unmarshal.Unmarshal HeredocEnd + +instance Data.Foldable.Foldable HeredocEnd where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor HeredocEnd where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable HeredocEnd where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Identifier a = Identifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_913. + AST.Traversable1.Class.Traversable1 a_913 + ) + +instance AST.Unmarshal.SymbolMatching Identifier where + matchedSymbols _ = [1] + showFailure _ node_914 = + "expected " + GHC.Base.<> ( "identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_914 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_914) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_915 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_916 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_917 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_918 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_915 + c1_916 = TreeSitter.Node.nodeStartPoint node_914 + TreeSitter.Node.TSPoint + r2_917 + c2_918 = TreeSitter.Node.nodeEndPoint node_914 + +deriving instance GHC.Classes.Eq a_919 => GHC.Classes.Eq (Identifier a_919) + +deriving instance GHC.Classes.Ord a_920 => GHC.Classes.Ord (Identifier a_920) + +deriving instance GHC.Show.Show a_921 => GHC.Show.Show (Identifier a_921) + +instance AST.Unmarshal.Unmarshal Identifier + +instance Data.Foldable.Foldable Identifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Identifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Identifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousIf = AST.Token.Token "if" 31 + +type AnonymousIn = AST.Token.Token "in" 37 + +data InstanceVariable a = InstanceVariable {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_922. + AST.Traversable1.Class.Traversable1 a_922 + ) + +instance AST.Unmarshal.SymbolMatching InstanceVariable where + matchedSymbols _ = [111] + showFailure _ node_923 = + "expected " + GHC.Base.<> ( "instance_variable" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_923 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_923) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_924 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_925 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_926 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_927 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_924 + c1_925 = TreeSitter.Node.nodeStartPoint node_923 + TreeSitter.Node.TSPoint + r2_926 + c2_927 = TreeSitter.Node.nodeEndPoint node_923 + +deriving instance GHC.Classes.Eq a_928 => GHC.Classes.Eq (InstanceVariable a_928) + +deriving instance GHC.Classes.Ord a_929 => GHC.Classes.Ord (InstanceVariable a_929) + +deriving instance GHC.Show.Show a_930 => GHC.Show.Show (InstanceVariable a_930) + +instance AST.Unmarshal.Unmarshal InstanceVariable + +instance Data.Foldable.Foldable InstanceVariable where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InstanceVariable where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InstanceVariable where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Integer a = Integer {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_931. + AST.Traversable1.Class.Traversable1 a_931 + ) + +instance AST.Unmarshal.SymbolMatching Integer where + matchedSymbols _ = [101] + showFailure _ node_932 = + "expected " + GHC.Base.<> ( "integer" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_932 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_932) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_933 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_934 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_935 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_936 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_933 + c1_934 = TreeSitter.Node.nodeStartPoint node_932 + TreeSitter.Node.TSPoint + r2_935 + c2_936 = TreeSitter.Node.nodeEndPoint node_932 + +deriving instance GHC.Classes.Eq a_937 => GHC.Classes.Eq (Integer a_937) + +deriving instance GHC.Classes.Ord a_938 => GHC.Classes.Ord (Integer a_938) + +deriving instance GHC.Show.Show a_939 => GHC.Show.Show (Integer a_939) + +instance AST.Unmarshal.Unmarshal Integer + +instance Data.Foldable.Foldable Integer where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Integer where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Integer where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousModule = AST.Token.Token "module" 23 + +type AnonymousNext = AST.Token.Token "next" 28 + +data Nil a = Nil {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_940. + AST.Traversable1.Class.Traversable1 a_940 + ) + +instance AST.Unmarshal.SymbolMatching Nil where + matchedSymbols _ = [109] + showFailure _ node_941 = + "expected " + GHC.Base.<> ( "nil" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_941 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_941) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_942 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_943 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_944 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_945 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_942 + c1_943 = TreeSitter.Node.nodeStartPoint node_941 + TreeSitter.Node.TSPoint + r2_944 + c2_945 = TreeSitter.Node.nodeEndPoint node_941 + +deriving instance GHC.Classes.Eq a_946 => GHC.Classes.Eq (Nil a_946) + +deriving instance GHC.Classes.Ord a_947 => GHC.Classes.Ord (Nil a_947) + +deriving instance GHC.Show.Show a_948 => GHC.Show.Show (Nil a_948) + +instance AST.Unmarshal.Unmarshal Nil + +instance Data.Foldable.Foldable Nil where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Nil where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Nil where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousNot = AST.Token.Token "not" 89 + +type AnonymousOr = AST.Token.Token "or" 70 + +type AnonymousR = AST.Token.Token "r" 104 + +type AnonymousRedo = AST.Token.Token "redo" 29 + +type AnonymousRescue = AST.Token.Token "rescue" 35 + +type AnonymousRetry = AST.Token.Token "retry" 30 + +type AnonymousReturn = AST.Token.Token "return" 25 + +data Self a = Self {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_949. + AST.Traversable1.Class.Traversable1 a_949 + ) + +instance AST.Unmarshal.SymbolMatching Self where + matchedSymbols _ = [106] + showFailure _ node_950 = + "expected " + GHC.Base.<> ( "self" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_950 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_950) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_951 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_952 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_953 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_954 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_951 + c1_952 = TreeSitter.Node.nodeStartPoint node_950 + TreeSitter.Node.TSPoint + r2_953 + c2_954 = TreeSitter.Node.nodeEndPoint node_950 + +deriving instance GHC.Classes.Eq a_955 => GHC.Classes.Eq (Self a_955) + +deriving instance GHC.Classes.Ord a_956 => GHC.Classes.Ord (Self a_956) + +deriving instance GHC.Show.Show a_957 => GHC.Show.Show (Self a_957) + +instance AST.Unmarshal.Unmarshal Self + +instance Data.Foldable.Foldable Self where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Self where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Self where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Super a = Super {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_958. + AST.Traversable1.Class.Traversable1 a_958 + ) + +instance AST.Unmarshal.SymbolMatching Super where + matchedSymbols _ = [105] + showFailure _ node_959 = + "expected " + GHC.Base.<> ( "super" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_959 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_959) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_960 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_961 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_962 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_963 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_960 + c1_961 = TreeSitter.Node.nodeStartPoint node_959 + TreeSitter.Node.TSPoint + r2_962 + c2_963 = TreeSitter.Node.nodeEndPoint node_959 + +deriving instance GHC.Classes.Eq a_964 => GHC.Classes.Eq (Super a_964) + +deriving instance GHC.Classes.Ord a_965 => GHC.Classes.Ord (Super a_965) + +deriving instance GHC.Show.Show a_966 => GHC.Show.Show (Super a_966) + +instance AST.Unmarshal.Unmarshal Super + +instance Data.Foldable.Foldable Super where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Super where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Super where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousThen = AST.Token.Token "then" 43 + +data True a = True {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_967. + AST.Traversable1.Class.Traversable1 a_967 + ) + +instance AST.Unmarshal.SymbolMatching True where + matchedSymbols _ = [107] + showFailure _ node_968 = + "expected " + GHC.Base.<> ( "true" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_968 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_968) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_969 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_970 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_971 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_972 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_969 + c1_970 = TreeSitter.Node.nodeStartPoint node_968 + TreeSitter.Node.TSPoint + r2_971 + c2_972 = TreeSitter.Node.nodeEndPoint node_968 + +deriving instance GHC.Classes.Eq a_973 => GHC.Classes.Eq (True a_973) + +deriving instance GHC.Classes.Ord a_974 => GHC.Classes.Ord (True a_974) + +deriving instance GHC.Show.Show a_975 => GHC.Show.Show (True a_975) + +instance AST.Unmarshal.Unmarshal True + +instance Data.Foldable.Foldable True where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor True where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable True where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousUndef = AST.Token.Token "undef" 98 + +data Uninterpreted a = Uninterpreted {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_976. + AST.Traversable1.Class.Traversable1 a_976 + ) + +instance AST.Unmarshal.SymbolMatching Uninterpreted where + matchedSymbols _ = [3] + showFailure _ node_977 = + "expected " + GHC.Base.<> ( "uninterpreted" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_977 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_977) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_978 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_979 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_980 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_981 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_978 + c1_979 = TreeSitter.Node.nodeStartPoint node_977 + TreeSitter.Node.TSPoint + r2_980 + c2_981 = TreeSitter.Node.nodeEndPoint node_977 + +deriving instance GHC.Classes.Eq a_982 => GHC.Classes.Eq (Uninterpreted a_982) + +deriving instance GHC.Classes.Ord a_983 => GHC.Classes.Ord (Uninterpreted a_983) + +deriving instance GHC.Show.Show a_984 => GHC.Show.Show (Uninterpreted a_984) + +instance AST.Unmarshal.Unmarshal Uninterpreted + +instance Data.Foldable.Foldable Uninterpreted where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Uninterpreted where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Uninterpreted where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousUnless = AST.Token.Token "unless" 32 + +type AnonymousUntil = AST.Token.Token "until" 34 + +type AnonymousWhen = AST.Token.Token "when" 40 + +type AnonymousWhile = AST.Token.Token "while" 33 + +type AnonymousYield = AST.Token.Token "yield" 26 + +type AnonymousLBrace = AST.Token.Token "{" 5 + +type AnonymousPipe = AST.Token.Token "|" 14 + +type AnonymousPipeEqual = AST.Token.Token "|=" 58 + +type AnonymousPipePipe = AST.Token.Token "||" 71 + +type AnonymousPipePipeEqual = AST.Token.Token "||=" 57 + +type AnonymousRBrace = AST.Token.Token "}" 6 + +type AnonymousTilde = AST.Token.Token "~" 91 diff --git a/semantic-ruby/src/Language/Ruby/Grammar.hs b/semantic-ruby/src/Language/Ruby/Grammar.hs new file mode 100644 index 0000000000..a26f04a66b --- /dev/null +++ b/semantic-ruby/src/Language/Ruby/Grammar.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} +module Language.Ruby.Grammar +( tree_sitter_ruby +, Grammar(..) +) where + +import AST.Grammar.TH +import Language.Haskell.TH +import TreeSitter.Ruby (tree_sitter_ruby) + +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData (mkName "Grammar") tree_sitter_ruby diff --git a/semantic-ruby/src/Language/Ruby/Tags.hs b/semantic-ruby/src/Language/Ruby/Tags.hs new file mode 100644 index 0000000000..fec7ffbf4c --- /dev/null +++ b/semantic-ruby/src/Language/Ruby/Tags.hs @@ -0,0 +1,519 @@ +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + + +module Language.Ruby.Tags + ( ToTags (..), + ) +where + +import AST.Element +import qualified AST.Parse as Parse +import AST.Token +import AST.Traversable1 +import qualified AST.Unmarshal as TS +import Control.Effect.Reader +import Control.Effect.State +import Control.Effect.Writer +import Control.Monad +import Data.Foldable +import Data.Text (Text) +import qualified Language.Ruby.AST as Rb +import Proto.Semantic as P +import Source.Loc +import Source.Range as Range +import Source.Source as Source +import qualified Tags.Tagging.Precise as Tags + +class ToTags t where + tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Has (State [Text]) sig m + ) => + t Loc -> + m () + default tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Has (State [Text]) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () + tags = gtags + +instance ToTags (Token sym n) where tags _ = pure () + +instance (ToTags l, ToTags r) => ToTags (l :+: r) where + tags (L1 l) = tags l + tags (R1 r) = tags r + +-- These are all valid, but point to methods in Kernel and other parts of the +-- Ruby stdlib. A la carte displays some of these, but not others and since we +-- have nothing to link to yet (can't jump-to-def), we hide them from the +-- current tags output. +nameBlacklist :: [Text] +nameBlacklist = + [ "alias", + "load", + "require_relative", + "require", + "super", + "undef", + "__FILE__", + "__LINE__", + "lambda" + ] + +yieldTag :: (Has (Reader Source) sig m, Has (State Tags.LineIndices) sig m, Has (Writer Tags.Tags) sig m) => Text -> P.SyntaxType -> P.NodeType -> Loc -> Range -> m () +yieldTag name P.CALL _ _ _ | name `elem` nameBlacklist = pure () +yieldTag name kind ty loc srcLineRange = Tags.yield name kind ty loc srcLineRange + +instance ToTags Rb.Class where + tags + t@Rb.Class + { ann = Loc {byteRange = Range {start}}, + name = Parse.Success expr, + extraChildren + } = enterScope True $ case expr of + Prj Rb.Constant {text, ann} -> yield text ann + Prj Rb.ScopeResolution {name = EPrj Rb.Constant {text, ann}} -> yield text ann + Prj Rb.ScopeResolution {name = EPrj Rb.Identifier {text, ann}} -> yield text ann + _ -> gtags t + where + range' = case extraChildren of + EPrj Rb.Superclass {ann = Loc {byteRange = Range {end}}} : _ -> Range start end + _ -> Range start (getEnd expr) + getEnd = Range.end . byteRange . TS.gann + yield name loc = yieldTag name P.CLASS P.DEFINITION loc range' >> gtags t + tags _ = pure () + +instance ToTags Rb.SingletonClass where + tags + t@Rb.SingletonClass + { ann = Loc {byteRange = range@Range {start}}, + value = Parse.Success (Rb.Arg expr), + extraChildren + } = enterScope True $ case expr of + Prj (Rb.Primary (Prj (Rb.Lhs (Prj (Rb.Variable (Prj Rb.Constant {text, ann})))))) -> yield text ann + Prj (Rb.Primary (Prj (Rb.Lhs (Prj Rb.ScopeResolution {name = EPrj Rb.Constant {text, ann}})))) -> yield text ann + Prj (Rb.Primary (Prj (Rb.Lhs (Prj Rb.ScopeResolution {name = EPrj Rb.Identifier {text, ann}})))) -> yield text ann + _ -> gtags t + where + range' = case extraChildren of + Parse.Success x : _ -> Range start (getStart x) + _ -> range + getStart = Range.start . byteRange . TS.gann + yield name loc = yieldTag name P.CLASS P.DEFINITION loc range' >> gtags t + tags _ = pure () + +instance ToTags Rb.Module where + tags + t@Rb.Module + { ann = Loc {byteRange = Range {start}}, + name = Parse.Success expr, + extraChildren + } = enterScope True $ case expr of + Prj Rb.Constant {text, ann} -> yield text ann + Prj Rb.ScopeResolution {name = EPrj Rb.Constant {text, ann}} -> yield text ann + Prj Rb.ScopeResolution {name = EPrj Rb.Identifier {text, ann}} -> yield text ann + _ -> gtags t + where + range' = case extraChildren of + Parse.Success x : _ -> Range start (getStart x) + _ -> Range start (getEnd expr) + getEnd = Range.end . byteRange . TS.gann + getStart = Range.start . byteRange . TS.gann + yield name loc = yieldTag name P.MODULE P.DEFINITION loc range' >> gtags t + tags _ = pure () + +yieldMethodNameTag :: + ( Has (State [Text]) sig m, + Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + Range -> + Rb.MethodName Loc -> + m () +yieldMethodNameTag t range (Rb.MethodName expr) = enterScope True $ case expr of + Prj Rb.Identifier {text, ann} -> yield text ann + Prj Rb.Constant {text, ann} -> yield text ann + -- Prj Rb.ClassVariable { text = name } -> yield name + Prj Rb.Operator {text, ann} -> yield text ann + -- Prj Rb.GlobalVariable { text = name } -> yield name + -- Prj Rb.InstanceVariable { text = name } -> yield name + Prj Rb.Setter {extraChildren = Parse.Success (Rb.Identifier {text, ann})} -> yield (text <> "=") ann-- NB: Matches existing tags output, TODO: Remove this. + -- TODO: Should we report symbol method names as tags? + -- Prj Rb.Symbol { extraChildren = [Prj Rb.EscapeSequence { text = name }] } -> yield name + _ -> gtags t + where + yield name loc = yieldTag name P.METHOD P.DEFINITION loc range >> gtags t + +enterScope :: (Has (State [Text]) sig m) => Bool -> m () -> m () +enterScope createNew m = do + locals <- get @[Text] + when createNew $ put @[Text] [] -- NB: Matches existing behavior in assignment, not necessarily correct + m + put locals + +instance ToTags Rb.Method where + tags + t@Rb.Method + { ann = Loc {byteRange = Range {start}}, + name = Parse.Success n, + parameters + } = yieldMethodNameTag t range' n + where + range' = case parameters of + Just (Parse.Success (Rb.MethodParameters {ann = Loc {byteRange = Range {end}}})) -> Range start end + _ -> Range start (getEnd n) + getEnd = Range.end . byteRange . TS.gann + tags _ = pure () + +instance ToTags Rb.SingletonMethod where + tags + t@Rb.SingletonMethod + { ann = Loc {byteRange = Range {start}}, + name = Parse.Success n, + parameters + } = yieldMethodNameTag t range' n + where + range' = case parameters of + Just (Parse.Success (Rb.MethodParameters {ann = Loc {byteRange = Range {end}}})) -> Range start end + _ -> Range start (getEnd n) + getEnd = Range.end . byteRange . TS.gann + tags _ = pure () + +instance ToTags Rb.Block where + tags = enterScope False . gtags + +instance ToTags Rb.DoBlock where + tags = enterScope False . gtags + +instance ToTags Rb.Lambda where + tags Rb.Lambda {body = Parse.Success b, parameters} = enterScope False $ do + case parameters of + Just (Parse.Success p) -> tags p + _ -> pure () + tags b + tags _ = pure () + +instance ToTags Rb.If where + tags Rb.If {condition = Parse.Success cond, consequence, alternative} = do + tags cond + case consequence of + Just (Parse.Success cons) -> tags cons + _ -> pure () + case alternative of + Just (Parse.Success alt) -> tags alt + _ -> pure () + tags _ = pure () + +instance ToTags Rb.Elsif where + tags Rb.Elsif {condition = Parse.Success cond, consequence, alternative} = do + tags cond + case consequence of + Just (Parse.Success cons) -> tags cons + _ -> pure () + case alternative of + Just (Parse.Success alt) -> tags alt + _ -> pure () + tags _ = pure () + +instance ToTags Rb.Unless where + tags Rb.Unless {condition = Parse.Success cond, consequence, alternative} = do + tags cond + case consequence of + Just (Parse.Success cons) -> tags cons + _ -> pure () + case alternative of + Just (Parse.Success alt) -> tags alt + _ -> pure () + tags _ = pure () + +instance ToTags Rb.While where + tags Rb.While {condition = Parse.Success cond, body = Parse.Success b} = tags cond >> tags b + tags _ = pure () + +instance ToTags Rb.Until where + tags Rb.Until {condition = Parse.Success cond, body = Parse.Success b} = tags cond >> tags b + tags _ = pure () + +instance ToTags Rb.Regex where + tags Rb.Regex {} = pure () + +instance ToTags Rb.Subshell where + tags Rb.Subshell {} = pure () + +-- TODO: Line of source produced here could be better. +instance ToTags Rb.Lhs where + tags t@(Rb.Lhs expr) = case expr of + -- NOTE: Calls do not look for locals + Prj Rb.Call {ann = Loc {byteRange}, method} -> case method of + EPrj Rb.Identifier {text, ann} -> yieldCall text ann byteRange + EPrj Rb.Constant {text, ann} -> yieldCall text ann byteRange + EPrj Rb.Operator {text, ann} -> yieldCall text ann byteRange + _ -> gtags t + -- These do check for locals before yielding a call tag + Prj (Rb.Variable (Prj Rb.Identifier {ann = loc@Loc {byteRange}, text})) -> yield text P.CALL loc byteRange + Prj Rb.ScopeResolution {ann = loc@Loc {byteRange}, name = EPrj Rb.Identifier {text}} -> yield text P.CALL loc byteRange + Prj (Rb.Variable (Prj Rb.Constant { ann = loc@Loc { byteRange }, text })) -> yield text P.CALL loc byteRange -- TODO: Should yield Constant + Prj Rb.ScopeResolution { ann = loc@Loc { byteRange }, name = EPrj Rb.Constant { text } } -> yield text P.CALL loc byteRange -- TODO: Should yield Constant + _ -> gtags t + where + yieldCall name loc range = yieldTag name P.CALL P.REFERENCE loc range >> gtags t + yield name kind loc range = do + locals <- get @[Text] + unless (name `elem` locals) $ yieldTag name kind P.REFERENCE loc range + gtags t + +-- TODO: Line of source produced here could be better. +instance ToTags Rb.MethodCall where + tags + t@Rb.MethodCall + { ann = Loc {byteRange = byteRange@Range {}}, + method = expr + } = case expr of + EPrj (Rb.Variable (Prj Rb.Identifier {text, ann})) -> yield text P.CALL ann + EPrj (Rb.Variable (Prj Rb.Constant {text, ann})) -> yield text P.CALL ann -- TODO: Should yield Constant + EPrj Rb.ScopeResolution {name = EPrj Rb.Identifier {text, ann}} -> yield text P.CALL ann + EPrj Rb.ScopeResolution {name = EPrj Rb.Constant {text, ann}} -> yield text P.CALL ann -- TODO: Should yield Constant + EPrj Rb.Call {method} -> case method of + EPrj Rb.Identifier {text, ann} -> yield text P.CALL ann + EPrj Rb.Constant {text, ann} -> yield text P.CALL ann + EPrj Rb.Operator {text, ann} -> yield text P.CALL ann + _ -> gtags t + _ -> gtags t + where + yield name kind loc = yieldTag name kind P.REFERENCE loc byteRange >> gtags t + +instance ToTags Rb.Alias where + tags + t@Rb.Alias + { alias = Parse.Success (Rb.MethodName aliasExpr), + name = Parse.Success (Rb.MethodName nameExpr), + ann = Loc {byteRange} + } = do + case aliasExpr of + Prj Rb.Identifier {ann, text} -> yieldTag text P.FUNCTION P.DEFINITION ann byteRange + _ -> tags aliasExpr + case nameExpr of + Prj Rb.Identifier {ann, text} -> yieldTag text P.CALL P.REFERENCE ann byteRange + _ -> tags nameExpr + gtags t + tags _ = pure () + +instance ToTags Rb.Undef where + tags + t@Rb.Undef + { extraChildren, + ann = Loc {byteRange} + } = do + for_ extraChildren $ + \case + Parse.Success (Rb.MethodName expr) -> do + case expr of + Prj Rb.Identifier {ann, text} -> yieldTag text P.CALL P.REFERENCE ann byteRange + _ -> tags expr + Parse.Fail _ -> pure () + gtags t + + +introduceLocals :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Has (State [Text]) sig m + ) => + [ Parse.Err + ( (:+:) + Rb.BlockParameter + ( Rb.DestructuredParameter + :+: ( Rb.HashSplatParameter + :+: ( Rb.Identifier + :+: ( Rb.KeywordParameter + :+: (Rb.OptionalParameter :+: Rb.SplatParameter) + ) + ) + ) + ) + Loc + ) + ] -> + m () +introduceLocals params = for_ params $ \param -> case param of + EPrj Rb.BlockParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :) + EPrj Rb.DestructuredParameter {extraChildren} -> introduceLocals extraChildren + EPrj Rb.HashSplatParameter {name = Just (Parse.Success (Rb.Identifier {text = lvar}))} -> modify (lvar :) + EPrj Rb.Identifier {text = lvar} -> modify (lvar :) + EPrj Rb.KeywordParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :) + EPrj Rb.OptionalParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :) + EPrj Rb.SplatParameter {name = Just (Parse.Success (Rb.Identifier {text = lvar}))} -> modify (lvar :) + _ -> pure () + +instance ToTags Rb.MethodParameters where + tags t@Rb.MethodParameters {extraChildren} = introduceLocals extraChildren >> gtags t + +instance ToTags Rb.LambdaParameters where + tags t@Rb.LambdaParameters {extraChildren} = introduceLocals extraChildren >> gtags t + +instance ToTags Rb.BlockParameters where + tags t@Rb.BlockParameters {extraChildren} = introduceLocals extraChildren >> gtags t + +instance ToTags Rb.Assignment where + tags t@Rb.Assignment {left} = do + case left of + EPrj (Rb.Lhs (Prj (Rb.Variable (Prj Rb.Identifier {text})))) -> modify (text :) + EPrj Rb.LeftAssignmentList {extraChildren} -> introduceLhsLocals extraChildren + _ -> pure () + gtags t + where + introduceLhsLocals xs = for_ xs $ \x -> case x of + EPrj (Rb.Lhs (Prj (Rb.Variable (Prj Rb.Identifier {text})))) -> modify (text :) + EPrj Rb.DestructuredLeftAssignment {extraChildren} -> introduceLhsLocals extraChildren + EPrj Rb.RestAssignment {extraChildren = Just (Parse.Success (Rb.Lhs (Prj (Rb.Variable (Prj Rb.Identifier {text})))))} -> modify (text :) + _ -> pure () + +instance ToTags Rb.OperatorAssignment where + tags t@Rb.OperatorAssignment {left} = do + case left of + EPrj (Rb.Lhs (Prj (Rb.Variable (Prj Rb.Identifier {text})))) -> modify (text :) + _ -> pure () + gtags t + +gtags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Has (State [Text]) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () +gtags = traverse1_ @ToTags (const (pure ())) tags + + +-- instance ToTags Rb.Alias +instance ToTags Rb.Arg +instance ToTags Rb.ArgumentList +instance ToTags Rb.Array +-- instance ToTags Rb.Assignment +instance ToTags Rb.BareString +instance ToTags Rb.BareSymbol +instance ToTags Rb.Begin +instance ToTags Rb.BeginBlock +instance ToTags Rb.Binary +-- instance ToTags Rb.Block +instance ToTags Rb.BlockArgument +instance ToTags Rb.BlockParameter +-- instance ToTags Rb.BlockParameters +instance ToTags Rb.Break +instance ToTags Rb.Call +instance ToTags Rb.Case +instance ToTags Rb.ChainedString +instance ToTags Rb.Character +-- instance ToTags Rb.Class +instance ToTags Rb.ClassVariable +instance ToTags Rb.Complex +instance ToTags Rb.Conditional +instance ToTags Rb.Constant +instance ToTags Rb.DestructuredLeftAssignment +instance ToTags Rb.DestructuredParameter +instance ToTags Rb.Do +-- instance ToTags Rb.DoBlock +instance ToTags Rb.ElementReference +instance ToTags Rb.Else +-- instance ToTags Rb.Elsif +instance ToTags Rb.EmptyStatement +instance ToTags Rb.EndBlock +instance ToTags Rb.Ensure +instance ToTags Rb.EscapeSequence +instance ToTags Rb.ExceptionVariable +instance ToTags Rb.Exceptions +instance ToTags Rb.False +instance ToTags Rb.Float +instance ToTags Rb.For +instance ToTags Rb.GlobalVariable +instance ToTags Rb.Hash +instance ToTags Rb.HashSplatArgument +instance ToTags Rb.HashSplatParameter +instance ToTags Rb.HeredocBeginning +instance ToTags Rb.HeredocEnd +instance ToTags Rb.Identifier +-- instance ToTags Rb.If +instance ToTags Rb.IfModifier +instance ToTags Rb.In +instance ToTags Rb.InstanceVariable +instance ToTags Rb.Integer +instance ToTags Rb.Interpolation +instance ToTags Rb.KeywordParameter +-- instance ToTags Rb.Lambda +-- instance ToTags Rb.LambdaParameters +instance ToTags Rb.LeftAssignmentList +-- instance ToTags Rb.Lhs +-- instance ToTags Rb.Method +-- instance ToTags Rb.MethodCall +instance ToTags Rb.MethodName +-- instance ToTags Rb.MethodParameters +-- instance ToTags Rb.Module +instance ToTags Rb.Next +instance ToTags Rb.Nil +instance ToTags Rb.Operator +-- instance ToTags Rb.OperatorAssignment +instance ToTags Rb.OptionalParameter +instance ToTags Rb.Pair +instance ToTags Rb.ParenthesizedStatements +instance ToTags Rb.Pattern +instance ToTags Rb.Primary +instance ToTags Rb.Program +instance ToTags Rb.Range +instance ToTags Rb.Rational +instance ToTags Rb.Redo +-- instance ToTags Rb.Regex +instance ToTags Rb.Rescue +instance ToTags Rb.RescueModifier +instance ToTags Rb.RestAssignment +instance ToTags Rb.Retry +instance ToTags Rb.Return +instance ToTags Rb.RightAssignmentList +instance ToTags Rb.ScopeResolution +instance ToTags Rb.Self +instance ToTags Rb.Setter +-- instance ToTags Rb.SingletonClass +-- instance ToTags Rb.SingletonMethod +instance ToTags Rb.SplatArgument +instance ToTags Rb.SplatParameter +instance ToTags Rb.Statement +instance ToTags Rb.String +instance ToTags Rb.StringArray +-- instance ToTags Rb.Subshell +instance ToTags Rb.Super +instance ToTags Rb.Superclass +instance ToTags Rb.Symbol +instance ToTags Rb.SymbolArray +instance ToTags Rb.Then +instance ToTags Rb.True +instance ToTags Rb.Unary +-- instance ToTags Rb.Undef +instance ToTags Rb.Uninterpreted +-- instance ToTags Rb.Unless +instance ToTags Rb.UnlessModifier +-- instance ToTags Rb.Until +instance ToTags Rb.UntilModifier +instance ToTags Rb.Variable +instance ToTags Rb.When +-- instance ToTags Rb.While +instance ToTags Rb.WhileModifier +instance ToTags Rb.Yield diff --git a/semantic-ruby/test/PreciseTest.hs b/semantic-ruby/test/PreciseTest.hs new file mode 100644 index 0000000000..f1d0e5f036 --- /dev/null +++ b/semantic-ruby/test/PreciseTest.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-unused-imports #-} +module Main (main) where + +import AST.TestHelpers +import AST.Unmarshal +import Control.Concurrent +import qualified Language.Ruby.AST as Ruby +import System.IO +import qualified System.Path.Fixture as Fixture +import Test.Tasty +import TreeSitter.Ruby + +main :: IO () +main = do +#if BAZEL_BUILD + rf <- Fixture.create + let ?project = "external/tree-sitter-ruby" + ?runfiles = rf + let dirs = Fixture.absRelDir "test/corpus" +#else + dirs <- Ruby.getTestCorpusDir +#endif + readCorpusFiles' dirs + >>= traverse (testCorpus parse) + >>= defaultMain . tests + where parse = parseByteString @Ruby.Program @() tree_sitter_ruby + +tests :: [TestTree] -> TestTree +tests = testGroup "tree-sitter-ruby corpus tests" diff --git a/semantic-rust/BUILD.bazel b/semantic-rust/BUILD.bazel new file mode 100644 index 0000000000..91c0f35ee9 --- /dev/null +++ b/semantic-rust/BUILD.bazel @@ -0,0 +1,12 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "//:build/common.bzl", + "semantic_language_library", +) + +semantic_language_library( + name = "semantic-rust", + srcs = glob(["src/**/*.hs"]), + language = "rust", +) diff --git a/semantic-rust/LICENSE b/semantic-rust/LICENSE new file mode 100644 index 0000000000..b50625eb63 --- /dev/null +++ b/semantic-rust/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-rust/README.md b/semantic-rust/README.md new file mode 100644 index 0000000000..de578d6d4b --- /dev/null +++ b/semantic-rust/README.md @@ -0,0 +1,18 @@ +# Semantic support for Rust + +This package implements `semantic` support for [Rust](https://www.rust-lang.org/). + +## Generating AST + +``` +cd semantic-rust +cabal v2-repl +Ξ»> :seti -XOverloadedStrings +Ξ»> :seti -XTypeApplications +Ξ»> import Source.Span +Ξ»> import Source.Range +Ξ»> import AST.Unmarshal +Ξ»> TS.parseByteString @Language.Rust.AST.SourceFile @(Source.Span.Span, Source.Range.Range) Language.Rust.Grammar.tree_sitter_rust "let x = 1;" +Right (SourceFile {ann = (Span {start = Pos {line = 0, column = 0}, end = Pos {line = 0, column = 10}},Range {start = 0, end = 10}), extraChildren = [L1 (DeclarationStatement {getDeclarationStatement = R1 (L1 (L1 (R1 (LetDeclaration {ann = (Span {start = Pos {line = 0, column = 0}, end = Pos {line = 0, column = 10}},Range {start = 0, end = 10}), pattern = Pattern {getPattern = L1 (R1 (L1 (L1 (Identifier {ann = (Span {start = Pos {line = 0, column = 4}, end = Pos {line = 0, column = 5}},Range +{start = 4, end = 5}), text = "x"}))))}, value = Just (Expression {getExpression = L1 (L1 (L1 (L1 (L1 (Literal {getLiteral = R1 (L1 (IntegerLiteral {ann = (Span {start = Pos {line = 0, column = 8}, end = Pos {line = 0, column = 9}},Range {start = 8, end = 9}), text = "1"}))})))))}), type' = Nothing, extraChildren = Nothing}))))})]}) +``` diff --git a/semantic-rust/Setup.hs b/semantic-rust/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-rust/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-rust/semantic-rust.cabal b/semantic-rust/semantic-rust.cabal new file mode 100644 index 0000000000..e42ec2fe2f --- /dev/null +++ b/semantic-rust/semantic-rust.cabal @@ -0,0 +1,76 @@ +cabal-version: 2.4 + +name: semantic-rust +version: 0.0.0.0 +synopsis: Semantic support for Rust +description: Semantic support for Rust. +homepage: https://github.com/github/semantic/tree/master/semantic-rust#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors, Alexei Pastuchov +maintainer: opensource+semantic@github.com +copyright: (c) 2020 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + cpp-options: + -DBAZEL_BUILD=0 + +library + import: haskell + exposed-modules: + Language.Rust + Language.Rust.AST + Language.Rust.Grammar + Language.Rust.Tags + hs-source-dirs: src + build-depends: + , base >= 4.13 && < 5 + , fused-effects ^>= 1.1 + , semantic-ast + , semantic-source ^>= 0.2 + , semantic-tags ^>= 0.0 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3 + , tree-sitter ^>= 0.9 + , tree-sitter-rust ^>= 0.1.0.0 + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Test.hs + build-depends: + , base + , filepath + , semantic-ast + , semantic-rust + , tasty diff --git a/semantic-rust/src/Language/Rust.hs b/semantic-rust/src/Language/Rust.hs new file mode 100644 index 0000000000..baf32df4e9 --- /dev/null +++ b/semantic-rust/src/Language/Rust.hs @@ -0,0 +1,24 @@ +-- | Semantic functionality for Rust programs. +module Language.Rust +( Term(..) +, Language.Rust.Grammar.tree_sitter_rust +) where + +import Data.Proxy +import qualified Language.Rust.AST as Rust +import qualified Language.Rust.Tags as RustTags +import qualified Tags.Tagging.Precise as Tags +import qualified Language.Rust.Grammar (tree_sitter_rust) +import qualified AST.Unmarshal as TS + +newtype Term a = Term { getTerm :: Rust.SourceFile a } + +instance TS.SymbolMatching Term where + matchedSymbols _ = TS.matchedSymbols (Proxy :: Proxy Rust.SourceFile) + showFailure _ = TS.showFailure (Proxy :: Proxy Rust.SourceFile) + +instance TS.Unmarshal Term where + matchers = fmap (fmap (TS.hoist Term)) TS.matchers + +instance Tags.ToTags Term where + tags src = Tags.runTagging src . RustTags.tags . getTerm diff --git a/semantic-rust/src/Language/Rust/AST.hs b/semantic-rust/src/Language/Rust/AST.hs new file mode 100644 index 0000000000..87392fce02 --- /dev/null +++ b/semantic-rust/src/Language/Rust/AST.hs @@ -0,0 +1,31 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# OPTIONS_GHC -Wno-unused-imports #-} + +module Language.Rust.AST +( module Language.Rust.AST +, Rust.getTestCorpusDir +) where + +import AST.GenerateSyntax +import AST.Token +import Language.Haskell.TH.Syntax (runIO) +import qualified TreeSitter.Rust as Rust (getNodeTypesPath, getTestCorpusDir, tree_sitter_rust) + +#ifdef NODE_TYPES_PATH +astDeclarationsForLanguage Rust.tree_sitter_rust NODE_TYPES_PATH +#else +runIO Rust.getNodeTypesPath >>= astDeclarationsForLanguage Rust.tree_sitter_rust +#endif diff --git a/semantic-rust/src/Language/Rust/Grammar.hs b/semantic-rust/src/Language/Rust/Grammar.hs new file mode 100644 index 0000000000..4acfc69e94 --- /dev/null +++ b/semantic-rust/src/Language/Rust/Grammar.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} +module Language.Rust.Grammar +( tree_sitter_rust +, Grammar(..) +) where + +import AST.Grammar.TH +import Language.Haskell.TH +import TreeSitter.Rust (tree_sitter_rust) + +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData (mkName "Grammar") tree_sitter_rust diff --git a/semantic-rust/src/Language/Rust/Tags.hs b/semantic-rust/src/Language/Rust/Tags.hs new file mode 100644 index 0000000000..62b0d76bf9 --- /dev/null +++ b/semantic-rust/src/Language/Rust/Tags.hs @@ -0,0 +1,208 @@ +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +module Language.Rust.Tags +( ToTags(..) +) where + +import AST.Element +import AST.Token +import AST.Traversable1 +import Control.Effect.Reader +import Control.Effect.Writer +import qualified Language.Rust.AST as Rust +import Source.Loc +import Source.Source as Source +import Tags.Tag() +import qualified Tags.Tagging.Precise as Tags + +class ToTags t where + tags + :: ( Has (Reader Source) sig m + , Has (Writer Tags.Tags) sig m + ) + => t Loc + -> m () + default tags + :: ( Has (Reader Source) sig m + , Has (Writer Tags.Tags) sig m + , Traversable1 ToTags t + ) + => t Loc + -> m () + tags = gtags + +instance (ToTags l, ToTags r) => ToTags (l :+: r) where + tags (L1 l) = tags l + tags (R1 r) = tags r + +instance ToTags (Token sym n) where tags _ = pure () + +gtags + :: ( Has (Reader Source) sig m + , Has (Writer Tags.Tags) sig m + , Traversable1 ToTags t + ) + => t Loc + -> m () +gtags = traverse1_ @ToTags (const (pure ())) tags + +instance ToTags Rust.AbstractType +instance ToTags Rust.Arguments +instance ToTags Rust.ArrayExpression +instance ToTags Rust.ArrayType +instance ToTags Rust.AssignmentExpression +instance ToTags Rust.AssociatedType +instance ToTags Rust.AsyncBlock +instance ToTags Rust.AttributeItem +instance ToTags Rust.AwaitExpression +instance ToTags Rust.BaseFieldInitializer +instance ToTags Rust.BinaryExpression +instance ToTags Rust.Block +instance ToTags Rust.BlockComment +instance ToTags Rust.BooleanLiteral +instance ToTags Rust.BoundedType +instance ToTags Rust.BracketedType +instance ToTags Rust.BreakExpression +instance ToTags Rust.CallExpression +instance ToTags Rust.CapturedPattern +instance ToTags Rust.CharLiteral +instance ToTags Rust.ClosureExpression +instance ToTags Rust.ClosureParameters +instance ToTags Rust.CompoundAssignmentExpr +instance ToTags Rust.ConstItem +instance ToTags Rust.ConstParameter +instance ToTags Rust.ConstrainedTypeParameter +instance ToTags Rust.ContinueExpression +instance ToTags Rust.Crate +instance ToTags Rust.DeclarationList +instance ToTags Rust.DeclarationStatement +instance ToTags Rust.DynamicType +instance ToTags Rust.EmptyStatement +instance ToTags Rust.EmptyType +instance ToTags Rust.EnumItem +instance ToTags Rust.EnumVariant +instance ToTags Rust.EnumVariantList +instance ToTags Rust.EscapeSequence +instance ToTags Rust.Expression +instance ToTags Rust.ExternCrateDeclaration +instance ToTags Rust.ExternModifier +instance ToTags Rust.FieldDeclaration +instance ToTags Rust.FieldDeclarationList +instance ToTags Rust.FieldExpression +instance ToTags Rust.FieldIdentifier +instance ToTags Rust.FieldInitializer +instance ToTags Rust.FieldInitializerList +instance ToTags Rust.FieldPattern +instance ToTags Rust.FloatLiteral +instance ToTags Rust.ForExpression +instance ToTags Rust.ForLifetimes +instance ToTags Rust.ForeignModItem +instance ToTags Rust.FragmentSpecifier +instance ToTags Rust.FunctionItem +instance ToTags Rust.FunctionModifiers +instance ToTags Rust.FunctionSignatureItem +instance ToTags Rust.FunctionType +instance ToTags Rust.GenericFunction +instance ToTags Rust.GenericType +instance ToTags Rust.GenericTypeWithTurbofish +instance ToTags Rust.HigherRankedTraitBound +instance ToTags Rust.Identifier +instance ToTags Rust.IfExpression +instance ToTags Rust.IfLetExpression +instance ToTags Rust.ImplItem +instance ToTags Rust.IndexExpression +instance ToTags Rust.InnerAttributeItem +instance ToTags Rust.IntegerLiteral +instance ToTags Rust.LetDeclaration +instance ToTags Rust.Lifetime +instance ToTags Rust.LineComment +instance ToTags Rust.Literal +instance ToTags Rust.LiteralPattern +instance ToTags Rust.LoopExpression +instance ToTags Rust.LoopLabel +instance ToTags Rust.MacroDefinition +instance ToTags Rust.MacroInvocation +instance ToTags Rust.MacroRule +instance ToTags Rust.MatchArm +instance ToTags Rust.MatchBlock +instance ToTags Rust.MatchExpression +instance ToTags Rust.MatchPattern +instance ToTags Rust.MetaArguments +instance ToTags Rust.MetaItem +instance ToTags Rust.Metavariable +instance ToTags Rust.ModItem +instance ToTags Rust.MutPattern +instance ToTags Rust.MutableSpecifier +instance ToTags Rust.NegativeLiteral +instance ToTags Rust.OptionalTypeParameter +instance ToTags Rust.OrderedFieldDeclarationList +instance ToTags Rust.Parameter +instance ToTags Rust.Parameters +instance ToTags Rust.ParenthesizedExpression +instance ToTags Rust.Pattern +instance ToTags Rust.PointerType +instance ToTags Rust.PrimitiveType +instance ToTags Rust.QualifiedType +instance ToTags Rust.RangeExpression +instance ToTags Rust.RangePattern +instance ToTags Rust.RawStringLiteral +instance ToTags Rust.RefPattern +instance ToTags Rust.ReferenceExpression +instance ToTags Rust.ReferencePattern +instance ToTags Rust.ReferenceType +instance ToTags Rust.RemainingFieldPattern +instance ToTags Rust.RemovedTraitBound +instance ToTags Rust.ReturnExpression +instance ToTags Rust.ScopedIdentifier +instance ToTags Rust.ScopedTypeIdentifier +instance ToTags Rust.ScopedUseList +instance ToTags Rust.Self +instance ToTags Rust.SelfParameter +instance ToTags Rust.ShorthandFieldIdentifier +instance ToTags Rust.ShorthandFieldInitializer +instance ToTags Rust.SlicePattern +instance ToTags Rust.SourceFile +instance ToTags Rust.StaticItem +instance ToTags Rust.StringLiteral +instance ToTags Rust.StructExpression +instance ToTags Rust.StructItem +instance ToTags Rust.StructPattern +instance ToTags Rust.Super +instance ToTags Rust.TokenBindingPattern +instance ToTags Rust.TokenRepetition +instance ToTags Rust.TokenRepetitionPattern +instance ToTags Rust.TokenTree +instance ToTags Rust.TokenTreePattern +instance ToTags Rust.TraitBounds +instance ToTags Rust.TraitItem +instance ToTags Rust.TryExpression +instance ToTags Rust.TupleExpression +instance ToTags Rust.TuplePattern +instance ToTags Rust.TupleStructPattern +instance ToTags Rust.TupleType +instance ToTags Rust.Type +instance ToTags Rust.TypeArguments +instance ToTags Rust.TypeBinding +instance ToTags Rust.TypeCastExpression +instance ToTags Rust.TypeIdentifier +instance ToTags Rust.TypeItem +instance ToTags Rust.TypeParameters +instance ToTags Rust.UnaryExpression +instance ToTags Rust.UnionItem +instance ToTags Rust.UnitExpression +instance ToTags Rust.UnitType +instance ToTags Rust.UnsafeBlock +instance ToTags Rust.UseAsClause +instance ToTags Rust.UseDeclaration +instance ToTags Rust.UseList +instance ToTags Rust.UseWildcard +instance ToTags Rust.VariadicParameter +instance ToTags Rust.VisibilityModifier +instance ToTags Rust.WhereClause +instance ToTags Rust.WherePredicate +instance ToTags Rust.WhileExpression +instance ToTags Rust.WhileLetExpression diff --git a/semantic-rust/test/Test.hs b/semantic-rust/test/Test.hs new file mode 100644 index 0000000000..614bd3970c --- /dev/null +++ b/semantic-rust/test/Test.hs @@ -0,0 +1,36 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +module Main (main) where + +import AST.TestHelpers +import AST.Unmarshal (parseByteString) +import Control.Monad (liftM) +import qualified Language.Rust.AST as Rust +import Language.Rust.Grammar +import System.FilePath +import Test.Tasty + +main :: IO () +main = do +#if BAZEL_BUILD + rf <- Fixture.create + let ?project = "external/tree-sitter-python" + ?runfiles = rf + let dirs = Fixture.absRelDir "test/corpus" +#else + dirs <- Rust.getTestCorpusDir +#endif + + + excludeMacrosCorpus (readCorpusFiles' dirs) + >>= traverse (testCorpus parse) + >>= defaultMain . tests + where + parse = parseByteString @Rust.SourceFile @() tree_sitter_rust + excludeMacrosCorpus l = liftM (filter (f "expressions") ) l + where f p bn = p /= takeBaseName bn + +tests :: [TestTree] -> TestTree +tests = testGroup "tree-sitter-rust corpus tests" diff --git a/semantic-scope-graph/BUILD.bazel b/semantic-scope-graph/BUILD.bazel new file mode 100644 index 0000000000..d1c60951e3 --- /dev/null +++ b/semantic-scope-graph/BUILD.bazel @@ -0,0 +1,37 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_binary", + "haskell_library", +) +load( + "@rules_haskell//haskell:cabal.bzl", + "haskell_cabal_binary", + "haskell_cabal_library", +) +load( + "//:build/common.bzl", + "GHC_FLAGS", +) + +haskell_library( + name = "semantic-scope-graph", + srcs = glob(["src/**/*.hs"]), + compiler_flags = GHC_FLAGS + ["-XOverloadedStrings"], + deps = [ + "//:base", + "//:containers", + "//:text", + "//semantic-analysis", + "//semantic-source", + "@stackage//:aeson", + "@stackage//:algebraic-graphs", + "@stackage//:fused-effects", + "@stackage//:generic-lens", + "@stackage//:hashable", + "@stackage//:lens", + "@stackage//:pathtype", + "@stackage//:semilattices", + ], +) diff --git a/semantic-scope-graph/CHANGELOG.md b/semantic-scope-graph/CHANGELOG.md new file mode 100644 index 0000000000..15152ea8d7 --- /dev/null +++ b/semantic-scope-graph/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for semantic-scope-graph + +## 0.1.0.0 -- 2020-01-14 + +* First version. diff --git a/semantic-scope-graph/LICENSE b/semantic-scope-graph/LICENSE new file mode 100644 index 0000000000..b50625eb63 --- /dev/null +++ b/semantic-scope-graph/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-scope-graph/README.md b/semantic-scope-graph/README.md new file mode 100644 index 0000000000..cd87fdb4d5 --- /dev/null +++ b/semantic-scope-graph/README.md @@ -0,0 +1 @@ +This project contains scope-graphing mechanisms atop the ASTs provided by semantic. diff --git a/semantic-scope-graph/Setup.hs b/semantic-scope-graph/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-scope-graph/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-scope-graph/semantic-scope-graph.cabal b/semantic-scope-graph/semantic-scope-graph.cabal new file mode 100644 index 0000000000..6ab223a87f --- /dev/null +++ b/semantic-scope-graph/semantic-scope-graph.cabal @@ -0,0 +1,72 @@ +cabal-version: 2.4 + +name: semantic-scope-graph +version: 0.0.0.0 +synopsis: Scope Graph computation +description: Scope Graph computation for ASTs derived from tree-sitter grammars. +homepage: https://github.com/github/semantic/tree/master/semantic-scope-graph#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +library + exposed-modules: + Control.Carrier.Sketch.ScopeGraph + Control.Effect.ScopeGraph + Control.Effect.ScopeGraph.Properties.Declaration + Control.Effect.ScopeGraph.Properties.Function + Control.Effect.ScopeGraph.Properties.Reference + Scope.Graph.AdjacencyList + Scope.Graph.Convert + Scope.Info + Scope.Path + Scope.Reference + Scope.Scope + Scope.Types + Data.Hole + Data.Module + Data.ScopeGraph + build-depends: + , aeson + , base >= 4.13 && < 5 + , containers + , fused-effects ^>= 1.1 + , generic-lens + , hashable + , lens + , semantic-analysis + , semantic-source ^>= 0.2 + , semilattices + , text ^>= 1.2.3.1 + hs-source-dirs: src + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures diff --git a/semantic-scope-graph/src/Control/Carrier/Sketch/ScopeGraph.hs b/semantic-scope-graph/src/Control/Carrier/Sketch/ScopeGraph.hs new file mode 100644 index 0000000000..878c5bc9a1 --- /dev/null +++ b/semantic-scope-graph/src/Control/Carrier/Sketch/ScopeGraph.hs @@ -0,0 +1,56 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DerivingVia #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fprint-expanded-synonyms #-} + +-- | This carrier interprets the Sketch effect, keeping track of +-- the current scope and in-progress graph internally. +module Control.Carrier.Sketch.ScopeGraph + ( SketchC + , runSketch + , module Control.Effect.ScopeGraph + ) where + +import Analysis.Name (Name) +import qualified Analysis.Name as Name +import Control.Carrier.Fresh.Strict +import Control.Carrier.Reader +import Control.Carrier.State.Strict +import Control.Effect.ScopeGraph +import Data.Module (ModuleInfo) +import qualified Data.ScopeGraph as ScopeGraph +import Data.Semilattice.Lower +import Scope.Types + +type SketchC addr m + = StateC (ScopeGraph Name) + ( StateC Name + ( ReaderC (CurrentScope Name) + ( ReaderC ModuleInfo + ( FreshC m + )))) + +runSketch :: + (Functor m) + => ModuleInfo + -> SketchC Name m a + -> m (ScopeGraph Name, a) +runSketch info go + = evalFresh 0 + . runReader @ModuleInfo info + . runReader (CurrentScope rootname) + . evalState @Name rootname + . runState @(ScopeGraph Name) initialGraph + $ go + where + rootname = Name.nameI 0 + initialGraph = ScopeGraph.insertScope rootname lowerBound lowerBound diff --git a/semantic-scope-graph/src/Control/Effect/ScopeGraph.hs b/semantic-scope-graph/src/Control/Effect/ScopeGraph.hs new file mode 100644 index 0000000000..649deca4f0 --- /dev/null +++ b/semantic-scope-graph/src/Control/Effect/ScopeGraph.hs @@ -0,0 +1,187 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +-- | The ScopeGraph effect is used to build up a scope graph over +-- the lifetime of a monadic computation. The name is meant to evoke +-- physically sketching the hierarchical outline of a graph. +module Control.Effect.ScopeGraph + ( ScopeGraph + , ScopeGraphEff + , declare + -- Scope Manipulation + , currentScope + , newEdge + , newReference + , newScope + , withScope + , declareFunction + , declareMaybeName + , reference + , Has + ) where + +import Analysis.Name (Name) +import qualified Analysis.Name as Name +import Control.Algebra +import Control.Effect.Fresh +import Control.Effect.Reader +import Control.Lens +import Data.List.NonEmpty +import Data.Map.Strict (Map) +import qualified Data.Map.Strict as Map +import qualified Data.Module as Module +import qualified Data.ScopeGraph as ScopeGraph +import Data.Semilattice.Lower +import Data.Text (Text) +import GHC.Records +import qualified Scope.Reference as Reference +import Source.Span + +import Scope.Graph.AdjacencyList (ScopeGraph) +import qualified Scope.Graph.AdjacencyList as AdjacencyList +import Scope.Types + +import qualified Control.Effect.ScopeGraph.Properties.Declaration as Props +import qualified Control.Effect.ScopeGraph.Properties.Function as Props +import qualified Control.Effect.ScopeGraph.Properties.Reference as Props +import qualified Control.Effect.ScopeGraph.Properties.Reference as Props.Reference +import Control.Effect.State + +-- | Extract the 'Just' of a 'Maybe' in an 'Applicative' context or, given 'Nothing', run the provided action. +maybeM :: Applicative f => f a -> Maybe a -> f a +maybeM f = maybe f pure +{-# INLINE maybeM #-} + +type ScopeGraphEff sig m + = ( Has (State (ScopeGraph Name)) sig m + , Has (State Name) sig m + , Has (Reader Module.ModuleInfo) sig m + , Has Fresh sig m + , Has (Reader (CurrentScope Name)) sig m + , Has (Reader Module.ModuleInfo) sig m + ) + +graphInProgress :: ScopeGraphEff sig m => m (ScopeGraph Name) +graphInProgress = get + +currentScope :: ScopeGraphEff sig m => m (CurrentScope Name) +currentScope = ask + +withScope :: ScopeGraphEff sig m + => CurrentScope Name + -> m a + -> m a +withScope scope = local (const scope) + + +declare :: ScopeGraphEff sig m => Name -> Props.Declaration -> m () +declare n props = do + CurrentScope current <- currentScope + old <- graphInProgress + info <- ask + let Props.Declaration kind relation associatedScope span = props + let (new, _pos) = + ScopeGraph.declare + (ScopeGraph.Declaration n) + info + relation + ScopeGraph.Public + span + kind + associatedScope + current + old + put new + +-- | Establish a reference to a prior declaration. +reference :: forall sig m . ScopeGraphEff sig m => Text -> Text -> Props.Reference -> m () +reference n decl props = do + CurrentScope current <- currentScope + old <- graphInProgress + info <- ask + let new = + ScopeGraph.reference + (ScopeGraph.Reference (Name.name n)) + info + (Props.Reference.span props) + (Props.Reference.kind props) + (ScopeGraph.Declaration (Name.name decl)) + current + old + put new + +newScope :: forall sig m . ScopeGraphEff sig m => Map ScopeGraph.EdgeLabel [Name] -> m Name +newScope edges = do + old <- graphInProgress + name <- Name.gensym + let new = ScopeGraph.newScope name edges old + name <$ put new + +-- | Takes an edge label and a list of names and inserts an import edge to a hole. +newEdge :: ScopeGraphEff sig m => ScopeGraph.EdgeLabel -> NonEmpty Name -> m () +newEdge label address = do + CurrentScope current <- currentScope + old <- graphInProgress + let new = ScopeGraph.addImportEdge label (toList address) current old + put new + +lookupScope :: ScopeGraphEff sig m => Name -> m (ScopeGraph.Scope Name) +lookupScope address = maybeM undefined . ScopeGraph.lookupScope address =<< get + +-- | Inserts a reference. +newReference :: ScopeGraphEff sig m => Name -> Props.Reference -> m () +newReference name props = do + CurrentScope currentAddress <- currentScope + scope <- lookupScope currentAddress + + let refProps = Reference.ReferenceInfo (props ^. span_) (Props.Reference.kind props) lowerBound + insertRef' :: ScopeGraph.Path Name -> ScopeGraph.ScopeGraph Name -> ScopeGraph.ScopeGraph Name + insertRef' path scopeGraph = let + scope' = (ScopeGraph.insertReference (Reference.Reference name) lowerBound (Props.Reference.span props) (getField @"kind" props) path) scope + in + (ScopeGraph.insertScope currentAddress scope' scopeGraph) + scopeGraph <- get @(ScopeGraph.ScopeGraph Name) + case AdjacencyList.findPath (const Nothing) (ScopeGraph.Declaration name) currentAddress scopeGraph of + -- If a path to a declaration is found, insert a reference into the current scope. + Just path -> modify (insertRef' path) + -- If no path is found, insert a reference with a hole into the current scope. + Nothing -> + modify (ScopeGraph.insertScope + currentAddress + (ScopeGraph.newReference + (Reference.Reference name) + refProps + scope)) + +declareFunction :: forall sig m . ScopeGraphEff sig m => Maybe Name -> Props.Function -> m (Name, Name) +declareFunction name (Props.Function kind span) = do + CurrentScope currentScope' <- currentScope + let lexicalEdges = Map.singleton ScopeGraph.Lexical [ currentScope' ] + associatedScope <- newScope lexicalEdges + name' <- declareMaybeName name Props.Declaration + { Props.relation = ScopeGraph.Default + , Props.kind = kind + , Props.associatedScope = Just associatedScope + , Props.span = span + } + pure (name', associatedScope) + +declareMaybeName :: ScopeGraphEff sig m + => Maybe Name + -> Props.Declaration + -> m Name +declareMaybeName maybeName props@(Props.Declaration kind _ associatedScope span) = do + case maybeName of + Just name -> name <$ declare name props + _ -> do + name <- Name.gensym + name <$ declare name (Props.Declaration kind ScopeGraph.Gensym associatedScope span) diff --git a/semantic-scope-graph/src/Control/Effect/ScopeGraph/Properties/Declaration.hs b/semantic-scope-graph/src/Control/Effect/ScopeGraph/Properties/Declaration.hs new file mode 100644 index 0000000000..96ac1bc1cf --- /dev/null +++ b/semantic-scope-graph/src/Control/Effect/ScopeGraph/Properties/Declaration.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE TypeApplications #-} + +-- | The 'Declaration' record type is used by the 'Control.Effect.Sketch' module to keep +-- track of the parameters that need to be passed when establishing a new declaration. +-- That is to say, it is a record type primarily used for its selector names. +module Control.Effect.ScopeGraph.Properties.Declaration + ( Declaration (..) + ) where + +import Analysis.Name (Name) +import Data.Generics.Product (field) +import Data.ScopeGraph as ScopeGraph (Kind, Relation) +import GHC.Generics (Generic) +import Source.Span + +data Declaration = Declaration + { kind :: ScopeGraph.Kind + , relation :: ScopeGraph.Relation + , associatedScope :: Maybe Name + , span :: Span + } deriving Generic + +instance HasSpan Declaration where span_ = field @"span" diff --git a/semantic-scope-graph/src/Control/Effect/ScopeGraph/Properties/Function.hs b/semantic-scope-graph/src/Control/Effect/ScopeGraph/Properties/Function.hs new file mode 100644 index 0000000000..50d56356be --- /dev/null +++ b/semantic-scope-graph/src/Control/Effect/ScopeGraph/Properties/Function.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE TypeApplications #-} + +-- | The 'Function' record type is used by the 'Control.Effect.Sketch' module to keep +-- track of the parameters that need to be passed when establishing a new declaration. +-- That is to say, it is a record type primarily used for its selector names. +module Control.Effect.ScopeGraph.Properties.Function + ( Function (..) + ) where + +import Data.Generics.Product (field) +import qualified Data.ScopeGraph as ScopeGraph (Kind) +import GHC.Generics (Generic) +import Source.Span + +data Function = Function + { kind :: ScopeGraph.Kind + , span :: Span + } deriving Generic + +instance HasSpan Function where span_ = field @"span" diff --git a/semantic-scope-graph/src/Control/Effect/ScopeGraph/Properties/Reference.hs b/semantic-scope-graph/src/Control/Effect/ScopeGraph/Properties/Reference.hs new file mode 100644 index 0000000000..c713792316 --- /dev/null +++ b/semantic-scope-graph/src/Control/Effect/ScopeGraph/Properties/Reference.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE TypeApplications #-} + +-- | The 'Declaration' record type is used by the 'Control.Effect.Sketch' module to keep +-- track of the parameters that need to be passed when establishing a new reference. +-- It is currently unused, but will possess more fields in the future as scope graph +-- functionality is enhanced. +module Control.Effect.ScopeGraph.Properties.Reference + ( Reference (..) + ) where + +import Control.Lens +import Data.ScopeGraph as ScopeGraph (Kind, Relation) +import GHC.Generics (Generic) +import Prelude hiding (span) +import Source.Span + +data Reference = Reference + { kind :: ScopeGraph.Kind + , relation :: ScopeGraph.Relation + , span :: Span + } deriving (Generic, Show) + +instance HasSpan Reference where + span_ = lens span (\r s -> r { span = s }) + {-# INLINE span_ #-} diff --git a/semantic-scope-graph/src/Data/Hole.hs b/semantic-scope-graph/src/Data/Hole.hs new file mode 100644 index 0000000000..e547b6174d --- /dev/null +++ b/semantic-scope-graph/src/Data/Hole.hs @@ -0,0 +1,6 @@ +module Data.Hole + ( AbstractHole (..) + ) where + +class AbstractHole a where + hole :: a diff --git a/semantic-scope-graph/src/Data/Module.hs b/semantic-scope-graph/src/Data/Module.hs new file mode 100644 index 0000000000..196eb29451 --- /dev/null +++ b/semantic-scope-graph/src/Data/Module.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} +module Data.Module +( Module(..) +, ModulePath +, ModuleInfo(..) +, moduleInfoFromSrcLoc +, moduleInfoFromCallStack +) where + +import Data.Functor.Classes +import Data.Maybe +import Data.Semilattice.Lower +import Data.Text (Text) +import GHC.Stack + +data Module body = Module { moduleInfo :: ModuleInfo, moduleBody :: body } + deriving (Eq, Foldable, Functor, Ord, Traversable) + +instance Show body => Show (Module body) where + showsPrec d Module{..} = showsBinaryWith showsPrec showsPrec "Module" d (modulePath moduleInfo) moduleBody + + +type ModulePath = FilePath + +data ModuleInfo = ModuleInfo { modulePath :: ModulePath, moduleLanguage :: Text, moduleOid :: Text } + deriving (Eq, Ord) + +instance Lower ModuleInfo where + lowerBound = ModuleInfo "" "Unknown" mempty + +instance Show ModuleInfo where + showsPrec d = showsUnaryWith showsPrec "ModuleInfo" d . modulePath + +moduleInfoFromSrcLoc :: SrcLoc -> ModuleInfo +moduleInfoFromSrcLoc loc = ModuleInfo (srcLocModule loc) "Unknown" mempty + +-- | Produce 'ModuleInfo' from the top location on the Haskell call stack (i.e. the file where the call to 'moduleInfoFromCallStack' was made). +moduleInfoFromCallStack :: HasCallStack => ModuleInfo +moduleInfoFromCallStack = maybe (ModuleInfo "?" "Unknown" mempty) (moduleInfoFromSrcLoc . snd) (listToMaybe (getCallStack callStack)) diff --git a/semantic-scope-graph/src/Data/ScopeGraph.hs b/semantic-scope-graph/src/Data/ScopeGraph.hs new file mode 100644 index 0000000000..e85e3931bc --- /dev/null +++ b/semantic-scope-graph/src/Data/ScopeGraph.hs @@ -0,0 +1,13 @@ +module Data.ScopeGraph + ( module Scope.Info + , module Scope.Path + , module Scope.Scope + , module Scope.Types + , module Scope.Graph.AdjacencyList + ) where + +import Scope.Graph.AdjacencyList +import Scope.Info +import Scope.Path +import Scope.Scope +import Scope.Types diff --git a/semantic-scope-graph/src/Scope/Graph/AdjacencyList.hs b/semantic-scope-graph/src/Scope/Graph/AdjacencyList.hs new file mode 100644 index 0000000000..992833c934 --- /dev/null +++ b/semantic-scope-graph/src/Scope/Graph/AdjacencyList.hs @@ -0,0 +1,255 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TupleSections #-} +module Scope.Graph.AdjacencyList + ( module Scope.Graph.AdjacencyList + ) where + +import Analysis.Name +import Control.Applicative +import Control.Monad +import Data.Bifunctor +import Data.Foldable +import Data.List.NonEmpty (NonEmpty) +import qualified Data.List.NonEmpty as NonEmpty +import Data.Map.Strict (Map) +import qualified Data.Map.Strict as Map +import Data.Maybe +import Data.Module +import Data.Monoid +import Data.Semilattice.Lower +import Data.Sequence (Seq) +import qualified Data.Sequence as Seq +import Data.Set (Set) +import qualified Data.Set as Set +import Scope.Info +import Scope.Path +import Scope.Reference +import Scope.Scope +import Scope.Types +import Source.Span + +newtype ScopeGraph scope = ScopeGraph { unScopeGraph :: Map scope (Scope scope) } + deriving (Eq, Ord, Show) + +instance Ord scope => Lower (ScopeGraph scope) where + lowerBound = ScopeGraph mempty + +-- Returns the reference paths of a scope in a scope graph. +pathsOfScope :: Ord scope => scope -> ScopeGraph scope -> Maybe (Map Reference ([ReferenceInfo], Path scope)) +pathsOfScope scope = fmap references . Map.lookup scope . unScopeGraph + +-- Returns the declaration data of a scope in a scope graph. +ddataOfScope :: Ord scope => scope -> ScopeGraph scope -> Maybe (Seq (Info scope)) +ddataOfScope scope = fmap declarations . Map.lookup scope . unScopeGraph + +-- Returns the edges of a scope in a scope graph. +linksOfScope :: Ord scope => scope -> ScopeGraph scope -> Maybe (Map EdgeLabel [scope]) +linksOfScope scope = fmap edges . Map.lookup scope . unScopeGraph + +declarationsByAccessControl :: Ord scope => scope -> AccessControl -> ScopeGraph scope -> [ Info scope ] +declarationsByAccessControl scope accessControl g = fromMaybe mempty $ do + dataSeq <- ddataOfScope scope g + pure . toList $ Seq.filter (\Info{..} -> accessControl <= infoAccessControl) dataSeq + +declarationsByRelation :: Ord scope => scope -> Relation -> ScopeGraph scope -> [ Info scope ] +declarationsByRelation scope relation g = fromMaybe mempty $ do + dataSeq <- ddataOfScope scope g + pure . toList $ Seq.filter (\Info{..} -> infoRelation == relation) dataSeq + +declarationByName :: Ord scope => scope -> Declaration -> ScopeGraph scope -> Maybe (Info scope) +declarationByName scope name g = do + dataSeq <- ddataOfScope scope g + find (\Info{..} -> infoDeclaration == name) dataSeq + +-- Lookup a scope in the scope graph. +lookupScope :: Ord scope => scope -> ScopeGraph scope -> Maybe (Scope scope) +lookupScope scope = Map.lookup scope . unScopeGraph + +-- Declare a declaration with a span and an associated scope in the scope graph. +-- TODO: Return the whole value in Maybe or Either. +declare :: Ord scope + => Declaration + -> ModuleInfo + -> Relation + -> AccessControl + -> Span + -> Kind + -> Maybe scope + -> scope + -> ScopeGraph scope + -> (ScopeGraph scope, Maybe Position) +declare decl moduleInfo rel accessControl declSpan kind assocScope currentScope g = fromMaybe (g, Nothing) $ do + scope <- lookupScope currentScope g + dataSeq <- ddataOfScope currentScope g + case Seq.findIndexR (\Info{..} -> decl == infoDeclaration && declSpan == infoSpan && rel == infoRelation) dataSeq of + Just index -> pure (g, Just (Position index)) + Nothing -> do + let newScope = scope { declarations = declarations scope Seq.|> Info decl moduleInfo rel accessControl declSpan kind assocScope } + pure (insertScope currentScope newScope g, Just (Position (length (declarations newScope)))) + +-- | Add a reference to a declaration in the scope graph. +-- Returns the original scope graph if the declaration could not be found. +reference :: Ord scope => Reference -> ModuleInfo -> Span -> Kind -> Declaration -> scope -> ScopeGraph scope -> ScopeGraph scope +reference ref moduleInfo span kind decl currentAddress g = fromMaybe g $ do + -- Start from the current address + currentScope' <- lookupScope currentAddress g + -- Build a path up to the declaration + flip (insertScope currentAddress) g . flip (insertReference ref moduleInfo span kind) currentScope' <$> findPath (const Nothing) decl currentAddress g + +-- | Insert a reference into the given scope by constructing a resolution path to the declaration within the given scope graph. +insertImportReference :: Ord address => Reference -> ModuleInfo -> Span -> Kind -> Declaration -> address -> ScopeGraph address -> Scope address -> Maybe (Scope address) +insertImportReference ref moduleInfo span kind decl currentAddress g scope = flip (insertReference ref moduleInfo span kind) scope . EPath Import currentAddress <$> findPath (const Nothing) decl currentAddress g + +lookupScopePath :: Ord scopeAddress => Name -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Path scopeAddress) +lookupScopePath declaration currentAddress g = findPath (flip (lookupReference declaration) g) (Declaration declaration) currentAddress g + +findPath :: Ord scopeAddress => (scopeAddress -> Maybe (Path scopeAddress)) -> Declaration -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Path scopeAddress) +findPath extra decl currentAddress g = snd <$> getFirst (foldGraph combine currentAddress g) + where combine address path = fmap (address, ) + $ First (pathToDeclaration decl address g) + <> First (extra address) + <> (uncurry (EPath Superclass) <$> path Superclass) + <> (uncurry (EPath Import) <$> path Import) + <> (uncurry (EPath Export) <$> path Export) + <> (uncurry (EPath Lexical) <$> path Lexical) + +foldGraph :: (Ord scopeAddress, Monoid a) => (scopeAddress -> (EdgeLabel -> a) -> a) -> scopeAddress -> ScopeGraph scopeAddress -> a +foldGraph combine address graph = go lowerBound address + where go visited address + | address `Set.notMember` visited + , Just edges <- linksOfScope address graph = combine address (recur edges) + | otherwise = mempty + where visited' = Set.insert address visited + recur edges edge = maybe mempty (foldMap (go visited')) (Map.lookup edge edges) + +pathToDeclaration :: Ord scopeAddress => Declaration -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Path scopeAddress) +pathToDeclaration decl address g = DPath decl . snd <$> lookupDeclaration (unDeclaration decl) address g + +insertReference :: Reference -> ModuleInfo -> Span -> Kind -> Path scopeAddress -> Scope scopeAddress -> Scope scopeAddress +insertReference ref moduleInfo span kind path scope = scope { references = Map.alter (\case + Nothing -> pure ([ ReferenceInfo span kind moduleInfo ], path) + Just (refInfos, path) -> pure (ReferenceInfo span kind moduleInfo : refInfos, path)) ref (references scope) } + +-- | Adds a reference and a Hole path to the given scope. +newReference :: Reference -> ReferenceInfo -> Scope scopeAddress -> Scope scopeAddress +newReference ref info scope = scope { references = Map.alter (\case + Nothing -> pure ([ info ], Hole) + Just (refInfos, path) -> pure (info : refInfos, path)) ref (references scope) } + +lookupDeclaration :: Ord scopeAddress => Name -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Info scopeAddress, Position) +lookupDeclaration name scope g = do + dataSeq <- ddataOfScope scope g + index <- Seq.findIndexR (\Info{..} -> Declaration name == infoDeclaration) dataSeq + (, Position index) <$> Seq.lookup index dataSeq + +declarationNames :: Ord address => [EdgeLabel] -> Scope address -> ScopeGraph address -> Set Declaration +declarationNames edgeLabels scope scopeGraph = localDeclarations <> edgeNames + where addresses = join (Map.elems $ Map.restrictKeys (edges scope) (Set.fromList edgeLabels)) + edgeNames = flip foldMap addresses $ \address -> maybe mempty (flip (declarationNames edgeLabels) scopeGraph) (lookupScope address scopeGraph) + localDeclarations = Set.fromList . toList . fmap infoDeclaration $ declarations scope + + +putDeclarationScopeAtPosition :: Ord scopeAddress => scopeAddress -> Position -> Maybe scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress +putDeclarationScopeAtPosition scope position assocScope g@(ScopeGraph graph) = fromMaybe g $ do + dataSeq <- ddataOfScope scope g + let seq = Seq.adjust' (\Info{..} -> Info { infoAssociatedScope = assocScope, .. }) (unPosition position) dataSeq + pure $ ScopeGraph (Map.adjust (\s -> s { declarations = seq }) scope graph) + +-- | Lookup a reference by traversing the paths of a given scope and return a Maybe (Path address) +lookupReference :: Ord address => Name -> address -> ScopeGraph address -> Maybe (Path address) +lookupReference name scope g = fmap snd . Map.lookup (Reference name) =<< pathsOfScope scope g + +insertEdge :: Ord scopeAddress => EdgeLabel -> scopeAddress -> scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress +insertEdge label target currentAddress g@(ScopeGraph graph) = fromMaybe g $ do + currentScope' <- lookupScope currentAddress g + scopes <- maybe (Just mempty) pure (Map.lookup label (edges currentScope')) + let newScope = currentScope' { edges = Map.insert label (target : scopes) (edges currentScope') } + pure (ScopeGraph (Map.insert currentAddress newScope graph)) + +insertEdges :: Ord scopeAddress => NonEmpty EdgeLabel -> scopeAddress -> scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress +insertEdges labels target currentAddress g = + foldr (\label graph -> insertEdge label target currentAddress graph) g labels + +-- | Add an import edge of the form 'a -> Import -> b -> Import -> c' or creates intermediate void scopes of the form +-- 'a -> Void -> b -> Import -> c' if the given scopes cannot be found. +addImportEdge :: Ord scopeAddress => EdgeLabel -> [scopeAddress] -> scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress +addImportEdge edge importEdge currentAddress g = do + case importEdge of + [] -> g + (name:[]) -> maybe + (addImportHole edge name currentAddress g) + (const (insertEdge edge name currentAddress g)) + (lookupScope name g) + (name:names) -> let + scopeGraph' = maybe + (addImportHole edge name currentAddress g) + (const (insertEdge edge name currentAddress g)) + (lookupScope name g) + in + addImportEdge edge names name scopeGraph' + +addImportHole :: Ord scopeAddress => EdgeLabel -> scopeAddress -> scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress +addImportHole edge name currentAddress g = let + scopeGraph' = newScope name mempty g + in + insertEdges (NonEmpty.fromList [Void, edge]) name currentAddress scopeGraph' + + +-- | Update the 'Scope' containing a 'Declaration' with an associated scope address. +-- Returns an unmodified 'ScopeGraph' if the 'Declaration' cannot be found with the given scope address. +insertDeclarationScope :: Ord scopeAddress => Declaration -> scopeAddress -> scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress +insertDeclarationScope Declaration{..} associatedScopeAddress scopeAddress g = fromMaybe g $ do + declScopeAddress <- pathDeclarationScope scopeAddress =<< lookupScopePath unDeclaration scopeAddress g + scope <- lookupScope declScopeAddress g + (declInfo, position) <- second unPosition <$> lookupDeclaration unDeclaration declScopeAddress g + pure $ insertScope declScopeAddress (scope { declarations = Seq.update position (declInfo { infoAssociatedScope = Just associatedScopeAddress }) (declarations scope) }) g + +-- | Insert a declaration span into the declaration in the scope graph. +insertDeclarationSpan :: Ord scopeAddress => Declaration -> Span -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress +insertDeclarationSpan decl@Declaration{..} span g = fromMaybe g $ do + declScopeAddress <- scopeOfDeclaration decl g + (declInfo, position) <- second unPosition <$> lookupDeclaration unDeclaration declScopeAddress g + scope <- lookupScope declScopeAddress g + pure $ insertScope declScopeAddress (scope { declarations = Seq.update position (declInfo { infoSpan = span }) (declarations scope) }) g + +-- | Insert a new scope with the given address and edges into the scope graph. +newScope :: Ord address => address -> Map EdgeLabel [address] -> ScopeGraph address -> ScopeGraph address +newScope address edges = insertScope address (Scope edges mempty mempty Standard) + +-- | Insert a new scope with the given address and edges into the scope graph. +newPreludeScope :: Ord address => address -> Map EdgeLabel [address] -> ScopeGraph address -> ScopeGraph address +newPreludeScope address edges = insertScope address (Scope edges mempty mempty Preluded) + +insertScope :: Ord address => address -> Scope address -> ScopeGraph address -> ScopeGraph address +insertScope address scope = ScopeGraph . Map.insert address scope . unScopeGraph + +-- | Returns the scope of a reference in the scope graph. +scopeOfRef :: Ord scope => Reference -> ScopeGraph scope -> Maybe scope +scopeOfRef ref g@(ScopeGraph graph) = go (Map.keys graph) + where + go (s : scopes') = fromMaybe (go scopes') $ do + pathMap <- pathsOfScope s g + _ <- Map.lookup ref pathMap + pure (Just s) + go [] = Nothing + +-- | Returns the path of a reference in the scope graph. +pathOfRef :: (Ord scope) => Reference -> ScopeGraph scope -> Maybe (Path scope) +pathOfRef ref graph = do + scope <- scopeOfRef ref graph + pathsMap <- pathsOfScope scope graph + snd <$> Map.lookup ref pathsMap + +-- Returns the scope the declaration was declared in. +scopeOfDeclaration :: Ord scope => Declaration -> ScopeGraph scope -> Maybe scope +scopeOfDeclaration Declaration{..} g@(ScopeGraph graph) = go (Map.keys graph) + where + go = foldr (\ scope -> (scope <$ lookupDeclaration unDeclaration scope g <|>)) Nothing + +-- | Returns the scope associated with a declaration (the child scope if any exists). +associatedScope :: Ord scope => Declaration -> ScopeGraph scope -> Maybe scope +associatedScope Declaration{..} g@(ScopeGraph graph) = go (Map.keys graph) + where + go = foldr lookupAssociatedScope Nothing + lookupAssociatedScope scope = ((lookupDeclaration unDeclaration scope g >>= infoAssociatedScope . fst) <|>) diff --git a/semantic-scope-graph/src/Scope/Graph/Convert.hs b/semantic-scope-graph/src/Scope/Graph/Convert.hs new file mode 100644 index 0000000000..96b5dceaa9 --- /dev/null +++ b/semantic-scope-graph/src/Scope/Graph/Convert.hs @@ -0,0 +1,45 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE ExistentialQuantification #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +module Scope.Graph.Convert + ( ToScopeGraph (..) + , Result (..) + , todo + , complete + ) where + +import Control.Effect.ScopeGraph +import Data.List.NonEmpty +import Data.Typeable +import Source.Loc + +class Typeable t => ToScopeGraph t where + scopeGraph :: + ( ScopeGraphEff sig m + ) + => t Loc + -> m Result + +data Result + = Complete + | Todo (NonEmpty String) + deriving (Eq, Show, Ord) + +instance Semigroup Result where + Complete <> Complete = Complete + Todo a <> Todo b = Todo (a <> b) + a <> Complete = a + Complete <> a = a + +instance Monoid Result where mempty = Complete + +todo :: (Show a, Applicative m) => a -> m Result +todo = pure . Todo . pure . show + +complete :: Applicative m => m Result +complete = pure Complete diff --git a/semantic-scope-graph/src/Scope/Info.hs b/semantic-scope-graph/src/Scope/Info.hs new file mode 100644 index 0000000000..5f41f34cfb --- /dev/null +++ b/semantic-scope-graph/src/Scope/Info.hs @@ -0,0 +1,61 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +module Scope.Info + ( Info (..) + , Declaration (..) + , formatDeclaration + , Relation (..) + , Kind (..) + , AccessControl (..) + ) where + +import Analysis.Name +import Data.Generics.Product (field) +import Data.Hole +import Data.Module +import Data.Semilattice.Lower +import Data.Text (Text) +import GHC.Generics (Generic) +import Scope.Types +import Source.Span + +data Info scopeAddress = Info + { infoDeclaration :: Declaration + , infoModule :: ModuleInfo + , infoRelation :: Relation + , infoAccessControl :: AccessControl + , infoSpan :: Span + , infoKind :: Kind + , infoAssociatedScope :: Maybe scopeAddress + } deriving (Eq, Show, Ord, Generic) + +instance HasSpan (Info scopeAddress) where + span_ = field @"infoSpan" + {-# INLINE span_ #-} + +instance Lower (Info scopeAddress) where + lowerBound = Info lowerBound lowerBound lowerBound Public (point (Pos 0 0)) lowerBound Nothing + +instance AbstractHole (Info address) where + hole = lowerBound + +newtype Declaration = Declaration { unDeclaration :: Name } + deriving (Eq, Ord, Show) + +instance Lower Declaration where + lowerBound = Declaration $ name "" + +formatDeclaration :: Declaration -> Text +formatDeclaration = formatName . unDeclaration + + +data Relation = Default | Instance | Prelude | Gensym + deriving (Bounded, Enum, Eq, Show, Ord) + +instance Lower Relation where + lowerBound = Default + + diff --git a/semantic-scope-graph/src/Scope/Path.hs b/semantic-scope-graph/src/Scope/Path.hs new file mode 100644 index 0000000000..a39e0ae004 --- /dev/null +++ b/semantic-scope-graph/src/Scope/Path.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE DeriveFunctor #-} +module Scope.Path + ( Path (..) + , pathDeclaration + , pathDeclarationScope + , pathPosition + ) where + +import Data.Hole +import Scope.Info +import Scope.Types + +data Path scope + = Hole + -- | Construct a direct path to a declaration. + | DPath Declaration Position + -- | Construct an edge from a scope to another declaration path. + | EPath EdgeLabel scope (Path scope) + deriving (Eq, Functor, Ord, Show) + +instance AbstractHole (Path scope) where + hole = Hole + +-- Returns the declaration of a path. +pathDeclaration :: Path scope -> Declaration +pathDeclaration (DPath d _) = d +pathDeclaration (EPath _ _ p) = pathDeclaration p +pathDeclaration Hole = undefined + +-- TODO: Store the current scope closer _in_ the DPath? +pathDeclarationScope :: scope -> Path scope -> Maybe scope +pathDeclarationScope _ (EPath _ scope (DPath _ _)) = Just scope +pathDeclarationScope currentScope (EPath _ _ p) = pathDeclarationScope currentScope p +pathDeclarationScope currentScope (DPath _ _) = Just currentScope +pathDeclarationScope _ Hole = Nothing + +-- TODO: Possibly return in Maybe since we can have Hole paths +pathPosition :: Path scope -> Position +pathPosition Hole = Position 0 +pathPosition (DPath _ p) = p +pathPosition (EPath _ _ p) = pathPosition p diff --git a/semantic-scope-graph/src/Scope/Reference.hs b/semantic-scope-graph/src/Scope/Reference.hs new file mode 100644 index 0000000000..2b267f9c3b --- /dev/null +++ b/semantic-scope-graph/src/Scope/Reference.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE OverloadedStrings #-} +module Scope.Reference + ( ReferenceInfo (..) + , Reference (..) + ) where + +import Analysis.Name +import Control.Lens (lens) +import Data.Module +import Data.Semilattice.Lower +import Scope.Types +import Source.Span + +data ReferenceInfo = ReferenceInfo + { refSpan :: Span + , refKind :: Kind + , refModule :: ModuleInfo + } deriving (Eq, Show, Ord) + +instance HasSpan ReferenceInfo where + span_ = lens refSpan (\r s -> r { refSpan = s }) + {-# INLINE span_ #-} + +newtype Reference = Reference { unReference :: Name } + deriving (Eq, Ord, Show) + +instance Lower Reference where + lowerBound = Reference $ name "" diff --git a/semantic-scope-graph/src/Scope/Scope.hs b/semantic-scope-graph/src/Scope/Scope.hs new file mode 100644 index 0000000000..8d4947c610 --- /dev/null +++ b/semantic-scope-graph/src/Scope/Scope.hs @@ -0,0 +1,30 @@ +{-# LANGUAGE OverloadedStrings #-} +module Scope.Scope + ( Scope (..) + , Reference (..) + , ReferenceInfo (..) + , Domain (..) + ) where + +import Data.Hole +import Data.Map.Strict (Map) +import Data.Semilattice.Lower +import Data.Sequence (Seq) +import Scope.Info +import Scope.Path +import Scope.Reference +import Scope.Types + +-- Offsets and frame addresses in the heap should be addresses? +data Scope address = Scope + { edges :: Map EdgeLabel [address] + , references :: Map Reference ([ReferenceInfo], Path address) + , declarations :: Seq (Info address) + , domain :: Domain + } deriving (Eq, Show, Ord) + +instance Lower (Scope scopeAddress) where + lowerBound = Scope mempty mempty mempty Standard + +instance AbstractHole (Scope scopeAddress) where + hole = lowerBound diff --git a/semantic-scope-graph/src/Scope/Types.hs b/semantic-scope-graph/src/Scope/Types.hs new file mode 100644 index 0000000000..832e1dd9d4 --- /dev/null +++ b/semantic-scope-graph/src/Scope/Types.hs @@ -0,0 +1,101 @@ +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +module Scope.Types + ( Slot (..) + , EdgeLabel (..) + , Position (..) + , Domain (..) + , Kind (..) + , AccessControl (..) + -- * Identificatory newtypes + , CurrentScope (..) + ) where + +import Data.Aeson (ToJSON) +import Data.Hashable +import Data.Hole +import Data.Semilattice.Lower +import GHC.Generics (Generic) + +-- A slot is a location in the heap where a value is stored. +data Slot address = Slot { frameAddress :: address, position :: Position } + deriving (Eq, Show, Ord) + +instance AbstractHole address => AbstractHole (Slot address) where + hole = Slot hole (Position 0) + + +-- | The type of edge from a scope to its parent scopes. +-- Either a lexical edge or an import edge in the case of non-lexical edges. +data EdgeLabel = Lexical | Import | Export | Superclass | Void + deriving (Bounded, Enum, Eq, Ord, Show) + + +newtype Position = Position { unPosition :: Int } + deriving (Eq, Show, Ord) + + +data Domain + = Standard + | Preluded + deriving (Eq, Show, Ord) + + +data Kind = AbstractClass + | Assignment + | Call + | Class + | DefaultExport + | Function + | Identifier + | Let + | MemberAccess + | Method + | Module + | New + | Parameter + | PublicField + | QualifiedAliasedImport + | QualifiedExport + | QualifiedImport + | RequiredParameter + | This + | TypeAlias + | TypeIdentifier + | Unknown + | UnqualifiedImport + | VariableDeclaration + deriving (Bounded, Enum, Eq, Show, Ord) + +instance Lower Kind where + lowerBound = Unknown + + +data AccessControl = Public + | Protected + | Private + deriving (Bounded, Enum, Eq, Generic, Hashable, ToJSON, Show) + +-- | The Ord AccessControl instance represents an order specification of AccessControls. +-- AccessControls that are less than or equal to another AccessControl implies access. +-- It is helpful to consider `Public <= Private` as saying "Can a Public syntax term access a Private syntax term?" +-- In this way, Public AccessControl is the top of the order specification, and Private AccessControl is the bottom. +instance Ord AccessControl where + -- | Private AccessControl represents the least overlap or accessibility with other AccessControls. + -- When asking if the AccessControl "on the left" is less than the AccessControl "on the right", Private AccessControl on the left always implies access to the thing on the right. + (<=) Private _ = True + (<=) _ Private = False + + -- | Protected AccessControl is in between Private and Public in the order specification. + -- Protected AccessControl "on the left" has access to Protected or Public AccessControls "on the right". + (<=) Protected Public = True + (<=) Protected Protected = True + + -- | Public AccessControl "on the left" has access only to Public AccessControl "on the right". + (<=) Public Public = True + (<=) Public _ = False + +-- | A newtype indicating that the wrapped datum represents a parent scope +-- in some contextual computation. +newtype CurrentScope address = CurrentScope { unCurrentScope :: address } + diff --git a/semantic-source/BUILD.bazel b/semantic-source/BUILD.bazel new file mode 100644 index 0000000000..aca9f16210 --- /dev/null +++ b/semantic-source/BUILD.bazel @@ -0,0 +1,51 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_library", + "haskell_test", +) +load( + "@rules_haskell//haskell:cabal.bzl", + "haskell_cabal_binary", + "haskell_cabal_library", +) +load( + "//:build/common.bzl", + "EXECUTABLE_FLAGS", + "GHC_FLAGS", +) + +haskell_library( + name = "semantic-source", + srcs = glob(["src/**/*.hs"]), + compiler_flags = GHC_FLAGS + ["-XOverloadedStrings"], + deps = [ + "//:base", + "//:bytestring", + "//:containers", + "//:deepseq", + "//:filepath", + "//:text", + "@stackage//:lingo", + "@stackage//:aeson", + "@stackage//:hashable", + "@stackage//:pathtype", + "@stackage//:semilattices", + ], +) + +haskell_test( + name = "test", + srcs = glob(["test/**/*.hs"]), + compiler_flags = GHC_FLAGS + EXECUTABLE_FLAGS, + deps = [ + ":semantic-source", + "//:base", + "//:text", + "@stackage//:hedgehog", + "@stackage//:tasty", + "@stackage//:tasty-hedgehog", + "@stackage//:tasty-hunit", + ], +) diff --git a/semantic-source/CHANGELOG.md b/semantic-source/CHANGELOG.md new file mode 100644 index 0000000000..c48da20903 --- /dev/null +++ b/semantic-source/CHANGELOG.md @@ -0,0 +1,42 @@ +# 0.2.0.1 + +- Support ghc 9.4. + + +# 0.2.0.0 + +- Finds languages for `FilePath`s. +- Drops dependency on `pathtype`. + + +# 0.1.0.2 + +- Support ghc 9.2. + +# 0.1.0.0 + +- Adds `CodeQL` language constructor. +- Bumps `lingo-haskell` to 0.3.2. +- Removes Span and Pos lower bound instances. This makes callers responsible for defining whether Span / Pos are 0 or 1 indexed. + +# 0.0.2.0 + +- Adds `Source.Language`. +- Adds `ToJSON` instances for `Range` and `Loc`. + +# 0.0.1.0 + +- Adds an `NFData` instance for `Source`. + +- Decodes to `Text` leniently instead of throwing exceptions. + + +# 0.0.0.1 + +- Loosens the upper bound on `hashable`. +- Adds support for GHC 8.8.1. + + +# 0.0.0.0 + +Initial release diff --git a/LICENSE b/semantic-source/LICENSE similarity index 100% rename from LICENSE rename to semantic-source/LICENSE diff --git a/semantic-source/README.md b/semantic-source/README.md new file mode 100644 index 0000000000..807babf03b --- /dev/null +++ b/semantic-source/README.md @@ -0,0 +1,18 @@ +# semantic-source + +Types and functionality for working with source code (program text). + + +## Development + +This project consists of a Haskell package named `semantic-source`. The library’s sources are in [`src`][]. + +Development of `semantic-source` is typically done using `cabal v2-build`: + +```shell +cabal v2-build # build the library +cabal v2-repl # load the package into ghci +cabal v2-test # build and run the doctests +``` + +[`src`]: https://github.com/github/semantic/tree/master/semantic-source/src diff --git a/semantic-source/Setup.hs b/semantic-source/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-source/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-source/cabal.project b/semantic-source/cabal.project new file mode 100644 index 0000000000..1439002fe7 --- /dev/null +++ b/semantic-source/cabal.project @@ -0,0 +1,4 @@ +-- ATTENTION: care must be taken to keep this file in sync with cabal.project.ci. If you add a package here, add it there (and add a package stanza with ghc-options to enable errors in CI at the bottom of that file). + +-- Local packages +packages: . diff --git a/semantic-source/cabal.project.ci b/semantic-source/cabal.project.ci new file mode 100644 index 0000000000..4e5b2bd258 --- /dev/null +++ b/semantic-source/cabal.project.ci @@ -0,0 +1,9 @@ +-- ATTENTION: care must be taken to keep this file in sync with cabal.project. If you add a package here, add it there (and add a package stanza with ghc-options to enable errors in CI at the bottom of this file). + +-- Local packages +packages: . + + +-- Treat warnings as errors for CI builds +package semantic-source + ghc-options: -Werror diff --git a/semantic-source/semantic-source.cabal b/semantic-source/semantic-source.cabal new file mode 100644 index 0000000000..f0c610fe3f --- /dev/null +++ b/semantic-source/semantic-source.cabal @@ -0,0 +1,90 @@ +cabal-version: 2.4 + +name: semantic-source +version: 0.2.0.1 +synopsis: Types and functionality for working with source code +description: Types and functionality for working with source code (program text). +homepage: https://github.com/github/semantic/tree/master/semantic-source#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2020 GitHub, Inc. +category: Data +build-type: Simple +stability: alpha +extra-doc-files: + CHANGELOG.md + README.md + +tested-with: + GHC == 8.6.5 + GHC == 8.8.1 + GHC == 8.10.1 + GHC == 9.2.1 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + +library + import: haskell + exposed-modules: + Source.Language + Source.Loc + Source.Range + Source.Source + Source.Span + build-depends: + , aeson >= 1.4.2.0 && < 3 + , base >= 4.12 && < 5 + , bytestring >= 0.10.8.2 && < 0.13 + , deepseq ^>= 1.4.4.0 + , containers ^>= 0.6.2 + , hashable >= 1.2.7 && < 1.5 + , lingo ^>= 0.5.0.3 + , semilattices ^>= 0.0.0.3 + , text ^>= 1.2.3.2 + hs-source-dirs: src + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Test.hs + other-modules: + Range.Test + Source.Test + build-depends: + , base + , hedgehog >= 1 && < 1.2 + , semantic-source + , tasty >= 1.2 && <2 + , tasty-hedgehog >= 1.0.0.1 && < 1.3 + , tasty-hunit >= 0.10 && <1 + , text + +source-repository head + type: git + location: https://github.com/github/semantic diff --git a/semantic-source/src/Source/Language.hs b/semantic-source/src/Source/Language.hs new file mode 100644 index 0000000000..00bfb5e255 --- /dev/null +++ b/semantic-source/src/Source/Language.hs @@ -0,0 +1,140 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} +module Source.Language + ( Language (..) + , SLanguage (..) + , extensionsForLanguage + , knownLanguage + , forPath + , textToLanguage + , languageToText + ) where + +import Data.Aeson +import Data.Hashable (Hashable) +import qualified Data.Languages as Lingo +import qualified Data.Map.Strict as Map +import qualified Data.Text as T +import GHC.Generics (Generic) + +-- | The various languages we support. +data Language + = Unknown + | Go + | Haskell + | Java + | JavaScript + | JSON + | JSX + | Markdown + | PHP + | Python + | Ruby + | TypeScript + | TSX + | CodeQL + deriving (Eq, Generic, Ord, Read, Show, Bounded, Hashable, ToJSON, Enum) + +-- | Reifies a proxied type-level 'Language' to a value. +class SLanguage (lang :: Language) where + reflect :: proxy lang -> Language + +instance SLanguage 'Unknown where + reflect _ = Unknown + +instance SLanguage 'CodeQL where + reflect _ = CodeQL + +instance SLanguage 'Go where + reflect _ = Go + +instance SLanguage 'Haskell where + reflect _ = Haskell + +instance SLanguage 'Java where + reflect _ = Java + +instance SLanguage 'JavaScript where + reflect _ = JavaScript + +instance SLanguage 'JSON where + reflect _ = JSON + +instance SLanguage 'JSX where + reflect _ = JSX + +instance SLanguage 'Markdown where + reflect _ = Markdown + +instance SLanguage 'PHP where + reflect _ = PHP + +instance SLanguage 'Python where + reflect _ = Python + +instance SLanguage 'Ruby where + reflect _ = Ruby + +instance SLanguage 'TypeScript where + reflect _ = TypeScript + +instance FromJSON Language where + parseJSON = withText "Language" $ \l -> + pure $ textToLanguage l + + +-- | Predicate failing on 'Unknown' and passing in all other cases. +knownLanguage :: Language -> Bool +knownLanguage = (/= Unknown) + +extensionsForLanguage :: Language -> [String] +extensionsForLanguage language = fmap T.unpack (maybe mempty Lingo.languageExtensions (Map.lookup (languageToText language) Lingo.languages)) + +forPath :: FilePath -> Language +forPath path = + let spurious lang = lang `elem` [ "Hack" -- .php files + , "GCC Machine Description" -- .md files + , "XML" -- .tsx files + ] + allResults = Lingo.languageName <$> Lingo.languagesForPath path + in case filter (not . spurious) allResults of + [result] -> textToLanguage result + _ -> Unknown + +languageToText :: Language -> T.Text +languageToText = \case + Unknown -> "Unknown" + CodeQL -> "CodeQL" + Go -> "Go" + Haskell -> "Haskell" + Java -> "Java" + JavaScript -> "JavaScript" + JSON -> "JSON" + JSX -> "JSX" + Markdown -> "Markdown" + PHP -> "PHP" + Python -> "Python" + Ruby -> "Ruby" + TypeScript -> "TypeScript" + TSX -> "TSX" + +textToLanguage :: T.Text -> Language +textToLanguage = \case + "CodeQL" -> CodeQL + "Go" -> Go + "Haskell" -> Haskell + "Java" -> Java + "JavaScript" -> JavaScript + "JSON" -> JSON + "JSX" -> JSX + "Markdown" -> Markdown + "PHP" -> PHP + "Python" -> Python + "Ruby" -> Ruby + "TypeScript" -> TypeScript + "TSX" -> TSX + _ -> Unknown diff --git a/semantic-source/src/Source/Loc.hs b/semantic-source/src/Source/Loc.hs new file mode 100644 index 0000000000..9ab7a76bbc --- /dev/null +++ b/semantic-source/src/Source/Loc.hs @@ -0,0 +1,45 @@ +{-# LANGUAGE DeriveGeneric, RankNTypes, NamedFieldPuns, OverloadedStrings #-} +module Source.Loc +( Loc(..) +, byteRange_ +, Span(Span) +, Range(Range) +) where + +import Control.DeepSeq (NFData) +import Data.Aeson (ToJSON(..), object, (.=)) +import Data.Hashable (Hashable) +import GHC.Generics (Generic) +import Prelude hiding (span) +import Source.Range +import Source.Span + +data Loc = Loc + { byteRange :: {-# UNPACK #-} !Range + , span :: {-# UNPACK #-} !Span + } + deriving (Eq, Ord, Show, Generic) + +instance Semigroup Loc where + Loc b1 s1 <> Loc b2 s2 = Loc (b1 <> b2) (s1 <> s2) + +instance Hashable Loc +instance NFData Loc + +instance HasSpan Loc where + span_ = lens span (\l s -> l { span = s }) + {-# INLINE span_ #-} + +instance ToJSON Loc where + toJSON Loc{byteRange, span} = object ["sourceRange" .= byteRange + , "sourceSpan" .= span] + +byteRange_ :: Lens' Loc Range +byteRange_ = lens byteRange (\l r -> l { byteRange = r }) + + +type Lens' s a = forall f . Functor f => (a -> f a) -> (s -> f s) + +lens :: (s -> a) -> (s -> a -> s) -> Lens' s a +lens get put afa s = fmap (put s) (afa (get s)) +{-# INLINE lens #-} diff --git a/semantic-source/src/Source/Range.hs b/semantic-source/src/Source/Range.hs new file mode 100644 index 0000000000..9ad3df125e --- /dev/null +++ b/semantic-source/src/Source/Range.hs @@ -0,0 +1,58 @@ +{-# LANGUAGE DeriveAnyClass, DeriveGeneric, RankNTypes, NamedFieldPuns #-} +module Source.Range +( Range(..) +, point +, rangeLength +, subtractRange + -- * Lenses +, start_ +, end_ +) where + +import Control.DeepSeq (NFData) +import Data.Aeson (ToJSON(..)) +import Data.Hashable (Hashable) +import Data.Semilattice.Lower (Lower(..)) +import GHC.Generics (Generic) + +-- | A 0-indexed, half-open interval of integers, defined by start & end indices. +data Range = Range + { start :: {-# UNPACK #-} !Int + , end :: {-# UNPACK #-} !Int + } + deriving (Eq, Generic, Ord, Show) + +instance Hashable Range +instance NFData Range + +instance Semigroup Range where + Range start1 end1 <> Range start2 end2 = Range (min start1 start2) (max end1 end2) + +instance Lower Range where + lowerBound = Range 0 0 + +instance ToJSON Range where + toJSON Range { start, end } = toJSON [ start, end ] + +-- | Construct a 'Range' with a given value for both its start and end indices. +point :: Int -> Range +point i = Range i i + +-- | Return the length of the range. +rangeLength :: Range -> Int +rangeLength range = end range - start range + +subtractRange :: Range -> Range -> Range +subtractRange range1 range2 = Range (start range1) (end range1 - rangeLength (Range (start range2) (max (end range1) (end range2)))) + + +start_, end_ :: Lens' Range Int +start_ = lens start (\r s -> r { start = s }) +end_ = lens end (\r e -> r { end = e }) + + +type Lens' s a = forall f . Functor f => (a -> f a) -> (s -> f s) + +lens :: (s -> a) -> (s -> a -> s) -> Lens' s a +lens get put afa s = fmap (put s) (afa (get s)) +{-# INLINE lens #-} diff --git a/semantic-source/src/Source/Source.hs b/semantic-source/src/Source/Source.hs new file mode 100644 index 0000000000..2cafdab823 --- /dev/null +++ b/semantic-source/src/Source/Source.hs @@ -0,0 +1,145 @@ +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-| +'Source' models source code, represented as a thin wrapper around a 'B.ByteString' with conveniences for splitting by line, slicing, etc. + +This module is intended to be imported qualified to avoid name clashes with 'Prelude': + +> import qualified Source.Source as Source +-} +module Source.Source +( Source +, bytes +, fromUTF8 +-- * Measurement +, Source.Source.length +, Source.Source.null +, totalRange +, totalSpan +-- * En/decoding +, fromText +, toText +-- * Slicing +, slice +, drop +, take +-- * Splitting +, Source.Source.lines +, lineRanges +, lineRangesWithin +, newlineIndices +) where + +import Prelude hiding (drop, take) + +import Control.Arrow ((&&&)) +import Control.DeepSeq (NFData) +import Data.Aeson (FromJSON (..), withText) +import qualified Data.ByteString as B +import Data.Char (ord) +import Data.Maybe (fromMaybe) +import Data.Monoid (Last (..)) +import Data.Semilattice.Lower +import Data.String (IsString (..)) +import qualified Data.Text as T +import qualified Data.Text.Encoding as T +import Data.Text.Encoding.Error (lenientDecode) +import GHC.Generics (Generic) +import Source.Range +import Source.Span (Pos (..), Span (Span)) + + +-- | The contents of a source file. This is represented as a UTF-8 +-- 'ByteString' under the hood. Construct these with 'fromUTF8'; obviously, +-- passing 'fromUTF8' non-UTF8 bytes will cause crashes. +newtype Source = Source { bytes :: B.ByteString } + deriving (Eq, Semigroup, Monoid, IsString, Show, Generic, NFData) + +fromUTF8 :: B.ByteString -> Source +fromUTF8 = Source + +instance FromJSON Source where + parseJSON = withText "Source" (pure . fromText) + + +-- Measurement + +length :: Source -> Int +length = B.length . bytes + +null :: Source -> Bool +null = B.null . bytes + +-- | Return a 'Range' that covers the entire text. +totalRange :: Source -> Range +totalRange = Range 0 . B.length . bytes + +-- | Return a 'Span' that covers the entire text. +totalSpan :: Source -> Span +totalSpan source = Span (Pos 1 1) (Pos (Prelude.length ranges) (succ (end lastRange - start lastRange))) where + ranges = lineRanges source + lastRange = fromMaybe lowerBound (getLast (foldMap (Last . Just) ranges)) + + +-- En/decoding + +-- | Return a 'Source' from a 'Text'. +fromText :: T.Text -> Source +fromText = Source . T.encodeUtf8 + +-- | Return the Text contained in the 'Source'. +toText :: Source -> T.Text +toText = T.decodeUtf8With lenientDecode . bytes + + +-- Slicing + +-- | Return a 'Source' that contains a slice of the given 'Source'. +slice :: Source -> Range -> Source +slice source range = taking $ dropping source where + dropping = drop (start range) + taking = take (rangeLength range) + +drop :: Int -> Source -> Source +drop i = Source . B.drop i . bytes + +take :: Int -> Source -> Source +take i = Source . B.take i . bytes + + +-- Splitting + +-- | Split the contents of the source after newlines. +lines :: Source -> [Source] +lines source = slice source <$> lineRanges source + +-- | Compute the 'Range's of each line in a 'Source'. +lineRanges :: Source -> [Range] +lineRanges source = lineRangesWithin source (totalRange source) + +-- | Compute the 'Range's of each line in a 'Range' of a 'Source'. +lineRangesWithin :: Source -> Range -> [Range] +lineRangesWithin source range + = uncurry (zipWith Range) + . ((start range:) &&& (<> [ end range ])) + . fmap (+ succ (start range)) + . newlineIndices + . bytes + $ slice source range + +-- | Return all indices of newlines ('\n', '\r', and '\r\n') in the 'ByteString'. +newlineIndices :: B.ByteString -> [Int] +newlineIndices = go 0 where + go n bs + | B.null bs = [] + | otherwise = case (searchCR bs, searchLF bs) of + (Nothing, Nothing) -> [] + (Just i, Nothing) -> recur n i bs + (Nothing, Just i) -> recur n i bs + (Just crI, Just lfI) + | succ crI == lfI -> recur n lfI bs + | otherwise -> recur n (min crI lfI) bs + recur n i bs = let j = n + i in j : go (succ j) (B.drop (succ i) bs) + searchLF = B.elemIndex (toEnum (ord '\n')) + searchCR = B.elemIndex (toEnum (ord '\r')) +{-# INLINE newlineIndices #-} diff --git a/semantic-source/src/Source/Span.hs b/semantic-source/src/Source/Span.hs new file mode 100644 index 0000000000..7d15bce877 --- /dev/null +++ b/semantic-source/src/Source/Span.hs @@ -0,0 +1,113 @@ +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RankNTypes #-} +-- | Source position and span information +-- +-- Mostly taken from purescript's SourcePos definition. +module Source.Span +( Span(..) +, point +, spanFromSrcLoc +, Pos(..) +, line_ +, column_ +, HasSpan(..) +) where + +import Control.DeepSeq (NFData) +import Data.Aeson ((.:), (.=)) +import qualified Data.Aeson as A +import Data.Hashable (Hashable) +import GHC.Generics (Generic) +import GHC.Stack (SrcLoc (..)) + +-- | A Span of position information +data Span = Span + { start :: {-# UNPACK #-} !Pos + , end :: {-# UNPACK #-} !Pos + } + deriving (Eq, Ord, Generic, Show) + +instance Hashable Span +instance NFData Span + +instance Semigroup Span where + Span start1 end1 <> Span start2 end2 = Span (min start1 start2) (max end1 end2) + +instance A.ToJSON Span where + toJSON s = A.object + [ "start" .= start s + , "end" .= end s + ] + +instance A.FromJSON Span where + parseJSON = A.withObject "Span" $ \o -> Span + <$> o .: "start" + <*> o .: "end" + +-- | Construct a Span with a given value for both its start and end positions. +point :: Pos -> Span +point p = Span p p + +spanFromSrcLoc :: SrcLoc -> Span +spanFromSrcLoc s = Span (Pos (srcLocStartLine s) (srcLocStartCol s)) (Pos (srcLocEndLine s) (srcLocEndCol s)) + + +-- | Source position information. +-- The 'Pos' values associated with ASTs returned from tree-sitter +-- 'Unmarshal' instances are zero-indexed. Unless you are displaying +-- span information to a user, you should write your code assuming +-- zero-indexing. +data Pos = Pos + { line :: {-# UNPACK #-} !Int + , column :: {-# UNPACK #-} !Int + } + deriving (Eq, Ord, Generic, Show) + +instance Hashable Pos +instance NFData Pos + +instance A.ToJSON Pos where + toJSON p = A.toJSON + [ line p + , column p + ] + +instance A.FromJSON Pos where + parseJSON arr = do + [ line, col ] <- A.parseJSON arr + pure $ Pos line col + +line_, column_ :: Lens' Pos Int +line_ = lens line (\p l -> p { line = l }) +column_ = lens column (\p l -> p { column = l }) + + +-- | "Classy-fields" interface for data types that have spans. +class HasSpan a where + span_ :: Lens' a Span + + start_ :: Lens' a Pos + start_ = span_.start_ + {-# INLINE start_ #-} + + end_ :: Lens' a Pos + end_ = span_.end_ + {-# INLINE end_ #-} + +instance HasSpan Span where + span_ = id + {-# INLINE span_ #-} + + start_ = lens start (\s t -> s { start = t }) + {-# INLINE start_ #-} + + end_ = lens end (\s t -> s { end = t }) + {-# INLINE end_ #-} + + +type Lens' s a = forall f . Functor f => (a -> f a) -> (s -> f s) + +lens :: (s -> a) -> (s -> a -> s) -> Lens' s a +lens get put afa s = fmap (put s) (afa (get s)) +{-# INLINE lens #-} diff --git a/semantic-source/test/Range/Test.hs b/semantic-source/test/Range/Test.hs new file mode 100644 index 0000000000..ffb7c12793 --- /dev/null +++ b/semantic-source/test/Range/Test.hs @@ -0,0 +1,31 @@ +{-# LANGUAGE OverloadedStrings #-} +module Range.Test +( testTree +) where + +import Control.Monad (join) +import Hedgehog hiding (Range) +import qualified Hedgehog.Gen as Gen +import qualified Hedgehog.Range as Range +import Source.Range +import qualified Test.Tasty as Tasty +import Test.Tasty.Hedgehog (testPropertyNamed) + +testTree :: Tasty.TestTree +testTree = Tasty.testGroup "Source.Range" + [ Tasty.testGroup "Semigroup" + [ testPropertyNamed "associativity" "Range_associativity" . property $ do + (a, b, c) <- forAll ((,,) <$> range <*> range <*> range) + a <> (b <> c) === (a <> b) <> c + ] + ] + + +range :: MonadGen m => m Range +range = Gen.choice [ empty, nonEmpty ] where + point = Gen.int (Range.linear 0 100) + empty = join Range <$> point + nonEmpty = do + start <- point + length <- point + pure $! Range start (start + length + 1) diff --git a/semantic-source/test/Source/Test.hs b/semantic-source/test/Source/Test.hs new file mode 100644 index 0000000000..127cf80639 --- /dev/null +++ b/semantic-source/test/Source/Test.hs @@ -0,0 +1,60 @@ +{-# LANGUAGE OverloadedStrings #-} +module Source.Test +( testTree +) where + +import qualified Data.Text as Text +import Hedgehog hiding (Range) +import qualified Hedgehog.Gen as Gen +import qualified Hedgehog.Range as Range +import qualified Source.Source as Source +import Source.Span +import qualified Test.Tasty as Tasty +import Test.Tasty.HUnit +import Test.Tasty.Hedgehog (testPropertyNamed) + + +source :: MonadGen m => Range.Range Int -> m Source.Source +source r = Gen.frequency [ (1, empty), (20, nonEmpty) ] where + empty = pure mempty + nonEmpty = Source.fromUTF8 <$> Gen.utf8 r (Gen.frequency [ (1, pure '\r'), (1, pure '\n'), (20, Gen.unicode) ]) + +testTree :: Tasty.TestTree +testTree = Tasty.testGroup "Source.Source" + [ Tasty.testGroup "lineRanges" + [ testPropertyNamed "produces 1 more range than there are newlines" "Source_lineRanges_produces_1_more_range_than_there_are_newlines" . property $ do + source <- forAll (source (Range.linear 0 100)) + summarize source + length (Source.lineRanges source) === length (Text.splitOn "\r\n" (Source.toText source) >>= Text.splitOn "\r" >>= Text.splitOn "\n") + + , testPropertyNamed "produces exhaustive ranges" "Source_lineRanges_produces_exhaustive_ranges" . property $ do + source <- forAll (source (Range.linear 0 100)) + summarize source + foldMap (Source.slice source) (Source.lineRanges source) === source + ] + + , Tasty.testGroup "totalSpan" + [ testPropertyNamed "covers single lines" "Source_totalSpan_covers_single_lines" . property $ do + n <- forAll $ Gen.int (Range.linear 0 100) + Source.totalSpan (Source.fromText (Text.replicate n "*")) === Span (Pos 1 1) (Pos 1 (max 1 (succ n))) + + , testPropertyNamed "covers multiple lines" "Source_totalSpan_covers_multiple_lines" . property $ do + n <- forAll $ Gen.int (Range.linear 0 100) + Source.totalSpan (Source.fromText (Text.intersperse '\n' (Text.replicate n "*"))) === Span (Pos 1 1) (Pos (max 1 n) (if n > 0 then 2 else 1)) + ] + + , Tasty.testGroup "newlineIndices" + [ testCase "finds \\n" $ Source.newlineIndices "a\nb" @?= [1] + , testCase "finds \\r" $ Source.newlineIndices "a\rb" @?= [1] + , testCase "finds \\r\\n" $ Source.newlineIndices "a\r\nb" @?= [2] + , testCase "finds intermixed line endings" $ Source.newlineIndices "hi\r}\r}\n xxx \r a" @?= [2, 4, 6, 12] + ] + ] + +summarize :: Source.Source -> PropertyT IO () +summarize src = do + let lines = Source.lines src + -- FIXME: this should be using cover (reverted in 1b427b995), but that leads to flaky tests: hedgehog’s 'cover' implementation fails tests instead of warning, and currently has no equivalent to 'checkCoverage'. + classify "empty" $ Source.null src + classify "single-line" $ length lines == 1 + classify "multiple lines" $ length lines > 1 diff --git a/semantic-source/test/Test.hs b/semantic-source/test/Test.hs new file mode 100644 index 0000000000..70c07a874b --- /dev/null +++ b/semantic-source/test/Test.hs @@ -0,0 +1,13 @@ +module Main +( main +) where + +import qualified Range.Test as Range +import qualified Source.Test as Source +import Test.Tasty as Tasty + +main :: IO () +main = defaultMain $ testGroup "semantic-source" + [ Range.testTree + , Source.testTree + ] diff --git a/semantic-tags/BUILD.bazel b/semantic-tags/BUILD.bazel new file mode 100644 index 0000000000..606eea6183 --- /dev/null +++ b/semantic-tags/BUILD.bazel @@ -0,0 +1,31 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_binary", + "haskell_library", +) +load( + "@rules_haskell//haskell:cabal.bzl", + "haskell_cabal_binary", + "haskell_cabal_library", +) +load( + "//:build/common.bzl", + "GHC_FLAGS", +) + +haskell_library( + name = "semantic-tags", + srcs = glob(["src/**/*.hs"]), + compiler_flags = GHC_FLAGS, + deps = [ + "//:base", + "//:bytestring", + "//:containers", + "//:text", + "//semantic-proto", + "//semantic-source", + "@stackage//:fused-effects", + ], +) diff --git a/semantic-tags/LICENSE b/semantic-tags/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-tags/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-tags/README.md b/semantic-tags/README.md new file mode 100644 index 0000000000..1a0662907d --- /dev/null +++ b/semantic-tags/README.md @@ -0,0 +1,18 @@ +# semantic-tags + +Tags computation over ASTs. + + +## Development + +This project consists of a Haskell package named `semantic-tags`. The library’s sources are in [`src`][]. + +Development of `semantic-tags` is typically done using `cabal v2-build`: + +```shell +cabal v2-build # build the library +cabal v2-repl # load the package into ghci +cabal v2-test # build and run the doctests +``` + +[`src`]: https://github.com/github/semantic/tree/master/semantic-tags/src diff --git a/semantic-tags/Setup.hs b/semantic-tags/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-tags/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-tags/semantic-tags.cabal b/semantic-tags/semantic-tags.cabal new file mode 100644 index 0000000000..cf2ade6b6f --- /dev/null +++ b/semantic-tags/semantic-tags.cabal @@ -0,0 +1,72 @@ +cabal-version: 2.4 + +name: semantic-tags +version: 0.0.0.0 +synopsis: Tags computation +description: Tags computation for ASTs derived from tree-sitter grammars. +homepage: https://github.com/github/semantic/tree/master/semantic-tags#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + default-extensions: StrictData + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + +library + import: haskell + exposed-modules: + Tags.Tag + Tags.Tagging.Precise + build-depends: + , base >= 4.13 && < 5 + , bytestring >= 0.10.8.2 && < 0.13 + , containers ^>= 0.6.0.1 + , fused-effects ^>= 1.1 + , semantic-proto ^>= 0 + , semantic-source ^>= 0.2 + , text ^>= 1.2.3.1 + hs-source-dirs: src + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Test.hs + build-depends: + , base >= 4.13 && < 5 + , semantic-source ^>= 0.2 + , semantic-tags + , tasty >= 1.2 && <2 + , tasty-hunit >= 0.10 && <1 + , text ^>= 1.2.3.1 diff --git a/semantic-tags/src/Tags/Tag.hs b/semantic-tags/src/Tags/Tag.hs new file mode 100644 index 0000000000..d8d448bad5 --- /dev/null +++ b/semantic-tags/src/Tags/Tag.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE GeneralisedNewtypeDeriving #-} +module Tags.Tag (Tag (..), UTF16CodeUnitSpan(..), OneIndexedSpan(..)) where + +import Data.Text (Text) +import qualified Proto.Semantic as P +import Source.Loc + +-- | A 0-indxed Span where the column offset units are utf-16 code units (2 +-- bytes), suitable for the LSP (Language Server Protocol) specification. +newtype UTF16CodeUnitSpan = UTF16CodeUnitSpan { unUTF16CodeUnitSpan :: Span } + deriving (Eq, Show) + +-- A 1-indexed Span where the units are bytes. +newtype OneIndexedSpan = OneIndexedSpan { unOneIndexedSpan :: Span } + deriving (Eq, Show) + +data Tag + = Tag + { tagName :: Text, + tagSyntaxType :: P.SyntaxType, + tagNodeType :: P.NodeType, + tagByteRange :: Range, + tagOneIndexedSpan :: OneIndexedSpan, + tagLine :: Text, + tagUTF16CodeUnitSpan :: UTF16CodeUnitSpan + } + deriving (Eq, Show) diff --git a/semantic-tags/src/Tags/Tagging/Precise.hs b/semantic-tags/src/Tags/Tagging/Precise.hs new file mode 100644 index 0000000000..6ea28444b1 --- /dev/null +++ b/semantic-tags/src/Tags/Tagging/Precise.hs @@ -0,0 +1,159 @@ +{-# LANGUAGE GeneralisedNewtypeDeriving #-} +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE TypeApplications #-} +module Tags.Tagging.Precise +( Tags +, Tag(..) +, OneIndexedSpan(..) +, UTF16CodeUnitSpan(..) +, ToTags(..) +, LineIndices(..) +, yield +, runTagging +, calculateLineAndSpans +, countUtf16CodeUnits +, slice180 +, surroundingLine +, surroundingLineRange +) where + +import Control.Carrier.Reader +import Control.Carrier.Writer.Strict +import Control.Carrier.State.Strict +import qualified Data.ByteString as B +import Data.Char (ord) +import Data.Functor.Identity +import Data.Monoid (Endo (..)) +import Data.Text (Text) +import qualified Data.Text as Text +import qualified Proto.Semantic as P +import Source.Loc +import Source.Source as Source +import Source.Span (Pos (..), end, start) +import Tags.Tag +import Prelude hiding (span) +import Data.Map as Map +import Data.IntMap as IntMap + + +type Tags = Endo [Tag] + +class ToTags t where + tags :: Source -> t Loc -> [Tag] + + +yield :: + (Has (State LineIndices) sig m, Has (Reader Source) sig m, Has (Writer Tags) sig m) => + Text -> -- |^ Text of the identifier + P.SyntaxType -> -- |^ Type of syntax + P.NodeType -> -- |^ Node type: definition or reference + Loc -> -- |^ Location of the identifier + Range -> -- |^ Range of the entire expression (not used, but reserved for future used) + m () +yield name syntaxType nodeType loc _ = do + src <- ask @Source + xs <- get @LineIndices + let (line, span, lspSpan, map) = calculateLineAndSpans src xs loc + put map + tell . Endo . (:) $ + Tag name syntaxType nodeType (byteRange loc) span line lspSpan + +runTagging :: Source -> ReaderC Source (StateC LineIndices (WriterC Tags Identity)) () -> [Tag] +runTagging source + = ($ []) + . appEndo + . run + . execWriter + . evalState (LineIndices mempty) + . runReader source + +type UTF16CUCount = Int + +-- | LineCache is a cache of a line of source code and a map of byte offsets to utf16 code unit count. +type LineCache = (Source, Text, IntMap.IntMap UTF16CUCount) + +-- | LineIndices is a cache of row to LineCache +newtype LineIndices = LineIndices { unLineIndices :: Map.Map Int LineCache } + deriving (Eq, Show) + +-- | Takes a Loc (where the span's column offset is measured in bytes) and +-- returns two Spans: A 1-indexed span LSP friendly span (where column offset is +-- measure in utf16 code units). +calculateLineAndSpans :: + Source -> -- | ^ Source + LineIndices -> + Loc -> -- | ^ Location of identifier + (Text, OneIndexedSpan, UTF16CodeUnitSpan, LineIndices) +calculateLineAndSpans + src + lineIndexes + loc@Loc + { span = + span@Span + { start = start@(Pos startRow startCol), + end = end@(Pos _ endCol) + } + } = (line, toOneIndexed span, utf16Span, map') + where + line = slice180 end srcText + (srcLine, srcText, lineCache, map) = surroundingLine src lineIndexes loc + toOneIndexed (Span (Pos l1 c1) (Pos l2 c2)) = OneIndexedSpan $ Span (Pos (l1 + 1) (c1 + 1)) (Pos (l2 + 1) (c2 + 1)) + utf16Span = UTF16CodeUnitSpan $ Span start {column = utf16cpStartOffset} end {column = utf16cpEndOffset} + + (utf16cpStartOffset, map') = countOffsetCached startSlice lineCache startCol map + utf16cpEndOffset = utf16cpStartOffset + countUtf16CodeUnits endSlice + + countOffsetCached :: Source -> LineCache -> Int -> LineIndices -> (Int, LineIndices) + countOffsetCached slice (s, t, countMap) colKey (LineIndices map) + = let c = case IntMap.lookupLE colKey countMap of + Just (startOffset, count) -> count + countUtf16CodeUnits (Source.slice slice (Range startOffset colKey)) + Nothing -> countUtf16CodeUnits slice + in (c, LineIndices $ Map.insert startRow (s, t, IntMap.insert colKey c countMap) map) + + -- NB: Slice out of the Source ByteString, NOT Text because Loc/Range is in units of bytes. + startSlice = Source.slice srcLine (Range 0 startCol) + endSlice = Source.slice srcLine (Range startCol endCol) + +-- NB: Important to limit to 180 characters after converting to text so as not to take in the middle of a multi-byte character. +slice180 :: Pos -> Text -> Text +slice180 (Pos _ end) = Text.strip . Text.take 180 . drop + where + drop | end > 180 = Text.drop (end - 180) + | otherwise = id + +data Counter = Counter { _skip :: Int, unCounter :: Int } +countUtf16CodeUnits :: Source -> Int +countUtf16CodeUnits = unCounter . B.foldl' count (Counter 0 0) . bytes + where + count (Counter skip sum) !byte + | skip > 0 = Counter (pred skip) sum + | byte <= 0x7f = Counter 0 (1 + sum) -- takes 2 bytes (1 utf16 cu) + | byte <= 0xbf = error "not valid utf8, byte <= 0xbf" + | byte <= 0xdf = Counter 1 (1 + sum) -- takes 2 bytes (1 utf16 cu) + | byte <= 0xef = Counter 2 (1 + sum) -- takes 2 bytes (1 utf16 cu) + | byte <= 0xf7 = Counter 3 (2 + sum) -- takes 4 bytes (2 utf16 cu) + | otherwise = error "not valid utf8" +{-# INLINE countUtf16CodeUnits #-} + +-- | The Source of the entire surrounding line (cached). +surroundingLine :: Source -> LineIndices -> Loc -> (Source, Text, LineCache, LineIndices) +surroundingLine src li@(LineIndices map) loc@(Loc _ (Span (Pos start _) _)) = + case Map.lookup start map of + Just cache@(line, lineText, _) -> (line, lineText, cache, li) + Nothing -> let cache = (line, lineText, mempty) in (line, lineText, cache, LineIndices (Map.insert start cache map)) + where + lineText = Source.toText line + line = Source.slice src range + range = surroundingLineRange src loc + +-- | The Range of the line surrounding the given location. (Takes advantage of +-- the fact that we already have the row information (where newlines are) from +-- tree-sitter.) +surroundingLineRange :: Source -> Loc -> Range +surroundingLineRange src (Loc (Range start _) (Span (Pos _ startCol) _)) = Range (start - startCol) lineEnd + where + lineEnd = maybe eof (start +) $ B.elemIndex lfChar remainingSource + remainingSource = B.drop start (bytes src) + + lfChar = toEnum (ord '\n') + eof = Source.length src diff --git a/semantic-tags/test/Test.hs b/semantic-tags/test/Test.hs new file mode 100644 index 0000000000..10eeecc5e0 --- /dev/null +++ b/semantic-tags/test/Test.hs @@ -0,0 +1,126 @@ +{-# LANGUAGE OverloadedStrings #-} +module Main +( main +) where + +import Tags.Tagging.Precise +import Data.Text (Text) +import Source.Source as Source +import Source.Loc +import Source.Span +import Test.Tasty as Tasty +import Test.Tasty.HUnit + +main :: IO () +main = defaultMain $ testGroup "semantic-tags" [ testTree ] + +src :: Text -> Source +src = Source.fromText + +-- | For testing +calculateLineAndSpans' :: Source -> Loc -> (Text, OneIndexedSpan, UTF16CodeUnitSpan) +calculateLineAndSpans' src loc = let (a, b, c, _) = calculateLineAndSpans src (LineIndices mempty) loc in (a, b, c) + +testTree :: Tasty.TestTree +testTree = Tasty.testGroup "Tags.Tagging.Precise" + [ Tasty.testGroup "countUtf16CodeUnits from utf8 encoded bytestring" + [ testCase "one byte" $ do + 1 @=? countUtf16CodeUnits (src "a") + + , testCase "null byte" $ do + 1 @=? countUtf16CodeUnits (src "\0") -- NULL + + , testCase "two bytes" $ do + 1 @=? countUtf16CodeUnits (src "\x0080") -- "Β€" + 1 @=? countUtf16CodeUnits (src "Γ ") + + , testCase "three bytes" $ do + 1 @=? countUtf16CodeUnits (src "\x0800") -- "ΰ €" + + , testCase "four bytes" $ do + 2 @=? countUtf16CodeUnits (src "𐀀") + 2 @=? countUtf16CodeUnits (src "πŸ˜€") + + , testCase "multibyte" $ do + 4 @=? countUtf16CodeUnits (src "πŸ‘‹πŸ»") + ] + + -- Range start = 13 + *num bytes in char inside ''* + -- Span start col = 5 + *num bytes in char* + , Tasty.testGroup "firstLineAndSpans" + [ testCase "one line" $ + let src = Source.fromText "def foo;end" + loc = Loc (Range 4 7) (Span (Pos 0 4) (Pos 0 7)) + in ( "def foo;end" + , OneIndexedSpan $ Span (Pos 1 5) (Pos 1 8) -- one indexed, counting bytes + , UTF16CodeUnitSpan $ Span (Pos 0 4) (Pos 0 7) -- zero-indexed, counting utf16 code units (lsp-style column offset) + ) @=? calculateLineAndSpans' src loc + + , testCase "ascii" $ + let src = Source.fromText "def foo\n 'a'.hi\nend\n" + loc = Loc (Range 14 16) (Span (Pos 1 6) (Pos 1 8)) + in ( "'a'.hi" + , OneIndexedSpan $ Span (Pos 2 7) (Pos 2 9) -- one indexed, counting bytes + , UTF16CodeUnitSpan $ Span (Pos 1 6) (Pos 1 8) -- zero-indexed, counting utf16 code units (lsp-style column offset) + ) @=? calculateLineAndSpans' src loc + + , testCase "unicode" $ + let src = Source.fromText "def foo\n 'Γ '.hi\nend\n" + loc = Loc (Range 15 17) (Span (Pos 1 7) (Pos 1 9)) + in ( "'Γ '.hi" + , OneIndexedSpan $ Span (Pos 2 8) (Pos 2 10) -- one indexed, counting bytes + , UTF16CodeUnitSpan $ Span (Pos 1 6) (Pos 1 8) -- zero-indexed, counting utf16 code units (lsp-style column offset) + ) @=? calculateLineAndSpans' src loc + + , testCase "multi code point unicode" $ + let src = Source.fromText "def foo\n 'πŸ’€'.hi\nend\n" + loc = Loc (Range 17 19) (Span (Pos 1 9) (Pos 1 11)) + in ( "'πŸ’€'.hi" + , OneIndexedSpan $ Span (Pos 2 10) (Pos 2 12) -- one indexed, counting bytes + , UTF16CodeUnitSpan $ Span (Pos 1 7) (Pos 1 9) -- zero-indexed, counting utf16 code units (lsp-style column offset) + ) @=? calculateLineAndSpans' src loc + + -- NB: This emoji (:man-woman-girl-girl:) cannot be entered into a string literal in haskell for some reason, you'll get: + -- > lexical error in string/character literal at character '\8205' + -- The work around is to enter the unicode directly (7 code points). + -- utf-8: 25 bytes to represent + -- utf-16: 23 bytes to represent + , testCase "multi code point unicode :man-woman-girl-girl:" $ + let src = Source.fromText "def foo\n '\128104\8205\128105\8205\128103\8205\128103'.hi\nend\n" + loc = Loc (Range 38 40) (Span (Pos 1 30) (Pos 1 32)) + in ( "'\128104\8205\128105\8205\128103\8205\128103'.hi" + , OneIndexedSpan $ Span (Pos 2 31) (Pos 2 33) -- one indexed, counting bytes + , UTF16CodeUnitSpan $ Span (Pos 1 16) (Pos 1 18) -- zero-indexed, counting utf16 code units (lsp-style column offset) + ) @=? calculateLineAndSpans' src loc + ] + , Tasty.testGroup "slice180" + [ testCase "shorter than 180 chars" $ do + "def foo" @=? slice180 (Pos 0 0) "def foo" + + , testCase "180 chars at position 0" $ do + line180chars @=? slice180 (Pos 0 0) line180chars + + , testCase "180 chars at position 179" $ do + line180chars @=? slice180 (Pos 0 179) line180chars + + , testCase "240 chars at position 0" $ do + line180chars + @=? slice180 (Pos 0 0) line240chars + + , testCase "240 chars at position 179" $ do + line180chars + @=? slice180 (Pos 0 179) line240chars + + , testCase "240 chars at position 180" $ do + line180chars + @=? slice180 (Pos 0 180) line240chars + + , testCase "240 chars at position 182" $ do + "unction(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error(\"jQuery requires a w" + @=? slice180 (Pos 0 182) line240chars + ] + ] + + where + line180chars = "!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error(\"jQuery requires a" + line240chars = "!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error(\"jQuery requires a window with a document\");return t(e)}:t(e)}(\"undefined\"!=ty" diff --git a/semantic-tsx/BUILD.bazel b/semantic-tsx/BUILD.bazel new file mode 100644 index 0000000000..ce71c5921b --- /dev/null +++ b/semantic-tsx/BUILD.bazel @@ -0,0 +1,21 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "//:build/common.bzl", + "semantic_language_library", + "semantic_language_parsing_test", +) + +semantic_language_library( + name = "semantic-tsx", + srcs = glob(["src/**/*.hs"]), + language = "tsx", + nodetypes = "@tree-sitter-tsx//:vendor/tree-sitter-typescript/tsx/src/node-types.json", + ts_package = "tsx", +) + +semantic_language_parsing_test( + language = "tsx", + semantic_package = "tsx", + ts_package = "typescript", +) diff --git a/semantic-tsx/LICENSE b/semantic-tsx/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-tsx/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-tsx/README.md b/semantic-tsx/README.md new file mode 100644 index 0000000000..a927e88383 --- /dev/null +++ b/semantic-tsx/README.md @@ -0,0 +1,3 @@ +# Semantic support for TSX + +This package implements `semantic` support for TSX. diff --git a/semantic-tsx/Setup.hs b/semantic-tsx/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-tsx/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-tsx/semantic-tsx.cabal b/semantic-tsx/semantic-tsx.cabal new file mode 100644 index 0000000000..78225b883c --- /dev/null +++ b/semantic-tsx/semantic-tsx.cabal @@ -0,0 +1,77 @@ +cabal-version: 2.4 + +name: semantic-tsx +version: 0.0.0.0 +synopsis: Semantic support for TSX. +description: Semantic support for TSX. +homepage: https://github.com/github/semantic/tree/master/semantic-tsx#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + cpp-options: + -DBAZEL_BUILD=0 + +library + import: haskell + exposed-modules: + Language.TSX + Language.TSX.AST + Language.TSX.Grammar + Language.TSX.Tags + hs-source-dirs: src + build-depends: + , base >= 4.13 && < 5 + , fused-effects ^>= 1.1 + , semantic-ast + , semantic-proto ^>= 0 + , semantic-source ^>= 0.2 + , semantic-tags ^>= 0.0 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3 + , tree-sitter ^>= 0.9 + , tree-sitter-tsx ^>= 0.5.0.1 + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: PreciseTest.hs + build-depends: + , base + , semantic-ast + , semantic-tsx + , tasty + , tree-sitter-tsx ^>= 0.5.0.1 diff --git a/semantic-tsx/src/Language/TSX.hs b/semantic-tsx/src/Language/TSX.hs new file mode 100644 index 0000000000..18cc0b0b9e --- /dev/null +++ b/semantic-tsx/src/Language/TSX.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# OPTIONS_GHC -freduction-depth=0 #-} +-- | Semantic functionality for TSX programs. +module Language.TSX +( Term(..) +, Language.TSX.Grammar.tree_sitter_tsx +) where + +import AST.Marshal.JSON +import Data.Proxy +import qualified Language.TSX.AST as TSX +import qualified Language.TSX.Tags as TsxTags +import qualified Tags.Tagging.Precise as Tags +import qualified Language.TSX.Grammar (tree_sitter_tsx) +import qualified AST.Unmarshal as TS + +newtype Term a = Term { getTerm :: TSX.Program a } + deriving MarshalJSON + +instance TS.SymbolMatching Term where + matchedSymbols _ = TS.matchedSymbols (Proxy :: Proxy TSX.Program) + showFailure _ = TS.showFailure (Proxy :: Proxy TSX.Program) + +instance TS.Unmarshal Term where + matchers = fmap (fmap (TS.hoist Term)) TS.matchers + +instance Tags.ToTags Term where + tags src = Tags.runTagging src . TsxTags.tags . getTerm diff --git a/semantic-tsx/src/Language/TSX/AST.hs b/semantic-tsx/src/Language/TSX/AST.hs new file mode 100644 index 0000000000..86333a5d3d --- /dev/null +++ b/semantic-tsx/src/Language/TSX/AST.hs @@ -0,0 +1,7997 @@ +-- Language definition for TSX, generated by ast-generate. Do not edit! +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Language.TSX.AST (module Language.TSX.AST, getTestCorpusDir) where + +import qualified AST.Parse +import qualified AST.Token +import qualified AST.Traversable1.Class +import qualified AST.Unmarshal +import qualified Data.Foldable +import qualified Data.List as Data.OldList +import qualified Data.Maybe as GHC.Maybe +import qualified Data.Text.Internal +import qualified Data.Traversable +import qualified GHC.Base +import qualified GHC.Generics +import qualified GHC.Records +import qualified GHC.Show +import qualified TreeSitter.Node +import TreeSitter.TSX (getTestCorpusDir) +import qualified Prelude as GHC.Classes + +debugSymbolNames :: [GHC.Base.String] +debugSymbolNames = debugSymbolNames_0 + +debugSymbolNames_0 :: [GHC.Base.String] +debugSymbolNames_0 = + [ "end", + "identifier", + "hash_bang_line", + "_export", + "_*", + "_default", + "_=", + "_as", + "_namespace", + "_{", + "_,", + "_}", + "_type", + "_typeof", + "_import", + "_from", + "_var", + "_let", + "_const", + "_if", + "_else", + "_switch", + "_for", + "_(", + "_)", + "_await", + "_in", + "_of", + "_while", + "_do", + "_try", + "_with", + "_break", + "_continue", + "_debugger", + "_return", + "_throw", + "_;", + "_:", + "_case", + "_catch", + "_finally", + "_yield", + "_[", + "_]", + "_<", + "_>", + "_/", + "jsx_text", + "identifier", + "_.", + "_class", + "_async", + "_function", + "_=>", + "_new", + "_+=", + "_-=", + "_*=", + "_/=", + "_%=", + "_^=", + "_&=", + "_|=", + "_>>=", + "_>>>=", + "_<<=", + "_**=", + "_...", + "_?", + "_&&", + "_||", + "_>>", + "_>>>", + "_<<", + "_&", + "_^", + "_|", + "_+", + "_-", + "_%", + "_**", + "_<=", + "_==", + "_===", + "_!=", + "_!==", + "_>=", + "_??", + "_instanceof", + "_!", + "_~", + "_void", + "_delete", + "_++", + "_--", + "_\"", + "_string_token1", + "_'", + "_string_token2", + "escape_sequence", + "comment", + "_`", + "_${", + "_/", + "regex_pattern", + "regex_flags", + "number", + "_target", + "this", + "super", + "true", + "false", + "null", + "undefined", + "_@", + "_static", + "_abstract", + "_get", + "_set", + "_declare", + "_public", + "_private", + "_protected", + "_module", + "_any", + "_number", + "_boolean", + "_string", + "_symbol", + "_require", + "_implements", + "_global", + "_interface", + "_extends", + "_enum", + "readonly", + "_is", + "_keyof", + "_{|", + "_|}", + "_automatic_semicolon", + "_template_chars", + "program", + "export_statement", + "export_clause", + "_import_export_specifier", + "_declaration", + "import", + "import_statement", + "import_clause", + "_from_clause", + "namespace_import", + "named_imports", + "expression_statement", + "variable_declaration", + "lexical_declaration", + "variable_declarator", + "statement_block", + "if_statement", + "switch_statement", + "for_statement", + "for_in_statement", + "_for_header", + "while_statement", + "do_statement", + "try_statement", + "with_statement", + "break_statement", + "continue_statement", + "debugger_statement", + "return_statement", + "throw_statement", + "empty_statement", + "labeled_statement", + "switch_body", + "switch_case", + "switch_default", + "catch_clause", + "finally_clause", + "parenthesized_expression", + "_expression", + "yield_expression", + "object", + "assignment_pattern", + "array", + "jsx_element", + "jsx_fragment", + "jsx_expression", + "jsx_opening_element", + "nested_identifier", + "jsx_namespace_name", + "jsx_closing_element", + "jsx_self_closing_element", + "jsx_attribute", + "class", + "class_declaration", + "class_heritage", + "function", + "function_declaration", + "generator_function", + "generator_function_declaration", + "arrow_function", + "_call_signature", + "call_expression", + "new_expression", + "await_expression", + "member_expression", + "subscript_expression", + "assignment_expression", + "augmented_assignment_expression", + "_initializer", + "spread_element", + "ternary_expression", + "binary_expression", + "unary_expression", + "update_expression", + "sequence_expression", + "string", + "template_string", + "template_substitution", + "regex", + "meta_property", + "arguments", + "decorator", + "member_expression", + "call_expression", + "class_body", + "public_field_definition", + "formal_parameters", + "rest_parameter", + "method_definition", + "pair", + "_property_name", + "computed_property_name", + "non_null_expression", + "method_signature", + "abstract_method_signature", + "function_signature", + "as_expression", + "import_require_clause", + "implements_clause", + "ambient_declaration", + "abstract_class_declaration", + "module", + "internal_module", + "_module", + "import_alias", + "nested_type_identifier", + "interface_declaration", + "extends_clause", + "enum_declaration", + "enum_body", + "enum_assignment", + "type_alias_declaration", + "accessibility_modifier", + "required_parameter", + "optional_parameter", + "_parameter_name", + "type_annotation", + "_type", + "constructor_type", + "_primary_type", + "generic_type", + "type_predicate", + "type_query", + "index_type_query", + "lookup_type", + "mapped_type_clause", + "literal_type", + "unary_expression", + "existential_type", + "flow_maybe_type", + "parenthesized_type", + "predefined_type", + "type_arguments", + "object_type", + "call_signature", + "property_signature", + "type_parameters", + "type_parameter", + "default_type", + "constraint", + "construct_signature", + "index_signature", + "array_type", + "tuple_type", + "union_type", + "intersection_type", + "function_type", + "_program_repeat1", + "_export_statement_repeat1", + "_export_clause_repeat1", + "_named_imports_repeat1", + "_variable_declaration_repeat1", + "_switch_body_repeat1", + "_object_repeat1", + "_array_repeat1", + "_jsx_element_repeat1", + "_jsx_opening_element_repeat1", + "_string_repeat1", + "_string_repeat2", + "_template_string_repeat1", + "_class_body_repeat1", + "_formal_parameters_repeat1", + "_implements_clause_repeat1", + "_extends_clause_repeat1", + "_enum_body_repeat1", + "_object_type_repeat1", + "_type_parameters_repeat1", + "array_pattern", + "export_specifier", + "import_specifier", + "object_pattern", + "property_identifier", + "shorthand_property_identifier", + "statement_identifier", + "type_identifier" + ] + +newtype Declaration a = Declaration {getDeclaration :: ((AbstractClassDeclaration GHC.Generics.:+: AmbientDeclaration GHC.Generics.:+: ClassDeclaration GHC.Generics.:+: EnumDeclaration GHC.Generics.:+: FunctionDeclaration GHC.Generics.:+: FunctionSignature GHC.Generics.:+: GeneratorFunctionDeclaration GHC.Generics.:+: ImportAlias GHC.Generics.:+: InterfaceDeclaration GHC.Generics.:+: InternalModule GHC.Generics.:+: LexicalDeclaration GHC.Generics.:+: Module GHC.Generics.:+: TypeAliasDeclaration GHC.Generics.:+: VariableDeclaration) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1. + AST.Traversable1.Class.Traversable1 a_1 + ) + +instance GHC.Records.HasField "ann" (Declaration a_2) a_2 where + getField = AST.Unmarshal.gann GHC.Base.. getDeclaration + +deriving instance GHC.Classes.Eq a_3 => GHC.Classes.Eq (Declaration a_3) + +deriving instance GHC.Classes.Ord a_4 => GHC.Classes.Ord (Declaration a_4) + +deriving instance GHC.Show.Show a_5 => GHC.Show.Show (Declaration a_5) + +instance AST.Unmarshal.Unmarshal Declaration + +instance Data.Foldable.Foldable Declaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Declaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Declaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype DestructuringPattern a = DestructuringPattern {getDestructuringPattern :: ((ArrayPattern GHC.Generics.:+: ObjectPattern) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_6. + AST.Traversable1.Class.Traversable1 a_6 + ) + +instance GHC.Records.HasField "ann" (DestructuringPattern a_7) a_7 where + getField = AST.Unmarshal.gann GHC.Base.. getDestructuringPattern + +deriving instance GHC.Classes.Eq a_8 => GHC.Classes.Eq (DestructuringPattern a_8) + +deriving instance GHC.Classes.Ord a_9 => GHC.Classes.Ord (DestructuringPattern a_9) + +deriving instance GHC.Show.Show a_10 => GHC.Show.Show (DestructuringPattern a_10) + +instance AST.Unmarshal.Unmarshal DestructuringPattern + +instance Data.Foldable.Foldable DestructuringPattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DestructuringPattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DestructuringPattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Expression a = Expression {getExpression :: ((Array GHC.Generics.:+: ArrowFunction GHC.Generics.:+: AsExpression GHC.Generics.:+: AssignmentExpression GHC.Generics.:+: AugmentedAssignmentExpression GHC.Generics.:+: AwaitExpression GHC.Generics.:+: BinaryExpression GHC.Generics.:+: CallExpression GHC.Generics.:+: Class GHC.Generics.:+: False GHC.Generics.:+: Function GHC.Generics.:+: GeneratorFunction GHC.Generics.:+: Identifier GHC.Generics.:+: Import GHC.Generics.:+: InternalModule GHC.Generics.:+: JsxElement GHC.Generics.:+: JsxFragment GHC.Generics.:+: JsxSelfClosingElement GHC.Generics.:+: MemberExpression GHC.Generics.:+: MetaProperty GHC.Generics.:+: NewExpression GHC.Generics.:+: NonNullExpression GHC.Generics.:+: Null GHC.Generics.:+: Number GHC.Generics.:+: Object GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: Regex GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: Super GHC.Generics.:+: TemplateString GHC.Generics.:+: TernaryExpression GHC.Generics.:+: This GHC.Generics.:+: True GHC.Generics.:+: UnaryExpression GHC.Generics.:+: Undefined GHC.Generics.:+: UpdateExpression GHC.Generics.:+: YieldExpression) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_11. + AST.Traversable1.Class.Traversable1 a_11 + ) + +instance GHC.Records.HasField "ann" (Expression a_12) a_12 where + getField = AST.Unmarshal.gann GHC.Base.. getExpression + +deriving instance GHC.Classes.Eq a_13 => GHC.Classes.Eq (Expression a_13) + +deriving instance GHC.Classes.Ord a_14 => GHC.Classes.Ord (Expression a_14) + +deriving instance GHC.Show.Show a_15 => GHC.Show.Show (Expression a_15) + +instance AST.Unmarshal.Unmarshal Expression + +instance Data.Foldable.Foldable Expression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Expression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Expression where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Statement a = Statement {getStatement :: ((Declaration GHC.Generics.:+: BreakStatement GHC.Generics.:+: ContinueStatement GHC.Generics.:+: DebuggerStatement GHC.Generics.:+: DoStatement GHC.Generics.:+: EmptyStatement GHC.Generics.:+: ExportStatement GHC.Generics.:+: ExpressionStatement GHC.Generics.:+: ForInStatement GHC.Generics.:+: ForStatement GHC.Generics.:+: IfStatement GHC.Generics.:+: ImportStatement GHC.Generics.:+: LabeledStatement GHC.Generics.:+: ReturnStatement GHC.Generics.:+: StatementBlock GHC.Generics.:+: SwitchStatement GHC.Generics.:+: ThrowStatement GHC.Generics.:+: TryStatement GHC.Generics.:+: WhileStatement GHC.Generics.:+: WithStatement) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_16. + AST.Traversable1.Class.Traversable1 a_16 + ) + +instance GHC.Records.HasField "ann" (Statement a_17) a_17 where + getField = AST.Unmarshal.gann GHC.Base.. getStatement + +deriving instance GHC.Classes.Eq a_18 => GHC.Classes.Eq (Statement a_18) + +deriving instance GHC.Classes.Ord a_19 => GHC.Classes.Ord (Statement a_19) + +deriving instance GHC.Show.Show a_20 => GHC.Show.Show (Statement a_20) + +instance AST.Unmarshal.Unmarshal Statement + +instance Data.Foldable.Foldable Statement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Statement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Statement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AbstractClassDeclaration a = AbstractClassDeclaration + { ann :: a, + body :: (AST.Parse.Err (ClassBody a)), + name :: (AST.Parse.Err (TypeIdentifier a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ClassHeritage a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_21. + AST.Traversable1.Class.Traversable1 a_21 + ) + +instance AST.Unmarshal.SymbolMatching AbstractClassDeclaration where + matchedSymbols _ = [243] + showFailure _ node_22 = + "expected " + GHC.Base.<> ( "abstract_class_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_22 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_22) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_23 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_24 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_25 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_26 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_23 + c1_24 = TreeSitter.Node.nodeStartPoint node_22 + TreeSitter.Node.TSPoint + r2_25 + c2_26 = TreeSitter.Node.nodeEndPoint node_22 + +deriving instance GHC.Classes.Eq a_27 => GHC.Classes.Eq (AbstractClassDeclaration a_27) + +deriving instance GHC.Classes.Ord a_28 => GHC.Classes.Ord (AbstractClassDeclaration a_28) + +deriving instance GHC.Show.Show a_29 => GHC.Show.Show (AbstractClassDeclaration a_29) + +instance AST.Unmarshal.Unmarshal AbstractClassDeclaration + +instance Data.Foldable.Foldable AbstractClassDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AbstractClassDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AbstractClassDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AbstractMethodSignature a = AbstractMethodSignature + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + name :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (AccessibilityModifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_30. + AST.Traversable1.Class.Traversable1 a_30 + ) + +instance AST.Unmarshal.SymbolMatching AbstractMethodSignature where + matchedSymbols _ = [237] + showFailure _ node_31 = + "expected " + GHC.Base.<> ( "abstract_method_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_31 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_31) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_32 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_33 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_34 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_35 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_32 + c1_33 = TreeSitter.Node.nodeStartPoint node_31 + TreeSitter.Node.TSPoint + r2_34 + c2_35 = TreeSitter.Node.nodeEndPoint node_31 + +deriving instance GHC.Classes.Eq a_36 => GHC.Classes.Eq (AbstractMethodSignature a_36) + +deriving instance GHC.Classes.Ord a_37 => GHC.Classes.Ord (AbstractMethodSignature a_37) + +deriving instance GHC.Show.Show a_38 => GHC.Show.Show (AbstractMethodSignature a_38) + +instance AST.Unmarshal.Unmarshal AbstractMethodSignature + +instance Data.Foldable.Foldable AbstractMethodSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AbstractMethodSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AbstractMethodSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AccessibilityModifier a = AccessibilityModifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_39. + AST.Traversable1.Class.Traversable1 a_39 + ) + +instance AST.Unmarshal.SymbolMatching AccessibilityModifier where + matchedSymbols _ = [255] + showFailure _ node_40 = + "expected " + GHC.Base.<> ( "accessibility_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_40 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_40) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_41 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_42 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_43 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_44 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_41 + c1_42 = TreeSitter.Node.nodeStartPoint node_40 + TreeSitter.Node.TSPoint + r2_43 + c2_44 = TreeSitter.Node.nodeEndPoint node_40 + +deriving instance GHC.Classes.Eq a_45 => GHC.Classes.Eq (AccessibilityModifier a_45) + +deriving instance GHC.Classes.Ord a_46 => GHC.Classes.Ord (AccessibilityModifier a_46) + +deriving instance GHC.Show.Show a_47 => GHC.Show.Show (AccessibilityModifier a_47) + +instance AST.Unmarshal.Unmarshal AccessibilityModifier + +instance Data.Foldable.Foldable AccessibilityModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AccessibilityModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AccessibilityModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AmbientDeclaration a = AmbientDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Declaration GHC.Generics.:+: ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: StatementBlock GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_48. + AST.Traversable1.Class.Traversable1 a_48 + ) + +instance AST.Unmarshal.SymbolMatching AmbientDeclaration where + matchedSymbols _ = [242] + showFailure _ node_49 = + "expected " + GHC.Base.<> ( "ambient_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_49 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_49) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_50 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_51 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_52 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_53 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_50 + c1_51 = TreeSitter.Node.nodeStartPoint node_49 + TreeSitter.Node.TSPoint + r2_52 + c2_53 = TreeSitter.Node.nodeEndPoint node_49 + +deriving instance GHC.Classes.Eq a_54 => GHC.Classes.Eq (AmbientDeclaration a_54) + +deriving instance GHC.Classes.Ord a_55 => GHC.Classes.Ord (AmbientDeclaration a_55) + +deriving instance GHC.Show.Show a_56 => GHC.Show.Show (AmbientDeclaration a_56) + +instance AST.Unmarshal.Unmarshal AmbientDeclaration + +instance Data.Foldable.Foldable AmbientDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AmbientDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AmbientDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Arguments a = Arguments + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: SpreadElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_57. + AST.Traversable1.Class.Traversable1 a_57 + ) + +instance AST.Unmarshal.SymbolMatching Arguments where + matchedSymbols _ = [223] + showFailure _ node_58 = + "expected " + GHC.Base.<> ( "arguments" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_58 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_58) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_59 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_60 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_61 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_62 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_59 + c1_60 = TreeSitter.Node.nodeStartPoint node_58 + TreeSitter.Node.TSPoint + r2_61 + c2_62 = TreeSitter.Node.nodeEndPoint node_58 + +deriving instance GHC.Classes.Eq a_63 => GHC.Classes.Eq (Arguments a_63) + +deriving instance GHC.Classes.Ord a_64 => GHC.Classes.Ord (Arguments a_64) + +deriving instance GHC.Show.Show a_65 => GHC.Show.Show (Arguments a_65) + +instance AST.Unmarshal.Unmarshal Arguments + +instance Data.Foldable.Foldable Arguments where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Arguments where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Arguments where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Array a = Array + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: SpreadElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_66. + AST.Traversable1.Class.Traversable1 a_66 + ) + +instance AST.Unmarshal.SymbolMatching Array where + matchedSymbols _ = [185] + showFailure _ node_67 = + "expected " + GHC.Base.<> ( "array" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_67 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_67) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_68 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_69 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_70 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_71 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_68 + c1_69 = TreeSitter.Node.nodeStartPoint node_67 + TreeSitter.Node.TSPoint + r2_70 + c2_71 = TreeSitter.Node.nodeEndPoint node_67 + +deriving instance GHC.Classes.Eq a_72 => GHC.Classes.Eq (Array a_72) + +deriving instance GHC.Classes.Ord a_73 => GHC.Classes.Ord (Array a_73) + +deriving instance GHC.Show.Show a_74 => GHC.Show.Show (Array a_74) + +instance AST.Unmarshal.Unmarshal Array + +instance Data.Foldable.Foldable Array where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Array where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Array where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayPattern a = ArrayPattern + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: SpreadElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_75. + AST.Traversable1.Class.Traversable1 a_75 + ) + +instance AST.Unmarshal.SymbolMatching ArrayPattern where + matchedSymbols _ = [310] + showFailure _ node_76 = + "expected " + GHC.Base.<> ( "array_pattern" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_76 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_76) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_77 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_78 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_79 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_80 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_77 + c1_78 = TreeSitter.Node.nodeStartPoint node_76 + TreeSitter.Node.TSPoint + r2_79 + c2_80 = TreeSitter.Node.nodeEndPoint node_76 + +deriving instance GHC.Classes.Eq a_81 => GHC.Classes.Eq (ArrayPattern a_81) + +deriving instance GHC.Classes.Ord a_82 => GHC.Classes.Ord (ArrayPattern a_82) + +deriving instance GHC.Show.Show a_83 => GHC.Show.Show (ArrayPattern a_83) + +instance AST.Unmarshal.Unmarshal ArrayPattern + +instance Data.Foldable.Foldable ArrayPattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayPattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayPattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayType a = ArrayType + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_84. + AST.Traversable1.Class.Traversable1 a_84 + ) + +instance AST.Unmarshal.SymbolMatching ArrayType where + matchedSymbols _ = [285] + showFailure _ node_85 = + "expected " + GHC.Base.<> ( "array_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_85 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_85) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_86 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_87 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_88 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_89 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_86 + c1_87 = TreeSitter.Node.nodeStartPoint node_85 + TreeSitter.Node.TSPoint + r2_88 + c2_89 = TreeSitter.Node.nodeEndPoint node_85 + +deriving instance GHC.Classes.Eq a_90 => GHC.Classes.Eq (ArrayType a_90) + +deriving instance GHC.Classes.Ord a_91 => GHC.Classes.Ord (ArrayType a_91) + +deriving instance GHC.Show.Show a_92 => GHC.Show.Show (ArrayType a_92) + +instance AST.Unmarshal.Unmarshal ArrayType + +instance Data.Foldable.Foldable ArrayType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrowFunction a = ArrowFunction + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err ((Expression GHC.Generics.:+: StatementBlock) a)), + parameters :: (GHC.Maybe.Maybe (AST.Parse.Err (FormalParameters a))), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + parameter :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_93. + AST.Traversable1.Class.Traversable1 a_93 + ) + +instance AST.Unmarshal.SymbolMatching ArrowFunction where + matchedSymbols _ = [202] + showFailure _ node_94 = + "expected " + GHC.Base.<> ( "arrow_function" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_94 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_94) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_95 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_96 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_97 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_98 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_95 + c1_96 = TreeSitter.Node.nodeStartPoint node_94 + TreeSitter.Node.TSPoint + r2_97 + c2_98 = TreeSitter.Node.nodeEndPoint node_94 + +deriving instance GHC.Classes.Eq a_99 => GHC.Classes.Eq (ArrowFunction a_99) + +deriving instance GHC.Classes.Ord a_100 => GHC.Classes.Ord (ArrowFunction a_100) + +deriving instance GHC.Show.Show a_101 => GHC.Show.Show (ArrowFunction a_101) + +instance AST.Unmarshal.Unmarshal ArrowFunction + +instance Data.Foldable.Foldable ArrowFunction where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrowFunction where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrowFunction where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AsExpression a = AsExpression + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_102. + AST.Traversable1.Class.Traversable1 a_102 + ) + +instance AST.Unmarshal.SymbolMatching AsExpression where + matchedSymbols _ = [239] + showFailure _ node_103 = + "expected " + GHC.Base.<> ( "as_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_103 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_103) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_104 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_105 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_106 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_107 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_104 + c1_105 = TreeSitter.Node.nodeStartPoint node_103 + TreeSitter.Node.TSPoint + r2_106 + c2_107 = TreeSitter.Node.nodeEndPoint node_103 + +deriving instance GHC.Classes.Eq a_108 => GHC.Classes.Eq (AsExpression a_108) + +deriving instance GHC.Classes.Ord a_109 => GHC.Classes.Ord (AsExpression a_109) + +deriving instance GHC.Show.Show a_110 => GHC.Show.Show (AsExpression a_110) + +instance AST.Unmarshal.Unmarshal AsExpression + +instance Data.Foldable.Foldable AsExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AsExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AsExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AssignmentExpression a = AssignmentExpression + { ann :: a, + left :: (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: Identifier GHC.Generics.:+: MemberExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: SubscriptExpression) a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_111. + AST.Traversable1.Class.Traversable1 a_111 + ) + +instance AST.Unmarshal.SymbolMatching AssignmentExpression where + matchedSymbols _ = [209] + showFailure _ node_112 = + "expected " + GHC.Base.<> ( "assignment_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_112 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_112) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_113 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_114 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_115 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_116 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_113 + c1_114 = TreeSitter.Node.nodeStartPoint node_112 + TreeSitter.Node.TSPoint + r2_115 + c2_116 = TreeSitter.Node.nodeEndPoint node_112 + +deriving instance GHC.Classes.Eq a_117 => GHC.Classes.Eq (AssignmentExpression a_117) + +deriving instance GHC.Classes.Ord a_118 => GHC.Classes.Ord (AssignmentExpression a_118) + +deriving instance GHC.Show.Show a_119 => GHC.Show.Show (AssignmentExpression a_119) + +instance AST.Unmarshal.Unmarshal AssignmentExpression + +instance Data.Foldable.Foldable AssignmentExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AssignmentExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AssignmentExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AssignmentPattern a = AssignmentPattern + { ann :: a, + left :: (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: ShorthandPropertyIdentifier) a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_120. + AST.Traversable1.Class.Traversable1 a_120 + ) + +instance AST.Unmarshal.SymbolMatching AssignmentPattern where + matchedSymbols _ = [184] + showFailure _ node_121 = + "expected " + GHC.Base.<> ( "assignment_pattern" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_121 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_121) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_122 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_123 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_124 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_125 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_122 + c1_123 = TreeSitter.Node.nodeStartPoint node_121 + TreeSitter.Node.TSPoint + r2_124 + c2_125 = TreeSitter.Node.nodeEndPoint node_121 + +deriving instance GHC.Classes.Eq a_126 => GHC.Classes.Eq (AssignmentPattern a_126) + +deriving instance GHC.Classes.Ord a_127 => GHC.Classes.Ord (AssignmentPattern a_127) + +deriving instance GHC.Show.Show a_128 => GHC.Show.Show (AssignmentPattern a_128) + +instance AST.Unmarshal.Unmarshal AssignmentPattern + +instance Data.Foldable.Foldable AssignmentPattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AssignmentPattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AssignmentPattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AugmentedAssignmentExpression a = AugmentedAssignmentExpression + { ann :: a, + left :: (AST.Parse.Err ((Identifier GHC.Generics.:+: MemberExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: SubscriptExpression) a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_129. + AST.Traversable1.Class.Traversable1 a_129 + ) + +instance AST.Unmarshal.SymbolMatching AugmentedAssignmentExpression where + matchedSymbols _ = [210] + showFailure _ node_130 = + "expected " + GHC.Base.<> ( "augmented_assignment_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_130 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_130) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_131 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_132 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_133 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_134 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_131 + c1_132 = TreeSitter.Node.nodeStartPoint node_130 + TreeSitter.Node.TSPoint + r2_133 + c2_134 = TreeSitter.Node.nodeEndPoint node_130 + +deriving instance GHC.Classes.Eq a_135 => GHC.Classes.Eq (AugmentedAssignmentExpression a_135) + +deriving instance GHC.Classes.Ord a_136 => GHC.Classes.Ord (AugmentedAssignmentExpression a_136) + +deriving instance GHC.Show.Show a_137 => GHC.Show.Show (AugmentedAssignmentExpression a_137) + +instance AST.Unmarshal.Unmarshal AugmentedAssignmentExpression + +instance Data.Foldable.Foldable AugmentedAssignmentExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AugmentedAssignmentExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AugmentedAssignmentExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AwaitExpression a = AwaitExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_138. + AST.Traversable1.Class.Traversable1 a_138 + ) + +instance AST.Unmarshal.SymbolMatching AwaitExpression where + matchedSymbols _ = [206] + showFailure _ node_139 = + "expected " + GHC.Base.<> ( "await_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_139 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_139) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_140 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_141 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_142 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_143 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_140 + c1_141 = TreeSitter.Node.nodeStartPoint node_139 + TreeSitter.Node.TSPoint + r2_142 + c2_143 = TreeSitter.Node.nodeEndPoint node_139 + +deriving instance GHC.Classes.Eq a_144 => GHC.Classes.Eq (AwaitExpression a_144) + +deriving instance GHC.Classes.Ord a_145 => GHC.Classes.Ord (AwaitExpression a_145) + +deriving instance GHC.Show.Show a_146 => GHC.Show.Show (AwaitExpression a_146) + +instance AST.Unmarshal.Unmarshal AwaitExpression + +instance Data.Foldable.Foldable AwaitExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AwaitExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AwaitExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BinaryExpression a = BinaryExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousBangEqual GHC.Generics.:+: AnonymousBangEqualEqual GHC.Generics.:+: AnonymousPercent GHC.Generics.:+: AnonymousAmpersand GHC.Generics.:+: AnonymousAmpersandAmpersand GHC.Generics.:+: AnonymousStar GHC.Generics.:+: AnonymousStarStar GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousSlash GHC.Generics.:+: AnonymousLAngle GHC.Generics.:+: AnonymousLAngleLAngle GHC.Generics.:+: AnonymousLAngleEqual GHC.Generics.:+: AnonymousEqualEqual GHC.Generics.:+: AnonymousEqualEqualEqual GHC.Generics.:+: AnonymousRAngle GHC.Generics.:+: AnonymousRAngleEqual GHC.Generics.:+: AnonymousRAngleRAngle GHC.Generics.:+: AnonymousRAngleRAngleRAngle GHC.Generics.:+: AnonymousQuestionQuestion GHC.Generics.:+: AnonymousCaret GHC.Generics.:+: AnonymousIn GHC.Generics.:+: AnonymousInstanceof GHC.Generics.:+: AnonymousPipe GHC.Generics.:+: AnonymousPipePipe) a)), + left :: (AST.Parse.Err (Expression a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_147. + AST.Traversable1.Class.Traversable1 a_147 + ) + +instance AST.Unmarshal.SymbolMatching BinaryExpression where + matchedSymbols _ = [214] + showFailure _ node_148 = + "expected " + GHC.Base.<> ( "binary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_148 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_148) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_149 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_150 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_151 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_152 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_149 + c1_150 = TreeSitter.Node.nodeStartPoint node_148 + TreeSitter.Node.TSPoint + r2_151 + c2_152 = TreeSitter.Node.nodeEndPoint node_148 + +deriving instance GHC.Classes.Eq a_153 => GHC.Classes.Eq (BinaryExpression a_153) + +deriving instance GHC.Classes.Ord a_154 => GHC.Classes.Ord (BinaryExpression a_154) + +deriving instance GHC.Show.Show a_155 => GHC.Show.Show (BinaryExpression a_155) + +instance AST.Unmarshal.Unmarshal BinaryExpression + +instance Data.Foldable.Foldable BinaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BinaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BinaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BreakStatement a = BreakStatement + { ann :: a, + label :: (GHC.Maybe.Maybe (AST.Parse.Err (StatementIdentifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_156. + AST.Traversable1.Class.Traversable1 a_156 + ) + +instance AST.Unmarshal.SymbolMatching BreakStatement where + matchedSymbols _ = [168] + showFailure _ node_157 = + "expected " + GHC.Base.<> ( "break_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_157 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_157) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_158 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_159 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_160 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_161 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_158 + c1_159 = TreeSitter.Node.nodeStartPoint node_157 + TreeSitter.Node.TSPoint + r2_160 + c2_161 = TreeSitter.Node.nodeEndPoint node_157 + +deriving instance GHC.Classes.Eq a_162 => GHC.Classes.Eq (BreakStatement a_162) + +deriving instance GHC.Classes.Ord a_163 => GHC.Classes.Ord (BreakStatement a_163) + +deriving instance GHC.Show.Show a_164 => GHC.Show.Show (BreakStatement a_164) + +instance AST.Unmarshal.Unmarshal BreakStatement + +instance Data.Foldable.Foldable BreakStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BreakStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BreakStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CallExpression a = CallExpression + { ann :: a, + function :: (AST.Parse.Err (Expression a)), + arguments :: (AST.Parse.Err ((Arguments GHC.Generics.:+: TemplateString) a)), + typeArguments :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeArguments a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_165. + AST.Traversable1.Class.Traversable1 a_165 + ) + +instance AST.Unmarshal.SymbolMatching CallExpression where + matchedSymbols _ = [204, 226] + showFailure _ node_166 = + "expected " + GHC.Base.<> ( "call_expression, call_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_166 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_166) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_167 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_168 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_169 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_170 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_167 + c1_168 = TreeSitter.Node.nodeStartPoint node_166 + TreeSitter.Node.TSPoint + r2_169 + c2_170 = TreeSitter.Node.nodeEndPoint node_166 + +deriving instance GHC.Classes.Eq a_171 => GHC.Classes.Eq (CallExpression a_171) + +deriving instance GHC.Classes.Ord a_172 => GHC.Classes.Ord (CallExpression a_172) + +deriving instance GHC.Show.Show a_173 => GHC.Show.Show (CallExpression a_173) + +instance AST.Unmarshal.Unmarshal CallExpression + +instance Data.Foldable.Foldable CallExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CallExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CallExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CallSignature a = CallSignature + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_174. + AST.Traversable1.Class.Traversable1 a_174 + ) + +instance AST.Unmarshal.SymbolMatching CallSignature where + matchedSymbols _ = [277] + showFailure _ node_175 = + "expected " + GHC.Base.<> ( "call_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_175 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_175) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_176 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_177 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_178 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_179 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_176 + c1_177 = TreeSitter.Node.nodeStartPoint node_175 + TreeSitter.Node.TSPoint + r2_178 + c2_179 = TreeSitter.Node.nodeEndPoint node_175 + +deriving instance GHC.Classes.Eq a_180 => GHC.Classes.Eq (CallSignature a_180) + +deriving instance GHC.Classes.Ord a_181 => GHC.Classes.Ord (CallSignature a_181) + +deriving instance GHC.Show.Show a_182 => GHC.Show.Show (CallSignature a_182) + +instance AST.Unmarshal.Unmarshal CallSignature + +instance Data.Foldable.Foldable CallSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CallSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CallSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CatchClause a = CatchClause + { ann :: a, + body :: (AST.Parse.Err (StatementBlock a)), + parameter :: (GHC.Maybe.Maybe (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: Identifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_183. + AST.Traversable1.Class.Traversable1 a_183 + ) + +instance AST.Unmarshal.SymbolMatching CatchClause where + matchedSymbols _ = [178] + showFailure _ node_184 = + "expected " + GHC.Base.<> ( "catch_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_184 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_184) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_185 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_186 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_187 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_188 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_185 + c1_186 = TreeSitter.Node.nodeStartPoint node_184 + TreeSitter.Node.TSPoint + r2_187 + c2_188 = TreeSitter.Node.nodeEndPoint node_184 + +deriving instance GHC.Classes.Eq a_189 => GHC.Classes.Eq (CatchClause a_189) + +deriving instance GHC.Classes.Ord a_190 => GHC.Classes.Ord (CatchClause a_190) + +deriving instance GHC.Show.Show a_191 => GHC.Show.Show (CatchClause a_191) + +instance AST.Unmarshal.Unmarshal CatchClause + +instance Data.Foldable.Foldable CatchClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CatchClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CatchClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Class a = Class + { ann :: a, + decorator :: ([AST.Parse.Err (Decorator a)]), + body :: (AST.Parse.Err (ClassBody a)), + name :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeIdentifier a))), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ClassHeritage a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_192. + AST.Traversable1.Class.Traversable1 a_192 + ) + +instance AST.Unmarshal.SymbolMatching Class where + matchedSymbols _ = [195] + showFailure _ node_193 = + "expected " + GHC.Base.<> ( "class" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_193 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_193) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_194 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_195 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_196 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_197 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_194 + c1_195 = TreeSitter.Node.nodeStartPoint node_193 + TreeSitter.Node.TSPoint + r2_196 + c2_197 = TreeSitter.Node.nodeEndPoint node_193 + +deriving instance GHC.Classes.Eq a_198 => GHC.Classes.Eq (Class a_198) + +deriving instance GHC.Classes.Ord a_199 => GHC.Classes.Ord (Class a_199) + +deriving instance GHC.Show.Show a_200 => GHC.Show.Show (Class a_200) + +instance AST.Unmarshal.Unmarshal Class + +instance Data.Foldable.Foldable Class where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Class where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Class where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassBody a = ClassBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AbstractMethodSignature GHC.Generics.:+: Decorator GHC.Generics.:+: IndexSignature GHC.Generics.:+: MethodDefinition GHC.Generics.:+: MethodSignature GHC.Generics.:+: PublicFieldDefinition) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_201. + AST.Traversable1.Class.Traversable1 a_201 + ) + +instance AST.Unmarshal.SymbolMatching ClassBody where + matchedSymbols _ = [227] + showFailure _ node_202 = + "expected " + GHC.Base.<> ( "class_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_202 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_202) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_203 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_204 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_205 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_206 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_203 + c1_204 = TreeSitter.Node.nodeStartPoint node_202 + TreeSitter.Node.TSPoint + r2_205 + c2_206 = TreeSitter.Node.nodeEndPoint node_202 + +deriving instance GHC.Classes.Eq a_207 => GHC.Classes.Eq (ClassBody a_207) + +deriving instance GHC.Classes.Ord a_208 => GHC.Classes.Ord (ClassBody a_208) + +deriving instance GHC.Show.Show a_209 => GHC.Show.Show (ClassBody a_209) + +instance AST.Unmarshal.Unmarshal ClassBody + +instance Data.Foldable.Foldable ClassBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassDeclaration a = ClassDeclaration + { ann :: a, + decorator :: ([AST.Parse.Err (Decorator a)]), + body :: (AST.Parse.Err (ClassBody a)), + name :: (AST.Parse.Err (TypeIdentifier a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ClassHeritage a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_210. + AST.Traversable1.Class.Traversable1 a_210 + ) + +instance AST.Unmarshal.SymbolMatching ClassDeclaration where + matchedSymbols _ = [196] + showFailure _ node_211 = + "expected " + GHC.Base.<> ( "class_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_211 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_211) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_212 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_213 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_214 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_215 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_212 + c1_213 = TreeSitter.Node.nodeStartPoint node_211 + TreeSitter.Node.TSPoint + r2_214 + c2_215 = TreeSitter.Node.nodeEndPoint node_211 + +deriving instance GHC.Classes.Eq a_216 => GHC.Classes.Eq (ClassDeclaration a_216) + +deriving instance GHC.Classes.Ord a_217 => GHC.Classes.Ord (ClassDeclaration a_217) + +deriving instance GHC.Show.Show a_218 => GHC.Show.Show (ClassDeclaration a_218) + +instance AST.Unmarshal.Unmarshal ClassDeclaration + +instance Data.Foldable.Foldable ClassDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassHeritage a = ClassHeritage + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ExtendsClause GHC.Generics.:+: ImplementsClause) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_219. + AST.Traversable1.Class.Traversable1 a_219 + ) + +instance AST.Unmarshal.SymbolMatching ClassHeritage where + matchedSymbols _ = [197] + showFailure _ node_220 = + "expected " + GHC.Base.<> ( "class_heritage" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_220 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_220) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_221 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_222 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_223 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_224 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_221 + c1_222 = TreeSitter.Node.nodeStartPoint node_220 + TreeSitter.Node.TSPoint + r2_223 + c2_224 = TreeSitter.Node.nodeEndPoint node_220 + +deriving instance GHC.Classes.Eq a_225 => GHC.Classes.Eq (ClassHeritage a_225) + +deriving instance GHC.Classes.Ord a_226 => GHC.Classes.Ord (ClassHeritage a_226) + +deriving instance GHC.Show.Show a_227 => GHC.Show.Show (ClassHeritage a_227) + +instance AST.Unmarshal.Unmarshal ClassHeritage + +instance Data.Foldable.Foldable ClassHeritage where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassHeritage where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassHeritage where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ComputedPropertyName a = ComputedPropertyName + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_228. + AST.Traversable1.Class.Traversable1 a_228 + ) + +instance AST.Unmarshal.SymbolMatching ComputedPropertyName where + matchedSymbols _ = [234] + showFailure _ node_229 = + "expected " + GHC.Base.<> ( "computed_property_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_229 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_229) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_230 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_231 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_232 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_233 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_230 + c1_231 = TreeSitter.Node.nodeStartPoint node_229 + TreeSitter.Node.TSPoint + r2_232 + c2_233 = TreeSitter.Node.nodeEndPoint node_229 + +deriving instance GHC.Classes.Eq a_234 => GHC.Classes.Eq (ComputedPropertyName a_234) + +deriving instance GHC.Classes.Ord a_235 => GHC.Classes.Ord (ComputedPropertyName a_235) + +deriving instance GHC.Show.Show a_236 => GHC.Show.Show (ComputedPropertyName a_236) + +instance AST.Unmarshal.Unmarshal ComputedPropertyName + +instance Data.Foldable.Foldable ComputedPropertyName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ComputedPropertyName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ComputedPropertyName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Constraint a = Constraint + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_237. + AST.Traversable1.Class.Traversable1 a_237 + ) + +instance AST.Unmarshal.SymbolMatching Constraint where + matchedSymbols _ = [282] + showFailure _ node_238 = + "expected " + GHC.Base.<> ( "constraint" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_238 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_238) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_239 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_240 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_241 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_242 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_239 + c1_240 = TreeSitter.Node.nodeStartPoint node_238 + TreeSitter.Node.TSPoint + r2_241 + c2_242 = TreeSitter.Node.nodeEndPoint node_238 + +deriving instance GHC.Classes.Eq a_243 => GHC.Classes.Eq (Constraint a_243) + +deriving instance GHC.Classes.Ord a_244 => GHC.Classes.Ord (Constraint a_244) + +deriving instance GHC.Show.Show a_245 => GHC.Show.Show (Constraint a_245) + +instance AST.Unmarshal.Unmarshal Constraint + +instance Data.Foldable.Foldable Constraint where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Constraint where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Constraint where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstructSignature a = ConstructSignature + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((FormalParameters GHC.Generics.:+: TypeAnnotation GHC.Generics.:+: TypeParameters) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_246. + AST.Traversable1.Class.Traversable1 a_246 + ) + +instance AST.Unmarshal.SymbolMatching ConstructSignature where + matchedSymbols _ = [283] + showFailure _ node_247 = + "expected " + GHC.Base.<> ( "construct_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_247 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_247) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_248 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_249 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_250 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_251 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_248 + c1_249 = TreeSitter.Node.nodeStartPoint node_247 + TreeSitter.Node.TSPoint + r2_250 + c2_251 = TreeSitter.Node.nodeEndPoint node_247 + +deriving instance GHC.Classes.Eq a_252 => GHC.Classes.Eq (ConstructSignature a_252) + +deriving instance GHC.Classes.Ord a_253 => GHC.Classes.Ord (ConstructSignature a_253) + +deriving instance GHC.Show.Show a_254 => GHC.Show.Show (ConstructSignature a_254) + +instance AST.Unmarshal.Unmarshal ConstructSignature + +instance Data.Foldable.Foldable ConstructSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstructSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstructSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstructorType a = ConstructorType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FormalParameters GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypeParameters GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_255. + AST.Traversable1.Class.Traversable1 a_255 + ) + +instance AST.Unmarshal.SymbolMatching ConstructorType where + matchedSymbols _ = [261] + showFailure _ node_256 = + "expected " + GHC.Base.<> ( "constructor_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_256 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_256) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_257 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_258 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_259 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_260 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_257 + c1_258 = TreeSitter.Node.nodeStartPoint node_256 + TreeSitter.Node.TSPoint + r2_259 + c2_260 = TreeSitter.Node.nodeEndPoint node_256 + +deriving instance GHC.Classes.Eq a_261 => GHC.Classes.Eq (ConstructorType a_261) + +deriving instance GHC.Classes.Ord a_262 => GHC.Classes.Ord (ConstructorType a_262) + +deriving instance GHC.Show.Show a_263 => GHC.Show.Show (ConstructorType a_263) + +instance AST.Unmarshal.Unmarshal ConstructorType + +instance Data.Foldable.Foldable ConstructorType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstructorType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstructorType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ContinueStatement a = ContinueStatement + { ann :: a, + label :: (GHC.Maybe.Maybe (AST.Parse.Err (StatementIdentifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_264. + AST.Traversable1.Class.Traversable1 a_264 + ) + +instance AST.Unmarshal.SymbolMatching ContinueStatement where + matchedSymbols _ = [169] + showFailure _ node_265 = + "expected " + GHC.Base.<> ( "continue_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_265 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_265) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_266 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_267 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_268 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_269 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_266 + c1_267 = TreeSitter.Node.nodeStartPoint node_265 + TreeSitter.Node.TSPoint + r2_268 + c2_269 = TreeSitter.Node.nodeEndPoint node_265 + +deriving instance GHC.Classes.Eq a_270 => GHC.Classes.Eq (ContinueStatement a_270) + +deriving instance GHC.Classes.Ord a_271 => GHC.Classes.Ord (ContinueStatement a_271) + +deriving instance GHC.Show.Show a_272 => GHC.Show.Show (ContinueStatement a_272) + +instance AST.Unmarshal.Unmarshal ContinueStatement + +instance Data.Foldable.Foldable ContinueStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ContinueStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ContinueStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DebuggerStatement a = DebuggerStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_273. + AST.Traversable1.Class.Traversable1 a_273 + ) + +instance AST.Unmarshal.SymbolMatching DebuggerStatement where + matchedSymbols _ = [170] + showFailure _ node_274 = + "expected " + GHC.Base.<> ( "debugger_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_274 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_274) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_275 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_276 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_277 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_278 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_275 + c1_276 = TreeSitter.Node.nodeStartPoint node_274 + TreeSitter.Node.TSPoint + r2_277 + c2_278 = TreeSitter.Node.nodeEndPoint node_274 + +deriving instance GHC.Classes.Eq a_279 => GHC.Classes.Eq (DebuggerStatement a_279) + +deriving instance GHC.Classes.Ord a_280 => GHC.Classes.Ord (DebuggerStatement a_280) + +deriving instance GHC.Show.Show a_281 => GHC.Show.Show (DebuggerStatement a_281) + +instance AST.Unmarshal.Unmarshal DebuggerStatement + +instance Data.Foldable.Foldable DebuggerStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DebuggerStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DebuggerStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Decorator a = Decorator + { ann :: a, + extraChildren :: (AST.Parse.Err ((CallExpression GHC.Generics.:+: Identifier GHC.Generics.:+: MemberExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_282. + AST.Traversable1.Class.Traversable1 a_282 + ) + +instance AST.Unmarshal.SymbolMatching Decorator where + matchedSymbols _ = [224] + showFailure _ node_283 = + "expected " + GHC.Base.<> ( "decorator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_283 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_283) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_284 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_285 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_286 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_287 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_284 + c1_285 = TreeSitter.Node.nodeStartPoint node_283 + TreeSitter.Node.TSPoint + r2_286 + c2_287 = TreeSitter.Node.nodeEndPoint node_283 + +deriving instance GHC.Classes.Eq a_288 => GHC.Classes.Eq (Decorator a_288) + +deriving instance GHC.Classes.Ord a_289 => GHC.Classes.Ord (Decorator a_289) + +deriving instance GHC.Show.Show a_290 => GHC.Show.Show (Decorator a_290) + +instance AST.Unmarshal.Unmarshal Decorator + +instance Data.Foldable.Foldable Decorator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Decorator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Decorator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DefaultType a = DefaultType + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_291. + AST.Traversable1.Class.Traversable1 a_291 + ) + +instance AST.Unmarshal.SymbolMatching DefaultType where + matchedSymbols _ = [281] + showFailure _ node_292 = + "expected " + GHC.Base.<> ( "default_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_292 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_292) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_293 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_294 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_295 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_296 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_293 + c1_294 = TreeSitter.Node.nodeStartPoint node_292 + TreeSitter.Node.TSPoint + r2_295 + c2_296 = TreeSitter.Node.nodeEndPoint node_292 + +deriving instance GHC.Classes.Eq a_297 => GHC.Classes.Eq (DefaultType a_297) + +deriving instance GHC.Classes.Ord a_298 => GHC.Classes.Ord (DefaultType a_298) + +deriving instance GHC.Show.Show a_299 => GHC.Show.Show (DefaultType a_299) + +instance AST.Unmarshal.Unmarshal DefaultType + +instance Data.Foldable.Foldable DefaultType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DefaultType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DefaultType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DoStatement a = DoStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_300. + AST.Traversable1.Class.Traversable1 a_300 + ) + +instance AST.Unmarshal.SymbolMatching DoStatement where + matchedSymbols _ = [165] + showFailure _ node_301 = + "expected " + GHC.Base.<> ( "do_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_301 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_301) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_302 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_303 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_304 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_305 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_302 + c1_303 = TreeSitter.Node.nodeStartPoint node_301 + TreeSitter.Node.TSPoint + r2_304 + c2_305 = TreeSitter.Node.nodeEndPoint node_301 + +deriving instance GHC.Classes.Eq a_306 => GHC.Classes.Eq (DoStatement a_306) + +deriving instance GHC.Classes.Ord a_307 => GHC.Classes.Ord (DoStatement a_307) + +deriving instance GHC.Show.Show a_308 => GHC.Show.Show (DoStatement a_308) + +instance AST.Unmarshal.Unmarshal DoStatement + +instance Data.Foldable.Foldable DoStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DoStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DoStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EmptyStatement a = EmptyStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_309. + AST.Traversable1.Class.Traversable1 a_309 + ) + +instance AST.Unmarshal.SymbolMatching EmptyStatement where + matchedSymbols _ = [173] + showFailure _ node_310 = + "expected " + GHC.Base.<> ( "empty_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_310 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_310) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_311 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_312 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_313 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_314 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_311 + c1_312 = TreeSitter.Node.nodeStartPoint node_310 + TreeSitter.Node.TSPoint + r2_313 + c2_314 = TreeSitter.Node.nodeEndPoint node_310 + +deriving instance GHC.Classes.Eq a_315 => GHC.Classes.Eq (EmptyStatement a_315) + +deriving instance GHC.Classes.Ord a_316 => GHC.Classes.Ord (EmptyStatement a_316) + +deriving instance GHC.Show.Show a_317 => GHC.Show.Show (EmptyStatement a_317) + +instance AST.Unmarshal.Unmarshal EmptyStatement + +instance Data.Foldable.Foldable EmptyStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EmptyStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EmptyStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnumAssignment a = EnumAssignment + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + extraChildren :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_318. + AST.Traversable1.Class.Traversable1 a_318 + ) + +instance AST.Unmarshal.SymbolMatching EnumAssignment where + matchedSymbols _ = [253] + showFailure _ node_319 = + "expected " + GHC.Base.<> ( "enum_assignment" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_319 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_319) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_320 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_321 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_322 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_323 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_320 + c1_321 = TreeSitter.Node.nodeStartPoint node_319 + TreeSitter.Node.TSPoint + r2_322 + c2_323 = TreeSitter.Node.nodeEndPoint node_319 + +deriving instance GHC.Classes.Eq a_324 => GHC.Classes.Eq (EnumAssignment a_324) + +deriving instance GHC.Classes.Ord a_325 => GHC.Classes.Ord (EnumAssignment a_325) + +deriving instance GHC.Show.Show a_326 => GHC.Show.Show (EnumAssignment a_326) + +instance AST.Unmarshal.Unmarshal EnumAssignment + +instance Data.Foldable.Foldable EnumAssignment where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnumAssignment where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnumAssignment where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnumBody a = EnumBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: EnumAssignment GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_327. + AST.Traversable1.Class.Traversable1 a_327 + ) + +instance AST.Unmarshal.SymbolMatching EnumBody where + matchedSymbols _ = [252] + showFailure _ node_328 = + "expected " + GHC.Base.<> ( "enum_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_328 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_328) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_329 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_330 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_331 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_332 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_329 + c1_330 = TreeSitter.Node.nodeStartPoint node_328 + TreeSitter.Node.TSPoint + r2_331 + c2_332 = TreeSitter.Node.nodeEndPoint node_328 + +deriving instance GHC.Classes.Eq a_333 => GHC.Classes.Eq (EnumBody a_333) + +deriving instance GHC.Classes.Ord a_334 => GHC.Classes.Ord (EnumBody a_334) + +deriving instance GHC.Show.Show a_335 => GHC.Show.Show (EnumBody a_335) + +instance AST.Unmarshal.Unmarshal EnumBody + +instance Data.Foldable.Foldable EnumBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnumBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnumBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnumDeclaration a = EnumDeclaration + { ann :: a, + body :: (AST.Parse.Err (EnumBody a)), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_336. + AST.Traversable1.Class.Traversable1 a_336 + ) + +instance AST.Unmarshal.SymbolMatching EnumDeclaration where + matchedSymbols _ = [251] + showFailure _ node_337 = + "expected " + GHC.Base.<> ( "enum_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_337 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_337) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_338 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_339 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_340 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_341 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_338 + c1_339 = TreeSitter.Node.nodeStartPoint node_337 + TreeSitter.Node.TSPoint + r2_340 + c2_341 = TreeSitter.Node.nodeEndPoint node_337 + +deriving instance GHC.Classes.Eq a_342 => GHC.Classes.Eq (EnumDeclaration a_342) + +deriving instance GHC.Classes.Ord a_343 => GHC.Classes.Ord (EnumDeclaration a_343) + +deriving instance GHC.Show.Show a_344 => GHC.Show.Show (EnumDeclaration a_344) + +instance AST.Unmarshal.Unmarshal EnumDeclaration + +instance Data.Foldable.Foldable EnumDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnumDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnumDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExistentialType a = ExistentialType {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_345. + AST.Traversable1.Class.Traversable1 a_345 + ) + +instance AST.Unmarshal.SymbolMatching ExistentialType where + matchedSymbols _ = [271] + showFailure _ node_346 = + "expected " + GHC.Base.<> ( "existential_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_346 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_346) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_347 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_348 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_349 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_350 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_347 + c1_348 = TreeSitter.Node.nodeStartPoint node_346 + TreeSitter.Node.TSPoint + r2_349 + c2_350 = TreeSitter.Node.nodeEndPoint node_346 + +deriving instance GHC.Classes.Eq a_351 => GHC.Classes.Eq (ExistentialType a_351) + +deriving instance GHC.Classes.Ord a_352 => GHC.Classes.Ord (ExistentialType a_352) + +deriving instance GHC.Show.Show a_353 => GHC.Show.Show (ExistentialType a_353) + +instance AST.Unmarshal.Unmarshal ExistentialType + +instance Data.Foldable.Foldable ExistentialType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExistentialType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExistentialType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExportClause a = ExportClause + { ann :: a, + extraChildren :: ([AST.Parse.Err (ExportSpecifier a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_354. + AST.Traversable1.Class.Traversable1 a_354 + ) + +instance AST.Unmarshal.SymbolMatching ExportClause where + matchedSymbols _ = [145] + showFailure _ node_355 = + "expected " + GHC.Base.<> ( "export_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_355 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_355) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_356 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_357 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_358 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_359 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_356 + c1_357 = TreeSitter.Node.nodeStartPoint node_355 + TreeSitter.Node.TSPoint + r2_358 + c2_359 = TreeSitter.Node.nodeEndPoint node_355 + +deriving instance GHC.Classes.Eq a_360 => GHC.Classes.Eq (ExportClause a_360) + +deriving instance GHC.Classes.Ord a_361 => GHC.Classes.Ord (ExportClause a_361) + +deriving instance GHC.Show.Show a_362 => GHC.Show.Show (ExportClause a_362) + +instance AST.Unmarshal.Unmarshal ExportClause + +instance Data.Foldable.Foldable ExportClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExportClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExportClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExportSpecifier a = ExportSpecifier + { ann :: a, + alias :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_363. + AST.Traversable1.Class.Traversable1 a_363 + ) + +instance AST.Unmarshal.SymbolMatching ExportSpecifier where + matchedSymbols _ = [311] + showFailure _ node_364 = + "expected " + GHC.Base.<> ( "export_specifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_364 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_364) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_365 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_366 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_367 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_368 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_365 + c1_366 = TreeSitter.Node.nodeStartPoint node_364 + TreeSitter.Node.TSPoint + r2_367 + c2_368 = TreeSitter.Node.nodeEndPoint node_364 + +deriving instance GHC.Classes.Eq a_369 => GHC.Classes.Eq (ExportSpecifier a_369) + +deriving instance GHC.Classes.Ord a_370 => GHC.Classes.Ord (ExportSpecifier a_370) + +deriving instance GHC.Show.Show a_371 => GHC.Show.Show (ExportSpecifier a_371) + +instance AST.Unmarshal.Unmarshal ExportSpecifier + +instance Data.Foldable.Foldable ExportSpecifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExportSpecifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExportSpecifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExportStatement a = ExportStatement + { ann :: a, + decorator :: ([AST.Parse.Err (Decorator a)]), + declaration :: (GHC.Maybe.Maybe (AST.Parse.Err (Declaration a))), + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + source :: (GHC.Maybe.Maybe (AST.Parse.Err (String a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((ExportClause GHC.Generics.:+: Identifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_372. + AST.Traversable1.Class.Traversable1 a_372 + ) + +instance AST.Unmarshal.SymbolMatching ExportStatement where + matchedSymbols _ = [144] + showFailure _ node_373 = + "expected " + GHC.Base.<> ( "export_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_373 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_373) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_374 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_375 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_376 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_377 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_374 + c1_375 = TreeSitter.Node.nodeStartPoint node_373 + TreeSitter.Node.TSPoint + r2_376 + c2_377 = TreeSitter.Node.nodeEndPoint node_373 + +deriving instance GHC.Classes.Eq a_378 => GHC.Classes.Eq (ExportStatement a_378) + +deriving instance GHC.Classes.Ord a_379 => GHC.Classes.Ord (ExportStatement a_379) + +deriving instance GHC.Show.Show a_380 => GHC.Show.Show (ExportStatement a_380) + +instance AST.Unmarshal.Unmarshal ExportStatement + +instance Data.Foldable.Foldable ExportStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExportStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExportStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExpressionStatement a = ExpressionStatement + { ann :: a, + extraChildren :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_381. + AST.Traversable1.Class.Traversable1 a_381 + ) + +instance AST.Unmarshal.SymbolMatching ExpressionStatement where + matchedSymbols _ = [154] + showFailure _ node_382 = + "expected " + GHC.Base.<> ( "expression_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_382 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_382) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_383 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_384 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_385 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_386 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_383 + c1_384 = TreeSitter.Node.nodeStartPoint node_382 + TreeSitter.Node.TSPoint + r2_385 + c2_386 = TreeSitter.Node.nodeEndPoint node_382 + +deriving instance GHC.Classes.Eq a_387 => GHC.Classes.Eq (ExpressionStatement a_387) + +deriving instance GHC.Classes.Ord a_388 => GHC.Classes.Ord (ExpressionStatement a_388) + +deriving instance GHC.Show.Show a_389 => GHC.Show.Show (ExpressionStatement a_389) + +instance AST.Unmarshal.Unmarshal ExpressionStatement + +instance Data.Foldable.Foldable ExpressionStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExpressionStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExpressionStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExtendsClause a = ExtendsClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: GenericType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: TypeIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_390. + AST.Traversable1.Class.Traversable1 a_390 + ) + +instance AST.Unmarshal.SymbolMatching ExtendsClause where + matchedSymbols _ = [250] + showFailure _ node_391 = + "expected " + GHC.Base.<> ( "extends_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_391 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_391) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_392 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_393 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_394 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_395 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_392 + c1_393 = TreeSitter.Node.nodeStartPoint node_391 + TreeSitter.Node.TSPoint + r2_394 + c2_395 = TreeSitter.Node.nodeEndPoint node_391 + +deriving instance GHC.Classes.Eq a_396 => GHC.Classes.Eq (ExtendsClause a_396) + +deriving instance GHC.Classes.Ord a_397 => GHC.Classes.Ord (ExtendsClause a_397) + +deriving instance GHC.Show.Show a_398 => GHC.Show.Show (ExtendsClause a_398) + +instance AST.Unmarshal.Unmarshal ExtendsClause + +instance Data.Foldable.Foldable ExtendsClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExtendsClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExtendsClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FinallyClause a = FinallyClause + { ann :: a, + body :: (AST.Parse.Err (StatementBlock a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_399. + AST.Traversable1.Class.Traversable1 a_399 + ) + +instance AST.Unmarshal.SymbolMatching FinallyClause where + matchedSymbols _ = [179] + showFailure _ node_400 = + "expected " + GHC.Base.<> ( "finally_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_400 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_400) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_401 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_402 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_403 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_404 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_401 + c1_402 = TreeSitter.Node.nodeStartPoint node_400 + TreeSitter.Node.TSPoint + r2_403 + c2_404 = TreeSitter.Node.nodeEndPoint node_400 + +deriving instance GHC.Classes.Eq a_405 => GHC.Classes.Eq (FinallyClause a_405) + +deriving instance GHC.Classes.Ord a_406 => GHC.Classes.Ord (FinallyClause a_406) + +deriving instance GHC.Show.Show a_407 => GHC.Show.Show (FinallyClause a_407) + +instance AST.Unmarshal.Unmarshal FinallyClause + +instance Data.Foldable.Foldable FinallyClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FinallyClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FinallyClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FlowMaybeType a = FlowMaybeType + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_408. + AST.Traversable1.Class.Traversable1 a_408 + ) + +instance AST.Unmarshal.SymbolMatching FlowMaybeType where + matchedSymbols _ = [272] + showFailure _ node_409 = + "expected " + GHC.Base.<> ( "flow_maybe_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_409 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_409) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_410 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_411 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_412 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_413 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_410 + c1_411 = TreeSitter.Node.nodeStartPoint node_409 + TreeSitter.Node.TSPoint + r2_412 + c2_413 = TreeSitter.Node.nodeEndPoint node_409 + +deriving instance GHC.Classes.Eq a_414 => GHC.Classes.Eq (FlowMaybeType a_414) + +deriving instance GHC.Classes.Ord a_415 => GHC.Classes.Ord (FlowMaybeType a_415) + +deriving instance GHC.Show.Show a_416 => GHC.Show.Show (FlowMaybeType a_416) + +instance AST.Unmarshal.Unmarshal FlowMaybeType + +instance Data.Foldable.Foldable FlowMaybeType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FlowMaybeType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FlowMaybeType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForInStatement a = ForInStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + left :: (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: Identifier GHC.Generics.:+: MemberExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: SubscriptExpression) a)), + right :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_417. + AST.Traversable1.Class.Traversable1 a_417 + ) + +instance AST.Unmarshal.SymbolMatching ForInStatement where + matchedSymbols _ = [162] + showFailure _ node_418 = + "expected " + GHC.Base.<> ( "for_in_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_418 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_418) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_419 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_420 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_421 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_422 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_419 + c1_420 = TreeSitter.Node.nodeStartPoint node_418 + TreeSitter.Node.TSPoint + r2_421 + c2_422 = TreeSitter.Node.nodeEndPoint node_418 + +deriving instance GHC.Classes.Eq a_423 => GHC.Classes.Eq (ForInStatement a_423) + +deriving instance GHC.Classes.Ord a_424 => GHC.Classes.Ord (ForInStatement a_424) + +deriving instance GHC.Show.Show a_425 => GHC.Show.Show (ForInStatement a_425) + +instance AST.Unmarshal.Unmarshal ForInStatement + +instance Data.Foldable.Foldable ForInStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForInStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForInStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForStatement a = ForStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + initializer :: (AST.Parse.Err ((EmptyStatement GHC.Generics.:+: ExpressionStatement GHC.Generics.:+: LexicalDeclaration GHC.Generics.:+: VariableDeclaration) a)), + condition :: (AST.Parse.Err ((EmptyStatement GHC.Generics.:+: ExpressionStatement) a)), + increment :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_426. + AST.Traversable1.Class.Traversable1 a_426 + ) + +instance AST.Unmarshal.SymbolMatching ForStatement where + matchedSymbols _ = [161] + showFailure _ node_427 = + "expected " + GHC.Base.<> ( "for_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_427 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_427) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_428 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_429 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_430 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_431 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_428 + c1_429 = TreeSitter.Node.nodeStartPoint node_427 + TreeSitter.Node.TSPoint + r2_430 + c2_431 = TreeSitter.Node.nodeEndPoint node_427 + +deriving instance GHC.Classes.Eq a_432 => GHC.Classes.Eq (ForStatement a_432) + +deriving instance GHC.Classes.Ord a_433 => GHC.Classes.Ord (ForStatement a_433) + +deriving instance GHC.Show.Show a_434 => GHC.Show.Show (ForStatement a_434) + +instance AST.Unmarshal.Unmarshal ForStatement + +instance Data.Foldable.Foldable ForStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FormalParameters a = FormalParameters + { ann :: a, + decorator :: ([AST.Parse.Err (Decorator a)]), + extraChildren :: ([AST.Parse.Err ((OptionalParameter GHC.Generics.:+: RequiredParameter GHC.Generics.:+: RestParameter) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_435. + AST.Traversable1.Class.Traversable1 a_435 + ) + +instance AST.Unmarshal.SymbolMatching FormalParameters where + matchedSymbols _ = [229] + showFailure _ node_436 = + "expected " + GHC.Base.<> ( "formal_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_436 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_436) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_437 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_438 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_439 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_440 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_437 + c1_438 = TreeSitter.Node.nodeStartPoint node_436 + TreeSitter.Node.TSPoint + r2_439 + c2_440 = TreeSitter.Node.nodeEndPoint node_436 + +deriving instance GHC.Classes.Eq a_441 => GHC.Classes.Eq (FormalParameters a_441) + +deriving instance GHC.Classes.Ord a_442 => GHC.Classes.Ord (FormalParameters a_442) + +deriving instance GHC.Show.Show a_443 => GHC.Show.Show (FormalParameters a_443) + +instance AST.Unmarshal.Unmarshal FormalParameters + +instance Data.Foldable.Foldable FormalParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FormalParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FormalParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Function a = Function + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err (StatementBlock a)), + name :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_444. + AST.Traversable1.Class.Traversable1 a_444 + ) + +instance AST.Unmarshal.SymbolMatching Function where + matchedSymbols _ = [198] + showFailure _ node_445 = + "expected " + GHC.Base.<> ( "function" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_445 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_445) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_446 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_447 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_448 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_449 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_446 + c1_447 = TreeSitter.Node.nodeStartPoint node_445 + TreeSitter.Node.TSPoint + r2_448 + c2_449 = TreeSitter.Node.nodeEndPoint node_445 + +deriving instance GHC.Classes.Eq a_450 => GHC.Classes.Eq (Function a_450) + +deriving instance GHC.Classes.Ord a_451 => GHC.Classes.Ord (Function a_451) + +deriving instance GHC.Show.Show a_452 => GHC.Show.Show (Function a_452) + +instance AST.Unmarshal.Unmarshal Function + +instance Data.Foldable.Foldable Function where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Function where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Function where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionDeclaration a = FunctionDeclaration + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err (StatementBlock a)), + name :: (AST.Parse.Err (Identifier a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_453. + AST.Traversable1.Class.Traversable1 a_453 + ) + +instance AST.Unmarshal.SymbolMatching FunctionDeclaration where + matchedSymbols _ = [199] + showFailure _ node_454 = + "expected " + GHC.Base.<> ( "function_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_454 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_454) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_455 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_456 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_457 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_458 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_455 + c1_456 = TreeSitter.Node.nodeStartPoint node_454 + TreeSitter.Node.TSPoint + r2_457 + c2_458 = TreeSitter.Node.nodeEndPoint node_454 + +deriving instance GHC.Classes.Eq a_459 => GHC.Classes.Eq (FunctionDeclaration a_459) + +deriving instance GHC.Classes.Ord a_460 => GHC.Classes.Ord (FunctionDeclaration a_460) + +deriving instance GHC.Show.Show a_461 => GHC.Show.Show (FunctionDeclaration a_461) + +instance AST.Unmarshal.Unmarshal FunctionDeclaration + +instance Data.Foldable.Foldable FunctionDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionSignature a = FunctionSignature + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + name :: (AST.Parse.Err (Identifier a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_462. + AST.Traversable1.Class.Traversable1 a_462 + ) + +instance AST.Unmarshal.SymbolMatching FunctionSignature where + matchedSymbols _ = [238] + showFailure _ node_463 = + "expected " + GHC.Base.<> ( "function_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_463 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_463) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_464 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_465 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_466 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_467 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_464 + c1_465 = TreeSitter.Node.nodeStartPoint node_463 + TreeSitter.Node.TSPoint + r2_466 + c2_467 = TreeSitter.Node.nodeEndPoint node_463 + +deriving instance GHC.Classes.Eq a_468 => GHC.Classes.Eq (FunctionSignature a_468) + +deriving instance GHC.Classes.Ord a_469 => GHC.Classes.Ord (FunctionSignature a_469) + +deriving instance GHC.Show.Show a_470 => GHC.Show.Show (FunctionSignature a_470) + +instance AST.Unmarshal.Unmarshal FunctionSignature + +instance Data.Foldable.Foldable FunctionSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionType a = FunctionType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FormalParameters GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypeParameters GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_471. + AST.Traversable1.Class.Traversable1 a_471 + ) + +instance AST.Unmarshal.SymbolMatching FunctionType where + matchedSymbols _ = [289] + showFailure _ node_472 = + "expected " + GHC.Base.<> ( "function_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_472 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_472) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_473 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_474 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_475 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_476 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_473 + c1_474 = TreeSitter.Node.nodeStartPoint node_472 + TreeSitter.Node.TSPoint + r2_475 + c2_476 = TreeSitter.Node.nodeEndPoint node_472 + +deriving instance GHC.Classes.Eq a_477 => GHC.Classes.Eq (FunctionType a_477) + +deriving instance GHC.Classes.Ord a_478 => GHC.Classes.Ord (FunctionType a_478) + +deriving instance GHC.Show.Show a_479 => GHC.Show.Show (FunctionType a_479) + +instance AST.Unmarshal.Unmarshal FunctionType + +instance Data.Foldable.Foldable FunctionType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GeneratorFunction a = GeneratorFunction + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err (StatementBlock a)), + name :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_480. + AST.Traversable1.Class.Traversable1 a_480 + ) + +instance AST.Unmarshal.SymbolMatching GeneratorFunction where + matchedSymbols _ = [200] + showFailure _ node_481 = + "expected " + GHC.Base.<> ( "generator_function" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_481 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_481) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_482 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_483 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_484 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_485 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_482 + c1_483 = TreeSitter.Node.nodeStartPoint node_481 + TreeSitter.Node.TSPoint + r2_484 + c2_485 = TreeSitter.Node.nodeEndPoint node_481 + +deriving instance GHC.Classes.Eq a_486 => GHC.Classes.Eq (GeneratorFunction a_486) + +deriving instance GHC.Classes.Ord a_487 => GHC.Classes.Ord (GeneratorFunction a_487) + +deriving instance GHC.Show.Show a_488 => GHC.Show.Show (GeneratorFunction a_488) + +instance AST.Unmarshal.Unmarshal GeneratorFunction + +instance Data.Foldable.Foldable GeneratorFunction where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GeneratorFunction where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GeneratorFunction where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GeneratorFunctionDeclaration a = GeneratorFunctionDeclaration + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err (StatementBlock a)), + name :: (AST.Parse.Err (Identifier a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_489. + AST.Traversable1.Class.Traversable1 a_489 + ) + +instance AST.Unmarshal.SymbolMatching GeneratorFunctionDeclaration where + matchedSymbols _ = [201] + showFailure _ node_490 = + "expected " + GHC.Base.<> ( "generator_function_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_490 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_490) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_491 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_492 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_493 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_494 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_491 + c1_492 = TreeSitter.Node.nodeStartPoint node_490 + TreeSitter.Node.TSPoint + r2_493 + c2_494 = TreeSitter.Node.nodeEndPoint node_490 + +deriving instance GHC.Classes.Eq a_495 => GHC.Classes.Eq (GeneratorFunctionDeclaration a_495) + +deriving instance GHC.Classes.Ord a_496 => GHC.Classes.Ord (GeneratorFunctionDeclaration a_496) + +deriving instance GHC.Show.Show a_497 => GHC.Show.Show (GeneratorFunctionDeclaration a_497) + +instance AST.Unmarshal.Unmarshal GeneratorFunctionDeclaration + +instance Data.Foldable.Foldable GeneratorFunctionDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GeneratorFunctionDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GeneratorFunctionDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GenericType a = GenericType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((NestedTypeIdentifier GHC.Generics.:+: TypeArguments GHC.Generics.:+: TypeIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_498. + AST.Traversable1.Class.Traversable1 a_498 + ) + +instance AST.Unmarshal.SymbolMatching GenericType where + matchedSymbols _ = [263] + showFailure _ node_499 = + "expected " + GHC.Base.<> ( "generic_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_499 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_499) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_500 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_501 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_502 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_503 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_500 + c1_501 = TreeSitter.Node.nodeStartPoint node_499 + TreeSitter.Node.TSPoint + r2_502 + c2_503 = TreeSitter.Node.nodeEndPoint node_499 + +deriving instance GHC.Classes.Eq a_504 => GHC.Classes.Eq (GenericType a_504) + +deriving instance GHC.Classes.Ord a_505 => GHC.Classes.Ord (GenericType a_505) + +deriving instance GHC.Show.Show a_506 => GHC.Show.Show (GenericType a_506) + +instance AST.Unmarshal.Unmarshal GenericType + +instance Data.Foldable.Foldable GenericType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GenericType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GenericType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IfStatement a = IfStatement + { ann :: a, + alternative :: (GHC.Maybe.Maybe (AST.Parse.Err (Statement a))), + consequence :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_507. + AST.Traversable1.Class.Traversable1 a_507 + ) + +instance AST.Unmarshal.SymbolMatching IfStatement where + matchedSymbols _ = [159] + showFailure _ node_508 = + "expected " + GHC.Base.<> ( "if_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_508 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_508) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_509 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_510 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_511 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_512 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_509 + c1_510 = TreeSitter.Node.nodeStartPoint node_508 + TreeSitter.Node.TSPoint + r2_511 + c2_512 = TreeSitter.Node.nodeEndPoint node_508 + +deriving instance GHC.Classes.Eq a_513 => GHC.Classes.Eq (IfStatement a_513) + +deriving instance GHC.Classes.Ord a_514 => GHC.Classes.Ord (IfStatement a_514) + +deriving instance GHC.Show.Show a_515 => GHC.Show.Show (IfStatement a_515) + +instance AST.Unmarshal.Unmarshal IfStatement + +instance Data.Foldable.Foldable IfStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IfStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IfStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImplementsClause a = ImplementsClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_516. + AST.Traversable1.Class.Traversable1 a_516 + ) + +instance AST.Unmarshal.SymbolMatching ImplementsClause where + matchedSymbols _ = [241] + showFailure _ node_517 = + "expected " + GHC.Base.<> ( "implements_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_517 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_517) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_518 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_519 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_520 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_521 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_518 + c1_519 = TreeSitter.Node.nodeStartPoint node_517 + TreeSitter.Node.TSPoint + r2_520 + c2_521 = TreeSitter.Node.nodeEndPoint node_517 + +deriving instance GHC.Classes.Eq a_522 => GHC.Classes.Eq (ImplementsClause a_522) + +deriving instance GHC.Classes.Ord a_523 => GHC.Classes.Ord (ImplementsClause a_523) + +deriving instance GHC.Show.Show a_524 => GHC.Show.Show (ImplementsClause a_524) + +instance AST.Unmarshal.Unmarshal ImplementsClause + +instance Data.Foldable.Foldable ImplementsClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImplementsClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImplementsClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Import a = Import {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_525. + AST.Traversable1.Class.Traversable1 a_525 + ) + +instance AST.Unmarshal.SymbolMatching Import where + matchedSymbols _ = [148] + showFailure _ node_526 = + "expected " + GHC.Base.<> ( "import" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_526 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_526) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_527 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_528 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_529 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_530 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_527 + c1_528 = TreeSitter.Node.nodeStartPoint node_526 + TreeSitter.Node.TSPoint + r2_529 + c2_530 = TreeSitter.Node.nodeEndPoint node_526 + +deriving instance GHC.Classes.Eq a_531 => GHC.Classes.Eq (Import a_531) + +deriving instance GHC.Classes.Ord a_532 => GHC.Classes.Ord (Import a_532) + +deriving instance GHC.Show.Show a_533 => GHC.Show.Show (Import a_533) + +instance AST.Unmarshal.Unmarshal Import + +instance Data.Foldable.Foldable Import where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Import where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Import where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportAlias a = ImportAlias + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_534. + AST.Traversable1.Class.Traversable1 a_534 + ) + +instance AST.Unmarshal.SymbolMatching ImportAlias where + matchedSymbols _ = [247] + showFailure _ node_535 = + "expected " + GHC.Base.<> ( "import_alias" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_535 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_535) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_536 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_537 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_538 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_539 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_536 + c1_537 = TreeSitter.Node.nodeStartPoint node_535 + TreeSitter.Node.TSPoint + r2_538 + c2_539 = TreeSitter.Node.nodeEndPoint node_535 + +deriving instance GHC.Classes.Eq a_540 => GHC.Classes.Eq (ImportAlias a_540) + +deriving instance GHC.Classes.Ord a_541 => GHC.Classes.Ord (ImportAlias a_541) + +deriving instance GHC.Show.Show a_542 => GHC.Show.Show (ImportAlias a_542) + +instance AST.Unmarshal.Unmarshal ImportAlias + +instance Data.Foldable.Foldable ImportAlias where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportAlias where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportAlias where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportClause a = ImportClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: NamedImports GHC.Generics.:+: NamespaceImport) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_543. + AST.Traversable1.Class.Traversable1 a_543 + ) + +instance AST.Unmarshal.SymbolMatching ImportClause where + matchedSymbols _ = [150] + showFailure _ node_544 = + "expected " + GHC.Base.<> ( "import_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_544 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_544) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_545 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_546 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_547 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_548 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_545 + c1_546 = TreeSitter.Node.nodeStartPoint node_544 + TreeSitter.Node.TSPoint + r2_547 + c2_548 = TreeSitter.Node.nodeEndPoint node_544 + +deriving instance GHC.Classes.Eq a_549 => GHC.Classes.Eq (ImportClause a_549) + +deriving instance GHC.Classes.Ord a_550 => GHC.Classes.Ord (ImportClause a_550) + +deriving instance GHC.Show.Show a_551 => GHC.Show.Show (ImportClause a_551) + +instance AST.Unmarshal.Unmarshal ImportClause + +instance Data.Foldable.Foldable ImportClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportRequireClause a = ImportRequireClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: String) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_552. + AST.Traversable1.Class.Traversable1 a_552 + ) + +instance AST.Unmarshal.SymbolMatching ImportRequireClause where + matchedSymbols _ = [240] + showFailure _ node_553 = + "expected " + GHC.Base.<> ( "import_require_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_553 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_553) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_554 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_555 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_556 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_557 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_554 + c1_555 = TreeSitter.Node.nodeStartPoint node_553 + TreeSitter.Node.TSPoint + r2_556 + c2_557 = TreeSitter.Node.nodeEndPoint node_553 + +deriving instance GHC.Classes.Eq a_558 => GHC.Classes.Eq (ImportRequireClause a_558) + +deriving instance GHC.Classes.Ord a_559 => GHC.Classes.Ord (ImportRequireClause a_559) + +deriving instance GHC.Show.Show a_560 => GHC.Show.Show (ImportRequireClause a_560) + +instance AST.Unmarshal.Unmarshal ImportRequireClause + +instance Data.Foldable.Foldable ImportRequireClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportRequireClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportRequireClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportSpecifier a = ImportSpecifier + { ann :: a, + alias :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_561. + AST.Traversable1.Class.Traversable1 a_561 + ) + +instance AST.Unmarshal.SymbolMatching ImportSpecifier where + matchedSymbols _ = [312] + showFailure _ node_562 = + "expected " + GHC.Base.<> ( "import_specifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_562 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_562) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_563 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_564 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_565 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_566 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_563 + c1_564 = TreeSitter.Node.nodeStartPoint node_562 + TreeSitter.Node.TSPoint + r2_565 + c2_566 = TreeSitter.Node.nodeEndPoint node_562 + +deriving instance GHC.Classes.Eq a_567 => GHC.Classes.Eq (ImportSpecifier a_567) + +deriving instance GHC.Classes.Ord a_568 => GHC.Classes.Ord (ImportSpecifier a_568) + +deriving instance GHC.Show.Show a_569 => GHC.Show.Show (ImportSpecifier a_569) + +instance AST.Unmarshal.Unmarshal ImportSpecifier + +instance Data.Foldable.Foldable ImportSpecifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportSpecifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportSpecifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportStatement a = ImportStatement + { ann :: a, + source :: (GHC.Maybe.Maybe (AST.Parse.Err (String a))), + extraChildren :: (AST.Parse.Err ((ImportClause GHC.Generics.:+: ImportRequireClause GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_570. + AST.Traversable1.Class.Traversable1 a_570 + ) + +instance AST.Unmarshal.SymbolMatching ImportStatement where + matchedSymbols _ = [149] + showFailure _ node_571 = + "expected " + GHC.Base.<> ( "import_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_571 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_571) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_572 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_573 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_574 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_575 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_572 + c1_573 = TreeSitter.Node.nodeStartPoint node_571 + TreeSitter.Node.TSPoint + r2_574 + c2_575 = TreeSitter.Node.nodeEndPoint node_571 + +deriving instance GHC.Classes.Eq a_576 => GHC.Classes.Eq (ImportStatement a_576) + +deriving instance GHC.Classes.Ord a_577 => GHC.Classes.Ord (ImportStatement a_577) + +deriving instance GHC.Show.Show a_578 => GHC.Show.Show (ImportStatement a_578) + +instance AST.Unmarshal.Unmarshal ImportStatement + +instance Data.Foldable.Foldable ImportStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IndexSignature a = IndexSignature + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: MappedTypeClause GHC.Generics.:+: PredefinedType GHC.Generics.:+: TypeAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_579. + AST.Traversable1.Class.Traversable1 a_579 + ) + +instance AST.Unmarshal.SymbolMatching IndexSignature where + matchedSymbols _ = [284] + showFailure _ node_580 = + "expected " + GHC.Base.<> ( "index_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_580 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_580) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_581 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_582 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_583 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_584 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_581 + c1_582 = TreeSitter.Node.nodeStartPoint node_580 + TreeSitter.Node.TSPoint + r2_583 + c2_584 = TreeSitter.Node.nodeEndPoint node_580 + +deriving instance GHC.Classes.Eq a_585 => GHC.Classes.Eq (IndexSignature a_585) + +deriving instance GHC.Classes.Ord a_586 => GHC.Classes.Ord (IndexSignature a_586) + +deriving instance GHC.Show.Show a_587 => GHC.Show.Show (IndexSignature a_587) + +instance AST.Unmarshal.Unmarshal IndexSignature + +instance Data.Foldable.Foldable IndexSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IndexSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IndexSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IndexTypeQuery a = IndexTypeQuery + { ann :: a, + extraChildren :: (AST.Parse.Err ((NestedTypeIdentifier GHC.Generics.:+: TypeIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_588. + AST.Traversable1.Class.Traversable1 a_588 + ) + +instance AST.Unmarshal.SymbolMatching IndexTypeQuery where + matchedSymbols _ = [266] + showFailure _ node_589 = + "expected " + GHC.Base.<> ( "index_type_query" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_589 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_589) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_590 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_591 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_592 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_593 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_590 + c1_591 = TreeSitter.Node.nodeStartPoint node_589 + TreeSitter.Node.TSPoint + r2_592 + c2_593 = TreeSitter.Node.nodeEndPoint node_589 + +deriving instance GHC.Classes.Eq a_594 => GHC.Classes.Eq (IndexTypeQuery a_594) + +deriving instance GHC.Classes.Ord a_595 => GHC.Classes.Ord (IndexTypeQuery a_595) + +deriving instance GHC.Show.Show a_596 => GHC.Show.Show (IndexTypeQuery a_596) + +instance AST.Unmarshal.Unmarshal IndexTypeQuery + +instance Data.Foldable.Foldable IndexTypeQuery where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IndexTypeQuery where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IndexTypeQuery where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InterfaceDeclaration a = InterfaceDeclaration + { ann :: a, + body :: (AST.Parse.Err (ObjectType a)), + name :: (AST.Parse.Err (TypeIdentifier a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ExtendsClause a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_597. + AST.Traversable1.Class.Traversable1 a_597 + ) + +instance AST.Unmarshal.SymbolMatching InterfaceDeclaration where + matchedSymbols _ = [249] + showFailure _ node_598 = + "expected " + GHC.Base.<> ( "interface_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_598 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_598) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_599 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_600 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_601 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_602 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_599 + c1_600 = TreeSitter.Node.nodeStartPoint node_598 + TreeSitter.Node.TSPoint + r2_601 + c2_602 = TreeSitter.Node.nodeEndPoint node_598 + +deriving instance GHC.Classes.Eq a_603 => GHC.Classes.Eq (InterfaceDeclaration a_603) + +deriving instance GHC.Classes.Ord a_604 => GHC.Classes.Ord (InterfaceDeclaration a_604) + +deriving instance GHC.Show.Show a_605 => GHC.Show.Show (InterfaceDeclaration a_605) + +instance AST.Unmarshal.Unmarshal InterfaceDeclaration + +instance Data.Foldable.Foldable InterfaceDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InterfaceDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InterfaceDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InternalModule a = InternalModule + { ann :: a, + body :: (GHC.Maybe.Maybe (AST.Parse.Err (StatementBlock a))), + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_606. + AST.Traversable1.Class.Traversable1 a_606 + ) + +instance AST.Unmarshal.SymbolMatching InternalModule where + matchedSymbols _ = [245] + showFailure _ node_607 = + "expected " + GHC.Base.<> ( "internal_module" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_607 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_607) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_608 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_609 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_610 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_611 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_608 + c1_609 = TreeSitter.Node.nodeStartPoint node_607 + TreeSitter.Node.TSPoint + r2_610 + c2_611 = TreeSitter.Node.nodeEndPoint node_607 + +deriving instance GHC.Classes.Eq a_612 => GHC.Classes.Eq (InternalModule a_612) + +deriving instance GHC.Classes.Ord a_613 => GHC.Classes.Ord (InternalModule a_613) + +deriving instance GHC.Show.Show a_614 => GHC.Show.Show (InternalModule a_614) + +instance AST.Unmarshal.Unmarshal InternalModule + +instance Data.Foldable.Foldable InternalModule where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InternalModule where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InternalModule where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IntersectionType a = IntersectionType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_615. + AST.Traversable1.Class.Traversable1 a_615 + ) + +instance AST.Unmarshal.SymbolMatching IntersectionType where + matchedSymbols _ = [288] + showFailure _ node_616 = + "expected " + GHC.Base.<> ( "intersection_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_616 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_616) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_617 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_618 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_619 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_620 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_617 + c1_618 = TreeSitter.Node.nodeStartPoint node_616 + TreeSitter.Node.TSPoint + r2_619 + c2_620 = TreeSitter.Node.nodeEndPoint node_616 + +deriving instance GHC.Classes.Eq a_621 => GHC.Classes.Eq (IntersectionType a_621) + +deriving instance GHC.Classes.Ord a_622 => GHC.Classes.Ord (IntersectionType a_622) + +deriving instance GHC.Show.Show a_623 => GHC.Show.Show (IntersectionType a_623) + +instance AST.Unmarshal.Unmarshal IntersectionType + +instance Data.Foldable.Foldable IntersectionType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IntersectionType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IntersectionType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxAttribute a = JsxAttribute + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((JsxElement GHC.Generics.:+: JsxExpression GHC.Generics.:+: JsxFragment GHC.Generics.:+: JsxNamespaceName GHC.Generics.:+: JsxSelfClosingElement GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_624. + AST.Traversable1.Class.Traversable1 a_624 + ) + +instance AST.Unmarshal.SymbolMatching JsxAttribute where + matchedSymbols _ = [194] + showFailure _ node_625 = + "expected " + GHC.Base.<> ( "jsx_attribute" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_625 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_625) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_626 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_627 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_628 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_629 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_626 + c1_627 = TreeSitter.Node.nodeStartPoint node_625 + TreeSitter.Node.TSPoint + r2_628 + c2_629 = TreeSitter.Node.nodeEndPoint node_625 + +deriving instance GHC.Classes.Eq a_630 => GHC.Classes.Eq (JsxAttribute a_630) + +deriving instance GHC.Classes.Ord a_631 => GHC.Classes.Ord (JsxAttribute a_631) + +deriving instance GHC.Show.Show a_632 => GHC.Show.Show (JsxAttribute a_632) + +instance AST.Unmarshal.Unmarshal JsxAttribute + +instance Data.Foldable.Foldable JsxAttribute where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxAttribute where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxAttribute where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxClosingElement a = JsxClosingElement + { ann :: a, + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: JsxNamespaceName GHC.Generics.:+: NestedIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_633. + AST.Traversable1.Class.Traversable1 a_633 + ) + +instance AST.Unmarshal.SymbolMatching JsxClosingElement where + matchedSymbols _ = [192] + showFailure _ node_634 = + "expected " + GHC.Base.<> ( "jsx_closing_element" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_634 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_634) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_635 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_636 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_637 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_638 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_635 + c1_636 = TreeSitter.Node.nodeStartPoint node_634 + TreeSitter.Node.TSPoint + r2_637 + c2_638 = TreeSitter.Node.nodeEndPoint node_634 + +deriving instance GHC.Classes.Eq a_639 => GHC.Classes.Eq (JsxClosingElement a_639) + +deriving instance GHC.Classes.Ord a_640 => GHC.Classes.Ord (JsxClosingElement a_640) + +deriving instance GHC.Show.Show a_641 => GHC.Show.Show (JsxClosingElement a_641) + +instance AST.Unmarshal.Unmarshal JsxClosingElement + +instance Data.Foldable.Foldable JsxClosingElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxClosingElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxClosingElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxElement a = JsxElement + { ann :: a, + closeTag :: (AST.Parse.Err (JsxClosingElement a)), + openTag :: (AST.Parse.Err (JsxOpeningElement a)), + extraChildren :: ([AST.Parse.Err ((JsxElement GHC.Generics.:+: JsxExpression GHC.Generics.:+: JsxSelfClosingElement GHC.Generics.:+: JsxText) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_642. + AST.Traversable1.Class.Traversable1 a_642 + ) + +instance AST.Unmarshal.SymbolMatching JsxElement where + matchedSymbols _ = [186] + showFailure _ node_643 = + "expected " + GHC.Base.<> ( "jsx_element" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_643 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_643) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_644 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_645 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_646 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_647 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_644 + c1_645 = TreeSitter.Node.nodeStartPoint node_643 + TreeSitter.Node.TSPoint + r2_646 + c2_647 = TreeSitter.Node.nodeEndPoint node_643 + +deriving instance GHC.Classes.Eq a_648 => GHC.Classes.Eq (JsxElement a_648) + +deriving instance GHC.Classes.Ord a_649 => GHC.Classes.Ord (JsxElement a_649) + +deriving instance GHC.Show.Show a_650 => GHC.Show.Show (JsxElement a_650) + +instance AST.Unmarshal.Unmarshal JsxElement + +instance Data.Foldable.Foldable JsxElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxExpression a = JsxExpression + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression GHC.Generics.:+: SpreadElement) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_651. + AST.Traversable1.Class.Traversable1 a_651 + ) + +instance AST.Unmarshal.SymbolMatching JsxExpression where + matchedSymbols _ = [188] + showFailure _ node_652 = + "expected " + GHC.Base.<> ( "jsx_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_652 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_652) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_653 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_654 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_655 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_656 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_653 + c1_654 = TreeSitter.Node.nodeStartPoint node_652 + TreeSitter.Node.TSPoint + r2_655 + c2_656 = TreeSitter.Node.nodeEndPoint node_652 + +deriving instance GHC.Classes.Eq a_657 => GHC.Classes.Eq (JsxExpression a_657) + +deriving instance GHC.Classes.Ord a_658 => GHC.Classes.Ord (JsxExpression a_658) + +deriving instance GHC.Show.Show a_659 => GHC.Show.Show (JsxExpression a_659) + +instance AST.Unmarshal.Unmarshal JsxExpression + +instance Data.Foldable.Foldable JsxExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxFragment a = JsxFragment + { ann :: a, + extraChildren :: ([AST.Parse.Err ((JsxElement GHC.Generics.:+: JsxExpression GHC.Generics.:+: JsxSelfClosingElement GHC.Generics.:+: JsxText) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_660. + AST.Traversable1.Class.Traversable1 a_660 + ) + +instance AST.Unmarshal.SymbolMatching JsxFragment where + matchedSymbols _ = [187] + showFailure _ node_661 = + "expected " + GHC.Base.<> ( "jsx_fragment" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_661 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_661) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_662 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_663 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_664 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_665 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_662 + c1_663 = TreeSitter.Node.nodeStartPoint node_661 + TreeSitter.Node.TSPoint + r2_664 + c2_665 = TreeSitter.Node.nodeEndPoint node_661 + +deriving instance GHC.Classes.Eq a_666 => GHC.Classes.Eq (JsxFragment a_666) + +deriving instance GHC.Classes.Ord a_667 => GHC.Classes.Ord (JsxFragment a_667) + +deriving instance GHC.Show.Show a_668 => GHC.Show.Show (JsxFragment a_668) + +instance AST.Unmarshal.Unmarshal JsxFragment + +instance Data.Foldable.Foldable JsxFragment where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxFragment where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxFragment where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxNamespaceName a = JsxNamespaceName + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_669. + AST.Traversable1.Class.Traversable1 a_669 + ) + +instance AST.Unmarshal.SymbolMatching JsxNamespaceName where + matchedSymbols _ = [191] + showFailure _ node_670 = + "expected " + GHC.Base.<> ( "jsx_namespace_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_670 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_670) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_671 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_672 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_673 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_674 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_671 + c1_672 = TreeSitter.Node.nodeStartPoint node_670 + TreeSitter.Node.TSPoint + r2_673 + c2_674 = TreeSitter.Node.nodeEndPoint node_670 + +deriving instance GHC.Classes.Eq a_675 => GHC.Classes.Eq (JsxNamespaceName a_675) + +deriving instance GHC.Classes.Ord a_676 => GHC.Classes.Ord (JsxNamespaceName a_676) + +deriving instance GHC.Show.Show a_677 => GHC.Show.Show (JsxNamespaceName a_677) + +instance AST.Unmarshal.Unmarshal JsxNamespaceName + +instance Data.Foldable.Foldable JsxNamespaceName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxNamespaceName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxNamespaceName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxOpeningElement a = JsxOpeningElement + { ann :: a, + attribute :: ([AST.Parse.Err ((JsxAttribute GHC.Generics.:+: JsxExpression) a)]), + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: JsxNamespaceName GHC.Generics.:+: NestedIdentifier) a)), + typeArguments :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeArguments a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_678. + AST.Traversable1.Class.Traversable1 a_678 + ) + +instance AST.Unmarshal.SymbolMatching JsxOpeningElement where + matchedSymbols _ = [189] + showFailure _ node_679 = + "expected " + GHC.Base.<> ( "jsx_opening_element" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_679 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_679) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_680 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_681 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_682 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_683 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_680 + c1_681 = TreeSitter.Node.nodeStartPoint node_679 + TreeSitter.Node.TSPoint + r2_682 + c2_683 = TreeSitter.Node.nodeEndPoint node_679 + +deriving instance GHC.Classes.Eq a_684 => GHC.Classes.Eq (JsxOpeningElement a_684) + +deriving instance GHC.Classes.Ord a_685 => GHC.Classes.Ord (JsxOpeningElement a_685) + +deriving instance GHC.Show.Show a_686 => GHC.Show.Show (JsxOpeningElement a_686) + +instance AST.Unmarshal.Unmarshal JsxOpeningElement + +instance Data.Foldable.Foldable JsxOpeningElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxOpeningElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxOpeningElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxSelfClosingElement a = JsxSelfClosingElement + { ann :: a, + attribute :: ([AST.Parse.Err ((JsxAttribute GHC.Generics.:+: JsxExpression) a)]), + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: JsxNamespaceName GHC.Generics.:+: NestedIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_687. + AST.Traversable1.Class.Traversable1 a_687 + ) + +instance AST.Unmarshal.SymbolMatching JsxSelfClosingElement where + matchedSymbols _ = [193] + showFailure _ node_688 = + "expected " + GHC.Base.<> ( "jsx_self_closing_element" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_688 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_688) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_689 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_690 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_691 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_692 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_689 + c1_690 = TreeSitter.Node.nodeStartPoint node_688 + TreeSitter.Node.TSPoint + r2_691 + c2_692 = TreeSitter.Node.nodeEndPoint node_688 + +deriving instance GHC.Classes.Eq a_693 => GHC.Classes.Eq (JsxSelfClosingElement a_693) + +deriving instance GHC.Classes.Ord a_694 => GHC.Classes.Ord (JsxSelfClosingElement a_694) + +deriving instance GHC.Show.Show a_695 => GHC.Show.Show (JsxSelfClosingElement a_695) + +instance AST.Unmarshal.Unmarshal JsxSelfClosingElement + +instance Data.Foldable.Foldable JsxSelfClosingElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxSelfClosingElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxSelfClosingElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LabeledStatement a = LabeledStatement + { ann :: a, + label :: (AST.Parse.Err (StatementIdentifier a)), + extraChildren :: (AST.Parse.Err (Statement a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_696. + AST.Traversable1.Class.Traversable1 a_696 + ) + +instance AST.Unmarshal.SymbolMatching LabeledStatement where + matchedSymbols _ = [174] + showFailure _ node_697 = + "expected " + GHC.Base.<> ( "labeled_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_697 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_697) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_698 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_699 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_700 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_701 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_698 + c1_699 = TreeSitter.Node.nodeStartPoint node_697 + TreeSitter.Node.TSPoint + r2_700 + c2_701 = TreeSitter.Node.nodeEndPoint node_697 + +deriving instance GHC.Classes.Eq a_702 => GHC.Classes.Eq (LabeledStatement a_702) + +deriving instance GHC.Classes.Ord a_703 => GHC.Classes.Ord (LabeledStatement a_703) + +deriving instance GHC.Show.Show a_704 => GHC.Show.Show (LabeledStatement a_704) + +instance AST.Unmarshal.Unmarshal LabeledStatement + +instance Data.Foldable.Foldable LabeledStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LabeledStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LabeledStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LexicalDeclaration a = LexicalDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (VariableDeclarator a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_705. + AST.Traversable1.Class.Traversable1 a_705 + ) + +instance AST.Unmarshal.SymbolMatching LexicalDeclaration where + matchedSymbols _ = [156] + showFailure _ node_706 = + "expected " + GHC.Base.<> ( "lexical_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_706 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_706) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_707 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_708 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_709 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_710 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_707 + c1_708 = TreeSitter.Node.nodeStartPoint node_706 + TreeSitter.Node.TSPoint + r2_709 + c2_710 = TreeSitter.Node.nodeEndPoint node_706 + +deriving instance GHC.Classes.Eq a_711 => GHC.Classes.Eq (LexicalDeclaration a_711) + +deriving instance GHC.Classes.Ord a_712 => GHC.Classes.Ord (LexicalDeclaration a_712) + +deriving instance GHC.Show.Show a_713 => GHC.Show.Show (LexicalDeclaration a_713) + +instance AST.Unmarshal.Unmarshal LexicalDeclaration + +instance Data.Foldable.Foldable LexicalDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LexicalDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LexicalDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LiteralType a = LiteralType + { ann :: a, + extraChildren :: (AST.Parse.Err ((False GHC.Generics.:+: Number GHC.Generics.:+: String GHC.Generics.:+: True GHC.Generics.:+: UnaryExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_714. + AST.Traversable1.Class.Traversable1 a_714 + ) + +instance AST.Unmarshal.SymbolMatching LiteralType where + matchedSymbols _ = [269] + showFailure _ node_715 = + "expected " + GHC.Base.<> ( "literal_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_715 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_715) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_716 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_717 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_718 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_719 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_716 + c1_717 = TreeSitter.Node.nodeStartPoint node_715 + TreeSitter.Node.TSPoint + r2_718 + c2_719 = TreeSitter.Node.nodeEndPoint node_715 + +deriving instance GHC.Classes.Eq a_720 => GHC.Classes.Eq (LiteralType a_720) + +deriving instance GHC.Classes.Ord a_721 => GHC.Classes.Ord (LiteralType a_721) + +deriving instance GHC.Show.Show a_722 => GHC.Show.Show (LiteralType a_722) + +instance AST.Unmarshal.Unmarshal LiteralType + +instance Data.Foldable.Foldable LiteralType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LiteralType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LiteralType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LookupType a = LookupType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_723. + AST.Traversable1.Class.Traversable1 a_723 + ) + +instance AST.Unmarshal.SymbolMatching LookupType where + matchedSymbols _ = [267] + showFailure _ node_724 = + "expected " + GHC.Base.<> ( "lookup_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_724 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_724) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_725 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_726 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_727 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_728 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_725 + c1_726 = TreeSitter.Node.nodeStartPoint node_724 + TreeSitter.Node.TSPoint + r2_727 + c2_728 = TreeSitter.Node.nodeEndPoint node_724 + +deriving instance GHC.Classes.Eq a_729 => GHC.Classes.Eq (LookupType a_729) + +deriving instance GHC.Classes.Ord a_730 => GHC.Classes.Ord (LookupType a_730) + +deriving instance GHC.Show.Show a_731 => GHC.Show.Show (LookupType a_731) + +instance AST.Unmarshal.Unmarshal LookupType + +instance Data.Foldable.Foldable LookupType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LookupType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LookupType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MappedTypeClause a = MappedTypeClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_732. + AST.Traversable1.Class.Traversable1 a_732 + ) + +instance AST.Unmarshal.SymbolMatching MappedTypeClause where + matchedSymbols _ = [268] + showFailure _ node_733 = + "expected " + GHC.Base.<> ( "mapped_type_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_733 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_733) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_734 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_735 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_736 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_737 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_734 + c1_735 = TreeSitter.Node.nodeStartPoint node_733 + TreeSitter.Node.TSPoint + r2_736 + c2_737 = TreeSitter.Node.nodeEndPoint node_733 + +deriving instance GHC.Classes.Eq a_738 => GHC.Classes.Eq (MappedTypeClause a_738) + +deriving instance GHC.Classes.Ord a_739 => GHC.Classes.Ord (MappedTypeClause a_739) + +deriving instance GHC.Show.Show a_740 => GHC.Show.Show (MappedTypeClause a_740) + +instance AST.Unmarshal.Unmarshal MappedTypeClause + +instance Data.Foldable.Foldable MappedTypeClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MappedTypeClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MappedTypeClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MemberExpression a = MemberExpression + { ann :: a, + property :: (AST.Parse.Err (PropertyIdentifier a)), + object :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_741. + AST.Traversable1.Class.Traversable1 a_741 + ) + +instance AST.Unmarshal.SymbolMatching MemberExpression where + matchedSymbols _ = [207, 225] + showFailure _ node_742 = + "expected " + GHC.Base.<> ( "member_expression, member_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_742 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_742) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_743 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_744 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_745 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_746 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_743 + c1_744 = TreeSitter.Node.nodeStartPoint node_742 + TreeSitter.Node.TSPoint + r2_745 + c2_746 = TreeSitter.Node.nodeEndPoint node_742 + +deriving instance GHC.Classes.Eq a_747 => GHC.Classes.Eq (MemberExpression a_747) + +deriving instance GHC.Classes.Ord a_748 => GHC.Classes.Ord (MemberExpression a_748) + +deriving instance GHC.Show.Show a_749 => GHC.Show.Show (MemberExpression a_749) + +instance AST.Unmarshal.Unmarshal MemberExpression + +instance Data.Foldable.Foldable MemberExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MemberExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MemberExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MetaProperty a = MetaProperty {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_750. + AST.Traversable1.Class.Traversable1 a_750 + ) + +instance AST.Unmarshal.SymbolMatching MetaProperty where + matchedSymbols _ = [222] + showFailure _ node_751 = + "expected " + GHC.Base.<> ( "meta_property" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_751 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_751) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_752 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_753 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_754 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_755 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_752 + c1_753 = TreeSitter.Node.nodeStartPoint node_751 + TreeSitter.Node.TSPoint + r2_754 + c2_755 = TreeSitter.Node.nodeEndPoint node_751 + +deriving instance GHC.Classes.Eq a_756 => GHC.Classes.Eq (MetaProperty a_756) + +deriving instance GHC.Classes.Ord a_757 => GHC.Classes.Ord (MetaProperty a_757) + +deriving instance GHC.Show.Show a_758 => GHC.Show.Show (MetaProperty a_758) + +instance AST.Unmarshal.Unmarshal MetaProperty + +instance Data.Foldable.Foldable MetaProperty where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MetaProperty where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MetaProperty where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodDefinition a = MethodDefinition + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err (StatementBlock a)), + name :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: ([AST.Parse.Err ((AccessibilityModifier GHC.Generics.:+: Readonly) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_759. + AST.Traversable1.Class.Traversable1 a_759 + ) + +instance AST.Unmarshal.SymbolMatching MethodDefinition where + matchedSymbols _ = [231] + showFailure _ node_760 = + "expected " + GHC.Base.<> ( "method_definition" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_760 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_760) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_761 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_762 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_763 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_764 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_761 + c1_762 = TreeSitter.Node.nodeStartPoint node_760 + TreeSitter.Node.TSPoint + r2_763 + c2_764 = TreeSitter.Node.nodeEndPoint node_760 + +deriving instance GHC.Classes.Eq a_765 => GHC.Classes.Eq (MethodDefinition a_765) + +deriving instance GHC.Classes.Ord a_766 => GHC.Classes.Ord (MethodDefinition a_766) + +deriving instance GHC.Show.Show a_767 => GHC.Show.Show (MethodDefinition a_767) + +instance AST.Unmarshal.Unmarshal MethodDefinition + +instance Data.Foldable.Foldable MethodDefinition where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodDefinition where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodDefinition where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodSignature a = MethodSignature + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + name :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: ([AST.Parse.Err ((AccessibilityModifier GHC.Generics.:+: Readonly) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_768. + AST.Traversable1.Class.Traversable1 a_768 + ) + +instance AST.Unmarshal.SymbolMatching MethodSignature where + matchedSymbols _ = [236] + showFailure _ node_769 = + "expected " + GHC.Base.<> ( "method_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_769 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_769) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_770 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_771 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_772 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_773 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_770 + c1_771 = TreeSitter.Node.nodeStartPoint node_769 + TreeSitter.Node.TSPoint + r2_772 + c2_773 = TreeSitter.Node.nodeEndPoint node_769 + +deriving instance GHC.Classes.Eq a_774 => GHC.Classes.Eq (MethodSignature a_774) + +deriving instance GHC.Classes.Ord a_775 => GHC.Classes.Ord (MethodSignature a_775) + +deriving instance GHC.Show.Show a_776 => GHC.Show.Show (MethodSignature a_776) + +instance AST.Unmarshal.Unmarshal MethodSignature + +instance Data.Foldable.Foldable MethodSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Module a = Module + { ann :: a, + body :: (GHC.Maybe.Maybe (AST.Parse.Err (StatementBlock a))), + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_777. + AST.Traversable1.Class.Traversable1 a_777 + ) + +instance AST.Unmarshal.SymbolMatching Module where + matchedSymbols _ = [244] + showFailure _ node_778 = + "expected " + GHC.Base.<> ( "module" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_778 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_778) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_779 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_780 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_781 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_782 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_779 + c1_780 = TreeSitter.Node.nodeStartPoint node_778 + TreeSitter.Node.TSPoint + r2_781 + c2_782 = TreeSitter.Node.nodeEndPoint node_778 + +deriving instance GHC.Classes.Eq a_783 => GHC.Classes.Eq (Module a_783) + +deriving instance GHC.Classes.Ord a_784 => GHC.Classes.Ord (Module a_784) + +deriving instance GHC.Show.Show a_785 => GHC.Show.Show (Module a_785) + +instance AST.Unmarshal.Unmarshal Module + +instance Data.Foldable.Foldable Module where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Module where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Module where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamedImports a = NamedImports + { ann :: a, + extraChildren :: ([AST.Parse.Err (ImportSpecifier a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_786. + AST.Traversable1.Class.Traversable1 a_786 + ) + +instance AST.Unmarshal.SymbolMatching NamedImports where + matchedSymbols _ = [153] + showFailure _ node_787 = + "expected " + GHC.Base.<> ( "named_imports" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_787 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_787) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_788 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_789 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_790 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_791 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_788 + c1_789 = TreeSitter.Node.nodeStartPoint node_787 + TreeSitter.Node.TSPoint + r2_790 + c2_791 = TreeSitter.Node.nodeEndPoint node_787 + +deriving instance GHC.Classes.Eq a_792 => GHC.Classes.Eq (NamedImports a_792) + +deriving instance GHC.Classes.Ord a_793 => GHC.Classes.Ord (NamedImports a_793) + +deriving instance GHC.Show.Show a_794 => GHC.Show.Show (NamedImports a_794) + +instance AST.Unmarshal.Unmarshal NamedImports + +instance Data.Foldable.Foldable NamedImports where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamedImports where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamedImports where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceImport a = NamespaceImport + { ann :: a, + extraChildren :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_795. + AST.Traversable1.Class.Traversable1 a_795 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceImport where + matchedSymbols _ = [152] + showFailure _ node_796 = + "expected " + GHC.Base.<> ( "namespace_import" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_796 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_796) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_797 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_798 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_799 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_800 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_797 + c1_798 = TreeSitter.Node.nodeStartPoint node_796 + TreeSitter.Node.TSPoint + r2_799 + c2_800 = TreeSitter.Node.nodeEndPoint node_796 + +deriving instance GHC.Classes.Eq a_801 => GHC.Classes.Eq (NamespaceImport a_801) + +deriving instance GHC.Classes.Ord a_802 => GHC.Classes.Ord (NamespaceImport a_802) + +deriving instance GHC.Show.Show a_803 => GHC.Show.Show (NamespaceImport a_803) + +instance AST.Unmarshal.Unmarshal NamespaceImport + +instance Data.Foldable.Foldable NamespaceImport where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceImport where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceImport where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NestedIdentifier a = NestedIdentifier + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_804. + AST.Traversable1.Class.Traversable1 a_804 + ) + +instance AST.Unmarshal.SymbolMatching NestedIdentifier where + matchedSymbols _ = [190] + showFailure _ node_805 = + "expected " + GHC.Base.<> ( "nested_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_805 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_805) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_806 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_807 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_808 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_809 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_806 + c1_807 = TreeSitter.Node.nodeStartPoint node_805 + TreeSitter.Node.TSPoint + r2_808 + c2_809 = TreeSitter.Node.nodeEndPoint node_805 + +deriving instance GHC.Classes.Eq a_810 => GHC.Classes.Eq (NestedIdentifier a_810) + +deriving instance GHC.Classes.Ord a_811 => GHC.Classes.Ord (NestedIdentifier a_811) + +deriving instance GHC.Show.Show a_812 => GHC.Show.Show (NestedIdentifier a_812) + +instance AST.Unmarshal.Unmarshal NestedIdentifier + +instance Data.Foldable.Foldable NestedIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NestedIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NestedIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NestedTypeIdentifier a = NestedTypeIdentifier + { ann :: a, + name :: (AST.Parse.Err (TypeIdentifier a)), + module' :: (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_813. + AST.Traversable1.Class.Traversable1 a_813 + ) + +instance AST.Unmarshal.SymbolMatching NestedTypeIdentifier where + matchedSymbols _ = [248] + showFailure _ node_814 = + "expected " + GHC.Base.<> ( "nested_type_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_814 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_814) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_815 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_816 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_817 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_818 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_815 + c1_816 = TreeSitter.Node.nodeStartPoint node_814 + TreeSitter.Node.TSPoint + r2_817 + c2_818 = TreeSitter.Node.nodeEndPoint node_814 + +deriving instance GHC.Classes.Eq a_819 => GHC.Classes.Eq (NestedTypeIdentifier a_819) + +deriving instance GHC.Classes.Ord a_820 => GHC.Classes.Ord (NestedTypeIdentifier a_820) + +deriving instance GHC.Show.Show a_821 => GHC.Show.Show (NestedTypeIdentifier a_821) + +instance AST.Unmarshal.Unmarshal NestedTypeIdentifier + +instance Data.Foldable.Foldable NestedTypeIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NestedTypeIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NestedTypeIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NewExpression a = NewExpression + { ann :: a, + arguments :: (GHC.Maybe.Maybe (AST.Parse.Err (Arguments a))), + constructor :: (AST.Parse.Err ((Array GHC.Generics.:+: ArrowFunction GHC.Generics.:+: Class GHC.Generics.:+: False GHC.Generics.:+: Function GHC.Generics.:+: GeneratorFunction GHC.Generics.:+: Identifier GHC.Generics.:+: Import GHC.Generics.:+: MemberExpression GHC.Generics.:+: MetaProperty GHC.Generics.:+: NewExpression GHC.Generics.:+: Null GHC.Generics.:+: Number GHC.Generics.:+: Object GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: Regex GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: TemplateString GHC.Generics.:+: This GHC.Generics.:+: True GHC.Generics.:+: Undefined) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_822. + AST.Traversable1.Class.Traversable1 a_822 + ) + +instance AST.Unmarshal.SymbolMatching NewExpression where + matchedSymbols _ = [205] + showFailure _ node_823 = + "expected " + GHC.Base.<> ( "new_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_823 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_823) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_824 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_825 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_826 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_827 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_824 + c1_825 = TreeSitter.Node.nodeStartPoint node_823 + TreeSitter.Node.TSPoint + r2_826 + c2_827 = TreeSitter.Node.nodeEndPoint node_823 + +deriving instance GHC.Classes.Eq a_828 => GHC.Classes.Eq (NewExpression a_828) + +deriving instance GHC.Classes.Ord a_829 => GHC.Classes.Ord (NewExpression a_829) + +deriving instance GHC.Show.Show a_830 => GHC.Show.Show (NewExpression a_830) + +instance AST.Unmarshal.Unmarshal NewExpression + +instance Data.Foldable.Foldable NewExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NewExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NewExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NonNullExpression a = NonNullExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_831. + AST.Traversable1.Class.Traversable1 a_831 + ) + +instance AST.Unmarshal.SymbolMatching NonNullExpression where + matchedSymbols _ = [235] + showFailure _ node_832 = + "expected " + GHC.Base.<> ( "non_null_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_832 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_832) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_833 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_834 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_835 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_836 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_833 + c1_834 = TreeSitter.Node.nodeStartPoint node_832 + TreeSitter.Node.TSPoint + r2_835 + c2_836 = TreeSitter.Node.nodeEndPoint node_832 + +deriving instance GHC.Classes.Eq a_837 => GHC.Classes.Eq (NonNullExpression a_837) + +deriving instance GHC.Classes.Ord a_838 => GHC.Classes.Ord (NonNullExpression a_838) + +deriving instance GHC.Show.Show a_839 => GHC.Show.Show (NonNullExpression a_839) + +instance AST.Unmarshal.Unmarshal NonNullExpression + +instance Data.Foldable.Foldable NonNullExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NonNullExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NonNullExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Object a = Object + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AssignmentPattern GHC.Generics.:+: MethodDefinition GHC.Generics.:+: Pair GHC.Generics.:+: ShorthandPropertyIdentifier GHC.Generics.:+: SpreadElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_840. + AST.Traversable1.Class.Traversable1 a_840 + ) + +instance AST.Unmarshal.SymbolMatching Object where + matchedSymbols _ = [183] + showFailure _ node_841 = + "expected " + GHC.Base.<> ( "object" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_841 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_841) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_842 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_843 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_844 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_845 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_842 + c1_843 = TreeSitter.Node.nodeStartPoint node_841 + TreeSitter.Node.TSPoint + r2_844 + c2_845 = TreeSitter.Node.nodeEndPoint node_841 + +deriving instance GHC.Classes.Eq a_846 => GHC.Classes.Eq (Object a_846) + +deriving instance GHC.Classes.Ord a_847 => GHC.Classes.Ord (Object a_847) + +deriving instance GHC.Show.Show a_848 => GHC.Show.Show (Object a_848) + +instance AST.Unmarshal.Unmarshal Object + +instance Data.Foldable.Foldable Object where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Object where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Object where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ObjectPattern a = ObjectPattern + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AssignmentPattern GHC.Generics.:+: MethodDefinition GHC.Generics.:+: Pair GHC.Generics.:+: ShorthandPropertyIdentifier GHC.Generics.:+: SpreadElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_849. + AST.Traversable1.Class.Traversable1 a_849 + ) + +instance AST.Unmarshal.SymbolMatching ObjectPattern where + matchedSymbols _ = [313] + showFailure _ node_850 = + "expected " + GHC.Base.<> ( "object_pattern" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_850 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_850) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_851 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_852 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_853 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_854 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_851 + c1_852 = TreeSitter.Node.nodeStartPoint node_850 + TreeSitter.Node.TSPoint + r2_853 + c2_854 = TreeSitter.Node.nodeEndPoint node_850 + +deriving instance GHC.Classes.Eq a_855 => GHC.Classes.Eq (ObjectPattern a_855) + +deriving instance GHC.Classes.Ord a_856 => GHC.Classes.Ord (ObjectPattern a_856) + +deriving instance GHC.Show.Show a_857 => GHC.Show.Show (ObjectPattern a_857) + +instance AST.Unmarshal.Unmarshal ObjectPattern + +instance Data.Foldable.Foldable ObjectPattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ObjectPattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ObjectPattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ObjectType a = ObjectType + { ann :: a, + extraChildren :: ([AST.Parse.Err ((CallSignature GHC.Generics.:+: ConstructSignature GHC.Generics.:+: ExportStatement GHC.Generics.:+: IndexSignature GHC.Generics.:+: MethodSignature GHC.Generics.:+: PropertySignature) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_858. + AST.Traversable1.Class.Traversable1 a_858 + ) + +instance AST.Unmarshal.SymbolMatching ObjectType where + matchedSymbols _ = [276] + showFailure _ node_859 = + "expected " + GHC.Base.<> ( "object_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_859 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_859) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_860 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_861 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_862 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_863 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_860 + c1_861 = TreeSitter.Node.nodeStartPoint node_859 + TreeSitter.Node.TSPoint + r2_862 + c2_863 = TreeSitter.Node.nodeEndPoint node_859 + +deriving instance GHC.Classes.Eq a_864 => GHC.Classes.Eq (ObjectType a_864) + +deriving instance GHC.Classes.Ord a_865 => GHC.Classes.Ord (ObjectType a_865) + +deriving instance GHC.Show.Show a_866 => GHC.Show.Show (ObjectType a_866) + +instance AST.Unmarshal.Unmarshal ObjectType + +instance Data.Foldable.Foldable ObjectType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ObjectType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ObjectType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data OptionalParameter a = OptionalParameter + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: AccessibilityModifier GHC.Generics.:+: Identifier GHC.Generics.:+: Readonly GHC.Generics.:+: This GHC.Generics.:+: TypeAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_867. + AST.Traversable1.Class.Traversable1 a_867 + ) + +instance AST.Unmarshal.SymbolMatching OptionalParameter where + matchedSymbols _ = [257] + showFailure _ node_868 = + "expected " + GHC.Base.<> ( "optional_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_868 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_868) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_869 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_870 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_871 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_872 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_869 + c1_870 = TreeSitter.Node.nodeStartPoint node_868 + TreeSitter.Node.TSPoint + r2_871 + c2_872 = TreeSitter.Node.nodeEndPoint node_868 + +deriving instance GHC.Classes.Eq a_873 => GHC.Classes.Eq (OptionalParameter a_873) + +deriving instance GHC.Classes.Ord a_874 => GHC.Classes.Ord (OptionalParameter a_874) + +deriving instance GHC.Show.Show a_875 => GHC.Show.Show (OptionalParameter a_875) + +instance AST.Unmarshal.Unmarshal OptionalParameter + +instance Data.Foldable.Foldable OptionalParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor OptionalParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable OptionalParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Pair a = Pair + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + key :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_876. + AST.Traversable1.Class.Traversable1 a_876 + ) + +instance AST.Unmarshal.SymbolMatching Pair where + matchedSymbols _ = [232] + showFailure _ node_877 = + "expected " + GHC.Base.<> ( "pair" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_877 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_877) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_878 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_879 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_880 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_881 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_878 + c1_879 = TreeSitter.Node.nodeStartPoint node_877 + TreeSitter.Node.TSPoint + r2_880 + c2_881 = TreeSitter.Node.nodeEndPoint node_877 + +deriving instance GHC.Classes.Eq a_882 => GHC.Classes.Eq (Pair a_882) + +deriving instance GHC.Classes.Ord a_883 => GHC.Classes.Ord (Pair a_883) + +deriving instance GHC.Show.Show a_884 => GHC.Show.Show (Pair a_884) + +instance AST.Unmarshal.Unmarshal Pair + +instance Data.Foldable.Foldable Pair where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Pair where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Pair where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParenthesizedExpression a = ParenthesizedExpression + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression GHC.Generics.:+: TypeAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_885. + AST.Traversable1.Class.Traversable1 a_885 + ) + +instance AST.Unmarshal.SymbolMatching ParenthesizedExpression where + matchedSymbols _ = [180] + showFailure _ node_886 = + "expected " + GHC.Base.<> ( "parenthesized_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_886 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_886) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_887 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_888 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_889 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_890 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_887 + c1_888 = TreeSitter.Node.nodeStartPoint node_886 + TreeSitter.Node.TSPoint + r2_889 + c2_890 = TreeSitter.Node.nodeEndPoint node_886 + +deriving instance GHC.Classes.Eq a_891 => GHC.Classes.Eq (ParenthesizedExpression a_891) + +deriving instance GHC.Classes.Ord a_892 => GHC.Classes.Ord (ParenthesizedExpression a_892) + +deriving instance GHC.Show.Show a_893 => GHC.Show.Show (ParenthesizedExpression a_893) + +instance AST.Unmarshal.Unmarshal ParenthesizedExpression + +instance Data.Foldable.Foldable ParenthesizedExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParenthesizedExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParenthesizedExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParenthesizedType a = ParenthesizedType + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_894. + AST.Traversable1.Class.Traversable1 a_894 + ) + +instance AST.Unmarshal.SymbolMatching ParenthesizedType where + matchedSymbols _ = [273] + showFailure _ node_895 = + "expected " + GHC.Base.<> ( "parenthesized_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_895 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_895) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_896 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_897 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_898 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_899 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_896 + c1_897 = TreeSitter.Node.nodeStartPoint node_895 + TreeSitter.Node.TSPoint + r2_898 + c2_899 = TreeSitter.Node.nodeEndPoint node_895 + +deriving instance GHC.Classes.Eq a_900 => GHC.Classes.Eq (ParenthesizedType a_900) + +deriving instance GHC.Classes.Ord a_901 => GHC.Classes.Ord (ParenthesizedType a_901) + +deriving instance GHC.Show.Show a_902 => GHC.Show.Show (ParenthesizedType a_902) + +instance AST.Unmarshal.Unmarshal ParenthesizedType + +instance Data.Foldable.Foldable ParenthesizedType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParenthesizedType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParenthesizedType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PredefinedType a = PredefinedType {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_903. + AST.Traversable1.Class.Traversable1 a_903 + ) + +instance AST.Unmarshal.SymbolMatching PredefinedType where + matchedSymbols _ = [274] + showFailure _ node_904 = + "expected " + GHC.Base.<> ( "predefined_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_904 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_904) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_905 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_906 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_907 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_908 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_905 + c1_906 = TreeSitter.Node.nodeStartPoint node_904 + TreeSitter.Node.TSPoint + r2_907 + c2_908 = TreeSitter.Node.nodeEndPoint node_904 + +deriving instance GHC.Classes.Eq a_909 => GHC.Classes.Eq (PredefinedType a_909) + +deriving instance GHC.Classes.Ord a_910 => GHC.Classes.Ord (PredefinedType a_910) + +deriving instance GHC.Show.Show a_911 => GHC.Show.Show (PredefinedType a_911) + +instance AST.Unmarshal.Unmarshal PredefinedType + +instance Data.Foldable.Foldable PredefinedType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PredefinedType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PredefinedType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Program a = Program + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: HashBangLine) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_912. + AST.Traversable1.Class.Traversable1 a_912 + ) + +instance AST.Unmarshal.SymbolMatching Program where + matchedSymbols _ = [143] + showFailure _ node_913 = + "expected " + GHC.Base.<> ( "program" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_913 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_913) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_914 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_915 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_916 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_917 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_914 + c1_915 = TreeSitter.Node.nodeStartPoint node_913 + TreeSitter.Node.TSPoint + r2_916 + c2_917 = TreeSitter.Node.nodeEndPoint node_913 + +deriving instance GHC.Classes.Eq a_918 => GHC.Classes.Eq (Program a_918) + +deriving instance GHC.Classes.Ord a_919 => GHC.Classes.Ord (Program a_919) + +deriving instance GHC.Show.Show a_920 => GHC.Show.Show (Program a_920) + +instance AST.Unmarshal.Unmarshal Program + +instance Data.Foldable.Foldable Program where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Program where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Program where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PropertySignature a = PropertySignature + { ann :: a, + name :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + extraChildren :: ([AST.Parse.Err ((AccessibilityModifier GHC.Generics.:+: Readonly) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_921. + AST.Traversable1.Class.Traversable1 a_921 + ) + +instance AST.Unmarshal.SymbolMatching PropertySignature where + matchedSymbols _ = [278] + showFailure _ node_922 = + "expected " + GHC.Base.<> ( "property_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_922 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_922) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_923 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_924 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_925 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_926 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_923 + c1_924 = TreeSitter.Node.nodeStartPoint node_922 + TreeSitter.Node.TSPoint + r2_925 + c2_926 = TreeSitter.Node.nodeEndPoint node_922 + +deriving instance GHC.Classes.Eq a_927 => GHC.Classes.Eq (PropertySignature a_927) + +deriving instance GHC.Classes.Ord a_928 => GHC.Classes.Ord (PropertySignature a_928) + +deriving instance GHC.Show.Show a_929 => GHC.Show.Show (PropertySignature a_929) + +instance AST.Unmarshal.Unmarshal PropertySignature + +instance Data.Foldable.Foldable PropertySignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PropertySignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PropertySignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PublicFieldDefinition a = PublicFieldDefinition + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + name :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + extraChildren :: ([AST.Parse.Err ((AccessibilityModifier GHC.Generics.:+: Readonly) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_930. + AST.Traversable1.Class.Traversable1 a_930 + ) + +instance AST.Unmarshal.SymbolMatching PublicFieldDefinition where + matchedSymbols _ = [228] + showFailure _ node_931 = + "expected " + GHC.Base.<> ( "public_field_definition" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_931 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_931) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_932 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_933 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_934 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_935 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_932 + c1_933 = TreeSitter.Node.nodeStartPoint node_931 + TreeSitter.Node.TSPoint + r2_934 + c2_935 = TreeSitter.Node.nodeEndPoint node_931 + +deriving instance GHC.Classes.Eq a_936 => GHC.Classes.Eq (PublicFieldDefinition a_936) + +deriving instance GHC.Classes.Ord a_937 => GHC.Classes.Ord (PublicFieldDefinition a_937) + +deriving instance GHC.Show.Show a_938 => GHC.Show.Show (PublicFieldDefinition a_938) + +instance AST.Unmarshal.Unmarshal PublicFieldDefinition + +instance Data.Foldable.Foldable PublicFieldDefinition where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PublicFieldDefinition where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PublicFieldDefinition where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Regex a = Regex + { ann :: a, + flags :: (GHC.Maybe.Maybe (AST.Parse.Err (RegexFlags a))), + pattern :: (AST.Parse.Err (RegexPattern a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_939. + AST.Traversable1.Class.Traversable1 a_939 + ) + +instance AST.Unmarshal.SymbolMatching Regex where + matchedSymbols _ = [221] + showFailure _ node_940 = + "expected " + GHC.Base.<> ( "regex" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_940 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_940) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_941 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_942 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_943 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_944 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_941 + c1_942 = TreeSitter.Node.nodeStartPoint node_940 + TreeSitter.Node.TSPoint + r2_943 + c2_944 = TreeSitter.Node.nodeEndPoint node_940 + +deriving instance GHC.Classes.Eq a_945 => GHC.Classes.Eq (Regex a_945) + +deriving instance GHC.Classes.Ord a_946 => GHC.Classes.Ord (Regex a_946) + +deriving instance GHC.Show.Show a_947 => GHC.Show.Show (Regex a_947) + +instance AST.Unmarshal.Unmarshal Regex + +instance Data.Foldable.Foldable Regex where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Regex where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Regex where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RequiredParameter a = RequiredParameter + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: AccessibilityModifier GHC.Generics.:+: Identifier GHC.Generics.:+: Readonly GHC.Generics.:+: This GHC.Generics.:+: TypeAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_948. + AST.Traversable1.Class.Traversable1 a_948 + ) + +instance AST.Unmarshal.SymbolMatching RequiredParameter where + matchedSymbols _ = [256] + showFailure _ node_949 = + "expected " + GHC.Base.<> ( "required_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_949 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_949) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_950 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_951 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_952 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_953 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_950 + c1_951 = TreeSitter.Node.nodeStartPoint node_949 + TreeSitter.Node.TSPoint + r2_952 + c2_953 = TreeSitter.Node.nodeEndPoint node_949 + +deriving instance GHC.Classes.Eq a_954 => GHC.Classes.Eq (RequiredParameter a_954) + +deriving instance GHC.Classes.Ord a_955 => GHC.Classes.Ord (RequiredParameter a_955) + +deriving instance GHC.Show.Show a_956 => GHC.Show.Show (RequiredParameter a_956) + +instance AST.Unmarshal.Unmarshal RequiredParameter + +instance Data.Foldable.Foldable RequiredParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RequiredParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RequiredParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RestParameter a = RestParameter + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: TypeAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_957. + AST.Traversable1.Class.Traversable1 a_957 + ) + +instance AST.Unmarshal.SymbolMatching RestParameter where + matchedSymbols _ = [230] + showFailure _ node_958 = + "expected " + GHC.Base.<> ( "rest_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_958 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_958) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_959 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_960 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_961 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_962 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_959 + c1_960 = TreeSitter.Node.nodeStartPoint node_958 + TreeSitter.Node.TSPoint + r2_961 + c2_962 = TreeSitter.Node.nodeEndPoint node_958 + +deriving instance GHC.Classes.Eq a_963 => GHC.Classes.Eq (RestParameter a_963) + +deriving instance GHC.Classes.Ord a_964 => GHC.Classes.Ord (RestParameter a_964) + +deriving instance GHC.Show.Show a_965 => GHC.Show.Show (RestParameter a_965) + +instance AST.Unmarshal.Unmarshal RestParameter + +instance Data.Foldable.Foldable RestParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RestParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RestParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ReturnStatement a = ReturnStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_966. + AST.Traversable1.Class.Traversable1 a_966 + ) + +instance AST.Unmarshal.SymbolMatching ReturnStatement where + matchedSymbols _ = [171] + showFailure _ node_967 = + "expected " + GHC.Base.<> ( "return_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_967 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_967) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_968 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_969 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_970 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_971 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_968 + c1_969 = TreeSitter.Node.nodeStartPoint node_967 + TreeSitter.Node.TSPoint + r2_970 + c2_971 = TreeSitter.Node.nodeEndPoint node_967 + +deriving instance GHC.Classes.Eq a_972 => GHC.Classes.Eq (ReturnStatement a_972) + +deriving instance GHC.Classes.Ord a_973 => GHC.Classes.Ord (ReturnStatement a_973) + +deriving instance GHC.Show.Show a_974 => GHC.Show.Show (ReturnStatement a_974) + +instance AST.Unmarshal.Unmarshal ReturnStatement + +instance Data.Foldable.Foldable ReturnStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ReturnStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ReturnStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SequenceExpression a = SequenceExpression + { ann :: a, + left :: (AST.Parse.Err (Expression a)), + right :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_975. + AST.Traversable1.Class.Traversable1 a_975 + ) + +instance AST.Unmarshal.SymbolMatching SequenceExpression where + matchedSymbols _ = [217] + showFailure _ node_976 = + "expected " + GHC.Base.<> ( "sequence_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_976 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_976) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_977 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_978 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_979 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_980 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_977 + c1_978 = TreeSitter.Node.nodeStartPoint node_976 + TreeSitter.Node.TSPoint + r2_979 + c2_980 = TreeSitter.Node.nodeEndPoint node_976 + +deriving instance GHC.Classes.Eq a_981 => GHC.Classes.Eq (SequenceExpression a_981) + +deriving instance GHC.Classes.Ord a_982 => GHC.Classes.Ord (SequenceExpression a_982) + +deriving instance GHC.Show.Show a_983 => GHC.Show.Show (SequenceExpression a_983) + +instance AST.Unmarshal.Unmarshal SequenceExpression + +instance Data.Foldable.Foldable SequenceExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SequenceExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SequenceExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SpreadElement a = SpreadElement + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_984. + AST.Traversable1.Class.Traversable1 a_984 + ) + +instance AST.Unmarshal.SymbolMatching SpreadElement where + matchedSymbols _ = [212] + showFailure _ node_985 = + "expected " + GHC.Base.<> ( "spread_element" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_985 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_985) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_986 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_987 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_988 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_989 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_986 + c1_987 = TreeSitter.Node.nodeStartPoint node_985 + TreeSitter.Node.TSPoint + r2_988 + c2_989 = TreeSitter.Node.nodeEndPoint node_985 + +deriving instance GHC.Classes.Eq a_990 => GHC.Classes.Eq (SpreadElement a_990) + +deriving instance GHC.Classes.Ord a_991 => GHC.Classes.Ord (SpreadElement a_991) + +deriving instance GHC.Show.Show a_992 => GHC.Show.Show (SpreadElement a_992) + +instance AST.Unmarshal.Unmarshal SpreadElement + +instance Data.Foldable.Foldable SpreadElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SpreadElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SpreadElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data StatementBlock a = StatementBlock + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_993. + AST.Traversable1.Class.Traversable1 a_993 + ) + +instance AST.Unmarshal.SymbolMatching StatementBlock where + matchedSymbols _ = [158] + showFailure _ node_994 = + "expected " + GHC.Base.<> ( "statement_block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_994 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_994) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_995 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_996 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_997 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_998 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_995 + c1_996 = TreeSitter.Node.nodeStartPoint node_994 + TreeSitter.Node.TSPoint + r2_997 + c2_998 = TreeSitter.Node.nodeEndPoint node_994 + +deriving instance GHC.Classes.Eq a_999 => GHC.Classes.Eq (StatementBlock a_999) + +deriving instance GHC.Classes.Ord a_1000 => GHC.Classes.Ord (StatementBlock a_1000) + +deriving instance GHC.Show.Show a_1001 => GHC.Show.Show (StatementBlock a_1001) + +instance AST.Unmarshal.Unmarshal StatementBlock + +instance Data.Foldable.Foldable StatementBlock where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StatementBlock where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StatementBlock where + traverse = AST.Traversable1.Class.traverseDefault1 + +data String a = String + { ann :: a, + extraChildren :: ([AST.Parse.Err (EscapeSequence a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1002. + AST.Traversable1.Class.Traversable1 a_1002 + ) + +instance AST.Unmarshal.SymbolMatching String where + matchedSymbols _ = [218] + showFailure _ node_1003 = + "expected " + GHC.Base.<> ( "string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1003 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1003) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1004 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1005 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1006 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1007 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1004 + c1_1005 = TreeSitter.Node.nodeStartPoint node_1003 + TreeSitter.Node.TSPoint + r2_1006 + c2_1007 = TreeSitter.Node.nodeEndPoint node_1003 + +deriving instance GHC.Classes.Eq a_1008 => GHC.Classes.Eq (String a_1008) + +deriving instance GHC.Classes.Ord a_1009 => GHC.Classes.Ord (String a_1009) + +deriving instance GHC.Show.Show a_1010 => GHC.Show.Show (String a_1010) + +instance AST.Unmarshal.Unmarshal String + +instance Data.Foldable.Foldable String where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor String where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable String where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SubscriptExpression a = SubscriptExpression + { ann :: a, + object :: (AST.Parse.Err (Expression a)), + index :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1011. + AST.Traversable1.Class.Traversable1 a_1011 + ) + +instance AST.Unmarshal.SymbolMatching SubscriptExpression where + matchedSymbols _ = [208] + showFailure _ node_1012 = + "expected " + GHC.Base.<> ( "subscript_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1012 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1012) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1013 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1014 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1015 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1016 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1013 + c1_1014 = TreeSitter.Node.nodeStartPoint node_1012 + TreeSitter.Node.TSPoint + r2_1015 + c2_1016 = TreeSitter.Node.nodeEndPoint node_1012 + +deriving instance GHC.Classes.Eq a_1017 => GHC.Classes.Eq (SubscriptExpression a_1017) + +deriving instance GHC.Classes.Ord a_1018 => GHC.Classes.Ord (SubscriptExpression a_1018) + +deriving instance GHC.Show.Show a_1019 => GHC.Show.Show (SubscriptExpression a_1019) + +instance AST.Unmarshal.Unmarshal SubscriptExpression + +instance Data.Foldable.Foldable SubscriptExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SubscriptExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SubscriptExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchBody a = SwitchBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((SwitchCase GHC.Generics.:+: SwitchDefault) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1020. + AST.Traversable1.Class.Traversable1 a_1020 + ) + +instance AST.Unmarshal.SymbolMatching SwitchBody where + matchedSymbols _ = [175] + showFailure _ node_1021 = + "expected " + GHC.Base.<> ( "switch_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1021 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1021) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1022 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1023 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1024 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1025 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1022 + c1_1023 = TreeSitter.Node.nodeStartPoint node_1021 + TreeSitter.Node.TSPoint + r2_1024 + c2_1025 = TreeSitter.Node.nodeEndPoint node_1021 + +deriving instance GHC.Classes.Eq a_1026 => GHC.Classes.Eq (SwitchBody a_1026) + +deriving instance GHC.Classes.Ord a_1027 => GHC.Classes.Ord (SwitchBody a_1027) + +deriving instance GHC.Show.Show a_1028 => GHC.Show.Show (SwitchBody a_1028) + +instance AST.Unmarshal.Unmarshal SwitchBody + +instance Data.Foldable.Foldable SwitchBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchCase a = SwitchCase + { ann :: a, + value :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)), + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1029. + AST.Traversable1.Class.Traversable1 a_1029 + ) + +instance AST.Unmarshal.SymbolMatching SwitchCase where + matchedSymbols _ = [176] + showFailure _ node_1030 = + "expected " + GHC.Base.<> ( "switch_case" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1030 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1030) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1031 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1032 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1033 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1034 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1031 + c1_1032 = TreeSitter.Node.nodeStartPoint node_1030 + TreeSitter.Node.TSPoint + r2_1033 + c2_1034 = TreeSitter.Node.nodeEndPoint node_1030 + +deriving instance GHC.Classes.Eq a_1035 => GHC.Classes.Eq (SwitchCase a_1035) + +deriving instance GHC.Classes.Ord a_1036 => GHC.Classes.Ord (SwitchCase a_1036) + +deriving instance GHC.Show.Show a_1037 => GHC.Show.Show (SwitchCase a_1037) + +instance AST.Unmarshal.Unmarshal SwitchCase + +instance Data.Foldable.Foldable SwitchCase where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchCase where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchCase where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchDefault a = SwitchDefault + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1038. + AST.Traversable1.Class.Traversable1 a_1038 + ) + +instance AST.Unmarshal.SymbolMatching SwitchDefault where + matchedSymbols _ = [177] + showFailure _ node_1039 = + "expected " + GHC.Base.<> ( "switch_default" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1039 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1039) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1040 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1041 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1042 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1043 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1040 + c1_1041 = TreeSitter.Node.nodeStartPoint node_1039 + TreeSitter.Node.TSPoint + r2_1042 + c2_1043 = TreeSitter.Node.nodeEndPoint node_1039 + +deriving instance GHC.Classes.Eq a_1044 => GHC.Classes.Eq (SwitchDefault a_1044) + +deriving instance GHC.Classes.Ord a_1045 => GHC.Classes.Ord (SwitchDefault a_1045) + +deriving instance GHC.Show.Show a_1046 => GHC.Show.Show (SwitchDefault a_1046) + +instance AST.Unmarshal.Unmarshal SwitchDefault + +instance Data.Foldable.Foldable SwitchDefault where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchDefault where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchDefault where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchStatement a = SwitchStatement + { ann :: a, + body :: (AST.Parse.Err (SwitchBody a)), + value :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1047. + AST.Traversable1.Class.Traversable1 a_1047 + ) + +instance AST.Unmarshal.SymbolMatching SwitchStatement where + matchedSymbols _ = [160] + showFailure _ node_1048 = + "expected " + GHC.Base.<> ( "switch_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1048 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1048) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1049 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1050 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1051 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1052 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1049 + c1_1050 = TreeSitter.Node.nodeStartPoint node_1048 + TreeSitter.Node.TSPoint + r2_1051 + c2_1052 = TreeSitter.Node.nodeEndPoint node_1048 + +deriving instance GHC.Classes.Eq a_1053 => GHC.Classes.Eq (SwitchStatement a_1053) + +deriving instance GHC.Classes.Ord a_1054 => GHC.Classes.Ord (SwitchStatement a_1054) + +deriving instance GHC.Show.Show a_1055 => GHC.Show.Show (SwitchStatement a_1055) + +instance AST.Unmarshal.Unmarshal SwitchStatement + +instance Data.Foldable.Foldable SwitchStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TemplateString a = TemplateString + { ann :: a, + extraChildren :: ([AST.Parse.Err ((EscapeSequence GHC.Generics.:+: TemplateSubstitution) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1056. + AST.Traversable1.Class.Traversable1 a_1056 + ) + +instance AST.Unmarshal.SymbolMatching TemplateString where + matchedSymbols _ = [219] + showFailure _ node_1057 = + "expected " + GHC.Base.<> ( "template_string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1057 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1057) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1058 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1059 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1060 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1061 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1058 + c1_1059 = TreeSitter.Node.nodeStartPoint node_1057 + TreeSitter.Node.TSPoint + r2_1060 + c2_1061 = TreeSitter.Node.nodeEndPoint node_1057 + +deriving instance GHC.Classes.Eq a_1062 => GHC.Classes.Eq (TemplateString a_1062) + +deriving instance GHC.Classes.Ord a_1063 => GHC.Classes.Ord (TemplateString a_1063) + +deriving instance GHC.Show.Show a_1064 => GHC.Show.Show (TemplateString a_1064) + +instance AST.Unmarshal.Unmarshal TemplateString + +instance Data.Foldable.Foldable TemplateString where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TemplateString where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TemplateString where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TemplateSubstitution a = TemplateSubstitution + { ann :: a, + extraChildren :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1065. + AST.Traversable1.Class.Traversable1 a_1065 + ) + +instance AST.Unmarshal.SymbolMatching TemplateSubstitution where + matchedSymbols _ = [220] + showFailure _ node_1066 = + "expected " + GHC.Base.<> ( "template_substitution" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1066 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1066) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1067 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1068 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1069 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1070 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1067 + c1_1068 = TreeSitter.Node.nodeStartPoint node_1066 + TreeSitter.Node.TSPoint + r2_1069 + c2_1070 = TreeSitter.Node.nodeEndPoint node_1066 + +deriving instance GHC.Classes.Eq a_1071 => GHC.Classes.Eq (TemplateSubstitution a_1071) + +deriving instance GHC.Classes.Ord a_1072 => GHC.Classes.Ord (TemplateSubstitution a_1072) + +deriving instance GHC.Show.Show a_1073 => GHC.Show.Show (TemplateSubstitution a_1073) + +instance AST.Unmarshal.Unmarshal TemplateSubstitution + +instance Data.Foldable.Foldable TemplateSubstitution where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TemplateSubstitution where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TemplateSubstitution where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TernaryExpression a = TernaryExpression + { ann :: a, + alternative :: (AST.Parse.Err (Expression a)), + consequence :: (AST.Parse.Err (Expression a)), + condition :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1074. + AST.Traversable1.Class.Traversable1 a_1074 + ) + +instance AST.Unmarshal.SymbolMatching TernaryExpression where + matchedSymbols _ = [213] + showFailure _ node_1075 = + "expected " + GHC.Base.<> ( "ternary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1075 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1075) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1076 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1077 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1078 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1079 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1076 + c1_1077 = TreeSitter.Node.nodeStartPoint node_1075 + TreeSitter.Node.TSPoint + r2_1078 + c2_1079 = TreeSitter.Node.nodeEndPoint node_1075 + +deriving instance GHC.Classes.Eq a_1080 => GHC.Classes.Eq (TernaryExpression a_1080) + +deriving instance GHC.Classes.Ord a_1081 => GHC.Classes.Ord (TernaryExpression a_1081) + +deriving instance GHC.Show.Show a_1082 => GHC.Show.Show (TernaryExpression a_1082) + +instance AST.Unmarshal.Unmarshal TernaryExpression + +instance Data.Foldable.Foldable TernaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TernaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TernaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ThrowStatement a = ThrowStatement + { ann :: a, + extraChildren :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1083. + AST.Traversable1.Class.Traversable1 a_1083 + ) + +instance AST.Unmarshal.SymbolMatching ThrowStatement where + matchedSymbols _ = [172] + showFailure _ node_1084 = + "expected " + GHC.Base.<> ( "throw_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1084 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1084) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1085 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1086 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1087 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1088 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1085 + c1_1086 = TreeSitter.Node.nodeStartPoint node_1084 + TreeSitter.Node.TSPoint + r2_1087 + c2_1088 = TreeSitter.Node.nodeEndPoint node_1084 + +deriving instance GHC.Classes.Eq a_1089 => GHC.Classes.Eq (ThrowStatement a_1089) + +deriving instance GHC.Classes.Ord a_1090 => GHC.Classes.Ord (ThrowStatement a_1090) + +deriving instance GHC.Show.Show a_1091 => GHC.Show.Show (ThrowStatement a_1091) + +instance AST.Unmarshal.Unmarshal ThrowStatement + +instance Data.Foldable.Foldable ThrowStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ThrowStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ThrowStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TryStatement a = TryStatement + { ann :: a, + body :: (AST.Parse.Err (StatementBlock a)), + handler :: (GHC.Maybe.Maybe (AST.Parse.Err (CatchClause a))), + finalizer :: (GHC.Maybe.Maybe (AST.Parse.Err (FinallyClause a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1092. + AST.Traversable1.Class.Traversable1 a_1092 + ) + +instance AST.Unmarshal.SymbolMatching TryStatement where + matchedSymbols _ = [166] + showFailure _ node_1093 = + "expected " + GHC.Base.<> ( "try_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1093 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1093) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1094 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1095 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1096 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1097 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1094 + c1_1095 = TreeSitter.Node.nodeStartPoint node_1093 + TreeSitter.Node.TSPoint + r2_1096 + c2_1097 = TreeSitter.Node.nodeEndPoint node_1093 + +deriving instance GHC.Classes.Eq a_1098 => GHC.Classes.Eq (TryStatement a_1098) + +deriving instance GHC.Classes.Ord a_1099 => GHC.Classes.Ord (TryStatement a_1099) + +deriving instance GHC.Show.Show a_1100 => GHC.Show.Show (TryStatement a_1100) + +instance AST.Unmarshal.Unmarshal TryStatement + +instance Data.Foldable.Foldable TryStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TryStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TryStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TupleType a = TupleType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1101. + AST.Traversable1.Class.Traversable1 a_1101 + ) + +instance AST.Unmarshal.SymbolMatching TupleType where + matchedSymbols _ = [286] + showFailure _ node_1102 = + "expected " + GHC.Base.<> ( "tuple_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1102 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1102) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1103 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1104 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1105 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1106 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1103 + c1_1104 = TreeSitter.Node.nodeStartPoint node_1102 + TreeSitter.Node.TSPoint + r2_1105 + c2_1106 = TreeSitter.Node.nodeEndPoint node_1102 + +deriving instance GHC.Classes.Eq a_1107 => GHC.Classes.Eq (TupleType a_1107) + +deriving instance GHC.Classes.Ord a_1108 => GHC.Classes.Ord (TupleType a_1108) + +deriving instance GHC.Show.Show a_1109 => GHC.Show.Show (TupleType a_1109) + +instance AST.Unmarshal.Unmarshal TupleType + +instance Data.Foldable.Foldable TupleType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TupleType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TupleType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeAliasDeclaration a = TypeAliasDeclaration + { ann :: a, + value :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a)), + name :: (AST.Parse.Err (TypeIdentifier a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1110. + AST.Traversable1.Class.Traversable1 a_1110 + ) + +instance AST.Unmarshal.SymbolMatching TypeAliasDeclaration where + matchedSymbols _ = [254] + showFailure _ node_1111 = + "expected " + GHC.Base.<> ( "type_alias_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1111 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1111) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1112 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1113 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1114 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1115 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1112 + c1_1113 = TreeSitter.Node.nodeStartPoint node_1111 + TreeSitter.Node.TSPoint + r2_1114 + c2_1115 = TreeSitter.Node.nodeEndPoint node_1111 + +deriving instance GHC.Classes.Eq a_1116 => GHC.Classes.Eq (TypeAliasDeclaration a_1116) + +deriving instance GHC.Classes.Ord a_1117 => GHC.Classes.Ord (TypeAliasDeclaration a_1117) + +deriving instance GHC.Show.Show a_1118 => GHC.Show.Show (TypeAliasDeclaration a_1118) + +instance AST.Unmarshal.Unmarshal TypeAliasDeclaration + +instance Data.Foldable.Foldable TypeAliasDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeAliasDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeAliasDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeAnnotation a = TypeAnnotation + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1119. + AST.Traversable1.Class.Traversable1 a_1119 + ) + +instance AST.Unmarshal.SymbolMatching TypeAnnotation where + matchedSymbols _ = [259] + showFailure _ node_1120 = + "expected " + GHC.Base.<> ( "type_annotation" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1120 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1120) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1121 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1122 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1123 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1124 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1121 + c1_1122 = TreeSitter.Node.nodeStartPoint node_1120 + TreeSitter.Node.TSPoint + r2_1123 + c2_1124 = TreeSitter.Node.nodeEndPoint node_1120 + +deriving instance GHC.Classes.Eq a_1125 => GHC.Classes.Eq (TypeAnnotation a_1125) + +deriving instance GHC.Classes.Ord a_1126 => GHC.Classes.Ord (TypeAnnotation a_1126) + +deriving instance GHC.Show.Show a_1127 => GHC.Show.Show (TypeAnnotation a_1127) + +instance AST.Unmarshal.Unmarshal TypeAnnotation + +instance Data.Foldable.Foldable TypeAnnotation where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeAnnotation where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeAnnotation where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeArguments a = TypeArguments + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1128. + AST.Traversable1.Class.Traversable1 a_1128 + ) + +instance AST.Unmarshal.SymbolMatching TypeArguments where + matchedSymbols _ = [275] + showFailure _ node_1129 = + "expected " + GHC.Base.<> ( "type_arguments" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1129 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1129) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1130 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1131 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1132 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1133 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1130 + c1_1131 = TreeSitter.Node.nodeStartPoint node_1129 + TreeSitter.Node.TSPoint + r2_1132 + c2_1133 = TreeSitter.Node.nodeEndPoint node_1129 + +deriving instance GHC.Classes.Eq a_1134 => GHC.Classes.Eq (TypeArguments a_1134) + +deriving instance GHC.Classes.Ord a_1135 => GHC.Classes.Ord (TypeArguments a_1135) + +deriving instance GHC.Show.Show a_1136 => GHC.Show.Show (TypeArguments a_1136) + +instance AST.Unmarshal.Unmarshal TypeArguments + +instance Data.Foldable.Foldable TypeArguments where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeArguments where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeArguments where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeParameter a = TypeParameter + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Constraint GHC.Generics.:+: DefaultType GHC.Generics.:+: TypeIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1137. + AST.Traversable1.Class.Traversable1 a_1137 + ) + +instance AST.Unmarshal.SymbolMatching TypeParameter where + matchedSymbols _ = [280] + showFailure _ node_1138 = + "expected " + GHC.Base.<> ( "type_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1138 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1138) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1139 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1140 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1141 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1142 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1139 + c1_1140 = TreeSitter.Node.nodeStartPoint node_1138 + TreeSitter.Node.TSPoint + r2_1141 + c2_1142 = TreeSitter.Node.nodeEndPoint node_1138 + +deriving instance GHC.Classes.Eq a_1143 => GHC.Classes.Eq (TypeParameter a_1143) + +deriving instance GHC.Classes.Ord a_1144 => GHC.Classes.Ord (TypeParameter a_1144) + +deriving instance GHC.Show.Show a_1145 => GHC.Show.Show (TypeParameter a_1145) + +instance AST.Unmarshal.Unmarshal TypeParameter + +instance Data.Foldable.Foldable TypeParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeParameters a = TypeParameters + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (TypeParameter a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1146. + AST.Traversable1.Class.Traversable1 a_1146 + ) + +instance AST.Unmarshal.SymbolMatching TypeParameters where + matchedSymbols _ = [279] + showFailure _ node_1147 = + "expected " + GHC.Base.<> ( "type_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1147 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1147) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1148 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1149 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1150 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1151 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1148 + c1_1149 = TreeSitter.Node.nodeStartPoint node_1147 + TreeSitter.Node.TSPoint + r2_1150 + c2_1151 = TreeSitter.Node.nodeEndPoint node_1147 + +deriving instance GHC.Classes.Eq a_1152 => GHC.Classes.Eq (TypeParameters a_1152) + +deriving instance GHC.Classes.Ord a_1153 => GHC.Classes.Ord (TypeParameters a_1153) + +deriving instance GHC.Show.Show a_1154 => GHC.Show.Show (TypeParameters a_1154) + +instance AST.Unmarshal.Unmarshal TypeParameters + +instance Data.Foldable.Foldable TypeParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypePredicate a = TypePredicate + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: Identifier GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1155. + AST.Traversable1.Class.Traversable1 a_1155 + ) + +instance AST.Unmarshal.SymbolMatching TypePredicate where + matchedSymbols _ = [264] + showFailure _ node_1156 = + "expected " + GHC.Base.<> ( "type_predicate" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1156 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1156) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1157 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1158 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1159 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1160 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1157 + c1_1158 = TreeSitter.Node.nodeStartPoint node_1156 + TreeSitter.Node.TSPoint + r2_1159 + c2_1160 = TreeSitter.Node.nodeEndPoint node_1156 + +deriving instance GHC.Classes.Eq a_1161 => GHC.Classes.Eq (TypePredicate a_1161) + +deriving instance GHC.Classes.Ord a_1162 => GHC.Classes.Ord (TypePredicate a_1162) + +deriving instance GHC.Show.Show a_1163 => GHC.Show.Show (TypePredicate a_1163) + +instance AST.Unmarshal.Unmarshal TypePredicate + +instance Data.Foldable.Foldable TypePredicate where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypePredicate where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypePredicate where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeQuery a = TypeQuery + { ann :: a, + extraChildren :: (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1164. + AST.Traversable1.Class.Traversable1 a_1164 + ) + +instance AST.Unmarshal.SymbolMatching TypeQuery where + matchedSymbols _ = [265] + showFailure _ node_1165 = + "expected " + GHC.Base.<> ( "type_query" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1165 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1165) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1166 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1167 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1168 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1169 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1166 + c1_1167 = TreeSitter.Node.nodeStartPoint node_1165 + TreeSitter.Node.TSPoint + r2_1168 + c2_1169 = TreeSitter.Node.nodeEndPoint node_1165 + +deriving instance GHC.Classes.Eq a_1170 => GHC.Classes.Eq (TypeQuery a_1170) + +deriving instance GHC.Classes.Ord a_1171 => GHC.Classes.Ord (TypeQuery a_1171) + +deriving instance GHC.Show.Show a_1172 => GHC.Show.Show (TypeQuery a_1172) + +instance AST.Unmarshal.Unmarshal TypeQuery + +instance Data.Foldable.Foldable TypeQuery where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeQuery where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeQuery where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnaryExpression a = UnaryExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousBang GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousDelete GHC.Generics.:+: AnonymousTypeof GHC.Generics.:+: AnonymousVoid GHC.Generics.:+: AnonymousTilde) a)), + argument :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1173. + AST.Traversable1.Class.Traversable1 a_1173 + ) + +instance AST.Unmarshal.SymbolMatching UnaryExpression where + matchedSymbols _ = [215, 270] + showFailure _ node_1174 = + "expected " + GHC.Base.<> ( "unary_expression, unary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1174 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1174) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1175 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1176 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1177 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1178 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1175 + c1_1176 = TreeSitter.Node.nodeStartPoint node_1174 + TreeSitter.Node.TSPoint + r2_1177 + c2_1178 = TreeSitter.Node.nodeEndPoint node_1174 + +deriving instance GHC.Classes.Eq a_1179 => GHC.Classes.Eq (UnaryExpression a_1179) + +deriving instance GHC.Classes.Ord a_1180 => GHC.Classes.Ord (UnaryExpression a_1180) + +deriving instance GHC.Show.Show a_1181 => GHC.Show.Show (UnaryExpression a_1181) + +instance AST.Unmarshal.Unmarshal UnaryExpression + +instance Data.Foldable.Foldable UnaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnionType a = UnionType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1182. + AST.Traversable1.Class.Traversable1 a_1182 + ) + +instance AST.Unmarshal.SymbolMatching UnionType where + matchedSymbols _ = [287] + showFailure _ node_1183 = + "expected " + GHC.Base.<> ( "union_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1183 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1183) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1184 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1185 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1186 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1187 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1184 + c1_1185 = TreeSitter.Node.nodeStartPoint node_1183 + TreeSitter.Node.TSPoint + r2_1186 + c2_1187 = TreeSitter.Node.nodeEndPoint node_1183 + +deriving instance GHC.Classes.Eq a_1188 => GHC.Classes.Eq (UnionType a_1188) + +deriving instance GHC.Classes.Ord a_1189 => GHC.Classes.Ord (UnionType a_1189) + +deriving instance GHC.Show.Show a_1190 => GHC.Show.Show (UnionType a_1190) + +instance AST.Unmarshal.Unmarshal UnionType + +instance Data.Foldable.Foldable UnionType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnionType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnionType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UpdateExpression a = UpdateExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousPlusPlus GHC.Generics.:+: AnonymousMinusMinus) a)), + argument :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1191. + AST.Traversable1.Class.Traversable1 a_1191 + ) + +instance AST.Unmarshal.SymbolMatching UpdateExpression where + matchedSymbols _ = [216] + showFailure _ node_1192 = + "expected " + GHC.Base.<> ( "update_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1192 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1192) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1193 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1194 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1195 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1196 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1193 + c1_1194 = TreeSitter.Node.nodeStartPoint node_1192 + TreeSitter.Node.TSPoint + r2_1195 + c2_1196 = TreeSitter.Node.nodeEndPoint node_1192 + +deriving instance GHC.Classes.Eq a_1197 => GHC.Classes.Eq (UpdateExpression a_1197) + +deriving instance GHC.Classes.Ord a_1198 => GHC.Classes.Ord (UpdateExpression a_1198) + +deriving instance GHC.Show.Show a_1199 => GHC.Show.Show (UpdateExpression a_1199) + +instance AST.Unmarshal.Unmarshal UpdateExpression + +instance Data.Foldable.Foldable UpdateExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UpdateExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UpdateExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VariableDeclaration a = VariableDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (VariableDeclarator a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1200. + AST.Traversable1.Class.Traversable1 a_1200 + ) + +instance AST.Unmarshal.SymbolMatching VariableDeclaration where + matchedSymbols _ = [155] + showFailure _ node_1201 = + "expected " + GHC.Base.<> ( "variable_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1201 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1201) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1202 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1203 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1204 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1205 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1202 + c1_1203 = TreeSitter.Node.nodeStartPoint node_1201 + TreeSitter.Node.TSPoint + r2_1204 + c2_1205 = TreeSitter.Node.nodeEndPoint node_1201 + +deriving instance GHC.Classes.Eq a_1206 => GHC.Classes.Eq (VariableDeclaration a_1206) + +deriving instance GHC.Classes.Ord a_1207 => GHC.Classes.Ord (VariableDeclaration a_1207) + +deriving instance GHC.Show.Show a_1208 => GHC.Show.Show (VariableDeclaration a_1208) + +instance AST.Unmarshal.Unmarshal VariableDeclaration + +instance Data.Foldable.Foldable VariableDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VariableDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VariableDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VariableDeclarator a = VariableDeclarator + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + name :: (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: Identifier) a)), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1209. + AST.Traversable1.Class.Traversable1 a_1209 + ) + +instance AST.Unmarshal.SymbolMatching VariableDeclarator where + matchedSymbols _ = [157] + showFailure _ node_1210 = + "expected " + GHC.Base.<> ( "variable_declarator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1210 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1210) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1211 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1212 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1213 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1214 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1211 + c1_1212 = TreeSitter.Node.nodeStartPoint node_1210 + TreeSitter.Node.TSPoint + r2_1213 + c2_1214 = TreeSitter.Node.nodeEndPoint node_1210 + +deriving instance GHC.Classes.Eq a_1215 => GHC.Classes.Eq (VariableDeclarator a_1215) + +deriving instance GHC.Classes.Ord a_1216 => GHC.Classes.Ord (VariableDeclarator a_1216) + +deriving instance GHC.Show.Show a_1217 => GHC.Show.Show (VariableDeclarator a_1217) + +instance AST.Unmarshal.Unmarshal VariableDeclarator + +instance Data.Foldable.Foldable VariableDeclarator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VariableDeclarator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VariableDeclarator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WhileStatement a = WhileStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1218. + AST.Traversable1.Class.Traversable1 a_1218 + ) + +instance AST.Unmarshal.SymbolMatching WhileStatement where + matchedSymbols _ = [164] + showFailure _ node_1219 = + "expected " + GHC.Base.<> ( "while_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1219 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1219) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1220 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1221 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1222 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1223 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1220 + c1_1221 = TreeSitter.Node.nodeStartPoint node_1219 + TreeSitter.Node.TSPoint + r2_1222 + c2_1223 = TreeSitter.Node.nodeEndPoint node_1219 + +deriving instance GHC.Classes.Eq a_1224 => GHC.Classes.Eq (WhileStatement a_1224) + +deriving instance GHC.Classes.Ord a_1225 => GHC.Classes.Ord (WhileStatement a_1225) + +deriving instance GHC.Show.Show a_1226 => GHC.Show.Show (WhileStatement a_1226) + +instance AST.Unmarshal.Unmarshal WhileStatement + +instance Data.Foldable.Foldable WhileStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WhileStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WhileStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WithStatement a = WithStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + object :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1227. + AST.Traversable1.Class.Traversable1 a_1227 + ) + +instance AST.Unmarshal.SymbolMatching WithStatement where + matchedSymbols _ = [167] + showFailure _ node_1228 = + "expected " + GHC.Base.<> ( "with_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1228 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1228) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1229 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1230 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1231 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1232 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1229 + c1_1230 = TreeSitter.Node.nodeStartPoint node_1228 + TreeSitter.Node.TSPoint + r2_1231 + c2_1232 = TreeSitter.Node.nodeEndPoint node_1228 + +deriving instance GHC.Classes.Eq a_1233 => GHC.Classes.Eq (WithStatement a_1233) + +deriving instance GHC.Classes.Ord a_1234 => GHC.Classes.Ord (WithStatement a_1234) + +deriving instance GHC.Show.Show a_1235 => GHC.Show.Show (WithStatement a_1235) + +instance AST.Unmarshal.Unmarshal WithStatement + +instance Data.Foldable.Foldable WithStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WithStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WithStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data YieldExpression a = YieldExpression + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1236. + AST.Traversable1.Class.Traversable1 a_1236 + ) + +instance AST.Unmarshal.SymbolMatching YieldExpression where + matchedSymbols _ = [182] + showFailure _ node_1237 = + "expected " + GHC.Base.<> ( "yield_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1237 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1237) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1238 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1239 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1240 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1241 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1238 + c1_1239 = TreeSitter.Node.nodeStartPoint node_1237 + TreeSitter.Node.TSPoint + r2_1240 + c2_1241 = TreeSitter.Node.nodeEndPoint node_1237 + +deriving instance GHC.Classes.Eq a_1242 => GHC.Classes.Eq (YieldExpression a_1242) + +deriving instance GHC.Classes.Ord a_1243 => GHC.Classes.Ord (YieldExpression a_1243) + +deriving instance GHC.Show.Show a_1244 => GHC.Show.Show (YieldExpression a_1244) + +instance AST.Unmarshal.Unmarshal YieldExpression + +instance Data.Foldable.Foldable YieldExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor YieldExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable YieldExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousBang = AST.Token.Token "!" 90 + +type AnonymousBangEqual = AST.Token.Token "!=" 85 + +type AnonymousBangEqualEqual = AST.Token.Token "!==" 86 + +type AnonymousDQuote = AST.Token.Token "\"" 96 + +type AnonymousDollarLBrace = AST.Token.Token "${" 103 + +type AnonymousPercent = AST.Token.Token "%" 80 + +type AnonymousPercentEqual = AST.Token.Token "%=" 60 + +type AnonymousAmpersand = AST.Token.Token "&" 75 + +type AnonymousAmpersandAmpersand = AST.Token.Token "&&" 70 + +type AnonymousAmpersandEqual = AST.Token.Token "&=" 62 + +type AnonymousSQuote = AST.Token.Token "'" 98 + +type AnonymousLParen = AST.Token.Token "(" 23 + +type AnonymousRParen = AST.Token.Token ")" 24 + +type AnonymousStar = AST.Token.Token "*" 4 + +type AnonymousStarStar = AST.Token.Token "**" 81 + +type AnonymousStarStarEqual = AST.Token.Token "**=" 67 + +type AnonymousStarEqual = AST.Token.Token "*=" 58 + +type AnonymousPlus = AST.Token.Token "+" 78 + +type AnonymousPlusPlus = AST.Token.Token "++" 94 + +type AnonymousPlusEqual = AST.Token.Token "+=" 56 + +type AnonymousComma = AST.Token.Token "," 10 + +type AnonymousMinus = AST.Token.Token "-" 79 + +type AnonymousMinusMinus = AST.Token.Token "--" 95 + +type AnonymousMinusEqual = AST.Token.Token "-=" 57 + +type AnonymousDot = AST.Token.Token "." 50 + +type AnonymousDotDotDot = AST.Token.Token "..." 68 + +type AnonymousSlash = AST.Token.Token "/" 47 + +type AnonymousSlashEqual = AST.Token.Token "/=" 59 + +type AnonymousColon = AST.Token.Token ":" 38 + +type AnonymousSemicolon = AST.Token.Token ";" 37 + +type AnonymousLAngle = AST.Token.Token "<" 45 + +type AnonymousLAngleLAngle = AST.Token.Token "<<" 74 + +type AnonymousLAngleLAngleEqual = AST.Token.Token "<<=" 66 + +type AnonymousLAngleEqual = AST.Token.Token "<=" 82 + +type AnonymousEqual = AST.Token.Token "=" 6 + +type AnonymousEqualEqual = AST.Token.Token "==" 83 + +type AnonymousEqualEqualEqual = AST.Token.Token "===" 84 + +type AnonymousEqualRAngle = AST.Token.Token "=>" 54 + +type AnonymousRAngle = AST.Token.Token ">" 46 + +type AnonymousRAngleEqual = AST.Token.Token ">=" 87 + +type AnonymousRAngleRAngle = AST.Token.Token ">>" 72 + +type AnonymousRAngleRAngleEqual = AST.Token.Token ">>=" 64 + +type AnonymousRAngleRAngleRAngle = AST.Token.Token ">>>" 73 + +type AnonymousRAngleRAngleRAngleEqual = AST.Token.Token ">>>=" 65 + +type AnonymousQuestion = AST.Token.Token "?" 69 + +type AnonymousQuestionQuestion = AST.Token.Token "??" 88 + +type AnonymousAt = AST.Token.Token "@" 115 + +type AnonymousLBracket = AST.Token.Token "[" 43 + +type AnonymousRBracket = AST.Token.Token "]" 44 + +type AnonymousCaret = AST.Token.Token "^" 76 + +type AnonymousCaretEqual = AST.Token.Token "^=" 61 + +type AnonymousBacktick = AST.Token.Token "`" 102 + +type AnonymousAbstract = AST.Token.Token "abstract" 117 + +type AnonymousAny = AST.Token.Token "any" 125 + +type AnonymousAs = AST.Token.Token "as" 7 + +type AnonymousAsync = AST.Token.Token "async" 52 + +type AnonymousAwait = AST.Token.Token "await" 25 + +type AnonymousBoolean = AST.Token.Token "boolean" 127 + +type AnonymousBreak = AST.Token.Token "break" 32 + +type AnonymousCase = AST.Token.Token "case" 39 + +type AnonymousCatch = AST.Token.Token "catch" 40 + +type AnonymousClass = AST.Token.Token "class" 51 + +type AnonymousConst = AST.Token.Token "const" 18 + +type AnonymousContinue = AST.Token.Token "continue" 33 + +type AnonymousDebugger = AST.Token.Token "debugger" 34 + +type AnonymousDeclare = AST.Token.Token "declare" 120 + +type AnonymousDefault = AST.Token.Token "default" 5 + +type AnonymousDelete = AST.Token.Token "delete" 93 + +type AnonymousDo = AST.Token.Token "do" 29 + +type AnonymousElse = AST.Token.Token "else" 20 + +type AnonymousEnum = AST.Token.Token "enum" 135 + +data EscapeSequence a = EscapeSequence {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1245. + AST.Traversable1.Class.Traversable1 a_1245 + ) + +instance AST.Unmarshal.SymbolMatching EscapeSequence where + matchedSymbols _ = [100] + showFailure _ node_1246 = + "expected " + GHC.Base.<> ( "escape_sequence" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1246 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1246) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1247 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1248 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1249 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1250 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1247 + c1_1248 = TreeSitter.Node.nodeStartPoint node_1246 + TreeSitter.Node.TSPoint + r2_1249 + c2_1250 = TreeSitter.Node.nodeEndPoint node_1246 + +deriving instance GHC.Classes.Eq a_1251 => GHC.Classes.Eq (EscapeSequence a_1251) + +deriving instance GHC.Classes.Ord a_1252 => GHC.Classes.Ord (EscapeSequence a_1252) + +deriving instance GHC.Show.Show a_1253 => GHC.Show.Show (EscapeSequence a_1253) + +instance AST.Unmarshal.Unmarshal EscapeSequence + +instance Data.Foldable.Foldable EscapeSequence where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EscapeSequence where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EscapeSequence where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousExport = AST.Token.Token "export" 3 + +type AnonymousExtends = AST.Token.Token "extends" 134 + +data False a = False {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1254. + AST.Traversable1.Class.Traversable1 a_1254 + ) + +instance AST.Unmarshal.SymbolMatching False where + matchedSymbols _ = [112] + showFailure _ node_1255 = + "expected " + GHC.Base.<> ( "false" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1255 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1255) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1256 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1257 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1258 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1259 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1256 + c1_1257 = TreeSitter.Node.nodeStartPoint node_1255 + TreeSitter.Node.TSPoint + r2_1258 + c2_1259 = TreeSitter.Node.nodeEndPoint node_1255 + +deriving instance GHC.Classes.Eq a_1260 => GHC.Classes.Eq (False a_1260) + +deriving instance GHC.Classes.Ord a_1261 => GHC.Classes.Ord (False a_1261) + +deriving instance GHC.Show.Show a_1262 => GHC.Show.Show (False a_1262) + +instance AST.Unmarshal.Unmarshal False + +instance Data.Foldable.Foldable False where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor False where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable False where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFinally = AST.Token.Token "finally" 41 + +type AnonymousFor = AST.Token.Token "for" 22 + +type AnonymousFrom = AST.Token.Token "from" 15 + +type AnonymousFunction = AST.Token.Token "function" 53 + +type AnonymousGet = AST.Token.Token "get" 118 + +type AnonymousGlobal = AST.Token.Token "global" 132 + +data HashBangLine a = HashBangLine {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1263. + AST.Traversable1.Class.Traversable1 a_1263 + ) + +instance AST.Unmarshal.SymbolMatching HashBangLine where + matchedSymbols _ = [2] + showFailure _ node_1264 = + "expected " + GHC.Base.<> ( "hash_bang_line" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1264 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1264) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1265 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1266 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1267 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1268 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1265 + c1_1266 = TreeSitter.Node.nodeStartPoint node_1264 + TreeSitter.Node.TSPoint + r2_1267 + c2_1268 = TreeSitter.Node.nodeEndPoint node_1264 + +deriving instance GHC.Classes.Eq a_1269 => GHC.Classes.Eq (HashBangLine a_1269) + +deriving instance GHC.Classes.Ord a_1270 => GHC.Classes.Ord (HashBangLine a_1270) + +deriving instance GHC.Show.Show a_1271 => GHC.Show.Show (HashBangLine a_1271) + +instance AST.Unmarshal.Unmarshal HashBangLine + +instance Data.Foldable.Foldable HashBangLine where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor HashBangLine where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable HashBangLine where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Identifier a = Identifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1272. + AST.Traversable1.Class.Traversable1 a_1272 + ) + +instance AST.Unmarshal.SymbolMatching Identifier where + matchedSymbols _ = [1, 49] + showFailure _ node_1273 = + "expected " + GHC.Base.<> ( "identifier, identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1273 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1273) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1274 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1275 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1276 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1277 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1274 + c1_1275 = TreeSitter.Node.nodeStartPoint node_1273 + TreeSitter.Node.TSPoint + r2_1276 + c2_1277 = TreeSitter.Node.nodeEndPoint node_1273 + +deriving instance GHC.Classes.Eq a_1278 => GHC.Classes.Eq (Identifier a_1278) + +deriving instance GHC.Classes.Ord a_1279 => GHC.Classes.Ord (Identifier a_1279) + +deriving instance GHC.Show.Show a_1280 => GHC.Show.Show (Identifier a_1280) + +instance AST.Unmarshal.Unmarshal Identifier + +instance Data.Foldable.Foldable Identifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Identifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Identifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousIf = AST.Token.Token "if" 19 + +type AnonymousImplements = AST.Token.Token "implements" 131 + +type AnonymousImport = AST.Token.Token "import" 14 + +type AnonymousIn = AST.Token.Token "in" 26 + +type AnonymousInstanceof = AST.Token.Token "instanceof" 89 + +type AnonymousInterface = AST.Token.Token "interface" 133 + +type AnonymousIs = AST.Token.Token "is" 137 + +data JsxText a = JsxText {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1281. + AST.Traversable1.Class.Traversable1 a_1281 + ) + +instance AST.Unmarshal.SymbolMatching JsxText where + matchedSymbols _ = [48] + showFailure _ node_1282 = + "expected " + GHC.Base.<> ( "jsx_text" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1282 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1282) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1283 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1284 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1285 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1286 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1283 + c1_1284 = TreeSitter.Node.nodeStartPoint node_1282 + TreeSitter.Node.TSPoint + r2_1285 + c2_1286 = TreeSitter.Node.nodeEndPoint node_1282 + +deriving instance GHC.Classes.Eq a_1287 => GHC.Classes.Eq (JsxText a_1287) + +deriving instance GHC.Classes.Ord a_1288 => GHC.Classes.Ord (JsxText a_1288) + +deriving instance GHC.Show.Show a_1289 => GHC.Show.Show (JsxText a_1289) + +instance AST.Unmarshal.Unmarshal JsxText + +instance Data.Foldable.Foldable JsxText where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxText where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxText where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousKeyof = AST.Token.Token "keyof" 138 + +type AnonymousLet = AST.Token.Token "let" 17 + +type AnonymousModule = AST.Token.Token "module" 124 + +type AnonymousNamespace = AST.Token.Token "namespace" 8 + +type AnonymousNew = AST.Token.Token "new" 55 + +data Null a = Null {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1290. + AST.Traversable1.Class.Traversable1 a_1290 + ) + +instance AST.Unmarshal.SymbolMatching Null where + matchedSymbols _ = [113] + showFailure _ node_1291 = + "expected " + GHC.Base.<> ( "null" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1291 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1291) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1292 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1293 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1294 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1295 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1292 + c1_1293 = TreeSitter.Node.nodeStartPoint node_1291 + TreeSitter.Node.TSPoint + r2_1294 + c2_1295 = TreeSitter.Node.nodeEndPoint node_1291 + +deriving instance GHC.Classes.Eq a_1296 => GHC.Classes.Eq (Null a_1296) + +deriving instance GHC.Classes.Ord a_1297 => GHC.Classes.Ord (Null a_1297) + +deriving instance GHC.Show.Show a_1298 => GHC.Show.Show (Null a_1298) + +instance AST.Unmarshal.Unmarshal Null + +instance Data.Foldable.Foldable Null where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Null where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Null where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousNumber = AST.Token.Token "number" 126 + +data Number a = Number {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1299. + AST.Traversable1.Class.Traversable1 a_1299 + ) + +instance AST.Unmarshal.SymbolMatching Number where + matchedSymbols _ = [107] + showFailure _ node_1300 = + "expected " + GHC.Base.<> ( "number" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1300 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1300) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1301 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1302 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1303 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1304 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1301 + c1_1302 = TreeSitter.Node.nodeStartPoint node_1300 + TreeSitter.Node.TSPoint + r2_1303 + c2_1304 = TreeSitter.Node.nodeEndPoint node_1300 + +deriving instance GHC.Classes.Eq a_1305 => GHC.Classes.Eq (Number a_1305) + +deriving instance GHC.Classes.Ord a_1306 => GHC.Classes.Ord (Number a_1306) + +deriving instance GHC.Show.Show a_1307 => GHC.Show.Show (Number a_1307) + +instance AST.Unmarshal.Unmarshal Number + +instance Data.Foldable.Foldable Number where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Number where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Number where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousOf = AST.Token.Token "of" 27 + +type AnonymousPrivate = AST.Token.Token "private" 122 + +data PropertyIdentifier a = PropertyIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1308. + AST.Traversable1.Class.Traversable1 a_1308 + ) + +instance AST.Unmarshal.SymbolMatching PropertyIdentifier where + matchedSymbols _ = [314] + showFailure _ node_1309 = + "expected " + GHC.Base.<> ( "property_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1309 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1309) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1310 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1311 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1312 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1313 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1310 + c1_1311 = TreeSitter.Node.nodeStartPoint node_1309 + TreeSitter.Node.TSPoint + r2_1312 + c2_1313 = TreeSitter.Node.nodeEndPoint node_1309 + +deriving instance GHC.Classes.Eq a_1314 => GHC.Classes.Eq (PropertyIdentifier a_1314) + +deriving instance GHC.Classes.Ord a_1315 => GHC.Classes.Ord (PropertyIdentifier a_1315) + +deriving instance GHC.Show.Show a_1316 => GHC.Show.Show (PropertyIdentifier a_1316) + +instance AST.Unmarshal.Unmarshal PropertyIdentifier + +instance Data.Foldable.Foldable PropertyIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PropertyIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PropertyIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousProtected = AST.Token.Token "protected" 123 + +type AnonymousPublic = AST.Token.Token "public" 121 + +data Readonly a = Readonly {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1317. + AST.Traversable1.Class.Traversable1 a_1317 + ) + +instance AST.Unmarshal.SymbolMatching Readonly where + matchedSymbols _ = [136] + showFailure _ node_1318 = + "expected " + GHC.Base.<> ( "readonly" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1318 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1318) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1319 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1320 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1321 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1322 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1319 + c1_1320 = TreeSitter.Node.nodeStartPoint node_1318 + TreeSitter.Node.TSPoint + r2_1321 + c2_1322 = TreeSitter.Node.nodeEndPoint node_1318 + +deriving instance GHC.Classes.Eq a_1323 => GHC.Classes.Eq (Readonly a_1323) + +deriving instance GHC.Classes.Ord a_1324 => GHC.Classes.Ord (Readonly a_1324) + +deriving instance GHC.Show.Show a_1325 => GHC.Show.Show (Readonly a_1325) + +instance AST.Unmarshal.Unmarshal Readonly + +instance Data.Foldable.Foldable Readonly where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Readonly where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Readonly where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RegexFlags a = RegexFlags {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1326. + AST.Traversable1.Class.Traversable1 a_1326 + ) + +instance AST.Unmarshal.SymbolMatching RegexFlags where + matchedSymbols _ = [106] + showFailure _ node_1327 = + "expected " + GHC.Base.<> ( "regex_flags" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1327 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1327) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1328 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1329 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1330 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1331 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1328 + c1_1329 = TreeSitter.Node.nodeStartPoint node_1327 + TreeSitter.Node.TSPoint + r2_1330 + c2_1331 = TreeSitter.Node.nodeEndPoint node_1327 + +deriving instance GHC.Classes.Eq a_1332 => GHC.Classes.Eq (RegexFlags a_1332) + +deriving instance GHC.Classes.Ord a_1333 => GHC.Classes.Ord (RegexFlags a_1333) + +deriving instance GHC.Show.Show a_1334 => GHC.Show.Show (RegexFlags a_1334) + +instance AST.Unmarshal.Unmarshal RegexFlags + +instance Data.Foldable.Foldable RegexFlags where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RegexFlags where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RegexFlags where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RegexPattern a = RegexPattern {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1335. + AST.Traversable1.Class.Traversable1 a_1335 + ) + +instance AST.Unmarshal.SymbolMatching RegexPattern where + matchedSymbols _ = [105] + showFailure _ node_1336 = + "expected " + GHC.Base.<> ( "regex_pattern" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1336 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1336) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1337 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1338 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1339 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1340 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1337 + c1_1338 = TreeSitter.Node.nodeStartPoint node_1336 + TreeSitter.Node.TSPoint + r2_1339 + c2_1340 = TreeSitter.Node.nodeEndPoint node_1336 + +deriving instance GHC.Classes.Eq a_1341 => GHC.Classes.Eq (RegexPattern a_1341) + +deriving instance GHC.Classes.Ord a_1342 => GHC.Classes.Ord (RegexPattern a_1342) + +deriving instance GHC.Show.Show a_1343 => GHC.Show.Show (RegexPattern a_1343) + +instance AST.Unmarshal.Unmarshal RegexPattern + +instance Data.Foldable.Foldable RegexPattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RegexPattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RegexPattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousRequire = AST.Token.Token "require" 130 + +type AnonymousReturn = AST.Token.Token "return" 35 + +type AnonymousSet = AST.Token.Token "set" 119 + +data ShorthandPropertyIdentifier a = ShorthandPropertyIdentifier + { ann :: a, + text :: Data.Text.Internal.Text + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1344. + AST.Traversable1.Class.Traversable1 a_1344 + ) + +instance AST.Unmarshal.SymbolMatching ShorthandPropertyIdentifier where + matchedSymbols _ = [315] + showFailure _ node_1345 = + "expected " + GHC.Base.<> ( "shorthand_property_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1345 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1345) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1346 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1347 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1348 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1349 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1346 + c1_1347 = TreeSitter.Node.nodeStartPoint node_1345 + TreeSitter.Node.TSPoint + r2_1348 + c2_1349 = TreeSitter.Node.nodeEndPoint node_1345 + +deriving instance GHC.Classes.Eq a_1350 => GHC.Classes.Eq (ShorthandPropertyIdentifier a_1350) + +deriving instance GHC.Classes.Ord a_1351 => GHC.Classes.Ord (ShorthandPropertyIdentifier a_1351) + +deriving instance GHC.Show.Show a_1352 => GHC.Show.Show (ShorthandPropertyIdentifier a_1352) + +instance AST.Unmarshal.Unmarshal ShorthandPropertyIdentifier + +instance Data.Foldable.Foldable ShorthandPropertyIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ShorthandPropertyIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ShorthandPropertyIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data StatementIdentifier a = StatementIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1353. + AST.Traversable1.Class.Traversable1 a_1353 + ) + +instance AST.Unmarshal.SymbolMatching StatementIdentifier where + matchedSymbols _ = [316] + showFailure _ node_1354 = + "expected " + GHC.Base.<> ( "statement_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1354 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1354) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1355 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1356 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1357 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1358 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1355 + c1_1356 = TreeSitter.Node.nodeStartPoint node_1354 + TreeSitter.Node.TSPoint + r2_1357 + c2_1358 = TreeSitter.Node.nodeEndPoint node_1354 + +deriving instance GHC.Classes.Eq a_1359 => GHC.Classes.Eq (StatementIdentifier a_1359) + +deriving instance GHC.Classes.Ord a_1360 => GHC.Classes.Ord (StatementIdentifier a_1360) + +deriving instance GHC.Show.Show a_1361 => GHC.Show.Show (StatementIdentifier a_1361) + +instance AST.Unmarshal.Unmarshal StatementIdentifier + +instance Data.Foldable.Foldable StatementIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StatementIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StatementIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousStatic = AST.Token.Token "static" 116 + +type AnonymousString = AST.Token.Token "string" 128 + +data Super a = Super {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1362. + AST.Traversable1.Class.Traversable1 a_1362 + ) + +instance AST.Unmarshal.SymbolMatching Super where + matchedSymbols _ = [110] + showFailure _ node_1363 = + "expected " + GHC.Base.<> ( "super" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1363 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1363) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1364 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1365 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1366 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1367 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1364 + c1_1365 = TreeSitter.Node.nodeStartPoint node_1363 + TreeSitter.Node.TSPoint + r2_1366 + c2_1367 = TreeSitter.Node.nodeEndPoint node_1363 + +deriving instance GHC.Classes.Eq a_1368 => GHC.Classes.Eq (Super a_1368) + +deriving instance GHC.Classes.Ord a_1369 => GHC.Classes.Ord (Super a_1369) + +deriving instance GHC.Show.Show a_1370 => GHC.Show.Show (Super a_1370) + +instance AST.Unmarshal.Unmarshal Super + +instance Data.Foldable.Foldable Super where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Super where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Super where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousSwitch = AST.Token.Token "switch" 21 + +type AnonymousSymbol = AST.Token.Token "symbol" 129 + +type AnonymousTarget = AST.Token.Token "target" 108 + +data This a = This {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1371. + AST.Traversable1.Class.Traversable1 a_1371 + ) + +instance AST.Unmarshal.SymbolMatching This where + matchedSymbols _ = [109] + showFailure _ node_1372 = + "expected " + GHC.Base.<> ( "this" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1372 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1372) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1373 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1374 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1375 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1376 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1373 + c1_1374 = TreeSitter.Node.nodeStartPoint node_1372 + TreeSitter.Node.TSPoint + r2_1375 + c2_1376 = TreeSitter.Node.nodeEndPoint node_1372 + +deriving instance GHC.Classes.Eq a_1377 => GHC.Classes.Eq (This a_1377) + +deriving instance GHC.Classes.Ord a_1378 => GHC.Classes.Ord (This a_1378) + +deriving instance GHC.Show.Show a_1379 => GHC.Show.Show (This a_1379) + +instance AST.Unmarshal.Unmarshal This + +instance Data.Foldable.Foldable This where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor This where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable This where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousThrow = AST.Token.Token "throw" 36 + +data True a = True {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1380. + AST.Traversable1.Class.Traversable1 a_1380 + ) + +instance AST.Unmarshal.SymbolMatching True where + matchedSymbols _ = [111] + showFailure _ node_1381 = + "expected " + GHC.Base.<> ( "true" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1381 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1381) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1382 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1383 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1384 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1385 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1382 + c1_1383 = TreeSitter.Node.nodeStartPoint node_1381 + TreeSitter.Node.TSPoint + r2_1384 + c2_1385 = TreeSitter.Node.nodeEndPoint node_1381 + +deriving instance GHC.Classes.Eq a_1386 => GHC.Classes.Eq (True a_1386) + +deriving instance GHC.Classes.Ord a_1387 => GHC.Classes.Ord (True a_1387) + +deriving instance GHC.Show.Show a_1388 => GHC.Show.Show (True a_1388) + +instance AST.Unmarshal.Unmarshal True + +instance Data.Foldable.Foldable True where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor True where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable True where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousTry = AST.Token.Token "try" 30 + +type AnonymousType = AST.Token.Token "type" 12 + +data TypeIdentifier a = TypeIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1389. + AST.Traversable1.Class.Traversable1 a_1389 + ) + +instance AST.Unmarshal.SymbolMatching TypeIdentifier where + matchedSymbols _ = [317] + showFailure _ node_1390 = + "expected " + GHC.Base.<> ( "type_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1390 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1390) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1391 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1392 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1393 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1394 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1391 + c1_1392 = TreeSitter.Node.nodeStartPoint node_1390 + TreeSitter.Node.TSPoint + r2_1393 + c2_1394 = TreeSitter.Node.nodeEndPoint node_1390 + +deriving instance GHC.Classes.Eq a_1395 => GHC.Classes.Eq (TypeIdentifier a_1395) + +deriving instance GHC.Classes.Ord a_1396 => GHC.Classes.Ord (TypeIdentifier a_1396) + +deriving instance GHC.Show.Show a_1397 => GHC.Show.Show (TypeIdentifier a_1397) + +instance AST.Unmarshal.Unmarshal TypeIdentifier + +instance Data.Foldable.Foldable TypeIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousTypeof = AST.Token.Token "typeof" 13 + +data Undefined a = Undefined {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1398. + AST.Traversable1.Class.Traversable1 a_1398 + ) + +instance AST.Unmarshal.SymbolMatching Undefined where + matchedSymbols _ = [114] + showFailure _ node_1399 = + "expected " + GHC.Base.<> ( "undefined" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1399 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1399) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1400 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1401 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1402 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1403 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1400 + c1_1401 = TreeSitter.Node.nodeStartPoint node_1399 + TreeSitter.Node.TSPoint + r2_1402 + c2_1403 = TreeSitter.Node.nodeEndPoint node_1399 + +deriving instance GHC.Classes.Eq a_1404 => GHC.Classes.Eq (Undefined a_1404) + +deriving instance GHC.Classes.Ord a_1405 => GHC.Classes.Ord (Undefined a_1405) + +deriving instance GHC.Show.Show a_1406 => GHC.Show.Show (Undefined a_1406) + +instance AST.Unmarshal.Unmarshal Undefined + +instance Data.Foldable.Foldable Undefined where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Undefined where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Undefined where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousVar = AST.Token.Token "var" 16 + +type AnonymousVoid = AST.Token.Token "void" 92 + +type AnonymousWhile = AST.Token.Token "while" 28 + +type AnonymousWith = AST.Token.Token "with" 31 + +type AnonymousYield = AST.Token.Token "yield" 42 + +type AnonymousLBrace = AST.Token.Token "{" 9 + +type AnonymousLBracePipe = AST.Token.Token "{|" 139 + +type AnonymousPipe = AST.Token.Token "|" 77 + +type AnonymousPipeEqual = AST.Token.Token "|=" 63 + +type AnonymousPipePipe = AST.Token.Token "||" 71 + +type AnonymousPipeRBrace = AST.Token.Token "|}" 140 + +type AnonymousRBrace = AST.Token.Token "}" 11 + +type AnonymousTilde = AST.Token.Token "~" 91 diff --git a/semantic-tsx/src/Language/TSX/Grammar.hs b/semantic-tsx/src/Language/TSX/Grammar.hs new file mode 100644 index 0000000000..3760b5f8d1 --- /dev/null +++ b/semantic-tsx/src/Language/TSX/Grammar.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} +module Language.TSX.Grammar +( tree_sitter_tsx +, Grammar(..) +) where + +import AST.Grammar.TH +import Language.Haskell.TH +import TreeSitter.TSX (tree_sitter_tsx) + +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData (mkName "Grammar") tree_sitter_tsx diff --git a/semantic-tsx/src/Language/TSX/Tags.hs b/semantic-tsx/src/Language/TSX/Tags.hs new file mode 100644 index 0000000000..20e7255db8 --- /dev/null +++ b/semantic-tsx/src/Language/TSX/Tags.hs @@ -0,0 +1,315 @@ +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module Language.TSX.Tags + ( ToTags (..), + ) +where + +import AST.Element +import qualified AST.Parse as Parse +import AST.Token +import AST.Traversable1 +import Control.Effect.Reader +import Control.Effect.State +import Control.Effect.Writer +import Data.Foldable +import Data.Text (Text) +import qualified Language.TSX.AST as Tsx +import Proto.Semantic as P +import Source.Loc +import Source.Source as Source +import qualified Tags.Tagging.Precise as Tags + +class ToTags t where + tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m + ) => + t Loc -> + m () + default tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () + tags = gtags + +instance ToTags Tsx.Function where + tags t@Tsx.Function {ann = Loc {byteRange}, name = Just (Parse.Success (Tsx.Identifier {text, ann}))} = + yieldTag text P.FUNCTION P.DEFINITION ann byteRange >> gtags t + tags t = gtags t + +instance ToTags Tsx.FunctionSignature where + tags t@Tsx.FunctionSignature {ann = Loc {byteRange}, name = Parse.Success (Tsx.Identifier {text, ann})} = + yieldTag text P.FUNCTION P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags Tsx.FunctionDeclaration where + tags t@Tsx.FunctionDeclaration {ann = Loc {byteRange}, name = Parse.Success (Tsx.Identifier {text, ann})} = + yieldTag text P.FUNCTION P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags Tsx.MethodDefinition where + tags t@Tsx.MethodDefinition {ann = Loc {byteRange}, name} = case name of + EPrj Tsx.PropertyIdentifier {text, ann} -> yieldTag text P.METHOD P.DEFINITION ann byteRange >> gtags t + _ -> gtags t + +instance ToTags Tsx.Pair where + tags t@Tsx.Pair {ann = Loc {byteRange}, key, value = Parse.Success (Tsx.Expression expr)} = case (key, expr) of + (EPrj Tsx.PropertyIdentifier {text, ann}, Prj Tsx.Function {}) -> yield text ann + (EPrj Tsx.PropertyIdentifier {text, ann}, Prj Tsx.ArrowFunction {}) -> yield text ann + _ -> gtags t + where + yield text loc = yieldTag text P.FUNCTION P.DEFINITION loc byteRange >> gtags t + tags _ = pure () + +instance ToTags Tsx.ClassDeclaration where + tags t@Tsx.ClassDeclaration {ann = Loc {byteRange}, name = Parse.Success (Tsx.TypeIdentifier {text, ann})} = + yieldTag text P.CLASS P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags Tsx.CallExpression where + tags t@Tsx.CallExpression {ann = Loc {byteRange}, function = Parse.Success (Tsx.Expression expr)} = match expr + where + match expr = case expr of + Prj Tsx.Identifier {text, ann} -> yield text ann + Prj Tsx.NewExpression {constructor = EPrj Tsx.Identifier {text, ann}} -> yield text ann + Prj Tsx.CallExpression {function = Parse.Success (Tsx.Expression expr)} -> match expr + Prj Tsx.MemberExpression {property = Parse.Success (Tsx.PropertyIdentifier {text, ann})} -> yield text ann + Prj Tsx.Function {name = Just (Parse.Success (Tsx.Identifier {text, ann}))} -> yield text ann + Prj Tsx.ParenthesizedExpression {extraChildren} -> for_ extraChildren $ \x -> case x of + EPrj (Tsx.Expression expr) -> match expr + Parse.Success x -> tags x + Parse.Fail _ -> pure () + _ -> gtags t + yield name loc = yieldTag name P.CALL P.REFERENCE loc byteRange >> gtags t + tags _ = pure () + +instance ToTags Tsx.Class where + tags t@Tsx.Class {ann = Loc {byteRange}, name = Just (Parse.Success (Tsx.TypeIdentifier {text, ann}))} = + yieldTag text P.CLASS P.DEFINITION ann byteRange >> gtags t + tags t = gtags t + +instance ToTags Tsx.Module where + tags t@Tsx.Module {ann = Loc {byteRange}, name} = case name of + EPrj Tsx.Identifier {text, ann} -> yieldTag text P.MODULE P.DEFINITION ann byteRange >> gtags t + _ -> gtags t + +instance ToTags Tsx.VariableDeclarator where + tags t@Tsx.VariableDeclarator {ann = Loc {byteRange}, name, value = Just (Parse.Success (Tsx.Expression expr))} = + case (expr, name) of + (Prj Tsx.Function {}, EPrj Tsx.Identifier {text, ann}) -> yield text ann + (Prj Tsx.ArrowFunction {}, EPrj Tsx.Identifier {text, ann}) -> yield text ann + _ -> gtags t + where + yield text loc = yieldTag text P.FUNCTION P.DEFINITION loc byteRange >> gtags t + tags t = gtags t + +instance ToTags Tsx.AssignmentExpression where + tags t@Tsx.AssignmentExpression {ann = Loc {byteRange}, left, right = Parse.Success (Tsx.Expression expr)} = + case (left, expr) of + (EPrj Tsx.Identifier {text, ann}, Prj Tsx.Function {}) -> yield text ann + (EPrj Tsx.Identifier {text, ann}, Prj Tsx.ArrowFunction {}) -> yield text ann + (EPrj Tsx.MemberExpression {property = Parse.Success (Tsx.PropertyIdentifier {text, ann})}, Prj Tsx.Function {}) -> yield text ann + (EPrj Tsx.MemberExpression {property = Parse.Success (Tsx.PropertyIdentifier {text, ann})}, Prj Tsx.ArrowFunction {}) -> yield text ann + _ -> gtags t + where + yield text loc = yieldTag text P.FUNCTION P.DEFINITION loc byteRange >> gtags t + tags _ = pure () + +instance (ToTags l, ToTags r) => ToTags (l :+: r) where + tags (L1 l) = tags l + tags (R1 r) = tags r + +instance ToTags (Token sym n) where tags _ = pure () + +gtags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () +gtags = traverse1_ @ToTags (const (pure ())) tags + +-- These are all valid, but point to built-in functions (e.g. require) that a la +-- carte doesn't display and since we have nothing to link to yet (can't +-- jump-to-def), we hide them from the current tags output. +nameBlacklist :: [Text] +nameBlacklist = ["require"] + +yieldTag :: (Has (Reader Source) sig m, Has (State Tags.LineIndices) sig m, Has (Writer Tags.Tags) sig m) => Text -> P.SyntaxType -> P.NodeType -> Loc -> Range -> m () +yieldTag name P.CALL _ _ _ | name `elem` nameBlacklist = pure () +yieldTag name kind ty loc srcLineRange = Tags.yield name kind ty loc srcLineRange + +{- ORMOLU_DISABLE -} +instance ToTags Tsx.AbstractClassDeclaration +instance ToTags Tsx.AbstractMethodSignature +instance ToTags Tsx.AccessibilityModifier +instance ToTags Tsx.AmbientDeclaration +instance ToTags Tsx.Arguments +instance ToTags Tsx.Array +instance ToTags Tsx.ArrayPattern +instance ToTags Tsx.ArrayType +instance ToTags Tsx.ArrowFunction +instance ToTags Tsx.AsExpression +-- instance ToTags Tsx.AssignmentExpression +instance ToTags Tsx.AssignmentPattern +instance ToTags Tsx.AugmentedAssignmentExpression +instance ToTags Tsx.AwaitExpression +instance ToTags Tsx.BinaryExpression +instance ToTags Tsx.BreakStatement +-- instance ToTags Tsx.CallExpression +instance ToTags Tsx.CallSignature +instance ToTags Tsx.CatchClause +-- instance ToTags Tsx.Class +instance ToTags Tsx.ClassBody +-- instance ToTags Tsx.ClassDeclaration +instance ToTags Tsx.ClassHeritage +instance ToTags Tsx.ComputedPropertyName +instance ToTags Tsx.Constraint +instance ToTags Tsx.ConstructSignature +instance ToTags Tsx.ConstructorType +instance ToTags Tsx.ContinueStatement +instance ToTags Tsx.DebuggerStatement +instance ToTags Tsx.Declaration +instance ToTags Tsx.Decorator +instance ToTags Tsx.DefaultType +instance ToTags Tsx.DestructuringPattern +instance ToTags Tsx.DoStatement +instance ToTags Tsx.EmptyStatement +instance ToTags Tsx.EnumAssignment +instance ToTags Tsx.EnumBody +instance ToTags Tsx.EnumDeclaration +instance ToTags Tsx.EscapeSequence +instance ToTags Tsx.ExistentialType +instance ToTags Tsx.ExportClause +instance ToTags Tsx.ExportSpecifier +instance ToTags Tsx.ExportStatement +instance ToTags Tsx.Expression +instance ToTags Tsx.ExpressionStatement +instance ToTags Tsx.ExtendsClause +instance ToTags Tsx.False +instance ToTags Tsx.FinallyClause +instance ToTags Tsx.FlowMaybeType +instance ToTags Tsx.ForInStatement +instance ToTags Tsx.ForStatement +instance ToTags Tsx.FormalParameters +-- instance ToTags Tsx.Function +-- instance ToTags Tsx.FunctionDeclaration +-- instance ToTags Tsx.FunctionSignature +instance ToTags Tsx.FunctionType +instance ToTags Tsx.GeneratorFunction +instance ToTags Tsx.GeneratorFunctionDeclaration +instance ToTags Tsx.GenericType +instance ToTags Tsx.HashBangLine +instance ToTags Tsx.Identifier +instance ToTags Tsx.IfStatement +instance ToTags Tsx.ImplementsClause +instance ToTags Tsx.Import +instance ToTags Tsx.ImportAlias +instance ToTags Tsx.ImportClause +instance ToTags Tsx.ImportRequireClause +instance ToTags Tsx.ImportSpecifier +instance ToTags Tsx.ImportStatement +instance ToTags Tsx.IndexSignature +instance ToTags Tsx.IndexTypeQuery +instance ToTags Tsx.InterfaceDeclaration +instance ToTags Tsx.InternalModule +instance ToTags Tsx.IntersectionType +instance ToTags Tsx.JsxAttribute +instance ToTags Tsx.JsxClosingElement +instance ToTags Tsx.JsxElement +instance ToTags Tsx.JsxExpression +instance ToTags Tsx.JsxFragment +instance ToTags Tsx.JsxNamespaceName +instance ToTags Tsx.JsxOpeningElement +instance ToTags Tsx.JsxSelfClosingElement +instance ToTags Tsx.JsxText +instance ToTags Tsx.LabeledStatement +instance ToTags Tsx.LexicalDeclaration +instance ToTags Tsx.LiteralType +instance ToTags Tsx.LookupType +instance ToTags Tsx.MappedTypeClause +instance ToTags Tsx.MemberExpression +instance ToTags Tsx.MetaProperty +-- instance ToTags Tsx.MethodDefinition +instance ToTags Tsx.MethodSignature +-- instance ToTags Tsx.Module +instance ToTags Tsx.NamedImports +instance ToTags Tsx.NamespaceImport +instance ToTags Tsx.NestedIdentifier +instance ToTags Tsx.NestedTypeIdentifier +instance ToTags Tsx.NewExpression +instance ToTags Tsx.NonNullExpression +instance ToTags Tsx.Null +instance ToTags Tsx.Number +instance ToTags Tsx.Object +instance ToTags Tsx.ObjectPattern +instance ToTags Tsx.ObjectType +instance ToTags Tsx.OptionalParameter +-- instance ToTags Tsx.Pair +instance ToTags Tsx.ParenthesizedExpression +instance ToTags Tsx.ParenthesizedType +instance ToTags Tsx.PredefinedType +instance ToTags Tsx.Program +instance ToTags Tsx.PropertyIdentifier +instance ToTags Tsx.PropertySignature +instance ToTags Tsx.PublicFieldDefinition +instance ToTags Tsx.Readonly +instance ToTags Tsx.Regex +instance ToTags Tsx.RegexFlags +instance ToTags Tsx.RegexPattern +instance ToTags Tsx.RequiredParameter +instance ToTags Tsx.RestParameter +instance ToTags Tsx.ReturnStatement +instance ToTags Tsx.SequenceExpression +instance ToTags Tsx.ShorthandPropertyIdentifier +instance ToTags Tsx.SpreadElement +instance ToTags Tsx.Statement +instance ToTags Tsx.StatementBlock +instance ToTags Tsx.StatementIdentifier +instance ToTags Tsx.String +instance ToTags Tsx.SubscriptExpression +instance ToTags Tsx.Super +instance ToTags Tsx.SwitchBody +instance ToTags Tsx.SwitchCase +instance ToTags Tsx.SwitchDefault +instance ToTags Tsx.SwitchStatement +instance ToTags Tsx.TemplateString +instance ToTags Tsx.TemplateSubstitution +instance ToTags Tsx.TernaryExpression +instance ToTags Tsx.This +instance ToTags Tsx.ThrowStatement +instance ToTags Tsx.True +instance ToTags Tsx.TryStatement +instance ToTags Tsx.TupleType +instance ToTags Tsx.TypeAliasDeclaration +instance ToTags Tsx.TypeAnnotation +instance ToTags Tsx.TypeArguments +instance ToTags Tsx.TypeIdentifier +instance ToTags Tsx.TypeParameter +instance ToTags Tsx.TypeParameters +instance ToTags Tsx.TypePredicate +instance ToTags Tsx.TypeQuery +instance ToTags Tsx.UnaryExpression +instance ToTags Tsx.Undefined +instance ToTags Tsx.UnionType +instance ToTags Tsx.UpdateExpression +instance ToTags Tsx.VariableDeclaration +-- instance ToTags Tsx.VariableDeclarator +instance ToTags Tsx.WhileStatement +instance ToTags Tsx.WithStatement +instance ToTags Tsx.YieldExpression +{- ORMOLU_ENABLE -} diff --git a/semantic-tsx/test/PreciseTest.hs b/semantic-tsx/test/PreciseTest.hs new file mode 100644 index 0000000000..13313cbcbb --- /dev/null +++ b/semantic-tsx/test/PreciseTest.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-unused-imports #-} +module Main (main) where + + +import AST.TestHelpers +import AST.Unmarshal +import qualified Language.TSX.AST as Tsx +import qualified System.Path.Fixture as Fixture +import Test.Tasty +import TreeSitter.TSX + +main :: IO () +main = do +#if BAZEL_BUILD + rf <- Fixture.create + let ?project = "external/semantic-typescript" + ?runfiles = rf + let dirs = Fixture.absRelDir "tsx/corpus" +#else + dirs <- Tsx.getTestCorpusDir +#endif + + readCorpusFiles' dirs + >>= traverse (testCorpus parse) + >>= defaultMain . tests + where parse = parseByteString @Tsx.Program @() tree_sitter_tsx + +tests :: [TestTree] -> TestTree +tests = testGroup "tree-sitter-tsx corpus tests" diff --git a/semantic-typescript/BUILD.bazel b/semantic-typescript/BUILD.bazel new file mode 100644 index 0000000000..5007c32091 --- /dev/null +++ b/semantic-typescript/BUILD.bazel @@ -0,0 +1,16 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "//:build/common.bzl", + "semantic_language_library", + "semantic_language_parsing_test", +) + +semantic_language_library( + name = "semantic-typescript", + srcs = glob(["src/**/*.hs"]), + language = "typescript", + nodetypes = "@tree-sitter-typescript//:vendor/tree-sitter-typescript/typescript/src/node-types.json", +) + +semantic_language_parsing_test(language = "typescript") diff --git a/semantic-typescript/LICENSE b/semantic-typescript/LICENSE new file mode 100644 index 0000000000..331b241b36 --- /dev/null +++ b/semantic-typescript/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic-typescript/README.md b/semantic-typescript/README.md new file mode 100644 index 0000000000..6264068581 --- /dev/null +++ b/semantic-typescript/README.md @@ -0,0 +1,3 @@ +# Semantic support for TypeScript + +This package implements `semantic` support for TypeScript. diff --git a/semantic-typescript/Setup.hs b/semantic-typescript/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic-typescript/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/semantic-typescript/semantic-typescript.cabal b/semantic-typescript/semantic-typescript.cabal new file mode 100644 index 0000000000..1645c68b20 --- /dev/null +++ b/semantic-typescript/semantic-typescript.cabal @@ -0,0 +1,77 @@ +cabal-version: 2.4 + +name: semantic-typescript +version: 0.0.0.0 +synopsis: Semantic support for TypeScript. +description: Semantic support for TypeScript. +homepage: https://github.com/github/semantic/tree/master/semantic-typescript#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2019 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.6.5 + +common haskell + default-language: Haskell2010 + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + cpp-options: + -DBAZEL_BUILD=0 + +library + import: haskell + exposed-modules: + Language.TypeScript + Language.TypeScript.AST + Language.TypeScript.Grammar + Language.TypeScript.Tags + hs-source-dirs: src + build-depends: + , base >= 4.13 && < 5 + , fused-effects ^>= 1.1 + , semantic-ast + , semantic-proto ^>= 0 + , semantic-source ^>= 0.2 + , semantic-tags ^>= 0.0 + , template-haskell >= 2.15 && < 2.22 + , text ^>= 1.2.3 + , tree-sitter ^>= 0.9.0.0 + , tree-sitter-typescript ^>= 0.5.0.1 + +test-suite test + import: haskell + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: PreciseTest.hs + build-depends: + , base + , semantic-ast + , semantic-typescript + , tasty + , tree-sitter-typescript ^>= 0.5.0.1 diff --git a/semantic-typescript/src/Language/TypeScript.hs b/semantic-typescript/src/Language/TypeScript.hs new file mode 100644 index 0000000000..980aa5f74f --- /dev/null +++ b/semantic-typescript/src/Language/TypeScript.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# OPTIONS_GHC -freduction-depth=0 #-} +-- | Semantic functionality for TypeScript programs. +module Language.TypeScript +( Term(..) +, Language.TypeScript.Grammar.tree_sitter_typescript +) where + +import AST.Marshal.JSON +import Data.Proxy +import qualified Language.TypeScript.AST as TypeScript +import qualified Language.TypeScript.Tags as TsTags +import qualified Tags.Tagging.Precise as Tags +import qualified Language.TypeScript.Grammar (tree_sitter_typescript) +import qualified AST.Unmarshal as TS + +newtype Term a = Term { getTerm :: TypeScript.Program a } + deriving MarshalJSON + +instance TS.SymbolMatching Term where + matchedSymbols _ = TS.matchedSymbols (Proxy :: Proxy TypeScript.Program) + showFailure _ = TS.showFailure (Proxy :: Proxy TypeScript.Program) + +instance TS.Unmarshal Term where + matchers = fmap (fmap (TS.hoist Term)) TS.matchers + +instance Tags.ToTags Term where + tags src = Tags.runTagging src . TsTags.tags . getTerm diff --git a/semantic-typescript/src/Language/TypeScript/AST.hs b/semantic-typescript/src/Language/TypeScript/AST.hs new file mode 100644 index 0000000000..93d87230f2 --- /dev/null +++ b/semantic-typescript/src/Language/TypeScript/AST.hs @@ -0,0 +1,8033 @@ +-- Language definition for TypeScript, generated by ast-generate. Do not edit! +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Language.TypeScript.AST (module Language.TypeScript.AST, getTestCorpusDir) where + +import qualified AST.Parse +import qualified AST.Token +import qualified AST.Traversable1.Class +import qualified AST.Unmarshal +import qualified Data.Foldable +import qualified Data.List as Data.OldList +import qualified Data.Maybe as GHC.Maybe +import qualified Data.Text.Internal +import qualified Data.Traversable +import qualified GHC.Base +import qualified GHC.Generics +import qualified GHC.Records +import qualified GHC.Show +import qualified TreeSitter.Node +import TreeSitter.TypeScript (getTestCorpusDir) +import qualified Prelude as GHC.Classes + +debugSymbolNames :: [GHC.Base.String] +debugSymbolNames = debugSymbolNames_0 + +debugSymbolNames_0 :: [GHC.Base.String] +debugSymbolNames_0 = + [ "end", + "identifier", + "hash_bang_line", + "_export", + "_*", + "_default", + "_=", + "_as", + "_namespace", + "_{", + "_,", + "_}", + "_type", + "_typeof", + "_import", + "_from", + "_var", + "_let", + "_const", + "_if", + "_else", + "_switch", + "_for", + "_(", + "_)", + "_await", + "_in", + "_of", + "_while", + "_do", + "_try", + "_with", + "_break", + "_continue", + "_debugger", + "_return", + "_throw", + "_;", + "_:", + "_case", + "_catch", + "_finally", + "_yield", + "_[", + "_]", + "_<", + "_>", + "_/", + "_.", + "_class", + "_async", + "_function", + "_=>", + "_new", + "_+=", + "_-=", + "_*=", + "_/=", + "_%=", + "_^=", + "_&=", + "_|=", + "_>>=", + "_>>>=", + "_<<=", + "_**=", + "_...", + "_?", + "_&&", + "_||", + "_>>", + "_>>>", + "_<<", + "_&", + "_^", + "_|", + "_+", + "_-", + "_%", + "_**", + "_<=", + "_==", + "_===", + "_!=", + "_!==", + "_>=", + "_??", + "_instanceof", + "_!", + "_~", + "_void", + "_delete", + "_++", + "_--", + "_\"", + "_string_token1", + "_'", + "_string_token2", + "escape_sequence", + "comment", + "_`", + "_${", + "_/", + "regex_pattern", + "regex_flags", + "number", + "_target", + "this", + "super", + "true", + "false", + "null", + "undefined", + "_@", + "_static", + "_abstract", + "_get", + "_set", + "_declare", + "_public", + "_private", + "_protected", + "_module", + "_any", + "_number", + "_boolean", + "_string", + "_symbol", + "_require", + "_implements", + "_global", + "_interface", + "_extends", + "_enum", + "readonly", + "_is", + "_keyof", + "_{|", + "_|}", + "_automatic_semicolon", + "_template_chars", + "program", + "export_statement", + "export_clause", + "_import_export_specifier", + "_declaration", + "import", + "import_statement", + "import_clause", + "_from_clause", + "namespace_import", + "named_imports", + "expression_statement", + "variable_declaration", + "lexical_declaration", + "variable_declarator", + "statement_block", + "if_statement", + "switch_statement", + "for_statement", + "for_in_statement", + "_for_header", + "while_statement", + "do_statement", + "try_statement", + "with_statement", + "break_statement", + "continue_statement", + "debugger_statement", + "return_statement", + "throw_statement", + "empty_statement", + "labeled_statement", + "switch_body", + "switch_case", + "switch_default", + "catch_clause", + "finally_clause", + "parenthesized_expression", + "_expression", + "yield_expression", + "object", + "assignment_pattern", + "array", + "nested_identifier", + "class", + "class_declaration", + "class_heritage", + "function", + "function_declaration", + "generator_function", + "generator_function_declaration", + "arrow_function", + "_call_signature", + "call_expression", + "new_expression", + "await_expression", + "member_expression", + "subscript_expression", + "assignment_expression", + "augmented_assignment_expression", + "_initializer", + "spread_element", + "ternary_expression", + "binary_expression", + "unary_expression", + "update_expression", + "sequence_expression", + "string", + "template_string", + "template_substitution", + "regex", + "meta_property", + "arguments", + "decorator", + "member_expression", + "call_expression", + "class_body", + "public_field_definition", + "formal_parameters", + "rest_parameter", + "method_definition", + "pair", + "_property_name", + "computed_property_name", + "non_null_expression", + "method_signature", + "abstract_method_signature", + "function_signature", + "type_assertion", + "as_expression", + "import_require_clause", + "implements_clause", + "ambient_declaration", + "abstract_class_declaration", + "module", + "internal_module", + "_module", + "import_alias", + "nested_type_identifier", + "interface_declaration", + "extends_clause", + "enum_declaration", + "enum_body", + "enum_assignment", + "type_alias_declaration", + "accessibility_modifier", + "required_parameter", + "optional_parameter", + "_parameter_name", + "type_annotation", + "_type", + "constructor_type", + "_primary_type", + "generic_type", + "type_predicate", + "type_query", + "index_type_query", + "lookup_type", + "mapped_type_clause", + "literal_type", + "unary_expression", + "existential_type", + "flow_maybe_type", + "parenthesized_type", + "predefined_type", + "type_arguments", + "object_type", + "call_signature", + "property_signature", + "type_parameters", + "type_parameter", + "default_type", + "constraint", + "construct_signature", + "index_signature", + "array_type", + "tuple_type", + "union_type", + "intersection_type", + "function_type", + "_program_repeat1", + "_export_statement_repeat1", + "_export_clause_repeat1", + "_named_imports_repeat1", + "_variable_declaration_repeat1", + "_switch_body_repeat1", + "_object_repeat1", + "_array_repeat1", + "_string_repeat1", + "_string_repeat2", + "_template_string_repeat1", + "_class_body_repeat1", + "_formal_parameters_repeat1", + "_implements_clause_repeat1", + "_extends_clause_repeat1", + "_enum_body_repeat1", + "_object_type_repeat1", + "_type_parameters_repeat1", + "array_pattern", + "export_specifier", + "import_specifier", + "object_pattern", + "property_identifier", + "shorthand_property_identifier", + "statement_identifier", + "type_identifier" + ] + +newtype Declaration a = Declaration {getDeclaration :: ((AbstractClassDeclaration GHC.Generics.:+: AmbientDeclaration GHC.Generics.:+: ClassDeclaration GHC.Generics.:+: EnumDeclaration GHC.Generics.:+: FunctionDeclaration GHC.Generics.:+: FunctionSignature GHC.Generics.:+: GeneratorFunctionDeclaration GHC.Generics.:+: ImportAlias GHC.Generics.:+: InterfaceDeclaration GHC.Generics.:+: InternalModule GHC.Generics.:+: LexicalDeclaration GHC.Generics.:+: Module GHC.Generics.:+: TypeAliasDeclaration GHC.Generics.:+: VariableDeclaration) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1. + AST.Traversable1.Class.Traversable1 a_1 + ) + +instance GHC.Records.HasField "ann" (Declaration a_2) a_2 where + getField = AST.Unmarshal.gann GHC.Base.. getDeclaration + +deriving instance GHC.Classes.Eq a_3 => GHC.Classes.Eq (Declaration a_3) + +deriving instance GHC.Classes.Ord a_4 => GHC.Classes.Ord (Declaration a_4) + +deriving instance GHC.Show.Show a_5 => GHC.Show.Show (Declaration a_5) + +instance AST.Unmarshal.Unmarshal Declaration + +instance Data.Foldable.Foldable Declaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Declaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Declaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype DestructuringPattern a = DestructuringPattern {getDestructuringPattern :: ((ArrayPattern GHC.Generics.:+: ObjectPattern) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_6. + AST.Traversable1.Class.Traversable1 a_6 + ) + +instance GHC.Records.HasField "ann" (DestructuringPattern a_7) a_7 where + getField = AST.Unmarshal.gann GHC.Base.. getDestructuringPattern + +deriving instance GHC.Classes.Eq a_8 => GHC.Classes.Eq (DestructuringPattern a_8) + +deriving instance GHC.Classes.Ord a_9 => GHC.Classes.Ord (DestructuringPattern a_9) + +deriving instance GHC.Show.Show a_10 => GHC.Show.Show (DestructuringPattern a_10) + +instance AST.Unmarshal.Unmarshal DestructuringPattern + +instance Data.Foldable.Foldable DestructuringPattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DestructuringPattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DestructuringPattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Expression a = Expression {getExpression :: ((Array GHC.Generics.:+: ArrowFunction GHC.Generics.:+: AsExpression GHC.Generics.:+: AssignmentExpression GHC.Generics.:+: AugmentedAssignmentExpression GHC.Generics.:+: AwaitExpression GHC.Generics.:+: BinaryExpression GHC.Generics.:+: CallExpression GHC.Generics.:+: Class GHC.Generics.:+: False GHC.Generics.:+: Function GHC.Generics.:+: GeneratorFunction GHC.Generics.:+: Identifier GHC.Generics.:+: Import GHC.Generics.:+: InternalModule GHC.Generics.:+: MemberExpression GHC.Generics.:+: MetaProperty GHC.Generics.:+: NewExpression GHC.Generics.:+: NonNullExpression GHC.Generics.:+: Null GHC.Generics.:+: Number GHC.Generics.:+: Object GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: Regex GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: Super GHC.Generics.:+: TemplateString GHC.Generics.:+: TernaryExpression GHC.Generics.:+: This GHC.Generics.:+: True GHC.Generics.:+: TypeAssertion GHC.Generics.:+: UnaryExpression GHC.Generics.:+: Undefined GHC.Generics.:+: UpdateExpression GHC.Generics.:+: YieldExpression) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_11. + AST.Traversable1.Class.Traversable1 a_11 + ) + +instance GHC.Records.HasField "ann" (Expression a_12) a_12 where + getField = AST.Unmarshal.gann GHC.Base.. getExpression + +deriving instance GHC.Classes.Eq a_13 => GHC.Classes.Eq (Expression a_13) + +deriving instance GHC.Classes.Ord a_14 => GHC.Classes.Ord (Expression a_14) + +deriving instance GHC.Show.Show a_15 => GHC.Show.Show (Expression a_15) + +instance AST.Unmarshal.Unmarshal Expression + +instance Data.Foldable.Foldable Expression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Expression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Expression where + traverse = AST.Traversable1.Class.traverseDefault1 + +newtype Statement a = Statement {getStatement :: ((Declaration GHC.Generics.:+: BreakStatement GHC.Generics.:+: ContinueStatement GHC.Generics.:+: DebuggerStatement GHC.Generics.:+: DoStatement GHC.Generics.:+: EmptyStatement GHC.Generics.:+: ExportStatement GHC.Generics.:+: ExpressionStatement GHC.Generics.:+: ForInStatement GHC.Generics.:+: ForStatement GHC.Generics.:+: IfStatement GHC.Generics.:+: ImportStatement GHC.Generics.:+: LabeledStatement GHC.Generics.:+: ReturnStatement GHC.Generics.:+: StatementBlock GHC.Generics.:+: SwitchStatement GHC.Generics.:+: ThrowStatement GHC.Generics.:+: TryStatement GHC.Generics.:+: WhileStatement GHC.Generics.:+: WithStatement) a)} + deriving newtype (AST.Unmarshal.SymbolMatching) + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_16. + AST.Traversable1.Class.Traversable1 a_16 + ) + +instance GHC.Records.HasField "ann" (Statement a_17) a_17 where + getField = AST.Unmarshal.gann GHC.Base.. getStatement + +deriving instance GHC.Classes.Eq a_18 => GHC.Classes.Eq (Statement a_18) + +deriving instance GHC.Classes.Ord a_19 => GHC.Classes.Ord (Statement a_19) + +deriving instance GHC.Show.Show a_20 => GHC.Show.Show (Statement a_20) + +instance AST.Unmarshal.Unmarshal Statement + +instance Data.Foldable.Foldable Statement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Statement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Statement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AbstractClassDeclaration a = AbstractClassDeclaration + { ann :: a, + body :: (AST.Parse.Err (ClassBody a)), + name :: (AST.Parse.Err (TypeIdentifier a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ClassHeritage a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_21. + AST.Traversable1.Class.Traversable1 a_21 + ) + +instance AST.Unmarshal.SymbolMatching AbstractClassDeclaration where + matchedSymbols _ = [234] + showFailure _ node_22 = + "expected " + GHC.Base.<> ( "abstract_class_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_22 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_22) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_23 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_24 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_25 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_26 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_23 + c1_24 = TreeSitter.Node.nodeStartPoint node_22 + TreeSitter.Node.TSPoint + r2_25 + c2_26 = TreeSitter.Node.nodeEndPoint node_22 + +deriving instance GHC.Classes.Eq a_27 => GHC.Classes.Eq (AbstractClassDeclaration a_27) + +deriving instance GHC.Classes.Ord a_28 => GHC.Classes.Ord (AbstractClassDeclaration a_28) + +deriving instance GHC.Show.Show a_29 => GHC.Show.Show (AbstractClassDeclaration a_29) + +instance AST.Unmarshal.Unmarshal AbstractClassDeclaration + +instance Data.Foldable.Foldable AbstractClassDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AbstractClassDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AbstractClassDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AbstractMethodSignature a = AbstractMethodSignature + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + name :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (AccessibilityModifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_30. + AST.Traversable1.Class.Traversable1 a_30 + ) + +instance AST.Unmarshal.SymbolMatching AbstractMethodSignature where + matchedSymbols _ = [227] + showFailure _ node_31 = + "expected " + GHC.Base.<> ( "abstract_method_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_31 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_31) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_32 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_33 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_34 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_35 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_32 + c1_33 = TreeSitter.Node.nodeStartPoint node_31 + TreeSitter.Node.TSPoint + r2_34 + c2_35 = TreeSitter.Node.nodeEndPoint node_31 + +deriving instance GHC.Classes.Eq a_36 => GHC.Classes.Eq (AbstractMethodSignature a_36) + +deriving instance GHC.Classes.Ord a_37 => GHC.Classes.Ord (AbstractMethodSignature a_37) + +deriving instance GHC.Show.Show a_38 => GHC.Show.Show (AbstractMethodSignature a_38) + +instance AST.Unmarshal.Unmarshal AbstractMethodSignature + +instance Data.Foldable.Foldable AbstractMethodSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AbstractMethodSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AbstractMethodSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AccessibilityModifier a = AccessibilityModifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_39. + AST.Traversable1.Class.Traversable1 a_39 + ) + +instance AST.Unmarshal.SymbolMatching AccessibilityModifier where + matchedSymbols _ = [246] + showFailure _ node_40 = + "expected " + GHC.Base.<> ( "accessibility_modifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_40 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_40) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_41 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_42 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_43 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_44 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_41 + c1_42 = TreeSitter.Node.nodeStartPoint node_40 + TreeSitter.Node.TSPoint + r2_43 + c2_44 = TreeSitter.Node.nodeEndPoint node_40 + +deriving instance GHC.Classes.Eq a_45 => GHC.Classes.Eq (AccessibilityModifier a_45) + +deriving instance GHC.Classes.Ord a_46 => GHC.Classes.Ord (AccessibilityModifier a_46) + +deriving instance GHC.Show.Show a_47 => GHC.Show.Show (AccessibilityModifier a_47) + +instance AST.Unmarshal.Unmarshal AccessibilityModifier + +instance Data.Foldable.Foldable AccessibilityModifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AccessibilityModifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AccessibilityModifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AmbientDeclaration a = AmbientDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Declaration GHC.Generics.:+: ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: StatementBlock GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_48. + AST.Traversable1.Class.Traversable1 a_48 + ) + +instance AST.Unmarshal.SymbolMatching AmbientDeclaration where + matchedSymbols _ = [233] + showFailure _ node_49 = + "expected " + GHC.Base.<> ( "ambient_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_49 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_49) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_50 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_51 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_52 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_53 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_50 + c1_51 = TreeSitter.Node.nodeStartPoint node_49 + TreeSitter.Node.TSPoint + r2_52 + c2_53 = TreeSitter.Node.nodeEndPoint node_49 + +deriving instance GHC.Classes.Eq a_54 => GHC.Classes.Eq (AmbientDeclaration a_54) + +deriving instance GHC.Classes.Ord a_55 => GHC.Classes.Ord (AmbientDeclaration a_55) + +deriving instance GHC.Show.Show a_56 => GHC.Show.Show (AmbientDeclaration a_56) + +instance AST.Unmarshal.Unmarshal AmbientDeclaration + +instance Data.Foldable.Foldable AmbientDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AmbientDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AmbientDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Arguments a = Arguments + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: SpreadElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_57. + AST.Traversable1.Class.Traversable1 a_57 + ) + +instance AST.Unmarshal.SymbolMatching Arguments where + matchedSymbols _ = [213] + showFailure _ node_58 = + "expected " + GHC.Base.<> ( "arguments" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_58 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_58) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_59 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_60 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_61 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_62 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_59 + c1_60 = TreeSitter.Node.nodeStartPoint node_58 + TreeSitter.Node.TSPoint + r2_61 + c2_62 = TreeSitter.Node.nodeEndPoint node_58 + +deriving instance GHC.Classes.Eq a_63 => GHC.Classes.Eq (Arguments a_63) + +deriving instance GHC.Classes.Ord a_64 => GHC.Classes.Ord (Arguments a_64) + +deriving instance GHC.Show.Show a_65 => GHC.Show.Show (Arguments a_65) + +instance AST.Unmarshal.Unmarshal Arguments + +instance Data.Foldable.Foldable Arguments where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Arguments where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Arguments where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Array a = Array + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: SpreadElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_66. + AST.Traversable1.Class.Traversable1 a_66 + ) + +instance AST.Unmarshal.SymbolMatching Array where + matchedSymbols _ = [183] + showFailure _ node_67 = + "expected " + GHC.Base.<> ( "array" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_67 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_67) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_68 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_69 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_70 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_71 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_68 + c1_69 = TreeSitter.Node.nodeStartPoint node_67 + TreeSitter.Node.TSPoint + r2_70 + c2_71 = TreeSitter.Node.nodeEndPoint node_67 + +deriving instance GHC.Classes.Eq a_72 => GHC.Classes.Eq (Array a_72) + +deriving instance GHC.Classes.Ord a_73 => GHC.Classes.Ord (Array a_73) + +deriving instance GHC.Show.Show a_74 => GHC.Show.Show (Array a_74) + +instance AST.Unmarshal.Unmarshal Array + +instance Data.Foldable.Foldable Array where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Array where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Array where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayPattern a = ArrayPattern + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Expression GHC.Generics.:+: SpreadElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_75. + AST.Traversable1.Class.Traversable1 a_75 + ) + +instance AST.Unmarshal.SymbolMatching ArrayPattern where + matchedSymbols _ = [299] + showFailure _ node_76 = + "expected " + GHC.Base.<> ( "array_pattern" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_76 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_76) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_77 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_78 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_79 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_80 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_77 + c1_78 = TreeSitter.Node.nodeStartPoint node_76 + TreeSitter.Node.TSPoint + r2_79 + c2_80 = TreeSitter.Node.nodeEndPoint node_76 + +deriving instance GHC.Classes.Eq a_81 => GHC.Classes.Eq (ArrayPattern a_81) + +deriving instance GHC.Classes.Ord a_82 => GHC.Classes.Ord (ArrayPattern a_82) + +deriving instance GHC.Show.Show a_83 => GHC.Show.Show (ArrayPattern a_83) + +instance AST.Unmarshal.Unmarshal ArrayPattern + +instance Data.Foldable.Foldable ArrayPattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayPattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayPattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrayType a = ArrayType + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_84. + AST.Traversable1.Class.Traversable1 a_84 + ) + +instance AST.Unmarshal.SymbolMatching ArrayType where + matchedSymbols _ = [276] + showFailure _ node_85 = + "expected " + GHC.Base.<> ( "array_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_85 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_85) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_86 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_87 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_88 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_89 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_86 + c1_87 = TreeSitter.Node.nodeStartPoint node_85 + TreeSitter.Node.TSPoint + r2_88 + c2_89 = TreeSitter.Node.nodeEndPoint node_85 + +deriving instance GHC.Classes.Eq a_90 => GHC.Classes.Eq (ArrayType a_90) + +deriving instance GHC.Classes.Ord a_91 => GHC.Classes.Ord (ArrayType a_91) + +deriving instance GHC.Show.Show a_92 => GHC.Show.Show (ArrayType a_92) + +instance AST.Unmarshal.Unmarshal ArrayType + +instance Data.Foldable.Foldable ArrayType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrayType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrayType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ArrowFunction a = ArrowFunction + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err ((Expression GHC.Generics.:+: StatementBlock) a)), + parameters :: (GHC.Maybe.Maybe (AST.Parse.Err (FormalParameters a))), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + parameter :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_93. + AST.Traversable1.Class.Traversable1 a_93 + ) + +instance AST.Unmarshal.SymbolMatching ArrowFunction where + matchedSymbols _ = [192] + showFailure _ node_94 = + "expected " + GHC.Base.<> ( "arrow_function" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_94 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_94) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_95 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_96 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_97 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_98 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_95 + c1_96 = TreeSitter.Node.nodeStartPoint node_94 + TreeSitter.Node.TSPoint + r2_97 + c2_98 = TreeSitter.Node.nodeEndPoint node_94 + +deriving instance GHC.Classes.Eq a_99 => GHC.Classes.Eq (ArrowFunction a_99) + +deriving instance GHC.Classes.Ord a_100 => GHC.Classes.Ord (ArrowFunction a_100) + +deriving instance GHC.Show.Show a_101 => GHC.Show.Show (ArrowFunction a_101) + +instance AST.Unmarshal.Unmarshal ArrowFunction + +instance Data.Foldable.Foldable ArrowFunction where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ArrowFunction where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ArrowFunction where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AsExpression a = AsExpression + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_102. + AST.Traversable1.Class.Traversable1 a_102 + ) + +instance AST.Unmarshal.SymbolMatching AsExpression where + matchedSymbols _ = [230] + showFailure _ node_103 = + "expected " + GHC.Base.<> ( "as_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_103 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_103) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_104 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_105 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_106 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_107 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_104 + c1_105 = TreeSitter.Node.nodeStartPoint node_103 + TreeSitter.Node.TSPoint + r2_106 + c2_107 = TreeSitter.Node.nodeEndPoint node_103 + +deriving instance GHC.Classes.Eq a_108 => GHC.Classes.Eq (AsExpression a_108) + +deriving instance GHC.Classes.Ord a_109 => GHC.Classes.Ord (AsExpression a_109) + +deriving instance GHC.Show.Show a_110 => GHC.Show.Show (AsExpression a_110) + +instance AST.Unmarshal.Unmarshal AsExpression + +instance Data.Foldable.Foldable AsExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AsExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AsExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AssignmentExpression a = AssignmentExpression + { ann :: a, + left :: (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: Identifier GHC.Generics.:+: MemberExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: SubscriptExpression) a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_111. + AST.Traversable1.Class.Traversable1 a_111 + ) + +instance AST.Unmarshal.SymbolMatching AssignmentExpression where + matchedSymbols _ = [199] + showFailure _ node_112 = + "expected " + GHC.Base.<> ( "assignment_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_112 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_112) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_113 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_114 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_115 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_116 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_113 + c1_114 = TreeSitter.Node.nodeStartPoint node_112 + TreeSitter.Node.TSPoint + r2_115 + c2_116 = TreeSitter.Node.nodeEndPoint node_112 + +deriving instance GHC.Classes.Eq a_117 => GHC.Classes.Eq (AssignmentExpression a_117) + +deriving instance GHC.Classes.Ord a_118 => GHC.Classes.Ord (AssignmentExpression a_118) + +deriving instance GHC.Show.Show a_119 => GHC.Show.Show (AssignmentExpression a_119) + +instance AST.Unmarshal.Unmarshal AssignmentExpression + +instance Data.Foldable.Foldable AssignmentExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AssignmentExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AssignmentExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AssignmentPattern a = AssignmentPattern + { ann :: a, + left :: (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: ShorthandPropertyIdentifier) a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_120. + AST.Traversable1.Class.Traversable1 a_120 + ) + +instance AST.Unmarshal.SymbolMatching AssignmentPattern where + matchedSymbols _ = [182] + showFailure _ node_121 = + "expected " + GHC.Base.<> ( "assignment_pattern" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_121 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_121) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_122 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_123 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_124 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_125 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_122 + c1_123 = TreeSitter.Node.nodeStartPoint node_121 + TreeSitter.Node.TSPoint + r2_124 + c2_125 = TreeSitter.Node.nodeEndPoint node_121 + +deriving instance GHC.Classes.Eq a_126 => GHC.Classes.Eq (AssignmentPattern a_126) + +deriving instance GHC.Classes.Ord a_127 => GHC.Classes.Ord (AssignmentPattern a_127) + +deriving instance GHC.Show.Show a_128 => GHC.Show.Show (AssignmentPattern a_128) + +instance AST.Unmarshal.Unmarshal AssignmentPattern + +instance Data.Foldable.Foldable AssignmentPattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AssignmentPattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AssignmentPattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AugmentedAssignmentExpression a = AugmentedAssignmentExpression + { ann :: a, + left :: (AST.Parse.Err ((Identifier GHC.Generics.:+: MemberExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: SubscriptExpression) a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_129. + AST.Traversable1.Class.Traversable1 a_129 + ) + +instance AST.Unmarshal.SymbolMatching AugmentedAssignmentExpression where + matchedSymbols _ = [200] + showFailure _ node_130 = + "expected " + GHC.Base.<> ( "augmented_assignment_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_130 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_130) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_131 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_132 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_133 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_134 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_131 + c1_132 = TreeSitter.Node.nodeStartPoint node_130 + TreeSitter.Node.TSPoint + r2_133 + c2_134 = TreeSitter.Node.nodeEndPoint node_130 + +deriving instance GHC.Classes.Eq a_135 => GHC.Classes.Eq (AugmentedAssignmentExpression a_135) + +deriving instance GHC.Classes.Ord a_136 => GHC.Classes.Ord (AugmentedAssignmentExpression a_136) + +deriving instance GHC.Show.Show a_137 => GHC.Show.Show (AugmentedAssignmentExpression a_137) + +instance AST.Unmarshal.Unmarshal AugmentedAssignmentExpression + +instance Data.Foldable.Foldable AugmentedAssignmentExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AugmentedAssignmentExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AugmentedAssignmentExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data AwaitExpression a = AwaitExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_138. + AST.Traversable1.Class.Traversable1 a_138 + ) + +instance AST.Unmarshal.SymbolMatching AwaitExpression where + matchedSymbols _ = [196] + showFailure _ node_139 = + "expected " + GHC.Base.<> ( "await_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_139 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_139) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_140 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_141 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_142 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_143 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_140 + c1_141 = TreeSitter.Node.nodeStartPoint node_139 + TreeSitter.Node.TSPoint + r2_142 + c2_143 = TreeSitter.Node.nodeEndPoint node_139 + +deriving instance GHC.Classes.Eq a_144 => GHC.Classes.Eq (AwaitExpression a_144) + +deriving instance GHC.Classes.Ord a_145 => GHC.Classes.Ord (AwaitExpression a_145) + +deriving instance GHC.Show.Show a_146 => GHC.Show.Show (AwaitExpression a_146) + +instance AST.Unmarshal.Unmarshal AwaitExpression + +instance Data.Foldable.Foldable AwaitExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor AwaitExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable AwaitExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BinaryExpression a = BinaryExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousBangEqual GHC.Generics.:+: AnonymousBangEqualEqual GHC.Generics.:+: AnonymousPercent GHC.Generics.:+: AnonymousAmpersand GHC.Generics.:+: AnonymousAmpersandAmpersand GHC.Generics.:+: AnonymousStar GHC.Generics.:+: AnonymousStarStar GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousSlash GHC.Generics.:+: AnonymousLAngle GHC.Generics.:+: AnonymousLAngleLAngle GHC.Generics.:+: AnonymousLAngleEqual GHC.Generics.:+: AnonymousEqualEqual GHC.Generics.:+: AnonymousEqualEqualEqual GHC.Generics.:+: AnonymousRAngle GHC.Generics.:+: AnonymousRAngleEqual GHC.Generics.:+: AnonymousRAngleRAngle GHC.Generics.:+: AnonymousRAngleRAngleRAngle GHC.Generics.:+: AnonymousQuestionQuestion GHC.Generics.:+: AnonymousCaret GHC.Generics.:+: AnonymousIn GHC.Generics.:+: AnonymousInstanceof GHC.Generics.:+: AnonymousPipe GHC.Generics.:+: AnonymousPipePipe) a)), + left :: (AST.Parse.Err (Expression a)), + right :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_147. + AST.Traversable1.Class.Traversable1 a_147 + ) + +instance AST.Unmarshal.SymbolMatching BinaryExpression where + matchedSymbols _ = [204] + showFailure _ node_148 = + "expected " + GHC.Base.<> ( "binary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_148 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_148) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_149 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_150 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_151 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_152 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_149 + c1_150 = TreeSitter.Node.nodeStartPoint node_148 + TreeSitter.Node.TSPoint + r2_151 + c2_152 = TreeSitter.Node.nodeEndPoint node_148 + +deriving instance GHC.Classes.Eq a_153 => GHC.Classes.Eq (BinaryExpression a_153) + +deriving instance GHC.Classes.Ord a_154 => GHC.Classes.Ord (BinaryExpression a_154) + +deriving instance GHC.Show.Show a_155 => GHC.Show.Show (BinaryExpression a_155) + +instance AST.Unmarshal.Unmarshal BinaryExpression + +instance Data.Foldable.Foldable BinaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BinaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BinaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data BreakStatement a = BreakStatement + { ann :: a, + label :: (GHC.Maybe.Maybe (AST.Parse.Err (StatementIdentifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_156. + AST.Traversable1.Class.Traversable1 a_156 + ) + +instance AST.Unmarshal.SymbolMatching BreakStatement where + matchedSymbols _ = [166] + showFailure _ node_157 = + "expected " + GHC.Base.<> ( "break_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_157 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_157) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_158 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_159 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_160 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_161 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_158 + c1_159 = TreeSitter.Node.nodeStartPoint node_157 + TreeSitter.Node.TSPoint + r2_160 + c2_161 = TreeSitter.Node.nodeEndPoint node_157 + +deriving instance GHC.Classes.Eq a_162 => GHC.Classes.Eq (BreakStatement a_162) + +deriving instance GHC.Classes.Ord a_163 => GHC.Classes.Ord (BreakStatement a_163) + +deriving instance GHC.Show.Show a_164 => GHC.Show.Show (BreakStatement a_164) + +instance AST.Unmarshal.Unmarshal BreakStatement + +instance Data.Foldable.Foldable BreakStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor BreakStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable BreakStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CallExpression a = CallExpression + { ann :: a, + function :: (AST.Parse.Err (Expression a)), + arguments :: (AST.Parse.Err ((Arguments GHC.Generics.:+: TemplateString) a)), + typeArguments :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeArguments a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_165. + AST.Traversable1.Class.Traversable1 a_165 + ) + +instance AST.Unmarshal.SymbolMatching CallExpression where + matchedSymbols _ = [194, 216] + showFailure _ node_166 = + "expected " + GHC.Base.<> ( "call_expression, call_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_166 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_166) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_167 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_168 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_169 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_170 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_167 + c1_168 = TreeSitter.Node.nodeStartPoint node_166 + TreeSitter.Node.TSPoint + r2_169 + c2_170 = TreeSitter.Node.nodeEndPoint node_166 + +deriving instance GHC.Classes.Eq a_171 => GHC.Classes.Eq (CallExpression a_171) + +deriving instance GHC.Classes.Ord a_172 => GHC.Classes.Ord (CallExpression a_172) + +deriving instance GHC.Show.Show a_173 => GHC.Show.Show (CallExpression a_173) + +instance AST.Unmarshal.Unmarshal CallExpression + +instance Data.Foldable.Foldable CallExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CallExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CallExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CallSignature a = CallSignature + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_174. + AST.Traversable1.Class.Traversable1 a_174 + ) + +instance AST.Unmarshal.SymbolMatching CallSignature where + matchedSymbols _ = [268] + showFailure _ node_175 = + "expected " + GHC.Base.<> ( "call_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_175 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_175) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_176 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_177 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_178 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_179 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_176 + c1_177 = TreeSitter.Node.nodeStartPoint node_175 + TreeSitter.Node.TSPoint + r2_178 + c2_179 = TreeSitter.Node.nodeEndPoint node_175 + +deriving instance GHC.Classes.Eq a_180 => GHC.Classes.Eq (CallSignature a_180) + +deriving instance GHC.Classes.Ord a_181 => GHC.Classes.Ord (CallSignature a_181) + +deriving instance GHC.Show.Show a_182 => GHC.Show.Show (CallSignature a_182) + +instance AST.Unmarshal.Unmarshal CallSignature + +instance Data.Foldable.Foldable CallSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CallSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CallSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data CatchClause a = CatchClause + { ann :: a, + body :: (AST.Parse.Err (StatementBlock a)), + parameter :: (GHC.Maybe.Maybe (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: Identifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_183. + AST.Traversable1.Class.Traversable1 a_183 + ) + +instance AST.Unmarshal.SymbolMatching CatchClause where + matchedSymbols _ = [176] + showFailure _ node_184 = + "expected " + GHC.Base.<> ( "catch_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_184 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_184) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_185 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_186 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_187 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_188 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_185 + c1_186 = TreeSitter.Node.nodeStartPoint node_184 + TreeSitter.Node.TSPoint + r2_187 + c2_188 = TreeSitter.Node.nodeEndPoint node_184 + +deriving instance GHC.Classes.Eq a_189 => GHC.Classes.Eq (CatchClause a_189) + +deriving instance GHC.Classes.Ord a_190 => GHC.Classes.Ord (CatchClause a_190) + +deriving instance GHC.Show.Show a_191 => GHC.Show.Show (CatchClause a_191) + +instance AST.Unmarshal.Unmarshal CatchClause + +instance Data.Foldable.Foldable CatchClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor CatchClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable CatchClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Class a = Class + { ann :: a, + decorator :: ([AST.Parse.Err (Decorator a)]), + body :: (AST.Parse.Err (ClassBody a)), + name :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeIdentifier a))), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ClassHeritage a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_192. + AST.Traversable1.Class.Traversable1 a_192 + ) + +instance AST.Unmarshal.SymbolMatching Class where + matchedSymbols _ = [185] + showFailure _ node_193 = + "expected " + GHC.Base.<> ( "class" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_193 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_193) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_194 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_195 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_196 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_197 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_194 + c1_195 = TreeSitter.Node.nodeStartPoint node_193 + TreeSitter.Node.TSPoint + r2_196 + c2_197 = TreeSitter.Node.nodeEndPoint node_193 + +deriving instance GHC.Classes.Eq a_198 => GHC.Classes.Eq (Class a_198) + +deriving instance GHC.Classes.Ord a_199 => GHC.Classes.Ord (Class a_199) + +deriving instance GHC.Show.Show a_200 => GHC.Show.Show (Class a_200) + +instance AST.Unmarshal.Unmarshal Class + +instance Data.Foldable.Foldable Class where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Class where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Class where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassBody a = ClassBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AbstractMethodSignature GHC.Generics.:+: Decorator GHC.Generics.:+: IndexSignature GHC.Generics.:+: MethodDefinition GHC.Generics.:+: MethodSignature GHC.Generics.:+: PublicFieldDefinition) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_201. + AST.Traversable1.Class.Traversable1 a_201 + ) + +instance AST.Unmarshal.SymbolMatching ClassBody where + matchedSymbols _ = [217] + showFailure _ node_202 = + "expected " + GHC.Base.<> ( "class_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_202 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_202) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_203 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_204 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_205 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_206 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_203 + c1_204 = TreeSitter.Node.nodeStartPoint node_202 + TreeSitter.Node.TSPoint + r2_205 + c2_206 = TreeSitter.Node.nodeEndPoint node_202 + +deriving instance GHC.Classes.Eq a_207 => GHC.Classes.Eq (ClassBody a_207) + +deriving instance GHC.Classes.Ord a_208 => GHC.Classes.Ord (ClassBody a_208) + +deriving instance GHC.Show.Show a_209 => GHC.Show.Show (ClassBody a_209) + +instance AST.Unmarshal.Unmarshal ClassBody + +instance Data.Foldable.Foldable ClassBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassDeclaration a = ClassDeclaration + { ann :: a, + decorator :: ([AST.Parse.Err (Decorator a)]), + body :: (AST.Parse.Err (ClassBody a)), + name :: (AST.Parse.Err (TypeIdentifier a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ClassHeritage a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_210. + AST.Traversable1.Class.Traversable1 a_210 + ) + +instance AST.Unmarshal.SymbolMatching ClassDeclaration where + matchedSymbols _ = [186] + showFailure _ node_211 = + "expected " + GHC.Base.<> ( "class_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_211 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_211) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_212 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_213 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_214 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_215 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_212 + c1_213 = TreeSitter.Node.nodeStartPoint node_211 + TreeSitter.Node.TSPoint + r2_214 + c2_215 = TreeSitter.Node.nodeEndPoint node_211 + +deriving instance GHC.Classes.Eq a_216 => GHC.Classes.Eq (ClassDeclaration a_216) + +deriving instance GHC.Classes.Ord a_217 => GHC.Classes.Ord (ClassDeclaration a_217) + +deriving instance GHC.Show.Show a_218 => GHC.Show.Show (ClassDeclaration a_218) + +instance AST.Unmarshal.Unmarshal ClassDeclaration + +instance Data.Foldable.Foldable ClassDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ClassHeritage a = ClassHeritage + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ExtendsClause GHC.Generics.:+: ImplementsClause) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_219. + AST.Traversable1.Class.Traversable1 a_219 + ) + +instance AST.Unmarshal.SymbolMatching ClassHeritage where + matchedSymbols _ = [187] + showFailure _ node_220 = + "expected " + GHC.Base.<> ( "class_heritage" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_220 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_220) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_221 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_222 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_223 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_224 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_221 + c1_222 = TreeSitter.Node.nodeStartPoint node_220 + TreeSitter.Node.TSPoint + r2_223 + c2_224 = TreeSitter.Node.nodeEndPoint node_220 + +deriving instance GHC.Classes.Eq a_225 => GHC.Classes.Eq (ClassHeritage a_225) + +deriving instance GHC.Classes.Ord a_226 => GHC.Classes.Ord (ClassHeritage a_226) + +deriving instance GHC.Show.Show a_227 => GHC.Show.Show (ClassHeritage a_227) + +instance AST.Unmarshal.Unmarshal ClassHeritage + +instance Data.Foldable.Foldable ClassHeritage where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ClassHeritage where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ClassHeritage where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ComputedPropertyName a = ComputedPropertyName + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_228. + AST.Traversable1.Class.Traversable1 a_228 + ) + +instance AST.Unmarshal.SymbolMatching ComputedPropertyName where + matchedSymbols _ = [224] + showFailure _ node_229 = + "expected " + GHC.Base.<> ( "computed_property_name" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_229 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_229) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_230 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_231 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_232 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_233 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_230 + c1_231 = TreeSitter.Node.nodeStartPoint node_229 + TreeSitter.Node.TSPoint + r2_232 + c2_233 = TreeSitter.Node.nodeEndPoint node_229 + +deriving instance GHC.Classes.Eq a_234 => GHC.Classes.Eq (ComputedPropertyName a_234) + +deriving instance GHC.Classes.Ord a_235 => GHC.Classes.Ord (ComputedPropertyName a_235) + +deriving instance GHC.Show.Show a_236 => GHC.Show.Show (ComputedPropertyName a_236) + +instance AST.Unmarshal.Unmarshal ComputedPropertyName + +instance Data.Foldable.Foldable ComputedPropertyName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ComputedPropertyName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ComputedPropertyName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Constraint a = Constraint + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_237. + AST.Traversable1.Class.Traversable1 a_237 + ) + +instance AST.Unmarshal.SymbolMatching Constraint where + matchedSymbols _ = [273] + showFailure _ node_238 = + "expected " + GHC.Base.<> ( "constraint" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_238 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_238) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_239 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_240 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_241 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_242 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_239 + c1_240 = TreeSitter.Node.nodeStartPoint node_238 + TreeSitter.Node.TSPoint + r2_241 + c2_242 = TreeSitter.Node.nodeEndPoint node_238 + +deriving instance GHC.Classes.Eq a_243 => GHC.Classes.Eq (Constraint a_243) + +deriving instance GHC.Classes.Ord a_244 => GHC.Classes.Ord (Constraint a_244) + +deriving instance GHC.Show.Show a_245 => GHC.Show.Show (Constraint a_245) + +instance AST.Unmarshal.Unmarshal Constraint + +instance Data.Foldable.Foldable Constraint where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Constraint where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Constraint where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstructSignature a = ConstructSignature + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((FormalParameters GHC.Generics.:+: TypeAnnotation GHC.Generics.:+: TypeParameters) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_246. + AST.Traversable1.Class.Traversable1 a_246 + ) + +instance AST.Unmarshal.SymbolMatching ConstructSignature where + matchedSymbols _ = [274] + showFailure _ node_247 = + "expected " + GHC.Base.<> ( "construct_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_247 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_247) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_248 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_249 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_250 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_251 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_248 + c1_249 = TreeSitter.Node.nodeStartPoint node_247 + TreeSitter.Node.TSPoint + r2_250 + c2_251 = TreeSitter.Node.nodeEndPoint node_247 + +deriving instance GHC.Classes.Eq a_252 => GHC.Classes.Eq (ConstructSignature a_252) + +deriving instance GHC.Classes.Ord a_253 => GHC.Classes.Ord (ConstructSignature a_253) + +deriving instance GHC.Show.Show a_254 => GHC.Show.Show (ConstructSignature a_254) + +instance AST.Unmarshal.Unmarshal ConstructSignature + +instance Data.Foldable.Foldable ConstructSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstructSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstructSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ConstructorType a = ConstructorType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FormalParameters GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypeParameters GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_255. + AST.Traversable1.Class.Traversable1 a_255 + ) + +instance AST.Unmarshal.SymbolMatching ConstructorType where + matchedSymbols _ = [252] + showFailure _ node_256 = + "expected " + GHC.Base.<> ( "constructor_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_256 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_256) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_257 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_258 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_259 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_260 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_257 + c1_258 = TreeSitter.Node.nodeStartPoint node_256 + TreeSitter.Node.TSPoint + r2_259 + c2_260 = TreeSitter.Node.nodeEndPoint node_256 + +deriving instance GHC.Classes.Eq a_261 => GHC.Classes.Eq (ConstructorType a_261) + +deriving instance GHC.Classes.Ord a_262 => GHC.Classes.Ord (ConstructorType a_262) + +deriving instance GHC.Show.Show a_263 => GHC.Show.Show (ConstructorType a_263) + +instance AST.Unmarshal.Unmarshal ConstructorType + +instance Data.Foldable.Foldable ConstructorType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ConstructorType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ConstructorType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ContinueStatement a = ContinueStatement + { ann :: a, + label :: (GHC.Maybe.Maybe (AST.Parse.Err (StatementIdentifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_264. + AST.Traversable1.Class.Traversable1 a_264 + ) + +instance AST.Unmarshal.SymbolMatching ContinueStatement where + matchedSymbols _ = [167] + showFailure _ node_265 = + "expected " + GHC.Base.<> ( "continue_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_265 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_265) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_266 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_267 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_268 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_269 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_266 + c1_267 = TreeSitter.Node.nodeStartPoint node_265 + TreeSitter.Node.TSPoint + r2_268 + c2_269 = TreeSitter.Node.nodeEndPoint node_265 + +deriving instance GHC.Classes.Eq a_270 => GHC.Classes.Eq (ContinueStatement a_270) + +deriving instance GHC.Classes.Ord a_271 => GHC.Classes.Ord (ContinueStatement a_271) + +deriving instance GHC.Show.Show a_272 => GHC.Show.Show (ContinueStatement a_272) + +instance AST.Unmarshal.Unmarshal ContinueStatement + +instance Data.Foldable.Foldable ContinueStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ContinueStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ContinueStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DebuggerStatement a = DebuggerStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_273. + AST.Traversable1.Class.Traversable1 a_273 + ) + +instance AST.Unmarshal.SymbolMatching DebuggerStatement where + matchedSymbols _ = [168] + showFailure _ node_274 = + "expected " + GHC.Base.<> ( "debugger_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_274 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_274) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_275 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_276 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_277 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_278 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_275 + c1_276 = TreeSitter.Node.nodeStartPoint node_274 + TreeSitter.Node.TSPoint + r2_277 + c2_278 = TreeSitter.Node.nodeEndPoint node_274 + +deriving instance GHC.Classes.Eq a_279 => GHC.Classes.Eq (DebuggerStatement a_279) + +deriving instance GHC.Classes.Ord a_280 => GHC.Classes.Ord (DebuggerStatement a_280) + +deriving instance GHC.Show.Show a_281 => GHC.Show.Show (DebuggerStatement a_281) + +instance AST.Unmarshal.Unmarshal DebuggerStatement + +instance Data.Foldable.Foldable DebuggerStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DebuggerStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DebuggerStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Decorator a = Decorator + { ann :: a, + extraChildren :: (AST.Parse.Err ((CallExpression GHC.Generics.:+: Identifier GHC.Generics.:+: MemberExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_282. + AST.Traversable1.Class.Traversable1 a_282 + ) + +instance AST.Unmarshal.SymbolMatching Decorator where + matchedSymbols _ = [214] + showFailure _ node_283 = + "expected " + GHC.Base.<> ( "decorator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_283 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_283) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_284 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_285 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_286 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_287 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_284 + c1_285 = TreeSitter.Node.nodeStartPoint node_283 + TreeSitter.Node.TSPoint + r2_286 + c2_287 = TreeSitter.Node.nodeEndPoint node_283 + +deriving instance GHC.Classes.Eq a_288 => GHC.Classes.Eq (Decorator a_288) + +deriving instance GHC.Classes.Ord a_289 => GHC.Classes.Ord (Decorator a_289) + +deriving instance GHC.Show.Show a_290 => GHC.Show.Show (Decorator a_290) + +instance AST.Unmarshal.Unmarshal Decorator + +instance Data.Foldable.Foldable Decorator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Decorator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Decorator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DefaultType a = DefaultType + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_291. + AST.Traversable1.Class.Traversable1 a_291 + ) + +instance AST.Unmarshal.SymbolMatching DefaultType where + matchedSymbols _ = [272] + showFailure _ node_292 = + "expected " + GHC.Base.<> ( "default_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_292 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_292) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_293 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_294 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_295 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_296 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_293 + c1_294 = TreeSitter.Node.nodeStartPoint node_292 + TreeSitter.Node.TSPoint + r2_295 + c2_296 = TreeSitter.Node.nodeEndPoint node_292 + +deriving instance GHC.Classes.Eq a_297 => GHC.Classes.Eq (DefaultType a_297) + +deriving instance GHC.Classes.Ord a_298 => GHC.Classes.Ord (DefaultType a_298) + +deriving instance GHC.Show.Show a_299 => GHC.Show.Show (DefaultType a_299) + +instance AST.Unmarshal.Unmarshal DefaultType + +instance Data.Foldable.Foldable DefaultType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DefaultType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DefaultType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data DoStatement a = DoStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_300. + AST.Traversable1.Class.Traversable1 a_300 + ) + +instance AST.Unmarshal.SymbolMatching DoStatement where + matchedSymbols _ = [163] + showFailure _ node_301 = + "expected " + GHC.Base.<> ( "do_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_301 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_301) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_302 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_303 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_304 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_305 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_302 + c1_303 = TreeSitter.Node.nodeStartPoint node_301 + TreeSitter.Node.TSPoint + r2_304 + c2_305 = TreeSitter.Node.nodeEndPoint node_301 + +deriving instance GHC.Classes.Eq a_306 => GHC.Classes.Eq (DoStatement a_306) + +deriving instance GHC.Classes.Ord a_307 => GHC.Classes.Ord (DoStatement a_307) + +deriving instance GHC.Show.Show a_308 => GHC.Show.Show (DoStatement a_308) + +instance AST.Unmarshal.Unmarshal DoStatement + +instance Data.Foldable.Foldable DoStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor DoStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable DoStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EmptyStatement a = EmptyStatement {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_309. + AST.Traversable1.Class.Traversable1 a_309 + ) + +instance AST.Unmarshal.SymbolMatching EmptyStatement where + matchedSymbols _ = [171] + showFailure _ node_310 = + "expected " + GHC.Base.<> ( "empty_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_310 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_310) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_311 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_312 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_313 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_314 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_311 + c1_312 = TreeSitter.Node.nodeStartPoint node_310 + TreeSitter.Node.TSPoint + r2_313 + c2_314 = TreeSitter.Node.nodeEndPoint node_310 + +deriving instance GHC.Classes.Eq a_315 => GHC.Classes.Eq (EmptyStatement a_315) + +deriving instance GHC.Classes.Ord a_316 => GHC.Classes.Ord (EmptyStatement a_316) + +deriving instance GHC.Show.Show a_317 => GHC.Show.Show (EmptyStatement a_317) + +instance AST.Unmarshal.Unmarshal EmptyStatement + +instance Data.Foldable.Foldable EmptyStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EmptyStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EmptyStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnumAssignment a = EnumAssignment + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + extraChildren :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_318. + AST.Traversable1.Class.Traversable1 a_318 + ) + +instance AST.Unmarshal.SymbolMatching EnumAssignment where + matchedSymbols _ = [244] + showFailure _ node_319 = + "expected " + GHC.Base.<> ( "enum_assignment" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_319 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_319) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_320 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_321 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_322 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_323 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_320 + c1_321 = TreeSitter.Node.nodeStartPoint node_319 + TreeSitter.Node.TSPoint + r2_322 + c2_323 = TreeSitter.Node.nodeEndPoint node_319 + +deriving instance GHC.Classes.Eq a_324 => GHC.Classes.Eq (EnumAssignment a_324) + +deriving instance GHC.Classes.Ord a_325 => GHC.Classes.Ord (EnumAssignment a_325) + +deriving instance GHC.Show.Show a_326 => GHC.Show.Show (EnumAssignment a_326) + +instance AST.Unmarshal.Unmarshal EnumAssignment + +instance Data.Foldable.Foldable EnumAssignment where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnumAssignment where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnumAssignment where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnumBody a = EnumBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: EnumAssignment GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_327. + AST.Traversable1.Class.Traversable1 a_327 + ) + +instance AST.Unmarshal.SymbolMatching EnumBody where + matchedSymbols _ = [243] + showFailure _ node_328 = + "expected " + GHC.Base.<> ( "enum_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_328 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_328) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_329 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_330 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_331 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_332 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_329 + c1_330 = TreeSitter.Node.nodeStartPoint node_328 + TreeSitter.Node.TSPoint + r2_331 + c2_332 = TreeSitter.Node.nodeEndPoint node_328 + +deriving instance GHC.Classes.Eq a_333 => GHC.Classes.Eq (EnumBody a_333) + +deriving instance GHC.Classes.Ord a_334 => GHC.Classes.Ord (EnumBody a_334) + +deriving instance GHC.Show.Show a_335 => GHC.Show.Show (EnumBody a_335) + +instance AST.Unmarshal.Unmarshal EnumBody + +instance Data.Foldable.Foldable EnumBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnumBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnumBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data EnumDeclaration a = EnumDeclaration + { ann :: a, + body :: (AST.Parse.Err (EnumBody a)), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_336. + AST.Traversable1.Class.Traversable1 a_336 + ) + +instance AST.Unmarshal.SymbolMatching EnumDeclaration where + matchedSymbols _ = [242] + showFailure _ node_337 = + "expected " + GHC.Base.<> ( "enum_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_337 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_337) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_338 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_339 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_340 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_341 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_338 + c1_339 = TreeSitter.Node.nodeStartPoint node_337 + TreeSitter.Node.TSPoint + r2_340 + c2_341 = TreeSitter.Node.nodeEndPoint node_337 + +deriving instance GHC.Classes.Eq a_342 => GHC.Classes.Eq (EnumDeclaration a_342) + +deriving instance GHC.Classes.Ord a_343 => GHC.Classes.Ord (EnumDeclaration a_343) + +deriving instance GHC.Show.Show a_344 => GHC.Show.Show (EnumDeclaration a_344) + +instance AST.Unmarshal.Unmarshal EnumDeclaration + +instance Data.Foldable.Foldable EnumDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EnumDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EnumDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExistentialType a = ExistentialType {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_345. + AST.Traversable1.Class.Traversable1 a_345 + ) + +instance AST.Unmarshal.SymbolMatching ExistentialType where + matchedSymbols _ = [262] + showFailure _ node_346 = + "expected " + GHC.Base.<> ( "existential_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_346 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_346) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_347 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_348 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_349 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_350 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_347 + c1_348 = TreeSitter.Node.nodeStartPoint node_346 + TreeSitter.Node.TSPoint + r2_349 + c2_350 = TreeSitter.Node.nodeEndPoint node_346 + +deriving instance GHC.Classes.Eq a_351 => GHC.Classes.Eq (ExistentialType a_351) + +deriving instance GHC.Classes.Ord a_352 => GHC.Classes.Ord (ExistentialType a_352) + +deriving instance GHC.Show.Show a_353 => GHC.Show.Show (ExistentialType a_353) + +instance AST.Unmarshal.Unmarshal ExistentialType + +instance Data.Foldable.Foldable ExistentialType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExistentialType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExistentialType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExportClause a = ExportClause + { ann :: a, + extraChildren :: ([AST.Parse.Err (ExportSpecifier a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_354. + AST.Traversable1.Class.Traversable1 a_354 + ) + +instance AST.Unmarshal.SymbolMatching ExportClause where + matchedSymbols _ = [143] + showFailure _ node_355 = + "expected " + GHC.Base.<> ( "export_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_355 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_355) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_356 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_357 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_358 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_359 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_356 + c1_357 = TreeSitter.Node.nodeStartPoint node_355 + TreeSitter.Node.TSPoint + r2_358 + c2_359 = TreeSitter.Node.nodeEndPoint node_355 + +deriving instance GHC.Classes.Eq a_360 => GHC.Classes.Eq (ExportClause a_360) + +deriving instance GHC.Classes.Ord a_361 => GHC.Classes.Ord (ExportClause a_361) + +deriving instance GHC.Show.Show a_362 => GHC.Show.Show (ExportClause a_362) + +instance AST.Unmarshal.Unmarshal ExportClause + +instance Data.Foldable.Foldable ExportClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExportClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExportClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExportSpecifier a = ExportSpecifier + { ann :: a, + alias :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_363. + AST.Traversable1.Class.Traversable1 a_363 + ) + +instance AST.Unmarshal.SymbolMatching ExportSpecifier where + matchedSymbols _ = [300] + showFailure _ node_364 = + "expected " + GHC.Base.<> ( "export_specifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_364 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_364) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_365 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_366 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_367 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_368 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_365 + c1_366 = TreeSitter.Node.nodeStartPoint node_364 + TreeSitter.Node.TSPoint + r2_367 + c2_368 = TreeSitter.Node.nodeEndPoint node_364 + +deriving instance GHC.Classes.Eq a_369 => GHC.Classes.Eq (ExportSpecifier a_369) + +deriving instance GHC.Classes.Ord a_370 => GHC.Classes.Ord (ExportSpecifier a_370) + +deriving instance GHC.Show.Show a_371 => GHC.Show.Show (ExportSpecifier a_371) + +instance AST.Unmarshal.Unmarshal ExportSpecifier + +instance Data.Foldable.Foldable ExportSpecifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExportSpecifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExportSpecifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExportStatement a = ExportStatement + { ann :: a, + decorator :: ([AST.Parse.Err (Decorator a)]), + declaration :: (GHC.Maybe.Maybe (AST.Parse.Err (Declaration a))), + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + source :: (GHC.Maybe.Maybe (AST.Parse.Err (String a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((ExportClause GHC.Generics.:+: Identifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_372. + AST.Traversable1.Class.Traversable1 a_372 + ) + +instance AST.Unmarshal.SymbolMatching ExportStatement where + matchedSymbols _ = [142] + showFailure _ node_373 = + "expected " + GHC.Base.<> ( "export_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_373 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_373) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_374 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_375 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_376 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_377 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_374 + c1_375 = TreeSitter.Node.nodeStartPoint node_373 + TreeSitter.Node.TSPoint + r2_376 + c2_377 = TreeSitter.Node.nodeEndPoint node_373 + +deriving instance GHC.Classes.Eq a_378 => GHC.Classes.Eq (ExportStatement a_378) + +deriving instance GHC.Classes.Ord a_379 => GHC.Classes.Ord (ExportStatement a_379) + +deriving instance GHC.Show.Show a_380 => GHC.Show.Show (ExportStatement a_380) + +instance AST.Unmarshal.Unmarshal ExportStatement + +instance Data.Foldable.Foldable ExportStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExportStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExportStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExpressionStatement a = ExpressionStatement + { ann :: a, + extraChildren :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_381. + AST.Traversable1.Class.Traversable1 a_381 + ) + +instance AST.Unmarshal.SymbolMatching ExpressionStatement where + matchedSymbols _ = [152] + showFailure _ node_382 = + "expected " + GHC.Base.<> ( "expression_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_382 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_382) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_383 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_384 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_385 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_386 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_383 + c1_384 = TreeSitter.Node.nodeStartPoint node_382 + TreeSitter.Node.TSPoint + r2_385 + c2_386 = TreeSitter.Node.nodeEndPoint node_382 + +deriving instance GHC.Classes.Eq a_387 => GHC.Classes.Eq (ExpressionStatement a_387) + +deriving instance GHC.Classes.Ord a_388 => GHC.Classes.Ord (ExpressionStatement a_388) + +deriving instance GHC.Show.Show a_389 => GHC.Show.Show (ExpressionStatement a_389) + +instance AST.Unmarshal.Unmarshal ExpressionStatement + +instance Data.Foldable.Foldable ExpressionStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExpressionStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExpressionStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ExtendsClause a = ExtendsClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: GenericType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: TypeIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_390. + AST.Traversable1.Class.Traversable1 a_390 + ) + +instance AST.Unmarshal.SymbolMatching ExtendsClause where + matchedSymbols _ = [241] + showFailure _ node_391 = + "expected " + GHC.Base.<> ( "extends_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_391 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_391) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_392 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_393 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_394 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_395 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_392 + c1_393 = TreeSitter.Node.nodeStartPoint node_391 + TreeSitter.Node.TSPoint + r2_394 + c2_395 = TreeSitter.Node.nodeEndPoint node_391 + +deriving instance GHC.Classes.Eq a_396 => GHC.Classes.Eq (ExtendsClause a_396) + +deriving instance GHC.Classes.Ord a_397 => GHC.Classes.Ord (ExtendsClause a_397) + +deriving instance GHC.Show.Show a_398 => GHC.Show.Show (ExtendsClause a_398) + +instance AST.Unmarshal.Unmarshal ExtendsClause + +instance Data.Foldable.Foldable ExtendsClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ExtendsClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ExtendsClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FinallyClause a = FinallyClause + { ann :: a, + body :: (AST.Parse.Err (StatementBlock a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_399. + AST.Traversable1.Class.Traversable1 a_399 + ) + +instance AST.Unmarshal.SymbolMatching FinallyClause where + matchedSymbols _ = [177] + showFailure _ node_400 = + "expected " + GHC.Base.<> ( "finally_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_400 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_400) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_401 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_402 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_403 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_404 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_401 + c1_402 = TreeSitter.Node.nodeStartPoint node_400 + TreeSitter.Node.TSPoint + r2_403 + c2_404 = TreeSitter.Node.nodeEndPoint node_400 + +deriving instance GHC.Classes.Eq a_405 => GHC.Classes.Eq (FinallyClause a_405) + +deriving instance GHC.Classes.Ord a_406 => GHC.Classes.Ord (FinallyClause a_406) + +deriving instance GHC.Show.Show a_407 => GHC.Show.Show (FinallyClause a_407) + +instance AST.Unmarshal.Unmarshal FinallyClause + +instance Data.Foldable.Foldable FinallyClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FinallyClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FinallyClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FlowMaybeType a = FlowMaybeType + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_408. + AST.Traversable1.Class.Traversable1 a_408 + ) + +instance AST.Unmarshal.SymbolMatching FlowMaybeType where + matchedSymbols _ = [263] + showFailure _ node_409 = + "expected " + GHC.Base.<> ( "flow_maybe_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_409 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_409) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_410 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_411 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_412 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_413 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_410 + c1_411 = TreeSitter.Node.nodeStartPoint node_409 + TreeSitter.Node.TSPoint + r2_412 + c2_413 = TreeSitter.Node.nodeEndPoint node_409 + +deriving instance GHC.Classes.Eq a_414 => GHC.Classes.Eq (FlowMaybeType a_414) + +deriving instance GHC.Classes.Ord a_415 => GHC.Classes.Ord (FlowMaybeType a_415) + +deriving instance GHC.Show.Show a_416 => GHC.Show.Show (FlowMaybeType a_416) + +instance AST.Unmarshal.Unmarshal FlowMaybeType + +instance Data.Foldable.Foldable FlowMaybeType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FlowMaybeType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FlowMaybeType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForInStatement a = ForInStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + left :: (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: Identifier GHC.Generics.:+: MemberExpression GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: SubscriptExpression) a)), + right :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_417. + AST.Traversable1.Class.Traversable1 a_417 + ) + +instance AST.Unmarshal.SymbolMatching ForInStatement where + matchedSymbols _ = [160] + showFailure _ node_418 = + "expected " + GHC.Base.<> ( "for_in_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_418 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_418) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_419 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_420 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_421 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_422 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_419 + c1_420 = TreeSitter.Node.nodeStartPoint node_418 + TreeSitter.Node.TSPoint + r2_421 + c2_422 = TreeSitter.Node.nodeEndPoint node_418 + +deriving instance GHC.Classes.Eq a_423 => GHC.Classes.Eq (ForInStatement a_423) + +deriving instance GHC.Classes.Ord a_424 => GHC.Classes.Ord (ForInStatement a_424) + +deriving instance GHC.Show.Show a_425 => GHC.Show.Show (ForInStatement a_425) + +instance AST.Unmarshal.Unmarshal ForInStatement + +instance Data.Foldable.Foldable ForInStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForInStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForInStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ForStatement a = ForStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + initializer :: (AST.Parse.Err ((EmptyStatement GHC.Generics.:+: ExpressionStatement GHC.Generics.:+: LexicalDeclaration GHC.Generics.:+: VariableDeclaration) a)), + condition :: (AST.Parse.Err ((EmptyStatement GHC.Generics.:+: ExpressionStatement) a)), + increment :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_426. + AST.Traversable1.Class.Traversable1 a_426 + ) + +instance AST.Unmarshal.SymbolMatching ForStatement where + matchedSymbols _ = [159] + showFailure _ node_427 = + "expected " + GHC.Base.<> ( "for_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_427 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_427) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_428 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_429 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_430 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_431 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_428 + c1_429 = TreeSitter.Node.nodeStartPoint node_427 + TreeSitter.Node.TSPoint + r2_430 + c2_431 = TreeSitter.Node.nodeEndPoint node_427 + +deriving instance GHC.Classes.Eq a_432 => GHC.Classes.Eq (ForStatement a_432) + +deriving instance GHC.Classes.Ord a_433 => GHC.Classes.Ord (ForStatement a_433) + +deriving instance GHC.Show.Show a_434 => GHC.Show.Show (ForStatement a_434) + +instance AST.Unmarshal.Unmarshal ForStatement + +instance Data.Foldable.Foldable ForStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ForStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ForStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FormalParameters a = FormalParameters + { ann :: a, + decorator :: ([AST.Parse.Err (Decorator a)]), + extraChildren :: ([AST.Parse.Err ((OptionalParameter GHC.Generics.:+: RequiredParameter GHC.Generics.:+: RestParameter) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_435. + AST.Traversable1.Class.Traversable1 a_435 + ) + +instance AST.Unmarshal.SymbolMatching FormalParameters where + matchedSymbols _ = [219] + showFailure _ node_436 = + "expected " + GHC.Base.<> ( "formal_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_436 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_436) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_437 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_438 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_439 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_440 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_437 + c1_438 = TreeSitter.Node.nodeStartPoint node_436 + TreeSitter.Node.TSPoint + r2_439 + c2_440 = TreeSitter.Node.nodeEndPoint node_436 + +deriving instance GHC.Classes.Eq a_441 => GHC.Classes.Eq (FormalParameters a_441) + +deriving instance GHC.Classes.Ord a_442 => GHC.Classes.Ord (FormalParameters a_442) + +deriving instance GHC.Show.Show a_443 => GHC.Show.Show (FormalParameters a_443) + +instance AST.Unmarshal.Unmarshal FormalParameters + +instance Data.Foldable.Foldable FormalParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FormalParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FormalParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Function a = Function + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err (StatementBlock a)), + name :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_444. + AST.Traversable1.Class.Traversable1 a_444 + ) + +instance AST.Unmarshal.SymbolMatching Function where + matchedSymbols _ = [188] + showFailure _ node_445 = + "expected " + GHC.Base.<> ( "function" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_445 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_445) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_446 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_447 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_448 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_449 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_446 + c1_447 = TreeSitter.Node.nodeStartPoint node_445 + TreeSitter.Node.TSPoint + r2_448 + c2_449 = TreeSitter.Node.nodeEndPoint node_445 + +deriving instance GHC.Classes.Eq a_450 => GHC.Classes.Eq (Function a_450) + +deriving instance GHC.Classes.Ord a_451 => GHC.Classes.Ord (Function a_451) + +deriving instance GHC.Show.Show a_452 => GHC.Show.Show (Function a_452) + +instance AST.Unmarshal.Unmarshal Function + +instance Data.Foldable.Foldable Function where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Function where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Function where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionDeclaration a = FunctionDeclaration + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err (StatementBlock a)), + name :: (AST.Parse.Err (Identifier a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_453. + AST.Traversable1.Class.Traversable1 a_453 + ) + +instance AST.Unmarshal.SymbolMatching FunctionDeclaration where + matchedSymbols _ = [189] + showFailure _ node_454 = + "expected " + GHC.Base.<> ( "function_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_454 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_454) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_455 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_456 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_457 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_458 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_455 + c1_456 = TreeSitter.Node.nodeStartPoint node_454 + TreeSitter.Node.TSPoint + r2_457 + c2_458 = TreeSitter.Node.nodeEndPoint node_454 + +deriving instance GHC.Classes.Eq a_459 => GHC.Classes.Eq (FunctionDeclaration a_459) + +deriving instance GHC.Classes.Ord a_460 => GHC.Classes.Ord (FunctionDeclaration a_460) + +deriving instance GHC.Show.Show a_461 => GHC.Show.Show (FunctionDeclaration a_461) + +instance AST.Unmarshal.Unmarshal FunctionDeclaration + +instance Data.Foldable.Foldable FunctionDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionSignature a = FunctionSignature + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + name :: (AST.Parse.Err (Identifier a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_462. + AST.Traversable1.Class.Traversable1 a_462 + ) + +instance AST.Unmarshal.SymbolMatching FunctionSignature where + matchedSymbols _ = [228] + showFailure _ node_463 = + "expected " + GHC.Base.<> ( "function_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_463 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_463) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_464 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_465 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_466 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_467 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_464 + c1_465 = TreeSitter.Node.nodeStartPoint node_463 + TreeSitter.Node.TSPoint + r2_466 + c2_467 = TreeSitter.Node.nodeEndPoint node_463 + +deriving instance GHC.Classes.Eq a_468 => GHC.Classes.Eq (FunctionSignature a_468) + +deriving instance GHC.Classes.Ord a_469 => GHC.Classes.Ord (FunctionSignature a_469) + +deriving instance GHC.Show.Show a_470 => GHC.Show.Show (FunctionSignature a_470) + +instance AST.Unmarshal.Unmarshal FunctionSignature + +instance Data.Foldable.Foldable FunctionSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data FunctionType a = FunctionType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FormalParameters GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypeParameters GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_471. + AST.Traversable1.Class.Traversable1 a_471 + ) + +instance AST.Unmarshal.SymbolMatching FunctionType where + matchedSymbols _ = [280] + showFailure _ node_472 = + "expected " + GHC.Base.<> ( "function_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_472 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_472) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_473 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_474 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_475 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_476 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_473 + c1_474 = TreeSitter.Node.nodeStartPoint node_472 + TreeSitter.Node.TSPoint + r2_475 + c2_476 = TreeSitter.Node.nodeEndPoint node_472 + +deriving instance GHC.Classes.Eq a_477 => GHC.Classes.Eq (FunctionType a_477) + +deriving instance GHC.Classes.Ord a_478 => GHC.Classes.Ord (FunctionType a_478) + +deriving instance GHC.Show.Show a_479 => GHC.Show.Show (FunctionType a_479) + +instance AST.Unmarshal.Unmarshal FunctionType + +instance Data.Foldable.Foldable FunctionType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor FunctionType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable FunctionType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GeneratorFunction a = GeneratorFunction + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err (StatementBlock a)), + name :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_480. + AST.Traversable1.Class.Traversable1 a_480 + ) + +instance AST.Unmarshal.SymbolMatching GeneratorFunction where + matchedSymbols _ = [190] + showFailure _ node_481 = + "expected " + GHC.Base.<> ( "generator_function" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_481 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_481) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_482 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_483 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_484 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_485 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_482 + c1_483 = TreeSitter.Node.nodeStartPoint node_481 + TreeSitter.Node.TSPoint + r2_484 + c2_485 = TreeSitter.Node.nodeEndPoint node_481 + +deriving instance GHC.Classes.Eq a_486 => GHC.Classes.Eq (GeneratorFunction a_486) + +deriving instance GHC.Classes.Ord a_487 => GHC.Classes.Ord (GeneratorFunction a_487) + +deriving instance GHC.Show.Show a_488 => GHC.Show.Show (GeneratorFunction a_488) + +instance AST.Unmarshal.Unmarshal GeneratorFunction + +instance Data.Foldable.Foldable GeneratorFunction where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GeneratorFunction where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GeneratorFunction where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GeneratorFunctionDeclaration a = GeneratorFunctionDeclaration + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err (StatementBlock a)), + name :: (AST.Parse.Err (Identifier a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_489. + AST.Traversable1.Class.Traversable1 a_489 + ) + +instance AST.Unmarshal.SymbolMatching GeneratorFunctionDeclaration where + matchedSymbols _ = [191] + showFailure _ node_490 = + "expected " + GHC.Base.<> ( "generator_function_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_490 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_490) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_491 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_492 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_493 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_494 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_491 + c1_492 = TreeSitter.Node.nodeStartPoint node_490 + TreeSitter.Node.TSPoint + r2_493 + c2_494 = TreeSitter.Node.nodeEndPoint node_490 + +deriving instance GHC.Classes.Eq a_495 => GHC.Classes.Eq (GeneratorFunctionDeclaration a_495) + +deriving instance GHC.Classes.Ord a_496 => GHC.Classes.Ord (GeneratorFunctionDeclaration a_496) + +deriving instance GHC.Show.Show a_497 => GHC.Show.Show (GeneratorFunctionDeclaration a_497) + +instance AST.Unmarshal.Unmarshal GeneratorFunctionDeclaration + +instance Data.Foldable.Foldable GeneratorFunctionDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GeneratorFunctionDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GeneratorFunctionDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data GenericType a = GenericType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((NestedTypeIdentifier GHC.Generics.:+: TypeArguments GHC.Generics.:+: TypeIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_498. + AST.Traversable1.Class.Traversable1 a_498 + ) + +instance AST.Unmarshal.SymbolMatching GenericType where + matchedSymbols _ = [254] + showFailure _ node_499 = + "expected " + GHC.Base.<> ( "generic_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_499 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_499) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_500 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_501 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_502 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_503 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_500 + c1_501 = TreeSitter.Node.nodeStartPoint node_499 + TreeSitter.Node.TSPoint + r2_502 + c2_503 = TreeSitter.Node.nodeEndPoint node_499 + +deriving instance GHC.Classes.Eq a_504 => GHC.Classes.Eq (GenericType a_504) + +deriving instance GHC.Classes.Ord a_505 => GHC.Classes.Ord (GenericType a_505) + +deriving instance GHC.Show.Show a_506 => GHC.Show.Show (GenericType a_506) + +instance AST.Unmarshal.Unmarshal GenericType + +instance Data.Foldable.Foldable GenericType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor GenericType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable GenericType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IfStatement a = IfStatement + { ann :: a, + alternative :: (GHC.Maybe.Maybe (AST.Parse.Err (Statement a))), + consequence :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_507. + AST.Traversable1.Class.Traversable1 a_507 + ) + +instance AST.Unmarshal.SymbolMatching IfStatement where + matchedSymbols _ = [157] + showFailure _ node_508 = + "expected " + GHC.Base.<> ( "if_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_508 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_508) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_509 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_510 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_511 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_512 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_509 + c1_510 = TreeSitter.Node.nodeStartPoint node_508 + TreeSitter.Node.TSPoint + r2_511 + c2_512 = TreeSitter.Node.nodeEndPoint node_508 + +deriving instance GHC.Classes.Eq a_513 => GHC.Classes.Eq (IfStatement a_513) + +deriving instance GHC.Classes.Ord a_514 => GHC.Classes.Ord (IfStatement a_514) + +deriving instance GHC.Show.Show a_515 => GHC.Show.Show (IfStatement a_515) + +instance AST.Unmarshal.Unmarshal IfStatement + +instance Data.Foldable.Foldable IfStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IfStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IfStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImplementsClause a = ImplementsClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_516. + AST.Traversable1.Class.Traversable1 a_516 + ) + +instance AST.Unmarshal.SymbolMatching ImplementsClause where + matchedSymbols _ = [232] + showFailure _ node_517 = + "expected " + GHC.Base.<> ( "implements_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_517 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_517) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_518 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_519 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_520 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_521 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_518 + c1_519 = TreeSitter.Node.nodeStartPoint node_517 + TreeSitter.Node.TSPoint + r2_520 + c2_521 = TreeSitter.Node.nodeEndPoint node_517 + +deriving instance GHC.Classes.Eq a_522 => GHC.Classes.Eq (ImplementsClause a_522) + +deriving instance GHC.Classes.Ord a_523 => GHC.Classes.Ord (ImplementsClause a_523) + +deriving instance GHC.Show.Show a_524 => GHC.Show.Show (ImplementsClause a_524) + +instance AST.Unmarshal.Unmarshal ImplementsClause + +instance Data.Foldable.Foldable ImplementsClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImplementsClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImplementsClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Import a = Import {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_525. + AST.Traversable1.Class.Traversable1 a_525 + ) + +instance AST.Unmarshal.SymbolMatching Import where + matchedSymbols _ = [146] + showFailure _ node_526 = + "expected " + GHC.Base.<> ( "import" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_526 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_526) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_527 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_528 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_529 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_530 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_527 + c1_528 = TreeSitter.Node.nodeStartPoint node_526 + TreeSitter.Node.TSPoint + r2_529 + c2_530 = TreeSitter.Node.nodeEndPoint node_526 + +deriving instance GHC.Classes.Eq a_531 => GHC.Classes.Eq (Import a_531) + +deriving instance GHC.Classes.Ord a_532 => GHC.Classes.Ord (Import a_532) + +deriving instance GHC.Show.Show a_533 => GHC.Show.Show (Import a_533) + +instance AST.Unmarshal.Unmarshal Import + +instance Data.Foldable.Foldable Import where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Import where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Import where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportAlias a = ImportAlias + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_534. + AST.Traversable1.Class.Traversable1 a_534 + ) + +instance AST.Unmarshal.SymbolMatching ImportAlias where + matchedSymbols _ = [238] + showFailure _ node_535 = + "expected " + GHC.Base.<> ( "import_alias" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_535 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_535) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_536 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_537 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_538 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_539 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_536 + c1_537 = TreeSitter.Node.nodeStartPoint node_535 + TreeSitter.Node.TSPoint + r2_538 + c2_539 = TreeSitter.Node.nodeEndPoint node_535 + +deriving instance GHC.Classes.Eq a_540 => GHC.Classes.Eq (ImportAlias a_540) + +deriving instance GHC.Classes.Ord a_541 => GHC.Classes.Ord (ImportAlias a_541) + +deriving instance GHC.Show.Show a_542 => GHC.Show.Show (ImportAlias a_542) + +instance AST.Unmarshal.Unmarshal ImportAlias + +instance Data.Foldable.Foldable ImportAlias where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportAlias where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportAlias where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportClause a = ImportClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: NamedImports GHC.Generics.:+: NamespaceImport) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_543. + AST.Traversable1.Class.Traversable1 a_543 + ) + +instance AST.Unmarshal.SymbolMatching ImportClause where + matchedSymbols _ = [148] + showFailure _ node_544 = + "expected " + GHC.Base.<> ( "import_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_544 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_544) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_545 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_546 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_547 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_548 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_545 + c1_546 = TreeSitter.Node.nodeStartPoint node_544 + TreeSitter.Node.TSPoint + r2_547 + c2_548 = TreeSitter.Node.nodeEndPoint node_544 + +deriving instance GHC.Classes.Eq a_549 => GHC.Classes.Eq (ImportClause a_549) + +deriving instance GHC.Classes.Ord a_550 => GHC.Classes.Ord (ImportClause a_550) + +deriving instance GHC.Show.Show a_551 => GHC.Show.Show (ImportClause a_551) + +instance AST.Unmarshal.Unmarshal ImportClause + +instance Data.Foldable.Foldable ImportClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportRequireClause a = ImportRequireClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: String) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_552. + AST.Traversable1.Class.Traversable1 a_552 + ) + +instance AST.Unmarshal.SymbolMatching ImportRequireClause where + matchedSymbols _ = [231] + showFailure _ node_553 = + "expected " + GHC.Base.<> ( "import_require_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_553 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_553) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_554 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_555 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_556 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_557 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_554 + c1_555 = TreeSitter.Node.nodeStartPoint node_553 + TreeSitter.Node.TSPoint + r2_556 + c2_557 = TreeSitter.Node.nodeEndPoint node_553 + +deriving instance GHC.Classes.Eq a_558 => GHC.Classes.Eq (ImportRequireClause a_558) + +deriving instance GHC.Classes.Ord a_559 => GHC.Classes.Ord (ImportRequireClause a_559) + +deriving instance GHC.Show.Show a_560 => GHC.Show.Show (ImportRequireClause a_560) + +instance AST.Unmarshal.Unmarshal ImportRequireClause + +instance Data.Foldable.Foldable ImportRequireClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportRequireClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportRequireClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportSpecifier a = ImportSpecifier + { ann :: a, + alias :: (GHC.Maybe.Maybe (AST.Parse.Err (Identifier a))), + name :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_561. + AST.Traversable1.Class.Traversable1 a_561 + ) + +instance AST.Unmarshal.SymbolMatching ImportSpecifier where + matchedSymbols _ = [301] + showFailure _ node_562 = + "expected " + GHC.Base.<> ( "import_specifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_562 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_562) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_563 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_564 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_565 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_566 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_563 + c1_564 = TreeSitter.Node.nodeStartPoint node_562 + TreeSitter.Node.TSPoint + r2_565 + c2_566 = TreeSitter.Node.nodeEndPoint node_562 + +deriving instance GHC.Classes.Eq a_567 => GHC.Classes.Eq (ImportSpecifier a_567) + +deriving instance GHC.Classes.Ord a_568 => GHC.Classes.Ord (ImportSpecifier a_568) + +deriving instance GHC.Show.Show a_569 => GHC.Show.Show (ImportSpecifier a_569) + +instance AST.Unmarshal.Unmarshal ImportSpecifier + +instance Data.Foldable.Foldable ImportSpecifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportSpecifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportSpecifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ImportStatement a = ImportStatement + { ann :: a, + source :: (GHC.Maybe.Maybe (AST.Parse.Err (String a))), + extraChildren :: (AST.Parse.Err ((ImportClause GHC.Generics.:+: ImportRequireClause GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_570. + AST.Traversable1.Class.Traversable1 a_570 + ) + +instance AST.Unmarshal.SymbolMatching ImportStatement where + matchedSymbols _ = [147] + showFailure _ node_571 = + "expected " + GHC.Base.<> ( "import_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_571 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_571) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_572 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_573 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_574 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_575 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_572 + c1_573 = TreeSitter.Node.nodeStartPoint node_571 + TreeSitter.Node.TSPoint + r2_574 + c2_575 = TreeSitter.Node.nodeEndPoint node_571 + +deriving instance GHC.Classes.Eq a_576 => GHC.Classes.Eq (ImportStatement a_576) + +deriving instance GHC.Classes.Ord a_577 => GHC.Classes.Ord (ImportStatement a_577) + +deriving instance GHC.Show.Show a_578 => GHC.Show.Show (ImportStatement a_578) + +instance AST.Unmarshal.Unmarshal ImportStatement + +instance Data.Foldable.Foldable ImportStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ImportStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ImportStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IndexSignature a = IndexSignature + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: MappedTypeClause GHC.Generics.:+: PredefinedType GHC.Generics.:+: TypeAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_579. + AST.Traversable1.Class.Traversable1 a_579 + ) + +instance AST.Unmarshal.SymbolMatching IndexSignature where + matchedSymbols _ = [275] + showFailure _ node_580 = + "expected " + GHC.Base.<> ( "index_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_580 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_580) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_581 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_582 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_583 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_584 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_581 + c1_582 = TreeSitter.Node.nodeStartPoint node_580 + TreeSitter.Node.TSPoint + r2_583 + c2_584 = TreeSitter.Node.nodeEndPoint node_580 + +deriving instance GHC.Classes.Eq a_585 => GHC.Classes.Eq (IndexSignature a_585) + +deriving instance GHC.Classes.Ord a_586 => GHC.Classes.Ord (IndexSignature a_586) + +deriving instance GHC.Show.Show a_587 => GHC.Show.Show (IndexSignature a_587) + +instance AST.Unmarshal.Unmarshal IndexSignature + +instance Data.Foldable.Foldable IndexSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IndexSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IndexSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IndexTypeQuery a = IndexTypeQuery + { ann :: a, + extraChildren :: (AST.Parse.Err ((NestedTypeIdentifier GHC.Generics.:+: TypeIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_588. + AST.Traversable1.Class.Traversable1 a_588 + ) + +instance AST.Unmarshal.SymbolMatching IndexTypeQuery where + matchedSymbols _ = [257] + showFailure _ node_589 = + "expected " + GHC.Base.<> ( "index_type_query" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_589 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_589) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_590 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_591 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_592 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_593 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_590 + c1_591 = TreeSitter.Node.nodeStartPoint node_589 + TreeSitter.Node.TSPoint + r2_592 + c2_593 = TreeSitter.Node.nodeEndPoint node_589 + +deriving instance GHC.Classes.Eq a_594 => GHC.Classes.Eq (IndexTypeQuery a_594) + +deriving instance GHC.Classes.Ord a_595 => GHC.Classes.Ord (IndexTypeQuery a_595) + +deriving instance GHC.Show.Show a_596 => GHC.Show.Show (IndexTypeQuery a_596) + +instance AST.Unmarshal.Unmarshal IndexTypeQuery + +instance Data.Foldable.Foldable IndexTypeQuery where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IndexTypeQuery where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IndexTypeQuery where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InterfaceDeclaration a = InterfaceDeclaration + { ann :: a, + body :: (AST.Parse.Err (ObjectType a)), + name :: (AST.Parse.Err (TypeIdentifier a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (ExtendsClause a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_597. + AST.Traversable1.Class.Traversable1 a_597 + ) + +instance AST.Unmarshal.SymbolMatching InterfaceDeclaration where + matchedSymbols _ = [240] + showFailure _ node_598 = + "expected " + GHC.Base.<> ( "interface_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_598 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_598) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_599 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_600 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_601 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_602 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_599 + c1_600 = TreeSitter.Node.nodeStartPoint node_598 + TreeSitter.Node.TSPoint + r2_601 + c2_602 = TreeSitter.Node.nodeEndPoint node_598 + +deriving instance GHC.Classes.Eq a_603 => GHC.Classes.Eq (InterfaceDeclaration a_603) + +deriving instance GHC.Classes.Ord a_604 => GHC.Classes.Ord (InterfaceDeclaration a_604) + +deriving instance GHC.Show.Show a_605 => GHC.Show.Show (InterfaceDeclaration a_605) + +instance AST.Unmarshal.Unmarshal InterfaceDeclaration + +instance Data.Foldable.Foldable InterfaceDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InterfaceDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InterfaceDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data InternalModule a = InternalModule + { ann :: a, + body :: (GHC.Maybe.Maybe (AST.Parse.Err (StatementBlock a))), + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_606. + AST.Traversable1.Class.Traversable1 a_606 + ) + +instance AST.Unmarshal.SymbolMatching InternalModule where + matchedSymbols _ = [236] + showFailure _ node_607 = + "expected " + GHC.Base.<> ( "internal_module" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_607 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_607) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_608 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_609 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_610 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_611 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_608 + c1_609 = TreeSitter.Node.nodeStartPoint node_607 + TreeSitter.Node.TSPoint + r2_610 + c2_611 = TreeSitter.Node.nodeEndPoint node_607 + +deriving instance GHC.Classes.Eq a_612 => GHC.Classes.Eq (InternalModule a_612) + +deriving instance GHC.Classes.Ord a_613 => GHC.Classes.Ord (InternalModule a_613) + +deriving instance GHC.Show.Show a_614 => GHC.Show.Show (InternalModule a_614) + +instance AST.Unmarshal.Unmarshal InternalModule + +instance Data.Foldable.Foldable InternalModule where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor InternalModule where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable InternalModule where + traverse = AST.Traversable1.Class.traverseDefault1 + +data IntersectionType a = IntersectionType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_615. + AST.Traversable1.Class.Traversable1 a_615 + ) + +instance AST.Unmarshal.SymbolMatching IntersectionType where + matchedSymbols _ = [279] + showFailure _ node_616 = + "expected " + GHC.Base.<> ( "intersection_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_616 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_616) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_617 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_618 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_619 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_620 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_617 + c1_618 = TreeSitter.Node.nodeStartPoint node_616 + TreeSitter.Node.TSPoint + r2_619 + c2_620 = TreeSitter.Node.nodeEndPoint node_616 + +deriving instance GHC.Classes.Eq a_621 => GHC.Classes.Eq (IntersectionType a_621) + +deriving instance GHC.Classes.Ord a_622 => GHC.Classes.Ord (IntersectionType a_622) + +deriving instance GHC.Show.Show a_623 => GHC.Show.Show (IntersectionType a_623) + +instance AST.Unmarshal.Unmarshal IntersectionType + +instance Data.Foldable.Foldable IntersectionType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor IntersectionType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable IntersectionType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxAttribute a = JsxAttribute + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((JsxElement GHC.Generics.:+: JsxExpression GHC.Generics.:+: JsxFragment GHC.Generics.:+: JsxNamespaceName GHC.Generics.:+: JsxSelfClosingElement GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_624. + AST.Traversable1.Class.Traversable1 a_624 + ) + +instance AST.Unmarshal.SymbolMatching JsxAttribute where + matchedSymbols _ = [] + showFailure _ node_625 = + "expected " + GHC.Base.<> ( "" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_625 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_625) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_626 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_627 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_628 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_629 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_626 + c1_627 = TreeSitter.Node.nodeStartPoint node_625 + TreeSitter.Node.TSPoint + r2_628 + c2_629 = TreeSitter.Node.nodeEndPoint node_625 + +deriving instance GHC.Classes.Eq a_630 => GHC.Classes.Eq (JsxAttribute a_630) + +deriving instance GHC.Classes.Ord a_631 => GHC.Classes.Ord (JsxAttribute a_631) + +deriving instance GHC.Show.Show a_632 => GHC.Show.Show (JsxAttribute a_632) + +instance AST.Unmarshal.Unmarshal JsxAttribute + +instance Data.Foldable.Foldable JsxAttribute where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxAttribute where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxAttribute where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxClosingElement a = JsxClosingElement + { ann :: a, + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: JsxNamespaceName GHC.Generics.:+: NestedIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_633. + AST.Traversable1.Class.Traversable1 a_633 + ) + +instance AST.Unmarshal.SymbolMatching JsxClosingElement where + matchedSymbols _ = [] + showFailure _ node_634 = + "expected " + GHC.Base.<> ( "" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_634 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_634) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_635 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_636 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_637 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_638 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_635 + c1_636 = TreeSitter.Node.nodeStartPoint node_634 + TreeSitter.Node.TSPoint + r2_637 + c2_638 = TreeSitter.Node.nodeEndPoint node_634 + +deriving instance GHC.Classes.Eq a_639 => GHC.Classes.Eq (JsxClosingElement a_639) + +deriving instance GHC.Classes.Ord a_640 => GHC.Classes.Ord (JsxClosingElement a_640) + +deriving instance GHC.Show.Show a_641 => GHC.Show.Show (JsxClosingElement a_641) + +instance AST.Unmarshal.Unmarshal JsxClosingElement + +instance Data.Foldable.Foldable JsxClosingElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxClosingElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxClosingElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxElement a = JsxElement + { ann :: a, + closeTag :: (AST.Parse.Err (JsxClosingElement a)), + openTag :: (AST.Parse.Err (JsxOpeningElement a)), + extraChildren :: ([AST.Parse.Err ((JsxElement GHC.Generics.:+: JsxExpression GHC.Generics.:+: JsxSelfClosingElement GHC.Generics.:+: JsxText) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_642. + AST.Traversable1.Class.Traversable1 a_642 + ) + +instance AST.Unmarshal.SymbolMatching JsxElement where + matchedSymbols _ = [] + showFailure _ node_643 = + "expected " + GHC.Base.<> ( "" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_643 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_643) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_644 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_645 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_646 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_647 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_644 + c1_645 = TreeSitter.Node.nodeStartPoint node_643 + TreeSitter.Node.TSPoint + r2_646 + c2_647 = TreeSitter.Node.nodeEndPoint node_643 + +deriving instance GHC.Classes.Eq a_648 => GHC.Classes.Eq (JsxElement a_648) + +deriving instance GHC.Classes.Ord a_649 => GHC.Classes.Ord (JsxElement a_649) + +deriving instance GHC.Show.Show a_650 => GHC.Show.Show (JsxElement a_650) + +instance AST.Unmarshal.Unmarshal JsxElement + +instance Data.Foldable.Foldable JsxElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxExpression a = JsxExpression + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression GHC.Generics.:+: SpreadElement) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_651. + AST.Traversable1.Class.Traversable1 a_651 + ) + +instance AST.Unmarshal.SymbolMatching JsxExpression where + matchedSymbols _ = [] + showFailure _ node_652 = + "expected " + GHC.Base.<> ( "" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_652 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_652) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_653 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_654 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_655 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_656 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_653 + c1_654 = TreeSitter.Node.nodeStartPoint node_652 + TreeSitter.Node.TSPoint + r2_655 + c2_656 = TreeSitter.Node.nodeEndPoint node_652 + +deriving instance GHC.Classes.Eq a_657 => GHC.Classes.Eq (JsxExpression a_657) + +deriving instance GHC.Classes.Ord a_658 => GHC.Classes.Ord (JsxExpression a_658) + +deriving instance GHC.Show.Show a_659 => GHC.Show.Show (JsxExpression a_659) + +instance AST.Unmarshal.Unmarshal JsxExpression + +instance Data.Foldable.Foldable JsxExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxFragment a = JsxFragment + { ann :: a, + extraChildren :: ([AST.Parse.Err ((JsxElement GHC.Generics.:+: JsxExpression GHC.Generics.:+: JsxSelfClosingElement GHC.Generics.:+: JsxText) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_660. + AST.Traversable1.Class.Traversable1 a_660 + ) + +instance AST.Unmarshal.SymbolMatching JsxFragment where + matchedSymbols _ = [] + showFailure _ node_661 = + "expected " + GHC.Base.<> ( "" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_661 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_661) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_662 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_663 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_664 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_665 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_662 + c1_663 = TreeSitter.Node.nodeStartPoint node_661 + TreeSitter.Node.TSPoint + r2_664 + c2_665 = TreeSitter.Node.nodeEndPoint node_661 + +deriving instance GHC.Classes.Eq a_666 => GHC.Classes.Eq (JsxFragment a_666) + +deriving instance GHC.Classes.Ord a_667 => GHC.Classes.Ord (JsxFragment a_667) + +deriving instance GHC.Show.Show a_668 => GHC.Show.Show (JsxFragment a_668) + +instance AST.Unmarshal.Unmarshal JsxFragment + +instance Data.Foldable.Foldable JsxFragment where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxFragment where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxFragment where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxNamespaceName a = JsxNamespaceName + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (Identifier a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_669. + AST.Traversable1.Class.Traversable1 a_669 + ) + +instance AST.Unmarshal.SymbolMatching JsxNamespaceName where + matchedSymbols _ = [] + showFailure _ node_670 = + "expected " + GHC.Base.<> ( "" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_670 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_670) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_671 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_672 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_673 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_674 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_671 + c1_672 = TreeSitter.Node.nodeStartPoint node_670 + TreeSitter.Node.TSPoint + r2_673 + c2_674 = TreeSitter.Node.nodeEndPoint node_670 + +deriving instance GHC.Classes.Eq a_675 => GHC.Classes.Eq (JsxNamespaceName a_675) + +deriving instance GHC.Classes.Ord a_676 => GHC.Classes.Ord (JsxNamespaceName a_676) + +deriving instance GHC.Show.Show a_677 => GHC.Show.Show (JsxNamespaceName a_677) + +instance AST.Unmarshal.Unmarshal JsxNamespaceName + +instance Data.Foldable.Foldable JsxNamespaceName where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxNamespaceName where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxNamespaceName where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxOpeningElement a = JsxOpeningElement + { ann :: a, + attribute :: ([AST.Parse.Err ((JsxAttribute GHC.Generics.:+: JsxExpression) a)]), + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: JsxNamespaceName GHC.Generics.:+: NestedIdentifier) a)), + typeArguments :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeArguments a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_678. + AST.Traversable1.Class.Traversable1 a_678 + ) + +instance AST.Unmarshal.SymbolMatching JsxOpeningElement where + matchedSymbols _ = [] + showFailure _ node_679 = + "expected " + GHC.Base.<> ( "" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_679 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_679) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_680 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_681 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_682 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_683 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_680 + c1_681 = TreeSitter.Node.nodeStartPoint node_679 + TreeSitter.Node.TSPoint + r2_682 + c2_683 = TreeSitter.Node.nodeEndPoint node_679 + +deriving instance GHC.Classes.Eq a_684 => GHC.Classes.Eq (JsxOpeningElement a_684) + +deriving instance GHC.Classes.Ord a_685 => GHC.Classes.Ord (JsxOpeningElement a_685) + +deriving instance GHC.Show.Show a_686 => GHC.Show.Show (JsxOpeningElement a_686) + +instance AST.Unmarshal.Unmarshal JsxOpeningElement + +instance Data.Foldable.Foldable JsxOpeningElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxOpeningElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxOpeningElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data JsxSelfClosingElement a = JsxSelfClosingElement + { ann :: a, + attribute :: ([AST.Parse.Err ((JsxAttribute GHC.Generics.:+: JsxExpression) a)]), + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: JsxNamespaceName GHC.Generics.:+: NestedIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_687. + AST.Traversable1.Class.Traversable1 a_687 + ) + +instance AST.Unmarshal.SymbolMatching JsxSelfClosingElement where + matchedSymbols _ = [] + showFailure _ node_688 = + "expected " + GHC.Base.<> ( "" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_688 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_688) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_689 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_690 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_691 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_692 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_689 + c1_690 = TreeSitter.Node.nodeStartPoint node_688 + TreeSitter.Node.TSPoint + r2_691 + c2_692 = TreeSitter.Node.nodeEndPoint node_688 + +deriving instance GHC.Classes.Eq a_693 => GHC.Classes.Eq (JsxSelfClosingElement a_693) + +deriving instance GHC.Classes.Ord a_694 => GHC.Classes.Ord (JsxSelfClosingElement a_694) + +deriving instance GHC.Show.Show a_695 => GHC.Show.Show (JsxSelfClosingElement a_695) + +instance AST.Unmarshal.Unmarshal JsxSelfClosingElement + +instance Data.Foldable.Foldable JsxSelfClosingElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxSelfClosingElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxSelfClosingElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LabeledStatement a = LabeledStatement + { ann :: a, + label :: (AST.Parse.Err (StatementIdentifier a)), + extraChildren :: (AST.Parse.Err (Statement a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_696. + AST.Traversable1.Class.Traversable1 a_696 + ) + +instance AST.Unmarshal.SymbolMatching LabeledStatement where + matchedSymbols _ = [172] + showFailure _ node_697 = + "expected " + GHC.Base.<> ( "labeled_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_697 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_697) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_698 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_699 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_700 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_701 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_698 + c1_699 = TreeSitter.Node.nodeStartPoint node_697 + TreeSitter.Node.TSPoint + r2_700 + c2_701 = TreeSitter.Node.nodeEndPoint node_697 + +deriving instance GHC.Classes.Eq a_702 => GHC.Classes.Eq (LabeledStatement a_702) + +deriving instance GHC.Classes.Ord a_703 => GHC.Classes.Ord (LabeledStatement a_703) + +deriving instance GHC.Show.Show a_704 => GHC.Show.Show (LabeledStatement a_704) + +instance AST.Unmarshal.Unmarshal LabeledStatement + +instance Data.Foldable.Foldable LabeledStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LabeledStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LabeledStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LexicalDeclaration a = LexicalDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (VariableDeclarator a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_705. + AST.Traversable1.Class.Traversable1 a_705 + ) + +instance AST.Unmarshal.SymbolMatching LexicalDeclaration where + matchedSymbols _ = [154] + showFailure _ node_706 = + "expected " + GHC.Base.<> ( "lexical_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_706 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_706) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_707 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_708 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_709 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_710 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_707 + c1_708 = TreeSitter.Node.nodeStartPoint node_706 + TreeSitter.Node.TSPoint + r2_709 + c2_710 = TreeSitter.Node.nodeEndPoint node_706 + +deriving instance GHC.Classes.Eq a_711 => GHC.Classes.Eq (LexicalDeclaration a_711) + +deriving instance GHC.Classes.Ord a_712 => GHC.Classes.Ord (LexicalDeclaration a_712) + +deriving instance GHC.Show.Show a_713 => GHC.Show.Show (LexicalDeclaration a_713) + +instance AST.Unmarshal.Unmarshal LexicalDeclaration + +instance Data.Foldable.Foldable LexicalDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LexicalDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LexicalDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LiteralType a = LiteralType + { ann :: a, + extraChildren :: (AST.Parse.Err ((False GHC.Generics.:+: Number GHC.Generics.:+: String GHC.Generics.:+: True GHC.Generics.:+: UnaryExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_714. + AST.Traversable1.Class.Traversable1 a_714 + ) + +instance AST.Unmarshal.SymbolMatching LiteralType where + matchedSymbols _ = [260] + showFailure _ node_715 = + "expected " + GHC.Base.<> ( "literal_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_715 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_715) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_716 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_717 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_718 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_719 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_716 + c1_717 = TreeSitter.Node.nodeStartPoint node_715 + TreeSitter.Node.TSPoint + r2_718 + c2_719 = TreeSitter.Node.nodeEndPoint node_715 + +deriving instance GHC.Classes.Eq a_720 => GHC.Classes.Eq (LiteralType a_720) + +deriving instance GHC.Classes.Ord a_721 => GHC.Classes.Ord (LiteralType a_721) + +deriving instance GHC.Show.Show a_722 => GHC.Show.Show (LiteralType a_722) + +instance AST.Unmarshal.Unmarshal LiteralType + +instance Data.Foldable.Foldable LiteralType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LiteralType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LiteralType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data LookupType a = LookupType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_723. + AST.Traversable1.Class.Traversable1 a_723 + ) + +instance AST.Unmarshal.SymbolMatching LookupType where + matchedSymbols _ = [258] + showFailure _ node_724 = + "expected " + GHC.Base.<> ( "lookup_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_724 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_724) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_725 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_726 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_727 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_728 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_725 + c1_726 = TreeSitter.Node.nodeStartPoint node_724 + TreeSitter.Node.TSPoint + r2_727 + c2_728 = TreeSitter.Node.nodeEndPoint node_724 + +deriving instance GHC.Classes.Eq a_729 => GHC.Classes.Eq (LookupType a_729) + +deriving instance GHC.Classes.Ord a_730 => GHC.Classes.Ord (LookupType a_730) + +deriving instance GHC.Show.Show a_731 => GHC.Show.Show (LookupType a_731) + +instance AST.Unmarshal.Unmarshal LookupType + +instance Data.Foldable.Foldable LookupType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor LookupType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable LookupType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MappedTypeClause a = MappedTypeClause + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_732. + AST.Traversable1.Class.Traversable1 a_732 + ) + +instance AST.Unmarshal.SymbolMatching MappedTypeClause where + matchedSymbols _ = [259] + showFailure _ node_733 = + "expected " + GHC.Base.<> ( "mapped_type_clause" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_733 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_733) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_734 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_735 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_736 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_737 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_734 + c1_735 = TreeSitter.Node.nodeStartPoint node_733 + TreeSitter.Node.TSPoint + r2_736 + c2_737 = TreeSitter.Node.nodeEndPoint node_733 + +deriving instance GHC.Classes.Eq a_738 => GHC.Classes.Eq (MappedTypeClause a_738) + +deriving instance GHC.Classes.Ord a_739 => GHC.Classes.Ord (MappedTypeClause a_739) + +deriving instance GHC.Show.Show a_740 => GHC.Show.Show (MappedTypeClause a_740) + +instance AST.Unmarshal.Unmarshal MappedTypeClause + +instance Data.Foldable.Foldable MappedTypeClause where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MappedTypeClause where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MappedTypeClause where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MemberExpression a = MemberExpression + { ann :: a, + property :: (AST.Parse.Err (PropertyIdentifier a)), + object :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_741. + AST.Traversable1.Class.Traversable1 a_741 + ) + +instance AST.Unmarshal.SymbolMatching MemberExpression where + matchedSymbols _ = [197, 215] + showFailure _ node_742 = + "expected " + GHC.Base.<> ( "member_expression, member_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_742 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_742) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_743 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_744 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_745 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_746 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_743 + c1_744 = TreeSitter.Node.nodeStartPoint node_742 + TreeSitter.Node.TSPoint + r2_745 + c2_746 = TreeSitter.Node.nodeEndPoint node_742 + +deriving instance GHC.Classes.Eq a_747 => GHC.Classes.Eq (MemberExpression a_747) + +deriving instance GHC.Classes.Ord a_748 => GHC.Classes.Ord (MemberExpression a_748) + +deriving instance GHC.Show.Show a_749 => GHC.Show.Show (MemberExpression a_749) + +instance AST.Unmarshal.Unmarshal MemberExpression + +instance Data.Foldable.Foldable MemberExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MemberExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MemberExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MetaProperty a = MetaProperty {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_750. + AST.Traversable1.Class.Traversable1 a_750 + ) + +instance AST.Unmarshal.SymbolMatching MetaProperty where + matchedSymbols _ = [212] + showFailure _ node_751 = + "expected " + GHC.Base.<> ( "meta_property" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_751 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_751) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_752 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_753 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_754 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_755 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_752 + c1_753 = TreeSitter.Node.nodeStartPoint node_751 + TreeSitter.Node.TSPoint + r2_754 + c2_755 = TreeSitter.Node.nodeEndPoint node_751 + +deriving instance GHC.Classes.Eq a_756 => GHC.Classes.Eq (MetaProperty a_756) + +deriving instance GHC.Classes.Ord a_757 => GHC.Classes.Ord (MetaProperty a_757) + +deriving instance GHC.Show.Show a_758 => GHC.Show.Show (MetaProperty a_758) + +instance AST.Unmarshal.Unmarshal MetaProperty + +instance Data.Foldable.Foldable MetaProperty where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MetaProperty where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MetaProperty where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodDefinition a = MethodDefinition + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + body :: (AST.Parse.Err (StatementBlock a)), + name :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: ([AST.Parse.Err ((AccessibilityModifier GHC.Generics.:+: Readonly) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_759. + AST.Traversable1.Class.Traversable1 a_759 + ) + +instance AST.Unmarshal.SymbolMatching MethodDefinition where + matchedSymbols _ = [221] + showFailure _ node_760 = + "expected " + GHC.Base.<> ( "method_definition" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_760 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_760) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_761 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_762 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_763 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_764 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_761 + c1_762 = TreeSitter.Node.nodeStartPoint node_760 + TreeSitter.Node.TSPoint + r2_763 + c2_764 = TreeSitter.Node.nodeEndPoint node_760 + +deriving instance GHC.Classes.Eq a_765 => GHC.Classes.Eq (MethodDefinition a_765) + +deriving instance GHC.Classes.Ord a_766 => GHC.Classes.Ord (MethodDefinition a_766) + +deriving instance GHC.Show.Show a_767 => GHC.Show.Show (MethodDefinition a_767) + +instance AST.Unmarshal.Unmarshal MethodDefinition + +instance Data.Foldable.Foldable MethodDefinition where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodDefinition where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodDefinition where + traverse = AST.Traversable1.Class.traverseDefault1 + +data MethodSignature a = MethodSignature + { ann :: a, + returnType :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + name :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)), + parameters :: (AST.Parse.Err (FormalParameters a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))), + extraChildren :: ([AST.Parse.Err ((AccessibilityModifier GHC.Generics.:+: Readonly) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_768. + AST.Traversable1.Class.Traversable1 a_768 + ) + +instance AST.Unmarshal.SymbolMatching MethodSignature where + matchedSymbols _ = [226] + showFailure _ node_769 = + "expected " + GHC.Base.<> ( "method_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_769 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_769) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_770 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_771 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_772 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_773 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_770 + c1_771 = TreeSitter.Node.nodeStartPoint node_769 + TreeSitter.Node.TSPoint + r2_772 + c2_773 = TreeSitter.Node.nodeEndPoint node_769 + +deriving instance GHC.Classes.Eq a_774 => GHC.Classes.Eq (MethodSignature a_774) + +deriving instance GHC.Classes.Ord a_775 => GHC.Classes.Ord (MethodSignature a_775) + +deriving instance GHC.Show.Show a_776 => GHC.Show.Show (MethodSignature a_776) + +instance AST.Unmarshal.Unmarshal MethodSignature + +instance Data.Foldable.Foldable MethodSignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor MethodSignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable MethodSignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Module a = Module + { ann :: a, + body :: (GHC.Maybe.Maybe (AST.Parse.Err (StatementBlock a))), + name :: (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_777. + AST.Traversable1.Class.Traversable1 a_777 + ) + +instance AST.Unmarshal.SymbolMatching Module where + matchedSymbols _ = [235] + showFailure _ node_778 = + "expected " + GHC.Base.<> ( "module" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_778 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_778) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_779 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_780 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_781 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_782 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_779 + c1_780 = TreeSitter.Node.nodeStartPoint node_778 + TreeSitter.Node.TSPoint + r2_781 + c2_782 = TreeSitter.Node.nodeEndPoint node_778 + +deriving instance GHC.Classes.Eq a_783 => GHC.Classes.Eq (Module a_783) + +deriving instance GHC.Classes.Ord a_784 => GHC.Classes.Ord (Module a_784) + +deriving instance GHC.Show.Show a_785 => GHC.Show.Show (Module a_785) + +instance AST.Unmarshal.Unmarshal Module + +instance Data.Foldable.Foldable Module where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Module where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Module where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamedImports a = NamedImports + { ann :: a, + extraChildren :: ([AST.Parse.Err (ImportSpecifier a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_786. + AST.Traversable1.Class.Traversable1 a_786 + ) + +instance AST.Unmarshal.SymbolMatching NamedImports where + matchedSymbols _ = [151] + showFailure _ node_787 = + "expected " + GHC.Base.<> ( "named_imports" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_787 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_787) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_788 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_789 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_790 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_791 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_788 + c1_789 = TreeSitter.Node.nodeStartPoint node_787 + TreeSitter.Node.TSPoint + r2_790 + c2_791 = TreeSitter.Node.nodeEndPoint node_787 + +deriving instance GHC.Classes.Eq a_792 => GHC.Classes.Eq (NamedImports a_792) + +deriving instance GHC.Classes.Ord a_793 => GHC.Classes.Ord (NamedImports a_793) + +deriving instance GHC.Show.Show a_794 => GHC.Show.Show (NamedImports a_794) + +instance AST.Unmarshal.Unmarshal NamedImports + +instance Data.Foldable.Foldable NamedImports where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamedImports where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamedImports where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NamespaceImport a = NamespaceImport + { ann :: a, + extraChildren :: (AST.Parse.Err (Identifier a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_795. + AST.Traversable1.Class.Traversable1 a_795 + ) + +instance AST.Unmarshal.SymbolMatching NamespaceImport where + matchedSymbols _ = [150] + showFailure _ node_796 = + "expected " + GHC.Base.<> ( "namespace_import" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_796 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_796) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_797 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_798 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_799 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_800 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_797 + c1_798 = TreeSitter.Node.nodeStartPoint node_796 + TreeSitter.Node.TSPoint + r2_799 + c2_800 = TreeSitter.Node.nodeEndPoint node_796 + +deriving instance GHC.Classes.Eq a_801 => GHC.Classes.Eq (NamespaceImport a_801) + +deriving instance GHC.Classes.Ord a_802 => GHC.Classes.Ord (NamespaceImport a_802) + +deriving instance GHC.Show.Show a_803 => GHC.Show.Show (NamespaceImport a_803) + +instance AST.Unmarshal.Unmarshal NamespaceImport + +instance Data.Foldable.Foldable NamespaceImport where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NamespaceImport where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NamespaceImport where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NestedIdentifier a = NestedIdentifier + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_804. + AST.Traversable1.Class.Traversable1 a_804 + ) + +instance AST.Unmarshal.SymbolMatching NestedIdentifier where + matchedSymbols _ = [184] + showFailure _ node_805 = + "expected " + GHC.Base.<> ( "nested_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_805 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_805) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_806 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_807 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_808 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_809 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_806 + c1_807 = TreeSitter.Node.nodeStartPoint node_805 + TreeSitter.Node.TSPoint + r2_808 + c2_809 = TreeSitter.Node.nodeEndPoint node_805 + +deriving instance GHC.Classes.Eq a_810 => GHC.Classes.Eq (NestedIdentifier a_810) + +deriving instance GHC.Classes.Ord a_811 => GHC.Classes.Ord (NestedIdentifier a_811) + +deriving instance GHC.Show.Show a_812 => GHC.Show.Show (NestedIdentifier a_812) + +instance AST.Unmarshal.Unmarshal NestedIdentifier + +instance Data.Foldable.Foldable NestedIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NestedIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NestedIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NestedTypeIdentifier a = NestedTypeIdentifier + { ann :: a, + name :: (AST.Parse.Err (TypeIdentifier a)), + module' :: (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_813. + AST.Traversable1.Class.Traversable1 a_813 + ) + +instance AST.Unmarshal.SymbolMatching NestedTypeIdentifier where + matchedSymbols _ = [239] + showFailure _ node_814 = + "expected " + GHC.Base.<> ( "nested_type_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_814 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_814) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_815 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_816 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_817 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_818 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_815 + c1_816 = TreeSitter.Node.nodeStartPoint node_814 + TreeSitter.Node.TSPoint + r2_817 + c2_818 = TreeSitter.Node.nodeEndPoint node_814 + +deriving instance GHC.Classes.Eq a_819 => GHC.Classes.Eq (NestedTypeIdentifier a_819) + +deriving instance GHC.Classes.Ord a_820 => GHC.Classes.Ord (NestedTypeIdentifier a_820) + +deriving instance GHC.Show.Show a_821 => GHC.Show.Show (NestedTypeIdentifier a_821) + +instance AST.Unmarshal.Unmarshal NestedTypeIdentifier + +instance Data.Foldable.Foldable NestedTypeIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NestedTypeIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NestedTypeIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NewExpression a = NewExpression + { ann :: a, + arguments :: (GHC.Maybe.Maybe (AST.Parse.Err (Arguments a))), + constructor :: (AST.Parse.Err ((Array GHC.Generics.:+: ArrowFunction GHC.Generics.:+: Class GHC.Generics.:+: False GHC.Generics.:+: Function GHC.Generics.:+: GeneratorFunction GHC.Generics.:+: Identifier GHC.Generics.:+: Import GHC.Generics.:+: MemberExpression GHC.Generics.:+: MetaProperty GHC.Generics.:+: NewExpression GHC.Generics.:+: Null GHC.Generics.:+: Number GHC.Generics.:+: Object GHC.Generics.:+: ParenthesizedExpression GHC.Generics.:+: Regex GHC.Generics.:+: String GHC.Generics.:+: SubscriptExpression GHC.Generics.:+: TemplateString GHC.Generics.:+: This GHC.Generics.:+: True GHC.Generics.:+: Undefined) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_822. + AST.Traversable1.Class.Traversable1 a_822 + ) + +instance AST.Unmarshal.SymbolMatching NewExpression where + matchedSymbols _ = [195] + showFailure _ node_823 = + "expected " + GHC.Base.<> ( "new_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_823 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_823) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_824 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_825 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_826 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_827 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_824 + c1_825 = TreeSitter.Node.nodeStartPoint node_823 + TreeSitter.Node.TSPoint + r2_826 + c2_827 = TreeSitter.Node.nodeEndPoint node_823 + +deriving instance GHC.Classes.Eq a_828 => GHC.Classes.Eq (NewExpression a_828) + +deriving instance GHC.Classes.Ord a_829 => GHC.Classes.Ord (NewExpression a_829) + +deriving instance GHC.Show.Show a_830 => GHC.Show.Show (NewExpression a_830) + +instance AST.Unmarshal.Unmarshal NewExpression + +instance Data.Foldable.Foldable NewExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NewExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NewExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data NonNullExpression a = NonNullExpression + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_831. + AST.Traversable1.Class.Traversable1 a_831 + ) + +instance AST.Unmarshal.SymbolMatching NonNullExpression where + matchedSymbols _ = [225] + showFailure _ node_832 = + "expected " + GHC.Base.<> ( "non_null_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_832 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_832) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_833 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_834 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_835 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_836 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_833 + c1_834 = TreeSitter.Node.nodeStartPoint node_832 + TreeSitter.Node.TSPoint + r2_835 + c2_836 = TreeSitter.Node.nodeEndPoint node_832 + +deriving instance GHC.Classes.Eq a_837 => GHC.Classes.Eq (NonNullExpression a_837) + +deriving instance GHC.Classes.Ord a_838 => GHC.Classes.Ord (NonNullExpression a_838) + +deriving instance GHC.Show.Show a_839 => GHC.Show.Show (NonNullExpression a_839) + +instance AST.Unmarshal.Unmarshal NonNullExpression + +instance Data.Foldable.Foldable NonNullExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor NonNullExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable NonNullExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Object a = Object + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AssignmentPattern GHC.Generics.:+: MethodDefinition GHC.Generics.:+: Pair GHC.Generics.:+: ShorthandPropertyIdentifier GHC.Generics.:+: SpreadElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_840. + AST.Traversable1.Class.Traversable1 a_840 + ) + +instance AST.Unmarshal.SymbolMatching Object where + matchedSymbols _ = [181] + showFailure _ node_841 = + "expected " + GHC.Base.<> ( "object" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_841 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_841) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_842 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_843 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_844 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_845 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_842 + c1_843 = TreeSitter.Node.nodeStartPoint node_841 + TreeSitter.Node.TSPoint + r2_844 + c2_845 = TreeSitter.Node.nodeEndPoint node_841 + +deriving instance GHC.Classes.Eq a_846 => GHC.Classes.Eq (Object a_846) + +deriving instance GHC.Classes.Ord a_847 => GHC.Classes.Ord (Object a_847) + +deriving instance GHC.Show.Show a_848 => GHC.Show.Show (Object a_848) + +instance AST.Unmarshal.Unmarshal Object + +instance Data.Foldable.Foldable Object where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Object where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Object where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ObjectPattern a = ObjectPattern + { ann :: a, + extraChildren :: ([AST.Parse.Err ((AssignmentPattern GHC.Generics.:+: MethodDefinition GHC.Generics.:+: Pair GHC.Generics.:+: ShorthandPropertyIdentifier GHC.Generics.:+: SpreadElement) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_849. + AST.Traversable1.Class.Traversable1 a_849 + ) + +instance AST.Unmarshal.SymbolMatching ObjectPattern where + matchedSymbols _ = [302] + showFailure _ node_850 = + "expected " + GHC.Base.<> ( "object_pattern" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_850 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_850) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_851 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_852 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_853 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_854 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_851 + c1_852 = TreeSitter.Node.nodeStartPoint node_850 + TreeSitter.Node.TSPoint + r2_853 + c2_854 = TreeSitter.Node.nodeEndPoint node_850 + +deriving instance GHC.Classes.Eq a_855 => GHC.Classes.Eq (ObjectPattern a_855) + +deriving instance GHC.Classes.Ord a_856 => GHC.Classes.Ord (ObjectPattern a_856) + +deriving instance GHC.Show.Show a_857 => GHC.Show.Show (ObjectPattern a_857) + +instance AST.Unmarshal.Unmarshal ObjectPattern + +instance Data.Foldable.Foldable ObjectPattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ObjectPattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ObjectPattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ObjectType a = ObjectType + { ann :: a, + extraChildren :: ([AST.Parse.Err ((CallSignature GHC.Generics.:+: ConstructSignature GHC.Generics.:+: ExportStatement GHC.Generics.:+: IndexSignature GHC.Generics.:+: MethodSignature GHC.Generics.:+: PropertySignature) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_858. + AST.Traversable1.Class.Traversable1 a_858 + ) + +instance AST.Unmarshal.SymbolMatching ObjectType where + matchedSymbols _ = [267] + showFailure _ node_859 = + "expected " + GHC.Base.<> ( "object_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_859 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_859) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_860 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_861 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_862 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_863 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_860 + c1_861 = TreeSitter.Node.nodeStartPoint node_859 + TreeSitter.Node.TSPoint + r2_862 + c2_863 = TreeSitter.Node.nodeEndPoint node_859 + +deriving instance GHC.Classes.Eq a_864 => GHC.Classes.Eq (ObjectType a_864) + +deriving instance GHC.Classes.Ord a_865 => GHC.Classes.Ord (ObjectType a_865) + +deriving instance GHC.Show.Show a_866 => GHC.Show.Show (ObjectType a_866) + +instance AST.Unmarshal.Unmarshal ObjectType + +instance Data.Foldable.Foldable ObjectType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ObjectType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ObjectType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data OptionalParameter a = OptionalParameter + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: AccessibilityModifier GHC.Generics.:+: Identifier GHC.Generics.:+: Readonly GHC.Generics.:+: This GHC.Generics.:+: TypeAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_867. + AST.Traversable1.Class.Traversable1 a_867 + ) + +instance AST.Unmarshal.SymbolMatching OptionalParameter where + matchedSymbols _ = [248] + showFailure _ node_868 = + "expected " + GHC.Base.<> ( "optional_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_868 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_868) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_869 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_870 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_871 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_872 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_869 + c1_870 = TreeSitter.Node.nodeStartPoint node_868 + TreeSitter.Node.TSPoint + r2_871 + c2_872 = TreeSitter.Node.nodeEndPoint node_868 + +deriving instance GHC.Classes.Eq a_873 => GHC.Classes.Eq (OptionalParameter a_873) + +deriving instance GHC.Classes.Ord a_874 => GHC.Classes.Ord (OptionalParameter a_874) + +deriving instance GHC.Show.Show a_875 => GHC.Show.Show (OptionalParameter a_875) + +instance AST.Unmarshal.Unmarshal OptionalParameter + +instance Data.Foldable.Foldable OptionalParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor OptionalParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable OptionalParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Pair a = Pair + { ann :: a, + value :: (AST.Parse.Err (Expression a)), + key :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_876. + AST.Traversable1.Class.Traversable1 a_876 + ) + +instance AST.Unmarshal.SymbolMatching Pair where + matchedSymbols _ = [222] + showFailure _ node_877 = + "expected " + GHC.Base.<> ( "pair" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_877 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_877) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_878 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_879 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_880 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_881 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_878 + c1_879 = TreeSitter.Node.nodeStartPoint node_877 + TreeSitter.Node.TSPoint + r2_880 + c2_881 = TreeSitter.Node.nodeEndPoint node_877 + +deriving instance GHC.Classes.Eq a_882 => GHC.Classes.Eq (Pair a_882) + +deriving instance GHC.Classes.Ord a_883 => GHC.Classes.Ord (Pair a_883) + +deriving instance GHC.Show.Show a_884 => GHC.Show.Show (Pair a_884) + +instance AST.Unmarshal.Unmarshal Pair + +instance Data.Foldable.Foldable Pair where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Pair where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Pair where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParenthesizedExpression a = ParenthesizedExpression + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression GHC.Generics.:+: TypeAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_885. + AST.Traversable1.Class.Traversable1 a_885 + ) + +instance AST.Unmarshal.SymbolMatching ParenthesizedExpression where + matchedSymbols _ = [178] + showFailure _ node_886 = + "expected " + GHC.Base.<> ( "parenthesized_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_886 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_886) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_887 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_888 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_889 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_890 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_887 + c1_888 = TreeSitter.Node.nodeStartPoint node_886 + TreeSitter.Node.TSPoint + r2_889 + c2_890 = TreeSitter.Node.nodeEndPoint node_886 + +deriving instance GHC.Classes.Eq a_891 => GHC.Classes.Eq (ParenthesizedExpression a_891) + +deriving instance GHC.Classes.Ord a_892 => GHC.Classes.Ord (ParenthesizedExpression a_892) + +deriving instance GHC.Show.Show a_893 => GHC.Show.Show (ParenthesizedExpression a_893) + +instance AST.Unmarshal.Unmarshal ParenthesizedExpression + +instance Data.Foldable.Foldable ParenthesizedExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParenthesizedExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParenthesizedExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ParenthesizedType a = ParenthesizedType + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_894. + AST.Traversable1.Class.Traversable1 a_894 + ) + +instance AST.Unmarshal.SymbolMatching ParenthesizedType where + matchedSymbols _ = [264] + showFailure _ node_895 = + "expected " + GHC.Base.<> ( "parenthesized_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_895 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_895) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_896 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_897 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_898 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_899 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_896 + c1_897 = TreeSitter.Node.nodeStartPoint node_895 + TreeSitter.Node.TSPoint + r2_898 + c2_899 = TreeSitter.Node.nodeEndPoint node_895 + +deriving instance GHC.Classes.Eq a_900 => GHC.Classes.Eq (ParenthesizedType a_900) + +deriving instance GHC.Classes.Ord a_901 => GHC.Classes.Ord (ParenthesizedType a_901) + +deriving instance GHC.Show.Show a_902 => GHC.Show.Show (ParenthesizedType a_902) + +instance AST.Unmarshal.Unmarshal ParenthesizedType + +instance Data.Foldable.Foldable ParenthesizedType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ParenthesizedType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ParenthesizedType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PredefinedType a = PredefinedType {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_903. + AST.Traversable1.Class.Traversable1 a_903 + ) + +instance AST.Unmarshal.SymbolMatching PredefinedType where + matchedSymbols _ = [265] + showFailure _ node_904 = + "expected " + GHC.Base.<> ( "predefined_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_904 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_904) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_905 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_906 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_907 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_908 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_905 + c1_906 = TreeSitter.Node.nodeStartPoint node_904 + TreeSitter.Node.TSPoint + r2_907 + c2_908 = TreeSitter.Node.nodeEndPoint node_904 + +deriving instance GHC.Classes.Eq a_909 => GHC.Classes.Eq (PredefinedType a_909) + +deriving instance GHC.Classes.Ord a_910 => GHC.Classes.Ord (PredefinedType a_910) + +deriving instance GHC.Show.Show a_911 => GHC.Show.Show (PredefinedType a_911) + +instance AST.Unmarshal.Unmarshal PredefinedType + +instance Data.Foldable.Foldable PredefinedType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PredefinedType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PredefinedType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Program a = Program + { ann :: a, + extraChildren :: ([AST.Parse.Err ((Statement GHC.Generics.:+: HashBangLine) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_912. + AST.Traversable1.Class.Traversable1 a_912 + ) + +instance AST.Unmarshal.SymbolMatching Program where + matchedSymbols _ = [141] + showFailure _ node_913 = + "expected " + GHC.Base.<> ( "program" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_913 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_913) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_914 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_915 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_916 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_917 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_914 + c1_915 = TreeSitter.Node.nodeStartPoint node_913 + TreeSitter.Node.TSPoint + r2_916 + c2_917 = TreeSitter.Node.nodeEndPoint node_913 + +deriving instance GHC.Classes.Eq a_918 => GHC.Classes.Eq (Program a_918) + +deriving instance GHC.Classes.Ord a_919 => GHC.Classes.Ord (Program a_919) + +deriving instance GHC.Show.Show a_920 => GHC.Show.Show (Program a_920) + +instance AST.Unmarshal.Unmarshal Program + +instance Data.Foldable.Foldable Program where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Program where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Program where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PropertySignature a = PropertySignature + { ann :: a, + name :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + extraChildren :: ([AST.Parse.Err ((AccessibilityModifier GHC.Generics.:+: Readonly) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_921. + AST.Traversable1.Class.Traversable1 a_921 + ) + +instance AST.Unmarshal.SymbolMatching PropertySignature where + matchedSymbols _ = [269] + showFailure _ node_922 = + "expected " + GHC.Base.<> ( "property_signature" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_922 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_922) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_923 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_924 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_925 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_926 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_923 + c1_924 = TreeSitter.Node.nodeStartPoint node_922 + TreeSitter.Node.TSPoint + r2_925 + c2_926 = TreeSitter.Node.nodeEndPoint node_922 + +deriving instance GHC.Classes.Eq a_927 => GHC.Classes.Eq (PropertySignature a_927) + +deriving instance GHC.Classes.Ord a_928 => GHC.Classes.Ord (PropertySignature a_928) + +deriving instance GHC.Show.Show a_929 => GHC.Show.Show (PropertySignature a_929) + +instance AST.Unmarshal.Unmarshal PropertySignature + +instance Data.Foldable.Foldable PropertySignature where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PropertySignature where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PropertySignature where + traverse = AST.Traversable1.Class.traverseDefault1 + +data PublicFieldDefinition a = PublicFieldDefinition + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + name :: (AST.Parse.Err ((ComputedPropertyName GHC.Generics.:+: Number GHC.Generics.:+: PropertyIdentifier GHC.Generics.:+: String) a)), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))), + extraChildren :: ([AST.Parse.Err ((AccessibilityModifier GHC.Generics.:+: Readonly) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_930. + AST.Traversable1.Class.Traversable1 a_930 + ) + +instance AST.Unmarshal.SymbolMatching PublicFieldDefinition where + matchedSymbols _ = [218] + showFailure _ node_931 = + "expected " + GHC.Base.<> ( "public_field_definition" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_931 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_931) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_932 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_933 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_934 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_935 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_932 + c1_933 = TreeSitter.Node.nodeStartPoint node_931 + TreeSitter.Node.TSPoint + r2_934 + c2_935 = TreeSitter.Node.nodeEndPoint node_931 + +deriving instance GHC.Classes.Eq a_936 => GHC.Classes.Eq (PublicFieldDefinition a_936) + +deriving instance GHC.Classes.Ord a_937 => GHC.Classes.Ord (PublicFieldDefinition a_937) + +deriving instance GHC.Show.Show a_938 => GHC.Show.Show (PublicFieldDefinition a_938) + +instance AST.Unmarshal.Unmarshal PublicFieldDefinition + +instance Data.Foldable.Foldable PublicFieldDefinition where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PublicFieldDefinition where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PublicFieldDefinition where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Regex a = Regex + { ann :: a, + flags :: (GHC.Maybe.Maybe (AST.Parse.Err (RegexFlags a))), + pattern :: (AST.Parse.Err (RegexPattern a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_939. + AST.Traversable1.Class.Traversable1 a_939 + ) + +instance AST.Unmarshal.SymbolMatching Regex where + matchedSymbols _ = [211] + showFailure _ node_940 = + "expected " + GHC.Base.<> ( "regex" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_940 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_940) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_941 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_942 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_943 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_944 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_941 + c1_942 = TreeSitter.Node.nodeStartPoint node_940 + TreeSitter.Node.TSPoint + r2_943 + c2_944 = TreeSitter.Node.nodeEndPoint node_940 + +deriving instance GHC.Classes.Eq a_945 => GHC.Classes.Eq (Regex a_945) + +deriving instance GHC.Classes.Ord a_946 => GHC.Classes.Ord (Regex a_946) + +deriving instance GHC.Show.Show a_947 => GHC.Show.Show (Regex a_947) + +instance AST.Unmarshal.Unmarshal Regex + +instance Data.Foldable.Foldable Regex where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Regex where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Regex where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RequiredParameter a = RequiredParameter + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: AccessibilityModifier GHC.Generics.:+: Identifier GHC.Generics.:+: Readonly GHC.Generics.:+: This GHC.Generics.:+: TypeAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_948. + AST.Traversable1.Class.Traversable1 a_948 + ) + +instance AST.Unmarshal.SymbolMatching RequiredParameter where + matchedSymbols _ = [247] + showFailure _ node_949 = + "expected " + GHC.Base.<> ( "required_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_949 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_949) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_950 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_951 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_952 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_953 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_950 + c1_951 = TreeSitter.Node.nodeStartPoint node_949 + TreeSitter.Node.TSPoint + r2_952 + c2_953 = TreeSitter.Node.nodeEndPoint node_949 + +deriving instance GHC.Classes.Eq a_954 => GHC.Classes.Eq (RequiredParameter a_954) + +deriving instance GHC.Classes.Ord a_955 => GHC.Classes.Ord (RequiredParameter a_955) + +deriving instance GHC.Show.Show a_956 => GHC.Show.Show (RequiredParameter a_956) + +instance AST.Unmarshal.Unmarshal RequiredParameter + +instance Data.Foldable.Foldable RequiredParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RequiredParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RequiredParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RestParameter a = RestParameter + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Identifier GHC.Generics.:+: TypeAnnotation) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_957. + AST.Traversable1.Class.Traversable1 a_957 + ) + +instance AST.Unmarshal.SymbolMatching RestParameter where + matchedSymbols _ = [220] + showFailure _ node_958 = + "expected " + GHC.Base.<> ( "rest_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_958 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_958) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_959 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_960 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_961 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_962 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_959 + c1_960 = TreeSitter.Node.nodeStartPoint node_958 + TreeSitter.Node.TSPoint + r2_961 + c2_962 = TreeSitter.Node.nodeEndPoint node_958 + +deriving instance GHC.Classes.Eq a_963 => GHC.Classes.Eq (RestParameter a_963) + +deriving instance GHC.Classes.Ord a_964 => GHC.Classes.Ord (RestParameter a_964) + +deriving instance GHC.Show.Show a_965 => GHC.Show.Show (RestParameter a_965) + +instance AST.Unmarshal.Unmarshal RestParameter + +instance Data.Foldable.Foldable RestParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RestParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RestParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ReturnStatement a = ReturnStatement + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_966. + AST.Traversable1.Class.Traversable1 a_966 + ) + +instance AST.Unmarshal.SymbolMatching ReturnStatement where + matchedSymbols _ = [169] + showFailure _ node_967 = + "expected " + GHC.Base.<> ( "return_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_967 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_967) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_968 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_969 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_970 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_971 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_968 + c1_969 = TreeSitter.Node.nodeStartPoint node_967 + TreeSitter.Node.TSPoint + r2_970 + c2_971 = TreeSitter.Node.nodeEndPoint node_967 + +deriving instance GHC.Classes.Eq a_972 => GHC.Classes.Eq (ReturnStatement a_972) + +deriving instance GHC.Classes.Ord a_973 => GHC.Classes.Ord (ReturnStatement a_973) + +deriving instance GHC.Show.Show a_974 => GHC.Show.Show (ReturnStatement a_974) + +instance AST.Unmarshal.Unmarshal ReturnStatement + +instance Data.Foldable.Foldable ReturnStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ReturnStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ReturnStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SequenceExpression a = SequenceExpression + { ann :: a, + left :: (AST.Parse.Err (Expression a)), + right :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_975. + AST.Traversable1.Class.Traversable1 a_975 + ) + +instance AST.Unmarshal.SymbolMatching SequenceExpression where + matchedSymbols _ = [207] + showFailure _ node_976 = + "expected " + GHC.Base.<> ( "sequence_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_976 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_976) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_977 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_978 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_979 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_980 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_977 + c1_978 = TreeSitter.Node.nodeStartPoint node_976 + TreeSitter.Node.TSPoint + r2_979 + c2_980 = TreeSitter.Node.nodeEndPoint node_976 + +deriving instance GHC.Classes.Eq a_981 => GHC.Classes.Eq (SequenceExpression a_981) + +deriving instance GHC.Classes.Ord a_982 => GHC.Classes.Ord (SequenceExpression a_982) + +deriving instance GHC.Show.Show a_983 => GHC.Show.Show (SequenceExpression a_983) + +instance AST.Unmarshal.Unmarshal SequenceExpression + +instance Data.Foldable.Foldable SequenceExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SequenceExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SequenceExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SpreadElement a = SpreadElement + { ann :: a, + extraChildren :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_984. + AST.Traversable1.Class.Traversable1 a_984 + ) + +instance AST.Unmarshal.SymbolMatching SpreadElement where + matchedSymbols _ = [202] + showFailure _ node_985 = + "expected " + GHC.Base.<> ( "spread_element" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_985 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_985) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_986 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_987 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_988 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_989 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_986 + c1_987 = TreeSitter.Node.nodeStartPoint node_985 + TreeSitter.Node.TSPoint + r2_988 + c2_989 = TreeSitter.Node.nodeEndPoint node_985 + +deriving instance GHC.Classes.Eq a_990 => GHC.Classes.Eq (SpreadElement a_990) + +deriving instance GHC.Classes.Ord a_991 => GHC.Classes.Ord (SpreadElement a_991) + +deriving instance GHC.Show.Show a_992 => GHC.Show.Show (SpreadElement a_992) + +instance AST.Unmarshal.Unmarshal SpreadElement + +instance Data.Foldable.Foldable SpreadElement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SpreadElement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SpreadElement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data StatementBlock a = StatementBlock + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_993. + AST.Traversable1.Class.Traversable1 a_993 + ) + +instance AST.Unmarshal.SymbolMatching StatementBlock where + matchedSymbols _ = [156] + showFailure _ node_994 = + "expected " + GHC.Base.<> ( "statement_block" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_994 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_994) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_995 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_996 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_997 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_998 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_995 + c1_996 = TreeSitter.Node.nodeStartPoint node_994 + TreeSitter.Node.TSPoint + r2_997 + c2_998 = TreeSitter.Node.nodeEndPoint node_994 + +deriving instance GHC.Classes.Eq a_999 => GHC.Classes.Eq (StatementBlock a_999) + +deriving instance GHC.Classes.Ord a_1000 => GHC.Classes.Ord (StatementBlock a_1000) + +deriving instance GHC.Show.Show a_1001 => GHC.Show.Show (StatementBlock a_1001) + +instance AST.Unmarshal.Unmarshal StatementBlock + +instance Data.Foldable.Foldable StatementBlock where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StatementBlock where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StatementBlock where + traverse = AST.Traversable1.Class.traverseDefault1 + +data String a = String + { ann :: a, + extraChildren :: ([AST.Parse.Err (EscapeSequence a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1002. + AST.Traversable1.Class.Traversable1 a_1002 + ) + +instance AST.Unmarshal.SymbolMatching String where + matchedSymbols _ = [208] + showFailure _ node_1003 = + "expected " + GHC.Base.<> ( "string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1003 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1003) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1004 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1005 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1006 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1007 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1004 + c1_1005 = TreeSitter.Node.nodeStartPoint node_1003 + TreeSitter.Node.TSPoint + r2_1006 + c2_1007 = TreeSitter.Node.nodeEndPoint node_1003 + +deriving instance GHC.Classes.Eq a_1008 => GHC.Classes.Eq (String a_1008) + +deriving instance GHC.Classes.Ord a_1009 => GHC.Classes.Ord (String a_1009) + +deriving instance GHC.Show.Show a_1010 => GHC.Show.Show (String a_1010) + +instance AST.Unmarshal.Unmarshal String + +instance Data.Foldable.Foldable String where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor String where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable String where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SubscriptExpression a = SubscriptExpression + { ann :: a, + object :: (AST.Parse.Err (Expression a)), + index :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1011. + AST.Traversable1.Class.Traversable1 a_1011 + ) + +instance AST.Unmarshal.SymbolMatching SubscriptExpression where + matchedSymbols _ = [198] + showFailure _ node_1012 = + "expected " + GHC.Base.<> ( "subscript_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1012 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1012) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1013 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1014 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1015 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1016 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1013 + c1_1014 = TreeSitter.Node.nodeStartPoint node_1012 + TreeSitter.Node.TSPoint + r2_1015 + c2_1016 = TreeSitter.Node.nodeEndPoint node_1012 + +deriving instance GHC.Classes.Eq a_1017 => GHC.Classes.Eq (SubscriptExpression a_1017) + +deriving instance GHC.Classes.Ord a_1018 => GHC.Classes.Ord (SubscriptExpression a_1018) + +deriving instance GHC.Show.Show a_1019 => GHC.Show.Show (SubscriptExpression a_1019) + +instance AST.Unmarshal.Unmarshal SubscriptExpression + +instance Data.Foldable.Foldable SubscriptExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SubscriptExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SubscriptExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchBody a = SwitchBody + { ann :: a, + extraChildren :: ([AST.Parse.Err ((SwitchCase GHC.Generics.:+: SwitchDefault) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1020. + AST.Traversable1.Class.Traversable1 a_1020 + ) + +instance AST.Unmarshal.SymbolMatching SwitchBody where + matchedSymbols _ = [173] + showFailure _ node_1021 = + "expected " + GHC.Base.<> ( "switch_body" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1021 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1021) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1022 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1023 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1024 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1025 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1022 + c1_1023 = TreeSitter.Node.nodeStartPoint node_1021 + TreeSitter.Node.TSPoint + r2_1024 + c2_1025 = TreeSitter.Node.nodeEndPoint node_1021 + +deriving instance GHC.Classes.Eq a_1026 => GHC.Classes.Eq (SwitchBody a_1026) + +deriving instance GHC.Classes.Ord a_1027 => GHC.Classes.Ord (SwitchBody a_1027) + +deriving instance GHC.Show.Show a_1028 => GHC.Show.Show (SwitchBody a_1028) + +instance AST.Unmarshal.Unmarshal SwitchBody + +instance Data.Foldable.Foldable SwitchBody where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchBody where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchBody where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchCase a = SwitchCase + { ann :: a, + value :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)), + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1029. + AST.Traversable1.Class.Traversable1 a_1029 + ) + +instance AST.Unmarshal.SymbolMatching SwitchCase where + matchedSymbols _ = [174] + showFailure _ node_1030 = + "expected " + GHC.Base.<> ( "switch_case" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1030 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1030) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1031 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1032 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1033 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1034 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1031 + c1_1032 = TreeSitter.Node.nodeStartPoint node_1030 + TreeSitter.Node.TSPoint + r2_1033 + c2_1034 = TreeSitter.Node.nodeEndPoint node_1030 + +deriving instance GHC.Classes.Eq a_1035 => GHC.Classes.Eq (SwitchCase a_1035) + +deriving instance GHC.Classes.Ord a_1036 => GHC.Classes.Ord (SwitchCase a_1036) + +deriving instance GHC.Show.Show a_1037 => GHC.Show.Show (SwitchCase a_1037) + +instance AST.Unmarshal.Unmarshal SwitchCase + +instance Data.Foldable.Foldable SwitchCase where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchCase where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchCase where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchDefault a = SwitchDefault + { ann :: a, + extraChildren :: ([AST.Parse.Err (Statement a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1038. + AST.Traversable1.Class.Traversable1 a_1038 + ) + +instance AST.Unmarshal.SymbolMatching SwitchDefault where + matchedSymbols _ = [175] + showFailure _ node_1039 = + "expected " + GHC.Base.<> ( "switch_default" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1039 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1039) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1040 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1041 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1042 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1043 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1040 + c1_1041 = TreeSitter.Node.nodeStartPoint node_1039 + TreeSitter.Node.TSPoint + r2_1042 + c2_1043 = TreeSitter.Node.nodeEndPoint node_1039 + +deriving instance GHC.Classes.Eq a_1044 => GHC.Classes.Eq (SwitchDefault a_1044) + +deriving instance GHC.Classes.Ord a_1045 => GHC.Classes.Ord (SwitchDefault a_1045) + +deriving instance GHC.Show.Show a_1046 => GHC.Show.Show (SwitchDefault a_1046) + +instance AST.Unmarshal.Unmarshal SwitchDefault + +instance Data.Foldable.Foldable SwitchDefault where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchDefault where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchDefault where + traverse = AST.Traversable1.Class.traverseDefault1 + +data SwitchStatement a = SwitchStatement + { ann :: a, + body :: (AST.Parse.Err (SwitchBody a)), + value :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1047. + AST.Traversable1.Class.Traversable1 a_1047 + ) + +instance AST.Unmarshal.SymbolMatching SwitchStatement where + matchedSymbols _ = [158] + showFailure _ node_1048 = + "expected " + GHC.Base.<> ( "switch_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1048 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1048) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1049 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1050 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1051 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1052 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1049 + c1_1050 = TreeSitter.Node.nodeStartPoint node_1048 + TreeSitter.Node.TSPoint + r2_1051 + c2_1052 = TreeSitter.Node.nodeEndPoint node_1048 + +deriving instance GHC.Classes.Eq a_1053 => GHC.Classes.Eq (SwitchStatement a_1053) + +deriving instance GHC.Classes.Ord a_1054 => GHC.Classes.Ord (SwitchStatement a_1054) + +deriving instance GHC.Show.Show a_1055 => GHC.Show.Show (SwitchStatement a_1055) + +instance AST.Unmarshal.Unmarshal SwitchStatement + +instance Data.Foldable.Foldable SwitchStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor SwitchStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable SwitchStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TemplateString a = TemplateString + { ann :: a, + extraChildren :: ([AST.Parse.Err ((EscapeSequence GHC.Generics.:+: TemplateSubstitution) a)]) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1056. + AST.Traversable1.Class.Traversable1 a_1056 + ) + +instance AST.Unmarshal.SymbolMatching TemplateString where + matchedSymbols _ = [209] + showFailure _ node_1057 = + "expected " + GHC.Base.<> ( "template_string" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1057 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1057) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1058 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1059 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1060 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1061 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1058 + c1_1059 = TreeSitter.Node.nodeStartPoint node_1057 + TreeSitter.Node.TSPoint + r2_1060 + c2_1061 = TreeSitter.Node.nodeEndPoint node_1057 + +deriving instance GHC.Classes.Eq a_1062 => GHC.Classes.Eq (TemplateString a_1062) + +deriving instance GHC.Classes.Ord a_1063 => GHC.Classes.Ord (TemplateString a_1063) + +deriving instance GHC.Show.Show a_1064 => GHC.Show.Show (TemplateString a_1064) + +instance AST.Unmarshal.Unmarshal TemplateString + +instance Data.Foldable.Foldable TemplateString where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TemplateString where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TemplateString where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TemplateSubstitution a = TemplateSubstitution + { ann :: a, + extraChildren :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1065. + AST.Traversable1.Class.Traversable1 a_1065 + ) + +instance AST.Unmarshal.SymbolMatching TemplateSubstitution where + matchedSymbols _ = [210] + showFailure _ node_1066 = + "expected " + GHC.Base.<> ( "template_substitution" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1066 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1066) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1067 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1068 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1069 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1070 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1067 + c1_1068 = TreeSitter.Node.nodeStartPoint node_1066 + TreeSitter.Node.TSPoint + r2_1069 + c2_1070 = TreeSitter.Node.nodeEndPoint node_1066 + +deriving instance GHC.Classes.Eq a_1071 => GHC.Classes.Eq (TemplateSubstitution a_1071) + +deriving instance GHC.Classes.Ord a_1072 => GHC.Classes.Ord (TemplateSubstitution a_1072) + +deriving instance GHC.Show.Show a_1073 => GHC.Show.Show (TemplateSubstitution a_1073) + +instance AST.Unmarshal.Unmarshal TemplateSubstitution + +instance Data.Foldable.Foldable TemplateSubstitution where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TemplateSubstitution where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TemplateSubstitution where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TernaryExpression a = TernaryExpression + { ann :: a, + alternative :: (AST.Parse.Err (Expression a)), + consequence :: (AST.Parse.Err (Expression a)), + condition :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1074. + AST.Traversable1.Class.Traversable1 a_1074 + ) + +instance AST.Unmarshal.SymbolMatching TernaryExpression where + matchedSymbols _ = [203] + showFailure _ node_1075 = + "expected " + GHC.Base.<> ( "ternary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1075 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1075) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1076 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1077 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1078 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1079 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1076 + c1_1077 = TreeSitter.Node.nodeStartPoint node_1075 + TreeSitter.Node.TSPoint + r2_1078 + c2_1079 = TreeSitter.Node.nodeEndPoint node_1075 + +deriving instance GHC.Classes.Eq a_1080 => GHC.Classes.Eq (TernaryExpression a_1080) + +deriving instance GHC.Classes.Ord a_1081 => GHC.Classes.Ord (TernaryExpression a_1081) + +deriving instance GHC.Show.Show a_1082 => GHC.Show.Show (TernaryExpression a_1082) + +instance AST.Unmarshal.Unmarshal TernaryExpression + +instance Data.Foldable.Foldable TernaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TernaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TernaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data ThrowStatement a = ThrowStatement + { ann :: a, + extraChildren :: (AST.Parse.Err ((Expression GHC.Generics.:+: SequenceExpression) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1083. + AST.Traversable1.Class.Traversable1 a_1083 + ) + +instance AST.Unmarshal.SymbolMatching ThrowStatement where + matchedSymbols _ = [170] + showFailure _ node_1084 = + "expected " + GHC.Base.<> ( "throw_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1084 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1084) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1085 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1086 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1087 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1088 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1085 + c1_1086 = TreeSitter.Node.nodeStartPoint node_1084 + TreeSitter.Node.TSPoint + r2_1087 + c2_1088 = TreeSitter.Node.nodeEndPoint node_1084 + +deriving instance GHC.Classes.Eq a_1089 => GHC.Classes.Eq (ThrowStatement a_1089) + +deriving instance GHC.Classes.Ord a_1090 => GHC.Classes.Ord (ThrowStatement a_1090) + +deriving instance GHC.Show.Show a_1091 => GHC.Show.Show (ThrowStatement a_1091) + +instance AST.Unmarshal.Unmarshal ThrowStatement + +instance Data.Foldable.Foldable ThrowStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ThrowStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ThrowStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TryStatement a = TryStatement + { ann :: a, + body :: (AST.Parse.Err (StatementBlock a)), + handler :: (GHC.Maybe.Maybe (AST.Parse.Err (CatchClause a))), + finalizer :: (GHC.Maybe.Maybe (AST.Parse.Err (FinallyClause a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1092. + AST.Traversable1.Class.Traversable1 a_1092 + ) + +instance AST.Unmarshal.SymbolMatching TryStatement where + matchedSymbols _ = [164] + showFailure _ node_1093 = + "expected " + GHC.Base.<> ( "try_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1093 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1093) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1094 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1095 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1096 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1097 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1094 + c1_1095 = TreeSitter.Node.nodeStartPoint node_1093 + TreeSitter.Node.TSPoint + r2_1096 + c2_1097 = TreeSitter.Node.nodeEndPoint node_1093 + +deriving instance GHC.Classes.Eq a_1098 => GHC.Classes.Eq (TryStatement a_1098) + +deriving instance GHC.Classes.Ord a_1099 => GHC.Classes.Ord (TryStatement a_1099) + +deriving instance GHC.Show.Show a_1100 => GHC.Show.Show (TryStatement a_1100) + +instance AST.Unmarshal.Unmarshal TryStatement + +instance Data.Foldable.Foldable TryStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TryStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TryStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TupleType a = TupleType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1101. + AST.Traversable1.Class.Traversable1 a_1101 + ) + +instance AST.Unmarshal.SymbolMatching TupleType where + matchedSymbols _ = [277] + showFailure _ node_1102 = + "expected " + GHC.Base.<> ( "tuple_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1102 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1102) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1103 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1104 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1105 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1106 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1103 + c1_1104 = TreeSitter.Node.nodeStartPoint node_1102 + TreeSitter.Node.TSPoint + r2_1105 + c2_1106 = TreeSitter.Node.nodeEndPoint node_1102 + +deriving instance GHC.Classes.Eq a_1107 => GHC.Classes.Eq (TupleType a_1107) + +deriving instance GHC.Classes.Ord a_1108 => GHC.Classes.Ord (TupleType a_1108) + +deriving instance GHC.Show.Show a_1109 => GHC.Show.Show (TupleType a_1109) + +instance AST.Unmarshal.Unmarshal TupleType + +instance Data.Foldable.Foldable TupleType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TupleType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TupleType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeAliasDeclaration a = TypeAliasDeclaration + { ann :: a, + value :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a)), + name :: (AST.Parse.Err (TypeIdentifier a)), + typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1110. + AST.Traversable1.Class.Traversable1 a_1110 + ) + +instance AST.Unmarshal.SymbolMatching TypeAliasDeclaration where + matchedSymbols _ = [245] + showFailure _ node_1111 = + "expected " + GHC.Base.<> ( "type_alias_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1111 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1111) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1112 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1113 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1114 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1115 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1112 + c1_1113 = TreeSitter.Node.nodeStartPoint node_1111 + TreeSitter.Node.TSPoint + r2_1114 + c2_1115 = TreeSitter.Node.nodeEndPoint node_1111 + +deriving instance GHC.Classes.Eq a_1116 => GHC.Classes.Eq (TypeAliasDeclaration a_1116) + +deriving instance GHC.Classes.Ord a_1117 => GHC.Classes.Ord (TypeAliasDeclaration a_1117) + +deriving instance GHC.Show.Show a_1118 => GHC.Show.Show (TypeAliasDeclaration a_1118) + +instance AST.Unmarshal.Unmarshal TypeAliasDeclaration + +instance Data.Foldable.Foldable TypeAliasDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeAliasDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeAliasDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeAnnotation a = TypeAnnotation + { ann :: a, + extraChildren :: (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1119. + AST.Traversable1.Class.Traversable1 a_1119 + ) + +instance AST.Unmarshal.SymbolMatching TypeAnnotation where + matchedSymbols _ = [250] + showFailure _ node_1120 = + "expected " + GHC.Base.<> ( "type_annotation" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1120 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1120) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1121 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1122 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1123 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1124 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1121 + c1_1122 = TreeSitter.Node.nodeStartPoint node_1120 + TreeSitter.Node.TSPoint + r2_1123 + c2_1124 = TreeSitter.Node.nodeEndPoint node_1120 + +deriving instance GHC.Classes.Eq a_1125 => GHC.Classes.Eq (TypeAnnotation a_1125) + +deriving instance GHC.Classes.Ord a_1126 => GHC.Classes.Ord (TypeAnnotation a_1126) + +deriving instance GHC.Show.Show a_1127 => GHC.Show.Show (TypeAnnotation a_1127) + +instance AST.Unmarshal.Unmarshal TypeAnnotation + +instance Data.Foldable.Foldable TypeAnnotation where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeAnnotation where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeAnnotation where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeArguments a = TypeArguments + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1128. + AST.Traversable1.Class.Traversable1 a_1128 + ) + +instance AST.Unmarshal.SymbolMatching TypeArguments where + matchedSymbols _ = [266] + showFailure _ node_1129 = + "expected " + GHC.Base.<> ( "type_arguments" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1129 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1129) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1130 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1131 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1132 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1133 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1130 + c1_1131 = TreeSitter.Node.nodeStartPoint node_1129 + TreeSitter.Node.TSPoint + r2_1132 + c2_1133 = TreeSitter.Node.nodeEndPoint node_1129 + +deriving instance GHC.Classes.Eq a_1134 => GHC.Classes.Eq (TypeArguments a_1134) + +deriving instance GHC.Classes.Ord a_1135 => GHC.Classes.Ord (TypeArguments a_1135) + +deriving instance GHC.Show.Show a_1136 => GHC.Show.Show (TypeArguments a_1136) + +instance AST.Unmarshal.Unmarshal TypeArguments + +instance Data.Foldable.Foldable TypeArguments where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeArguments where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeArguments where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeAssertion a = TypeAssertion + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Expression GHC.Generics.:+: TypeArguments) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1137. + AST.Traversable1.Class.Traversable1 a_1137 + ) + +instance AST.Unmarshal.SymbolMatching TypeAssertion where + matchedSymbols _ = [229] + showFailure _ node_1138 = + "expected " + GHC.Base.<> ( "type_assertion" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1138 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1138) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1139 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1140 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1141 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1142 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1139 + c1_1140 = TreeSitter.Node.nodeStartPoint node_1138 + TreeSitter.Node.TSPoint + r2_1141 + c2_1142 = TreeSitter.Node.nodeEndPoint node_1138 + +deriving instance GHC.Classes.Eq a_1143 => GHC.Classes.Eq (TypeAssertion a_1143) + +deriving instance GHC.Classes.Ord a_1144 => GHC.Classes.Ord (TypeAssertion a_1144) + +deriving instance GHC.Show.Show a_1145 => GHC.Show.Show (TypeAssertion a_1145) + +instance AST.Unmarshal.Unmarshal TypeAssertion + +instance Data.Foldable.Foldable TypeAssertion where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeAssertion where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeAssertion where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeParameter a = TypeParameter + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((Constraint GHC.Generics.:+: DefaultType GHC.Generics.:+: TypeIdentifier) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1146. + AST.Traversable1.Class.Traversable1 a_1146 + ) + +instance AST.Unmarshal.SymbolMatching TypeParameter where + matchedSymbols _ = [271] + showFailure _ node_1147 = + "expected " + GHC.Base.<> ( "type_parameter" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1147 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1147) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1148 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1149 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1150 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1151 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1148 + c1_1149 = TreeSitter.Node.nodeStartPoint node_1147 + TreeSitter.Node.TSPoint + r2_1150 + c2_1151 = TreeSitter.Node.nodeEndPoint node_1147 + +deriving instance GHC.Classes.Eq a_1152 => GHC.Classes.Eq (TypeParameter a_1152) + +deriving instance GHC.Classes.Ord a_1153 => GHC.Classes.Ord (TypeParameter a_1153) + +deriving instance GHC.Show.Show a_1154 => GHC.Show.Show (TypeParameter a_1154) + +instance AST.Unmarshal.Unmarshal TypeParameter + +instance Data.Foldable.Foldable TypeParameter where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeParameter where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeParameter where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeParameters a = TypeParameters + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (TypeParameter a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1155. + AST.Traversable1.Class.Traversable1 a_1155 + ) + +instance AST.Unmarshal.SymbolMatching TypeParameters where + matchedSymbols _ = [270] + showFailure _ node_1156 = + "expected " + GHC.Base.<> ( "type_parameters" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1156 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1156) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1157 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1158 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1159 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1160 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1157 + c1_1158 = TreeSitter.Node.nodeStartPoint node_1156 + TreeSitter.Node.TSPoint + r2_1159 + c2_1160 = TreeSitter.Node.nodeEndPoint node_1156 + +deriving instance GHC.Classes.Eq a_1161 => GHC.Classes.Eq (TypeParameters a_1161) + +deriving instance GHC.Classes.Ord a_1162 => GHC.Classes.Ord (TypeParameters a_1162) + +deriving instance GHC.Show.Show a_1163 => GHC.Show.Show (TypeParameters a_1163) + +instance AST.Unmarshal.Unmarshal TypeParameters + +instance Data.Foldable.Foldable TypeParameters where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeParameters where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeParameters where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypePredicate a = TypePredicate + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: Identifier GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1164. + AST.Traversable1.Class.Traversable1 a_1164 + ) + +instance AST.Unmarshal.SymbolMatching TypePredicate where + matchedSymbols _ = [255] + showFailure _ node_1165 = + "expected " + GHC.Base.<> ( "type_predicate" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1165 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1165) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1166 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1167 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1168 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1169 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1166 + c1_1167 = TreeSitter.Node.nodeStartPoint node_1165 + TreeSitter.Node.TSPoint + r2_1168 + c2_1169 = TreeSitter.Node.nodeEndPoint node_1165 + +deriving instance GHC.Classes.Eq a_1170 => GHC.Classes.Eq (TypePredicate a_1170) + +deriving instance GHC.Classes.Ord a_1171 => GHC.Classes.Ord (TypePredicate a_1171) + +deriving instance GHC.Show.Show a_1172 => GHC.Show.Show (TypePredicate a_1172) + +instance AST.Unmarshal.Unmarshal TypePredicate + +instance Data.Foldable.Foldable TypePredicate where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypePredicate where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypePredicate where + traverse = AST.Traversable1.Class.traverseDefault1 + +data TypeQuery a = TypeQuery + { ann :: a, + extraChildren :: (AST.Parse.Err ((Identifier GHC.Generics.:+: NestedIdentifier) a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1173. + AST.Traversable1.Class.Traversable1 a_1173 + ) + +instance AST.Unmarshal.SymbolMatching TypeQuery where + matchedSymbols _ = [256] + showFailure _ node_1174 = + "expected " + GHC.Base.<> ( "type_query" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1174 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1174) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1175 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1176 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1177 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1178 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1175 + c1_1176 = TreeSitter.Node.nodeStartPoint node_1174 + TreeSitter.Node.TSPoint + r2_1177 + c2_1178 = TreeSitter.Node.nodeEndPoint node_1174 + +deriving instance GHC.Classes.Eq a_1179 => GHC.Classes.Eq (TypeQuery a_1179) + +deriving instance GHC.Classes.Ord a_1180 => GHC.Classes.Ord (TypeQuery a_1180) + +deriving instance GHC.Show.Show a_1181 => GHC.Show.Show (TypeQuery a_1181) + +instance AST.Unmarshal.Unmarshal TypeQuery + +instance Data.Foldable.Foldable TypeQuery where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeQuery where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeQuery where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnaryExpression a = UnaryExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousBang GHC.Generics.:+: AnonymousPlus GHC.Generics.:+: AnonymousMinus GHC.Generics.:+: AnonymousDelete GHC.Generics.:+: AnonymousTypeof GHC.Generics.:+: AnonymousVoid GHC.Generics.:+: AnonymousTilde) a)), + argument :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1182. + AST.Traversable1.Class.Traversable1 a_1182 + ) + +instance AST.Unmarshal.SymbolMatching UnaryExpression where + matchedSymbols _ = [205, 261] + showFailure _ node_1183 = + "expected " + GHC.Base.<> ( "unary_expression, unary_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1183 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1183) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1184 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1185 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1186 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1187 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1184 + c1_1185 = TreeSitter.Node.nodeStartPoint node_1183 + TreeSitter.Node.TSPoint + r2_1186 + c2_1187 = TreeSitter.Node.nodeEndPoint node_1183 + +deriving instance GHC.Classes.Eq a_1188 => GHC.Classes.Eq (UnaryExpression a_1188) + +deriving instance GHC.Classes.Ord a_1189 => GHC.Classes.Ord (UnaryExpression a_1189) + +deriving instance GHC.Show.Show a_1190 => GHC.Show.Show (UnaryExpression a_1190) + +instance AST.Unmarshal.Unmarshal UnaryExpression + +instance Data.Foldable.Foldable UnaryExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnaryExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnaryExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UnionType a = UnionType + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err ((ArrayType GHC.Generics.:+: ConstructorType GHC.Generics.:+: ExistentialType GHC.Generics.:+: FlowMaybeType GHC.Generics.:+: FunctionType GHC.Generics.:+: GenericType GHC.Generics.:+: IndexTypeQuery GHC.Generics.:+: IntersectionType GHC.Generics.:+: LiteralType GHC.Generics.:+: LookupType GHC.Generics.:+: NestedTypeIdentifier GHC.Generics.:+: ObjectType GHC.Generics.:+: ParenthesizedType GHC.Generics.:+: PredefinedType GHC.Generics.:+: This GHC.Generics.:+: TupleType GHC.Generics.:+: TypeIdentifier GHC.Generics.:+: TypePredicate GHC.Generics.:+: TypeQuery GHC.Generics.:+: UnionType) a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1191. + AST.Traversable1.Class.Traversable1 a_1191 + ) + +instance AST.Unmarshal.SymbolMatching UnionType where + matchedSymbols _ = [278] + showFailure _ node_1192 = + "expected " + GHC.Base.<> ( "union_type" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1192 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1192) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1193 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1194 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1195 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1196 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1193 + c1_1194 = TreeSitter.Node.nodeStartPoint node_1192 + TreeSitter.Node.TSPoint + r2_1195 + c2_1196 = TreeSitter.Node.nodeEndPoint node_1192 + +deriving instance GHC.Classes.Eq a_1197 => GHC.Classes.Eq (UnionType a_1197) + +deriving instance GHC.Classes.Ord a_1198 => GHC.Classes.Ord (UnionType a_1198) + +deriving instance GHC.Show.Show a_1199 => GHC.Show.Show (UnionType a_1199) + +instance AST.Unmarshal.Unmarshal UnionType + +instance Data.Foldable.Foldable UnionType where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UnionType where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UnionType where + traverse = AST.Traversable1.Class.traverseDefault1 + +data UpdateExpression a = UpdateExpression + { ann :: a, + operator :: (AST.Parse.Err ((AnonymousPlusPlus GHC.Generics.:+: AnonymousMinusMinus) a)), + argument :: (AST.Parse.Err (Expression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1200. + AST.Traversable1.Class.Traversable1 a_1200 + ) + +instance AST.Unmarshal.SymbolMatching UpdateExpression where + matchedSymbols _ = [206] + showFailure _ node_1201 = + "expected " + GHC.Base.<> ( "update_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1201 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1201) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1202 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1203 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1204 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1205 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1202 + c1_1203 = TreeSitter.Node.nodeStartPoint node_1201 + TreeSitter.Node.TSPoint + r2_1204 + c2_1205 = TreeSitter.Node.nodeEndPoint node_1201 + +deriving instance GHC.Classes.Eq a_1206 => GHC.Classes.Eq (UpdateExpression a_1206) + +deriving instance GHC.Classes.Ord a_1207 => GHC.Classes.Ord (UpdateExpression a_1207) + +deriving instance GHC.Show.Show a_1208 => GHC.Show.Show (UpdateExpression a_1208) + +instance AST.Unmarshal.Unmarshal UpdateExpression + +instance Data.Foldable.Foldable UpdateExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor UpdateExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable UpdateExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VariableDeclaration a = VariableDeclaration + { ann :: a, + extraChildren :: (GHC.Base.NonEmpty (AST.Parse.Err (VariableDeclarator a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1209. + AST.Traversable1.Class.Traversable1 a_1209 + ) + +instance AST.Unmarshal.SymbolMatching VariableDeclaration where + matchedSymbols _ = [153] + showFailure _ node_1210 = + "expected " + GHC.Base.<> ( "variable_declaration" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1210 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1210) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1211 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1212 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1213 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1214 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1211 + c1_1212 = TreeSitter.Node.nodeStartPoint node_1210 + TreeSitter.Node.TSPoint + r2_1213 + c2_1214 = TreeSitter.Node.nodeEndPoint node_1210 + +deriving instance GHC.Classes.Eq a_1215 => GHC.Classes.Eq (VariableDeclaration a_1215) + +deriving instance GHC.Classes.Ord a_1216 => GHC.Classes.Ord (VariableDeclaration a_1216) + +deriving instance GHC.Show.Show a_1217 => GHC.Show.Show (VariableDeclaration a_1217) + +instance AST.Unmarshal.Unmarshal VariableDeclaration + +instance Data.Foldable.Foldable VariableDeclaration where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VariableDeclaration where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VariableDeclaration where + traverse = AST.Traversable1.Class.traverseDefault1 + +data VariableDeclarator a = VariableDeclarator + { ann :: a, + value :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))), + name :: (AST.Parse.Err ((DestructuringPattern GHC.Generics.:+: Identifier) a)), + type' :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeAnnotation a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1218. + AST.Traversable1.Class.Traversable1 a_1218 + ) + +instance AST.Unmarshal.SymbolMatching VariableDeclarator where + matchedSymbols _ = [155] + showFailure _ node_1219 = + "expected " + GHC.Base.<> ( "variable_declarator" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1219 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1219) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1220 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1221 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1222 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1223 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1220 + c1_1221 = TreeSitter.Node.nodeStartPoint node_1219 + TreeSitter.Node.TSPoint + r2_1222 + c2_1223 = TreeSitter.Node.nodeEndPoint node_1219 + +deriving instance GHC.Classes.Eq a_1224 => GHC.Classes.Eq (VariableDeclarator a_1224) + +deriving instance GHC.Classes.Ord a_1225 => GHC.Classes.Ord (VariableDeclarator a_1225) + +deriving instance GHC.Show.Show a_1226 => GHC.Show.Show (VariableDeclarator a_1226) + +instance AST.Unmarshal.Unmarshal VariableDeclarator + +instance Data.Foldable.Foldable VariableDeclarator where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor VariableDeclarator where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable VariableDeclarator where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WhileStatement a = WhileStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + condition :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1227. + AST.Traversable1.Class.Traversable1 a_1227 + ) + +instance AST.Unmarshal.SymbolMatching WhileStatement where + matchedSymbols _ = [162] + showFailure _ node_1228 = + "expected " + GHC.Base.<> ( "while_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1228 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1228) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1229 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1230 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1231 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1232 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1229 + c1_1230 = TreeSitter.Node.nodeStartPoint node_1228 + TreeSitter.Node.TSPoint + r2_1231 + c2_1232 = TreeSitter.Node.nodeEndPoint node_1228 + +deriving instance GHC.Classes.Eq a_1233 => GHC.Classes.Eq (WhileStatement a_1233) + +deriving instance GHC.Classes.Ord a_1234 => GHC.Classes.Ord (WhileStatement a_1234) + +deriving instance GHC.Show.Show a_1235 => GHC.Show.Show (WhileStatement a_1235) + +instance AST.Unmarshal.Unmarshal WhileStatement + +instance Data.Foldable.Foldable WhileStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WhileStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WhileStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data WithStatement a = WithStatement + { ann :: a, + body :: (AST.Parse.Err (Statement a)), + object :: (AST.Parse.Err (ParenthesizedExpression a)) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1236. + AST.Traversable1.Class.Traversable1 a_1236 + ) + +instance AST.Unmarshal.SymbolMatching WithStatement where + matchedSymbols _ = [165] + showFailure _ node_1237 = + "expected " + GHC.Base.<> ( "with_statement" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1237 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1237) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1238 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1239 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1240 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1241 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1238 + c1_1239 = TreeSitter.Node.nodeStartPoint node_1237 + TreeSitter.Node.TSPoint + r2_1240 + c2_1241 = TreeSitter.Node.nodeEndPoint node_1237 + +deriving instance GHC.Classes.Eq a_1242 => GHC.Classes.Eq (WithStatement a_1242) + +deriving instance GHC.Classes.Ord a_1243 => GHC.Classes.Ord (WithStatement a_1243) + +deriving instance GHC.Show.Show a_1244 => GHC.Show.Show (WithStatement a_1244) + +instance AST.Unmarshal.Unmarshal WithStatement + +instance Data.Foldable.Foldable WithStatement where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor WithStatement where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable WithStatement where + traverse = AST.Traversable1.Class.traverseDefault1 + +data YieldExpression a = YieldExpression + { ann :: a, + extraChildren :: (GHC.Maybe.Maybe (AST.Parse.Err (Expression a))) + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1245. + AST.Traversable1.Class.Traversable1 a_1245 + ) + +instance AST.Unmarshal.SymbolMatching YieldExpression where + matchedSymbols _ = [180] + showFailure _ node_1246 = + "expected " + GHC.Base.<> ( "yield_expression" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1246 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1246) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1247 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1248 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1249 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1250 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1247 + c1_1248 = TreeSitter.Node.nodeStartPoint node_1246 + TreeSitter.Node.TSPoint + r2_1249 + c2_1250 = TreeSitter.Node.nodeEndPoint node_1246 + +deriving instance GHC.Classes.Eq a_1251 => GHC.Classes.Eq (YieldExpression a_1251) + +deriving instance GHC.Classes.Ord a_1252 => GHC.Classes.Ord (YieldExpression a_1252) + +deriving instance GHC.Show.Show a_1253 => GHC.Show.Show (YieldExpression a_1253) + +instance AST.Unmarshal.Unmarshal YieldExpression + +instance Data.Foldable.Foldable YieldExpression where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor YieldExpression where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable YieldExpression where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousBang = AST.Token.Token "!" 88 + +type AnonymousBangEqual = AST.Token.Token "!=" 83 + +type AnonymousBangEqualEqual = AST.Token.Token "!==" 84 + +type AnonymousDQuote = AST.Token.Token "\"" 94 + +type AnonymousDollarLBrace = AST.Token.Token "${" 101 + +type AnonymousPercent = AST.Token.Token "%" 78 + +type AnonymousPercentEqual = AST.Token.Token "%=" 58 + +type AnonymousAmpersand = AST.Token.Token "&" 73 + +type AnonymousAmpersandAmpersand = AST.Token.Token "&&" 68 + +type AnonymousAmpersandEqual = AST.Token.Token "&=" 60 + +type AnonymousSQuote = AST.Token.Token "'" 96 + +type AnonymousLParen = AST.Token.Token "(" 23 + +type AnonymousRParen = AST.Token.Token ")" 24 + +type AnonymousStar = AST.Token.Token "*" 4 + +type AnonymousStarStar = AST.Token.Token "**" 79 + +type AnonymousStarStarEqual = AST.Token.Token "**=" 65 + +type AnonymousStarEqual = AST.Token.Token "*=" 56 + +type AnonymousPlus = AST.Token.Token "+" 76 + +type AnonymousPlusPlus = AST.Token.Token "++" 92 + +type AnonymousPlusEqual = AST.Token.Token "+=" 54 + +type AnonymousComma = AST.Token.Token "," 10 + +type AnonymousMinus = AST.Token.Token "-" 77 + +type AnonymousMinusMinus = AST.Token.Token "--" 93 + +type AnonymousMinusEqual = AST.Token.Token "-=" 55 + +type AnonymousDot = AST.Token.Token "." 48 + +type AnonymousDotDotDot = AST.Token.Token "..." 66 + +type AnonymousSlash = AST.Token.Token "/" 47 + +type AnonymousSlashEqual = AST.Token.Token "/=" 57 + +type AnonymousColon = AST.Token.Token ":" 38 + +type AnonymousSemicolon = AST.Token.Token ";" 37 + +type AnonymousLAngle = AST.Token.Token "<" 45 + +type AnonymousLAngleLAngle = AST.Token.Token "<<" 72 + +type AnonymousLAngleLAngleEqual = AST.Token.Token "<<=" 64 + +type AnonymousLAngleEqual = AST.Token.Token "<=" 80 + +type AnonymousEqual = AST.Token.Token "=" 6 + +type AnonymousEqualEqual = AST.Token.Token "==" 81 + +type AnonymousEqualEqualEqual = AST.Token.Token "===" 82 + +type AnonymousEqualRAngle = AST.Token.Token "=>" 52 + +type AnonymousRAngle = AST.Token.Token ">" 46 + +type AnonymousRAngleEqual = AST.Token.Token ">=" 85 + +type AnonymousRAngleRAngle = AST.Token.Token ">>" 70 + +type AnonymousRAngleRAngleEqual = AST.Token.Token ">>=" 62 + +type AnonymousRAngleRAngleRAngle = AST.Token.Token ">>>" 71 + +type AnonymousRAngleRAngleRAngleEqual = AST.Token.Token ">>>=" 63 + +type AnonymousQuestion = AST.Token.Token "?" 67 + +type AnonymousQuestionQuestion = AST.Token.Token "??" 86 + +type AnonymousAt = AST.Token.Token "@" 113 + +type AnonymousLBracket = AST.Token.Token "[" 43 + +type AnonymousRBracket = AST.Token.Token "]" 44 + +type AnonymousCaret = AST.Token.Token "^" 74 + +type AnonymousCaretEqual = AST.Token.Token "^=" 59 + +type AnonymousBacktick = AST.Token.Token "`" 100 + +type AnonymousAbstract = AST.Token.Token "abstract" 115 + +type AnonymousAny = AST.Token.Token "any" 123 + +type AnonymousAs = AST.Token.Token "as" 7 + +type AnonymousAsync = AST.Token.Token "async" 50 + +type AnonymousAwait = AST.Token.Token "await" 25 + +type AnonymousBoolean = AST.Token.Token "boolean" 125 + +type AnonymousBreak = AST.Token.Token "break" 32 + +type AnonymousCase = AST.Token.Token "case" 39 + +type AnonymousCatch = AST.Token.Token "catch" 40 + +type AnonymousClass = AST.Token.Token "class" 49 + +type AnonymousConst = AST.Token.Token "const" 18 + +type AnonymousContinue = AST.Token.Token "continue" 33 + +type AnonymousDebugger = AST.Token.Token "debugger" 34 + +type AnonymousDeclare = AST.Token.Token "declare" 118 + +type AnonymousDefault = AST.Token.Token "default" 5 + +type AnonymousDelete = AST.Token.Token "delete" 91 + +type AnonymousDo = AST.Token.Token "do" 29 + +type AnonymousElse = AST.Token.Token "else" 20 + +type AnonymousEnum = AST.Token.Token "enum" 133 + +data EscapeSequence a = EscapeSequence {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1254. + AST.Traversable1.Class.Traversable1 a_1254 + ) + +instance AST.Unmarshal.SymbolMatching EscapeSequence where + matchedSymbols _ = [98] + showFailure _ node_1255 = + "expected " + GHC.Base.<> ( "escape_sequence" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1255 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1255) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1256 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1257 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1258 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1259 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1256 + c1_1257 = TreeSitter.Node.nodeStartPoint node_1255 + TreeSitter.Node.TSPoint + r2_1258 + c2_1259 = TreeSitter.Node.nodeEndPoint node_1255 + +deriving instance GHC.Classes.Eq a_1260 => GHC.Classes.Eq (EscapeSequence a_1260) + +deriving instance GHC.Classes.Ord a_1261 => GHC.Classes.Ord (EscapeSequence a_1261) + +deriving instance GHC.Show.Show a_1262 => GHC.Show.Show (EscapeSequence a_1262) + +instance AST.Unmarshal.Unmarshal EscapeSequence + +instance Data.Foldable.Foldable EscapeSequence where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor EscapeSequence where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable EscapeSequence where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousExport = AST.Token.Token "export" 3 + +type AnonymousExtends = AST.Token.Token "extends" 132 + +data False a = False {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1263. + AST.Traversable1.Class.Traversable1 a_1263 + ) + +instance AST.Unmarshal.SymbolMatching False where + matchedSymbols _ = [110] + showFailure _ node_1264 = + "expected " + GHC.Base.<> ( "false" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1264 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1264) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1265 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1266 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1267 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1268 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1265 + c1_1266 = TreeSitter.Node.nodeStartPoint node_1264 + TreeSitter.Node.TSPoint + r2_1267 + c2_1268 = TreeSitter.Node.nodeEndPoint node_1264 + +deriving instance GHC.Classes.Eq a_1269 => GHC.Classes.Eq (False a_1269) + +deriving instance GHC.Classes.Ord a_1270 => GHC.Classes.Ord (False a_1270) + +deriving instance GHC.Show.Show a_1271 => GHC.Show.Show (False a_1271) + +instance AST.Unmarshal.Unmarshal False + +instance Data.Foldable.Foldable False where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor False where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable False where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousFinally = AST.Token.Token "finally" 41 + +type AnonymousFor = AST.Token.Token "for" 22 + +type AnonymousFrom = AST.Token.Token "from" 15 + +type AnonymousFunction = AST.Token.Token "function" 51 + +type AnonymousGet = AST.Token.Token "get" 116 + +type AnonymousGlobal = AST.Token.Token "global" 130 + +data HashBangLine a = HashBangLine {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1272. + AST.Traversable1.Class.Traversable1 a_1272 + ) + +instance AST.Unmarshal.SymbolMatching HashBangLine where + matchedSymbols _ = [2] + showFailure _ node_1273 = + "expected " + GHC.Base.<> ( "hash_bang_line" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1273 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1273) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1274 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1275 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1276 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1277 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1274 + c1_1275 = TreeSitter.Node.nodeStartPoint node_1273 + TreeSitter.Node.TSPoint + r2_1276 + c2_1277 = TreeSitter.Node.nodeEndPoint node_1273 + +deriving instance GHC.Classes.Eq a_1278 => GHC.Classes.Eq (HashBangLine a_1278) + +deriving instance GHC.Classes.Ord a_1279 => GHC.Classes.Ord (HashBangLine a_1279) + +deriving instance GHC.Show.Show a_1280 => GHC.Show.Show (HashBangLine a_1280) + +instance AST.Unmarshal.Unmarshal HashBangLine + +instance Data.Foldable.Foldable HashBangLine where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor HashBangLine where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable HashBangLine where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Identifier a = Identifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1281. + AST.Traversable1.Class.Traversable1 a_1281 + ) + +instance AST.Unmarshal.SymbolMatching Identifier where + matchedSymbols _ = [1] + showFailure _ node_1282 = + "expected " + GHC.Base.<> ( "identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1282 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1282) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1283 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1284 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1285 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1286 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1283 + c1_1284 = TreeSitter.Node.nodeStartPoint node_1282 + TreeSitter.Node.TSPoint + r2_1285 + c2_1286 = TreeSitter.Node.nodeEndPoint node_1282 + +deriving instance GHC.Classes.Eq a_1287 => GHC.Classes.Eq (Identifier a_1287) + +deriving instance GHC.Classes.Ord a_1288 => GHC.Classes.Ord (Identifier a_1288) + +deriving instance GHC.Show.Show a_1289 => GHC.Show.Show (Identifier a_1289) + +instance AST.Unmarshal.Unmarshal Identifier + +instance Data.Foldable.Foldable Identifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Identifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Identifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousIf = AST.Token.Token "if" 19 + +type AnonymousImplements = AST.Token.Token "implements" 129 + +type AnonymousImport = AST.Token.Token "import" 14 + +type AnonymousIn = AST.Token.Token "in" 26 + +type AnonymousInstanceof = AST.Token.Token "instanceof" 87 + +type AnonymousInterface = AST.Token.Token "interface" 131 + +type AnonymousIs = AST.Token.Token "is" 135 + +data JsxText a = JsxText {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1290. + AST.Traversable1.Class.Traversable1 a_1290 + ) + +instance AST.Unmarshal.SymbolMatching JsxText where + matchedSymbols _ = [] + showFailure _ node_1291 = + "expected " + GHC.Base.<> ( "" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1291 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1291) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1292 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1293 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1294 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1295 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1292 + c1_1293 = TreeSitter.Node.nodeStartPoint node_1291 + TreeSitter.Node.TSPoint + r2_1294 + c2_1295 = TreeSitter.Node.nodeEndPoint node_1291 + +deriving instance GHC.Classes.Eq a_1296 => GHC.Classes.Eq (JsxText a_1296) + +deriving instance GHC.Classes.Ord a_1297 => GHC.Classes.Ord (JsxText a_1297) + +deriving instance GHC.Show.Show a_1298 => GHC.Show.Show (JsxText a_1298) + +instance AST.Unmarshal.Unmarshal JsxText + +instance Data.Foldable.Foldable JsxText where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor JsxText where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable JsxText where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousKeyof = AST.Token.Token "keyof" 136 + +type AnonymousLet = AST.Token.Token "let" 17 + +type AnonymousModule = AST.Token.Token "module" 122 + +type AnonymousNamespace = AST.Token.Token "namespace" 8 + +type AnonymousNew = AST.Token.Token "new" 53 + +data Null a = Null {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1299. + AST.Traversable1.Class.Traversable1 a_1299 + ) + +instance AST.Unmarshal.SymbolMatching Null where + matchedSymbols _ = [111] + showFailure _ node_1300 = + "expected " + GHC.Base.<> ( "null" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1300 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1300) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1301 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1302 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1303 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1304 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1301 + c1_1302 = TreeSitter.Node.nodeStartPoint node_1300 + TreeSitter.Node.TSPoint + r2_1303 + c2_1304 = TreeSitter.Node.nodeEndPoint node_1300 + +deriving instance GHC.Classes.Eq a_1305 => GHC.Classes.Eq (Null a_1305) + +deriving instance GHC.Classes.Ord a_1306 => GHC.Classes.Ord (Null a_1306) + +deriving instance GHC.Show.Show a_1307 => GHC.Show.Show (Null a_1307) + +instance AST.Unmarshal.Unmarshal Null + +instance Data.Foldable.Foldable Null where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Null where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Null where + traverse = AST.Traversable1.Class.traverseDefault1 + +data Number a = Number {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1308. + AST.Traversable1.Class.Traversable1 a_1308 + ) + +instance AST.Unmarshal.SymbolMatching Number where + matchedSymbols _ = [105] + showFailure _ node_1309 = + "expected " + GHC.Base.<> ( "number" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1309 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1309) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1310 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1311 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1312 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1313 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1310 + c1_1311 = TreeSitter.Node.nodeStartPoint node_1309 + TreeSitter.Node.TSPoint + r2_1312 + c2_1313 = TreeSitter.Node.nodeEndPoint node_1309 + +deriving instance GHC.Classes.Eq a_1314 => GHC.Classes.Eq (Number a_1314) + +deriving instance GHC.Classes.Ord a_1315 => GHC.Classes.Ord (Number a_1315) + +deriving instance GHC.Show.Show a_1316 => GHC.Show.Show (Number a_1316) + +instance AST.Unmarshal.Unmarshal Number + +instance Data.Foldable.Foldable Number where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Number where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Number where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousNumber = AST.Token.Token "number" 124 + +type AnonymousOf = AST.Token.Token "of" 27 + +type AnonymousPrivate = AST.Token.Token "private" 120 + +data PropertyIdentifier a = PropertyIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1317. + AST.Traversable1.Class.Traversable1 a_1317 + ) + +instance AST.Unmarshal.SymbolMatching PropertyIdentifier where + matchedSymbols _ = [303] + showFailure _ node_1318 = + "expected " + GHC.Base.<> ( "property_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1318 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1318) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1319 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1320 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1321 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1322 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1319 + c1_1320 = TreeSitter.Node.nodeStartPoint node_1318 + TreeSitter.Node.TSPoint + r2_1321 + c2_1322 = TreeSitter.Node.nodeEndPoint node_1318 + +deriving instance GHC.Classes.Eq a_1323 => GHC.Classes.Eq (PropertyIdentifier a_1323) + +deriving instance GHC.Classes.Ord a_1324 => GHC.Classes.Ord (PropertyIdentifier a_1324) + +deriving instance GHC.Show.Show a_1325 => GHC.Show.Show (PropertyIdentifier a_1325) + +instance AST.Unmarshal.Unmarshal PropertyIdentifier + +instance Data.Foldable.Foldable PropertyIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor PropertyIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable PropertyIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousProtected = AST.Token.Token "protected" 121 + +type AnonymousPublic = AST.Token.Token "public" 119 + +data Readonly a = Readonly {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1326. + AST.Traversable1.Class.Traversable1 a_1326 + ) + +instance AST.Unmarshal.SymbolMatching Readonly where + matchedSymbols _ = [134] + showFailure _ node_1327 = + "expected " + GHC.Base.<> ( "readonly" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1327 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1327) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1328 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1329 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1330 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1331 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1328 + c1_1329 = TreeSitter.Node.nodeStartPoint node_1327 + TreeSitter.Node.TSPoint + r2_1330 + c2_1331 = TreeSitter.Node.nodeEndPoint node_1327 + +deriving instance GHC.Classes.Eq a_1332 => GHC.Classes.Eq (Readonly a_1332) + +deriving instance GHC.Classes.Ord a_1333 => GHC.Classes.Ord (Readonly a_1333) + +deriving instance GHC.Show.Show a_1334 => GHC.Show.Show (Readonly a_1334) + +instance AST.Unmarshal.Unmarshal Readonly + +instance Data.Foldable.Foldable Readonly where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Readonly where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Readonly where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RegexFlags a = RegexFlags {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1335. + AST.Traversable1.Class.Traversable1 a_1335 + ) + +instance AST.Unmarshal.SymbolMatching RegexFlags where + matchedSymbols _ = [104] + showFailure _ node_1336 = + "expected " + GHC.Base.<> ( "regex_flags" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1336 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1336) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1337 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1338 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1339 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1340 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1337 + c1_1338 = TreeSitter.Node.nodeStartPoint node_1336 + TreeSitter.Node.TSPoint + r2_1339 + c2_1340 = TreeSitter.Node.nodeEndPoint node_1336 + +deriving instance GHC.Classes.Eq a_1341 => GHC.Classes.Eq (RegexFlags a_1341) + +deriving instance GHC.Classes.Ord a_1342 => GHC.Classes.Ord (RegexFlags a_1342) + +deriving instance GHC.Show.Show a_1343 => GHC.Show.Show (RegexFlags a_1343) + +instance AST.Unmarshal.Unmarshal RegexFlags + +instance Data.Foldable.Foldable RegexFlags where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RegexFlags where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RegexFlags where + traverse = AST.Traversable1.Class.traverseDefault1 + +data RegexPattern a = RegexPattern {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1344. + AST.Traversable1.Class.Traversable1 a_1344 + ) + +instance AST.Unmarshal.SymbolMatching RegexPattern where + matchedSymbols _ = [103] + showFailure _ node_1345 = + "expected " + GHC.Base.<> ( "regex_pattern" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1345 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1345) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1346 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1347 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1348 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1349 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1346 + c1_1347 = TreeSitter.Node.nodeStartPoint node_1345 + TreeSitter.Node.TSPoint + r2_1348 + c2_1349 = TreeSitter.Node.nodeEndPoint node_1345 + +deriving instance GHC.Classes.Eq a_1350 => GHC.Classes.Eq (RegexPattern a_1350) + +deriving instance GHC.Classes.Ord a_1351 => GHC.Classes.Ord (RegexPattern a_1351) + +deriving instance GHC.Show.Show a_1352 => GHC.Show.Show (RegexPattern a_1352) + +instance AST.Unmarshal.Unmarshal RegexPattern + +instance Data.Foldable.Foldable RegexPattern where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor RegexPattern where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable RegexPattern where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousRequire = AST.Token.Token "require" 128 + +type AnonymousReturn = AST.Token.Token "return" 35 + +type AnonymousSet = AST.Token.Token "set" 117 + +data ShorthandPropertyIdentifier a = ShorthandPropertyIdentifier + { ann :: a, + text :: Data.Text.Internal.Text + } + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1353. + AST.Traversable1.Class.Traversable1 a_1353 + ) + +instance AST.Unmarshal.SymbolMatching ShorthandPropertyIdentifier where + matchedSymbols _ = [304] + showFailure _ node_1354 = + "expected " + GHC.Base.<> ( "shorthand_property_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1354 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1354) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1355 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1356 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1357 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1358 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1355 + c1_1356 = TreeSitter.Node.nodeStartPoint node_1354 + TreeSitter.Node.TSPoint + r2_1357 + c2_1358 = TreeSitter.Node.nodeEndPoint node_1354 + +deriving instance GHC.Classes.Eq a_1359 => GHC.Classes.Eq (ShorthandPropertyIdentifier a_1359) + +deriving instance GHC.Classes.Ord a_1360 => GHC.Classes.Ord (ShorthandPropertyIdentifier a_1360) + +deriving instance GHC.Show.Show a_1361 => GHC.Show.Show (ShorthandPropertyIdentifier a_1361) + +instance AST.Unmarshal.Unmarshal ShorthandPropertyIdentifier + +instance Data.Foldable.Foldable ShorthandPropertyIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor ShorthandPropertyIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable ShorthandPropertyIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +data StatementIdentifier a = StatementIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1362. + AST.Traversable1.Class.Traversable1 a_1362 + ) + +instance AST.Unmarshal.SymbolMatching StatementIdentifier where + matchedSymbols _ = [305] + showFailure _ node_1363 = + "expected " + GHC.Base.<> ( "statement_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1363 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1363) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1364 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1365 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1366 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1367 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1364 + c1_1365 = TreeSitter.Node.nodeStartPoint node_1363 + TreeSitter.Node.TSPoint + r2_1366 + c2_1367 = TreeSitter.Node.nodeEndPoint node_1363 + +deriving instance GHC.Classes.Eq a_1368 => GHC.Classes.Eq (StatementIdentifier a_1368) + +deriving instance GHC.Classes.Ord a_1369 => GHC.Classes.Ord (StatementIdentifier a_1369) + +deriving instance GHC.Show.Show a_1370 => GHC.Show.Show (StatementIdentifier a_1370) + +instance AST.Unmarshal.Unmarshal StatementIdentifier + +instance Data.Foldable.Foldable StatementIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor StatementIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable StatementIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousStatic = AST.Token.Token "static" 114 + +type AnonymousString = AST.Token.Token "string" 126 + +data Super a = Super {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1371. + AST.Traversable1.Class.Traversable1 a_1371 + ) + +instance AST.Unmarshal.SymbolMatching Super where + matchedSymbols _ = [108] + showFailure _ node_1372 = + "expected " + GHC.Base.<> ( "super" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1372 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1372) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1373 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1374 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1375 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1376 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1373 + c1_1374 = TreeSitter.Node.nodeStartPoint node_1372 + TreeSitter.Node.TSPoint + r2_1375 + c2_1376 = TreeSitter.Node.nodeEndPoint node_1372 + +deriving instance GHC.Classes.Eq a_1377 => GHC.Classes.Eq (Super a_1377) + +deriving instance GHC.Classes.Ord a_1378 => GHC.Classes.Ord (Super a_1378) + +deriving instance GHC.Show.Show a_1379 => GHC.Show.Show (Super a_1379) + +instance AST.Unmarshal.Unmarshal Super + +instance Data.Foldable.Foldable Super where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Super where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Super where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousSwitch = AST.Token.Token "switch" 21 + +type AnonymousSymbol = AST.Token.Token "symbol" 127 + +type AnonymousTarget = AST.Token.Token "target" 106 + +data This a = This {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1380. + AST.Traversable1.Class.Traversable1 a_1380 + ) + +instance AST.Unmarshal.SymbolMatching This where + matchedSymbols _ = [107] + showFailure _ node_1381 = + "expected " + GHC.Base.<> ( "this" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1381 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1381) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1382 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1383 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1384 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1385 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1382 + c1_1383 = TreeSitter.Node.nodeStartPoint node_1381 + TreeSitter.Node.TSPoint + r2_1384 + c2_1385 = TreeSitter.Node.nodeEndPoint node_1381 + +deriving instance GHC.Classes.Eq a_1386 => GHC.Classes.Eq (This a_1386) + +deriving instance GHC.Classes.Ord a_1387 => GHC.Classes.Ord (This a_1387) + +deriving instance GHC.Show.Show a_1388 => GHC.Show.Show (This a_1388) + +instance AST.Unmarshal.Unmarshal This + +instance Data.Foldable.Foldable This where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor This where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable This where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousThrow = AST.Token.Token "throw" 36 + +data True a = True {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1389. + AST.Traversable1.Class.Traversable1 a_1389 + ) + +instance AST.Unmarshal.SymbolMatching True where + matchedSymbols _ = [109] + showFailure _ node_1390 = + "expected " + GHC.Base.<> ( "true" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1390 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1390) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1391 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1392 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1393 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1394 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1391 + c1_1392 = TreeSitter.Node.nodeStartPoint node_1390 + TreeSitter.Node.TSPoint + r2_1393 + c2_1394 = TreeSitter.Node.nodeEndPoint node_1390 + +deriving instance GHC.Classes.Eq a_1395 => GHC.Classes.Eq (True a_1395) + +deriving instance GHC.Classes.Ord a_1396 => GHC.Classes.Ord (True a_1396) + +deriving instance GHC.Show.Show a_1397 => GHC.Show.Show (True a_1397) + +instance AST.Unmarshal.Unmarshal True + +instance Data.Foldable.Foldable True where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor True where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable True where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousTry = AST.Token.Token "try" 30 + +type AnonymousType = AST.Token.Token "type" 12 + +data TypeIdentifier a = TypeIdentifier {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1398. + AST.Traversable1.Class.Traversable1 a_1398 + ) + +instance AST.Unmarshal.SymbolMatching TypeIdentifier where + matchedSymbols _ = [306] + showFailure _ node_1399 = + "expected " + GHC.Base.<> ( "type_identifier" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1399 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1399) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1400 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1401 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1402 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1403 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1400 + c1_1401 = TreeSitter.Node.nodeStartPoint node_1399 + TreeSitter.Node.TSPoint + r2_1402 + c2_1403 = TreeSitter.Node.nodeEndPoint node_1399 + +deriving instance GHC.Classes.Eq a_1404 => GHC.Classes.Eq (TypeIdentifier a_1404) + +deriving instance GHC.Classes.Ord a_1405 => GHC.Classes.Ord (TypeIdentifier a_1405) + +deriving instance GHC.Show.Show a_1406 => GHC.Show.Show (TypeIdentifier a_1406) + +instance AST.Unmarshal.Unmarshal TypeIdentifier + +instance Data.Foldable.Foldable TypeIdentifier where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor TypeIdentifier where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable TypeIdentifier where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousTypeof = AST.Token.Token "typeof" 13 + +data Undefined a = Undefined {ann :: a, text :: Data.Text.Internal.Text} + deriving stock (GHC.Generics.Generic, GHC.Generics.Generic1) + deriving anyclass + ( forall a_1407. + AST.Traversable1.Class.Traversable1 a_1407 + ) + +instance AST.Unmarshal.SymbolMatching Undefined where + matchedSymbols _ = [112] + showFailure _ node_1408 = + "expected " + GHC.Base.<> ( "undefined" + GHC.Base.<> ( " but got " + GHC.Base.<> ( if TreeSitter.Node.nodeSymbol node_1408 GHC.Classes.== 65535 + then "ERROR" + else Data.OldList.genericIndex debugSymbolNames (TreeSitter.Node.nodeSymbol node_1408) GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r1_1409 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c1_1410 GHC.Base.<> ("] -" GHC.Base.<> (" [" GHC.Base.<> (GHC.Show.show r2_1411 GHC.Base.<> (", " GHC.Base.<> (GHC.Show.show c2_1412 GHC.Base.<> "]"))))))))) + ) + ) + ) + where + TreeSitter.Node.TSPoint + r1_1409 + c1_1410 = TreeSitter.Node.nodeStartPoint node_1408 + TreeSitter.Node.TSPoint + r2_1411 + c2_1412 = TreeSitter.Node.nodeEndPoint node_1408 + +deriving instance GHC.Classes.Eq a_1413 => GHC.Classes.Eq (Undefined a_1413) + +deriving instance GHC.Classes.Ord a_1414 => GHC.Classes.Ord (Undefined a_1414) + +deriving instance GHC.Show.Show a_1415 => GHC.Show.Show (Undefined a_1415) + +instance AST.Unmarshal.Unmarshal Undefined + +instance Data.Foldable.Foldable Undefined where + foldMap = AST.Traversable1.Class.foldMapDefault1 + +instance GHC.Base.Functor Undefined where + fmap = AST.Traversable1.Class.fmapDefault1 + +instance Data.Traversable.Traversable Undefined where + traverse = AST.Traversable1.Class.traverseDefault1 + +type AnonymousVar = AST.Token.Token "var" 16 + +type AnonymousVoid = AST.Token.Token "void" 90 + +type AnonymousWhile = AST.Token.Token "while" 28 + +type AnonymousWith = AST.Token.Token "with" 31 + +type AnonymousYield = AST.Token.Token "yield" 42 + +type AnonymousLBrace = AST.Token.Token "{" 9 + +type AnonymousLBracePipe = AST.Token.Token "{|" 137 + +type AnonymousPipe = AST.Token.Token "|" 75 + +type AnonymousPipeEqual = AST.Token.Token "|=" 61 + +type AnonymousPipePipe = AST.Token.Token "||" 69 + +type AnonymousPipeRBrace = AST.Token.Token "|}" 138 + +type AnonymousRBrace = AST.Token.Token "}" 11 + +type AnonymousTilde = AST.Token.Token "~" 89 diff --git a/semantic-typescript/src/Language/TypeScript/Grammar.hs b/semantic-typescript/src/Language/TypeScript/Grammar.hs new file mode 100644 index 0000000000..591a6425f3 --- /dev/null +++ b/semantic-typescript/src/Language/TypeScript/Grammar.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} +module Language.TypeScript.Grammar +( tree_sitter_typescript +, Grammar(..) +) where + +import AST.Grammar.TH +import Language.Haskell.TH +import TreeSitter.TypeScript (tree_sitter_typescript) + +-- | Statically-known rules corresponding to symbols in the grammar. +mkStaticallyKnownRuleGrammarData (mkName "Grammar") tree_sitter_typescript diff --git a/semantic-typescript/src/Language/TypeScript/Tags.hs b/semantic-typescript/src/Language/TypeScript/Tags.hs new file mode 100644 index 0000000000..9d95a49344 --- /dev/null +++ b/semantic-typescript/src/Language/TypeScript/Tags.hs @@ -0,0 +1,320 @@ +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} + +module Language.TypeScript.Tags + ( ToTags (..), + ) +where + +import AST.Element +import qualified AST.Parse as Parse +import AST.Token +import AST.Traversable1 +import Control.Effect.Reader +import Control.Effect.State +import Control.Effect.Writer +import Data.Foldable +import Data.Text (Text) +import qualified Language.TypeScript.AST as Ts +import Proto.Semantic as P +import Source.Loc +import Source.Source as Source +import qualified Tags.Tagging.Precise as Tags + +class ToTags (t :: * -> *) where + tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m + ) => + t Loc -> + m () + default tags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () + tags = gtags + +instance ToTags Ts.Function where + tags t@Ts.Function {ann = Loc {byteRange}, name = Just (Parse.Success Ts.Identifier {text, ann})} = + yieldTag text P.FUNCTION P.DEFINITION ann byteRange >> gtags t + tags t = gtags t + +instance ToTags Ts.FunctionSignature where + tags t@Ts.FunctionSignature {ann = Loc {byteRange}, name = Parse.Success (Ts.Identifier {text, ann})} = + yieldTag text P.FUNCTION P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + + +instance ToTags Ts.FunctionDeclaration where + tags t@Ts.FunctionDeclaration {ann = Loc {byteRange}, name = Parse.Success (Ts.Identifier {text, ann})} = + yieldTag text P.FUNCTION P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags Ts.MethodDefinition where + tags t@Ts.MethodDefinition {ann = Loc {byteRange}, name} = case name of + Parse.Success (Prj Ts.PropertyIdentifier {text, ann}) -> yieldTag text P.METHOD P.DEFINITION ann byteRange >> gtags t + _ -> gtags t + +instance ToTags Ts.Pair where + tags t@Ts.Pair {ann = Loc {byteRange}, key = Parse.Success key, value = Parse.Success (Ts.Expression expr)} = case (key, expr) of + (Prj Ts.PropertyIdentifier {text, ann}, Prj Ts.Function {}) -> yield text ann + (Prj Ts.PropertyIdentifier {text, ann}, Prj Ts.ArrowFunction {}) -> yield text ann + _ -> gtags t + where + yield text loc = yieldTag text P.FUNCTION P.DEFINITION loc byteRange >> gtags t + tags _ = pure () + +instance ToTags Ts.ClassDeclaration where + tags t@Ts.ClassDeclaration {ann = Loc {byteRange}, name = Parse.Success (Ts.TypeIdentifier {text, ann})} = + yieldTag text P.CLASS P.DEFINITION ann byteRange >> gtags t + tags _ = pure () + +instance ToTags Ts.CallExpression where + tags t@Ts.CallExpression {ann = Loc {byteRange}, function = Parse.Success (Ts.Expression expr)} = match expr + where + match expr = case expr of + Prj Ts.Identifier {text, ann} -> yield text ann + Prj Ts.NewExpression {constructor = EPrj Ts.Identifier {text, ann}} -> yield text ann + Prj Ts.CallExpression {function = Parse.Success (Ts.Expression expr)} -> match expr + Prj Ts.MemberExpression {property = Parse.Success (Ts.PropertyIdentifier {text, ann})} -> yield text ann + Prj Ts.Function {name = Just (Parse.Success (Ts.Identifier {text, ann}))} -> yield text ann + Prj Ts.ParenthesizedExpression {extraChildren} -> for_ extraChildren $ \x -> case x of + EPrj (Ts.Expression expr) -> match expr + Parse.Success x -> tags x + Parse.Fail _ -> pure () + _ -> gtags t + yield name loc = yieldTag name P.CALL P.REFERENCE loc byteRange >> gtags t + tags _ = pure () + +instance ToTags Ts.Class where + tags t@Ts.Class {ann = Loc {byteRange}, name = Just (Parse.Success Ts.TypeIdentifier {text, ann})} = + yieldTag text P.CLASS P.DEFINITION ann byteRange >> gtags t + tags t = gtags t + +instance ToTags Ts.Module where + tags t@Ts.Module {ann = Loc {byteRange}, name} = case name of + Parse.Success (Prj Ts.Identifier {text, ann}) -> yieldTag text P.MODULE P.DEFINITION ann byteRange >> gtags t + _ -> gtags t + +instance ToTags Ts.VariableDeclarator where + tags t@Ts.VariableDeclarator {ann = Loc {byteRange}, name, value = Just (Parse.Success (Ts.Expression expr))} = + case (expr, name) of + (Prj Ts.Function {}, Parse.Success (Prj Ts.Identifier {text, ann})) -> yield text ann + (Prj Ts.ArrowFunction {}, Parse.Success (Prj Ts.Identifier {text, ann})) -> yield text ann + _ -> gtags t + where + yield text loc = yieldTag text P.FUNCTION P.DEFINITION loc byteRange >> gtags t + tags t = gtags t + +instance ToTags Ts.AssignmentExpression where + tags t@Ts.AssignmentExpression {ann = Loc {byteRange}, left, right = Parse.Success (Ts.Expression expr)} = + case (left, expr) of + (Parse.Success (Prj Ts.Identifier {text, ann}), Prj Ts.Function {}) -> yield text ann + (Parse.Success (Prj Ts.Identifier {text, ann}), Prj Ts.ArrowFunction {}) -> yield text ann + (EPrj Ts.MemberExpression {property = Parse.Success (Ts.PropertyIdentifier {text, ann})}, Prj Ts.Function {}) -> yield text ann + (EPrj Ts.MemberExpression {property = Parse.Success (Ts.PropertyIdentifier {text, ann})}, Prj Ts.ArrowFunction {}) -> yield text ann + _ -> gtags t + where + yield text loc = yieldTag text P.FUNCTION P.DEFINITION loc byteRange >> gtags t + tags _ = pure () + +instance (ToTags l, ToTags r) => ToTags (l :+: r) where + tags (L1 l) = tags l + tags (R1 r) = tags r + +instance ToTags (Token sym n) where tags _ = pure () + +gtags :: + ( Has (Reader Source) sig m, + Has (State Tags.LineIndices) sig m, + Has (Writer Tags.Tags) sig m, + Traversable1 ToTags t + ) => + t Loc -> + m () +gtags = traverse1_ @ToTags (const (pure ())) tags + +-- These are all valid, but point to built-in functions (e.g. require) that a la +-- carte doesn't display and since we have nothing to link to yet (can't +-- jump-to-def), we hide them from the current tags output. +nameBlacklist :: [Text] +nameBlacklist = ["require"] + +yieldTag :: (Has (Reader Source) sig m, Has (State Tags.LineIndices) sig m, Has (Writer Tags.Tags) sig m) => Text -> P.SyntaxType -> P.NodeType -> Loc -> Range -> m () +yieldTag name P.CALL _ _ _ | name `elem` nameBlacklist = pure () +yieldTag name kind ty loc srcLineRange = Tags.yield name kind ty loc srcLineRange + +{- ORMOLU_DISABLE -} +instance ToTags Ts.AbstractClassDeclaration +instance ToTags Ts.AbstractMethodSignature +instance ToTags Ts.AccessibilityModifier +instance ToTags Ts.AmbientDeclaration +instance ToTags Ts.Arguments +instance ToTags Ts.Array +instance ToTags Ts.ArrayPattern +instance ToTags Ts.ArrayType +instance ToTags Ts.ArrowFunction +instance ToTags Ts.AsExpression +-- instance ToTags Ts.AssignmentExpression +instance ToTags Ts.AssignmentPattern +instance ToTags Ts.AugmentedAssignmentExpression +instance ToTags Ts.AwaitExpression +instance ToTags Ts.BinaryExpression +instance ToTags Ts.BreakStatement +-- instance ToTags Ts.CallExpression +instance ToTags Ts.CallSignature +instance ToTags Ts.CatchClause +-- instance ToTags Ts.Class +instance ToTags Ts.ClassBody +-- instance ToTags Ts.ClassDeclaration +instance ToTags Ts.ClassHeritage +instance ToTags Ts.ComputedPropertyName +instance ToTags Ts.Constraint +instance ToTags Ts.ConstructSignature +instance ToTags Ts.ConstructorType +instance ToTags Ts.ContinueStatement +instance ToTags Ts.DebuggerStatement +instance ToTags Ts.Declaration +instance ToTags Ts.Decorator +instance ToTags Ts.DefaultType +instance ToTags Ts.DestructuringPattern +instance ToTags Ts.DoStatement +instance ToTags Ts.EmptyStatement +instance ToTags Ts.EnumAssignment +instance ToTags Ts.EnumBody +instance ToTags Ts.EnumDeclaration +instance ToTags Ts.EscapeSequence +instance ToTags Ts.ExistentialType +instance ToTags Ts.ExportClause +instance ToTags Ts.ExportSpecifier +instance ToTags Ts.ExportStatement +instance ToTags Ts.Expression +instance ToTags Ts.ExpressionStatement +instance ToTags Ts.ExtendsClause +instance ToTags Ts.False +instance ToTags Ts.FinallyClause +instance ToTags Ts.FlowMaybeType +instance ToTags Ts.ForInStatement +instance ToTags Ts.ForStatement +instance ToTags Ts.FormalParameters +-- instance ToTags Ts.Function +-- instance ToTags Ts.FunctionDeclaration +-- instance ToTags Ts.FunctionSignature +instance ToTags Ts.FunctionType +instance ToTags Ts.GeneratorFunction +instance ToTags Ts.GeneratorFunctionDeclaration +instance ToTags Ts.GenericType +instance ToTags Ts.HashBangLine +instance ToTags Ts.Identifier +instance ToTags Ts.IfStatement +instance ToTags Ts.ImplementsClause +instance ToTags Ts.Import +instance ToTags Ts.ImportAlias +instance ToTags Ts.ImportClause +instance ToTags Ts.ImportRequireClause +instance ToTags Ts.ImportSpecifier +instance ToTags Ts.ImportStatement +instance ToTags Ts.IndexSignature +instance ToTags Ts.IndexTypeQuery +instance ToTags Ts.InterfaceDeclaration +instance ToTags Ts.InternalModule +instance ToTags Ts.IntersectionType +instance ToTags Ts.JsxAttribute +instance ToTags Ts.JsxClosingElement +instance ToTags Ts.JsxElement +instance ToTags Ts.JsxExpression +instance ToTags Ts.JsxFragment +instance ToTags Ts.JsxNamespaceName +instance ToTags Ts.JsxOpeningElement +instance ToTags Ts.JsxSelfClosingElement +instance ToTags Ts.JsxText +instance ToTags Ts.LabeledStatement +instance ToTags Ts.LexicalDeclaration +instance ToTags Ts.LiteralType +instance ToTags Ts.LookupType +instance ToTags Ts.MappedTypeClause +instance ToTags Ts.MemberExpression +instance ToTags Ts.MetaProperty +-- instance ToTags Ts.MethodDefinition +instance ToTags Ts.MethodSignature +-- instance ToTags Ts.Module +instance ToTags Ts.NamedImports +instance ToTags Ts.NamespaceImport +instance ToTags Ts.NestedIdentifier +instance ToTags Ts.NestedTypeIdentifier +instance ToTags Ts.NewExpression +instance ToTags Ts.NonNullExpression +instance ToTags Ts.Null +instance ToTags Ts.Number +instance ToTags Ts.Object +instance ToTags Ts.ObjectPattern +instance ToTags Ts.ObjectType +instance ToTags Ts.OptionalParameter +-- instance ToTags Ts.Pair +instance ToTags Ts.ParenthesizedExpression +instance ToTags Ts.ParenthesizedType +instance ToTags Ts.PredefinedType +instance ToTags Ts.Program +instance ToTags Ts.PropertyIdentifier +instance ToTags Ts.PropertySignature +instance ToTags Ts.PublicFieldDefinition +instance ToTags Ts.Readonly +instance ToTags Ts.Regex +instance ToTags Ts.RegexFlags +instance ToTags Ts.RegexPattern +instance ToTags Ts.RequiredParameter +instance ToTags Ts.RestParameter +instance ToTags Ts.ReturnStatement +instance ToTags Ts.SequenceExpression +instance ToTags Ts.ShorthandPropertyIdentifier +instance ToTags Ts.SpreadElement +instance ToTags Ts.Statement +instance ToTags Ts.StatementBlock +instance ToTags Ts.StatementIdentifier +instance ToTags Ts.String +instance ToTags Ts.SubscriptExpression +instance ToTags Ts.Super +instance ToTags Ts.SwitchBody +instance ToTags Ts.SwitchCase +instance ToTags Ts.SwitchDefault +instance ToTags Ts.SwitchStatement +instance ToTags Ts.TemplateString +instance ToTags Ts.TemplateSubstitution +instance ToTags Ts.TernaryExpression +instance ToTags Ts.This +instance ToTags Ts.ThrowStatement +instance ToTags Ts.True +instance ToTags Ts.TryStatement +instance ToTags Ts.TupleType +instance ToTags Ts.TypeAliasDeclaration +instance ToTags Ts.TypeAssertion +instance ToTags Ts.TypeAnnotation +instance ToTags Ts.TypeArguments +instance ToTags Ts.TypeIdentifier +instance ToTags Ts.TypeParameter +instance ToTags Ts.TypeParameters +instance ToTags Ts.TypePredicate +instance ToTags Ts.TypeQuery +instance ToTags Ts.UnaryExpression +instance ToTags Ts.Undefined +instance ToTags Ts.UnionType +instance ToTags Ts.UpdateExpression +instance ToTags Ts.VariableDeclaration +-- instance ToTags Ts.VariableDeclarator +instance ToTags Ts.WhileStatement +instance ToTags Ts.WithStatement +instance ToTags Ts.YieldExpression +{- ORMOLU_ENABLE -} diff --git a/semantic-typescript/test/PreciseTest.hs b/semantic-typescript/test/PreciseTest.hs new file mode 100644 index 0000000000..fab7f7fee9 --- /dev/null +++ b/semantic-typescript/test/PreciseTest.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-unused-imports #-} +module Main (main) where + +import AST.TestHelpers +import AST.Unmarshal +import qualified Language.TypeScript.AST as Ts +import qualified System.Path.Fixture as Fixture +import Test.Tasty +import TreeSitter.TypeScript + +main :: IO () +main = do +#if BAZEL_BUILD + rf <- Fixture.create + let ?project = "external/tree-sitter-typescript" + ?runfiles = rf + let dirs = Fixture.absRelDir "typescript/corpus" +#else + dirs <- Ts.getTestCorpusDir +#endif + + readCorpusFiles' dirs + >>= traverse (testCorpus parse) + >>= defaultMain . tests + where parse = parseByteString @Ts.Program @() tree_sitter_typescript + +tests :: [TestTree] -> TestTree +tests = testGroup "tree-sitter-typescript corpus tests" diff --git a/semantic.cabal b/semantic.cabal deleted file mode 100644 index ccb96efc0e..0000000000 --- a/semantic.cabal +++ /dev/null @@ -1,424 +0,0 @@ -cabal-version: 2.2 -name: semantic -version: 0.6.0 -synopsis: Framework and service for analyzing and diffing untrusted code. -description: Please see README.md -homepage: http://github.com/github/semantic#readme -author: The Semantic authors -maintainer: opensource+semantic@github.com -license: MIT -license-file: LICENSE -copyright: (c) 2016-2019 GitHub, Inc. -category: Web -build-type: Simple -stability: alpha - -tested-with: GHC == 8.6.4 - -flag release - description: Build with optimizations on (for CI or deployment builds) - default: False - --- GHC extensions shared between targets -common haskell - default-language: Haskell2010 - default-extensions: DataKinds - , DeriveFoldable - , DeriveFunctor - , DeriveGeneric - , DeriveTraversable - , FlexibleContexts - , FlexibleInstances - , MonadFailDesugaring - , MultiParamTypeClasses - , OverloadedStrings - , RecordWildCards - , StandaloneDeriving - , StrictData - , TypeApplications - --- Except in case of vendored dependencies, these deps should be expressed --- as caret-operator bounds relative to a version in Stackage. --- These are currently pinned to lts-13.13. -common dependencies - build-depends: base >= 4.12 && < 5 - , aeson ^>= 1.4.2.0 - , algebraic-graphs ^>= 0.3 - , async ^>= 2.2.1 - , bifunctors ^>= 5.5 - , bytestring ^>= 0.10.8.2 - , containers ^>= 0.6.0.1 - , directory ^>= 1.3.3.0 - , fastsum - , filepath ^>= 1.4.2.1 - , free ^>= 5.1 - , fused-effects ^>= 0.4.0.0 - , fused-effects-exceptions ^>= 0.1.1.0 - , hashable ^>= 1.2.7.0 - , haskell-tree-sitter - , machines ^>= 0.6.4 - , mtl ^>= 2.2.2 - , network ^>= 2.8.0.0 - , process - , recursion-schemes ^>= 5.1 - , scientific ^>= 0.3.6.2 - , safe-exceptions - , semilattices - , text ^>= 1.2.3.1 - , these >= 0.7 && <1 - , unix ^>= 2.7.2.2 - , proto3-suite - , proto3-wire - -common executable-flags - ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" - -library - import: haskell, dependencies - hs-source-dirs: src - exposed-modules: - -- Analyses & term annotations - Analysis.Abstract.Caching.FlowInsensitive - , Analysis.Abstract.Caching.FlowSensitive - , Analysis.Abstract.Collecting - , Analysis.Abstract.Dead - , Analysis.Abstract.Graph - , Analysis.Abstract.Tracing - , Analysis.ConstructorName - , Analysis.CyclomaticComplexity - , Analysis.TOCSummary - , Analysis.Decorator - , Analysis.HasTextElement - , Analysis.PackageDef - -- Semantic assignment - , Assigning.Assignment - , Assigning.Assignment.Deterministic - , Assigning.Assignment.Table - -- Control structures & interfaces for abstract interpretation - , Control.Abstract - , Control.Abstract.Context - , Control.Abstract.Evaluator - , Control.Abstract.Heap - , Control.Abstract.Hole - , Control.Abstract.Modules - , Control.Abstract.Primitive - , Control.Abstract.PythonPackage - , Control.Abstract.Roots - , Control.Abstract.ScopeGraph - , Control.Abstract.Value - -- Effects - , Control.Effect.Interpose - , Control.Effect.REPL - , Control.Rewriting - -- Datatypes for abstract interpretation - , Data.Abstract.Address.Hole - , Data.Abstract.Address.Monovariant - , Data.Abstract.Address.Precise - , Data.Abstract.BaseError - , Data.Abstract.Declarations - , Data.Abstract.Evaluatable - , Data.Abstract.FreeVariables - , Data.Abstract.AccessControls.Class - , Data.Abstract.AccessControls.Instances - , Data.Abstract.Heap - , Data.Abstract.Live - , Data.Abstract.Module - , Data.Abstract.ModuleTable - , Data.Abstract.Name - , Data.Abstract.Number - , Data.Abstract.Package - , Data.Abstract.Path - , Data.Abstract.ScopeGraph - , Data.Abstract.Value.Abstract - , Data.Abstract.Value.Concrete - , Data.Abstract.Value.Type - -- General datatype definitions & generic algorithms - , Data.Algebra - , Data.AST - , Data.Blob - , Data.Blob.IO - , Data.Diff - , Data.Duration - , Data.Error - , Data.Flag - , Data.Functor.Both - , Data.Functor.Classes.Generic - , Data.Graph - , Data.Graph.ControlFlowVertex - , Data.Handle - , Data.History - , Data.ImportPath - , Data.JSON.Fields - , Data.Language - , Data.Location - , Data.Map.Monoidal - , Data.Patch - , Data.Project - , Data.Quieterm - , Data.Range - , Data.Reprinting.Errors - , Data.Reprinting.Fragment - , Data.Reprinting.Operator - , Data.Reprinting.Scope - , Data.Reprinting.Splice - , Data.Reprinting.Token - , Data.Semigroup.App - , Data.Scientific.Exts - , Data.Source - , Data.Span - -- Γ€ la carte syntax types - , Data.Syntax - , Data.Syntax.Comment - , Data.Syntax.Declaration - , Data.Syntax.Directive - , Data.Syntax.Expression - , Data.Syntax.Literal - , Data.Syntax.Statement - , Data.Syntax.Type - , Data.Tag - , Data.Term - -- Diffing algorithms & interpretation thereof - , Diffing.Algorithm - , Diffing.Algorithm.RWS - , Diffing.Algorithm.RWS.FeatureVector - , Diffing.Algorithm.SES - , Diffing.Interpreter - -- Language-specific grammar/syntax types, & assignments - , Language.Markdown.Assignment - , Language.Markdown.Syntax - , Language.Go.Assignment - , Language.Go.Syntax - , Language.Go.Type - , Language.Haskell.Assignment - , Language.Haskell.Syntax - , Language.Haskell.Syntax.Constructor - , Language.Haskell.Syntax.Haskell - , Language.Haskell.Syntax.Identifier - , Language.Haskell.Syntax.Pattern - , Language.Haskell.Syntax.QuasiQuote - , Language.Haskell.Syntax.Type - , Language.JSON.Assignment - , Language.JSON.PrettyPrint - , Language.Ruby.Assignment - , Language.Ruby.PrettyPrint - , Language.Ruby.Syntax - , Language.TSX.Assignment - , Language.TSX.Syntax - , Language.TSX.Syntax.JSX - , Language.TypeScript.Assignment - , Language.TypeScript.Resolution - , Language.TypeScript.Syntax - , Language.TypeScript.Syntax.Import - , Language.TypeScript.Syntax.JavaScript - , Language.TypeScript.Syntax.TypeScript - , Language.TypeScript.Syntax.Types - , Language.PHP.Assignment - , Language.PHP.Syntax - , Language.Python.Assignment - , Language.Python.PrettyPrint - , Language.Python.Syntax - , Language.Java.Assignment - , Language.Java.Syntax - , Numeric.Exts - -- Parser glue - , Parsing.CMark - , Parsing.Parser - , Parsing.TreeSitter - , Paths_semantic - -- Rendering formats - , Rendering.Graph - , Rendering.JSON - , Rendering.TOC - , Reprinting.Tokenize - , Reprinting.Translate - , Reprinting.Typeset - , Reprinting.Pipeline - -- High-level flow & operational functionality (logging, stats, etc.) - , Semantic.Analysis - -- API - , Semantic.Api - , Semantic.Api.Bridge - , Semantic.Api.Diffs - , Semantic.Api.LegacyTypes - , Semantic.Api.Symbols - , Semantic.Api.Terms - , Semantic.Api.TOCSummaries - , Semantic.Api.V1.CodeAnalysisPB - , Semantic.AST - , Semantic.CLI - , Semantic.Config - , Semantic.Distribute - , Semantic.Env - , Semantic.Git - , Semantic.Graph - , Semantic.IO - , Semantic.REPL - , Semantic.Resolution - , Semantic.Task - , Semantic.Task.Files - , Semantic.Telemetry - , Semantic.Telemetry.AsyncQueue - , Semantic.Telemetry.Error - , Semantic.Telemetry.Log - , Semantic.Telemetry.Stat - , Semantic.Timeout - , Semantic.Util - , Semantic.Util.Pretty - , Semantic.Version - -- Serialization - , Serializing.Format - , Serializing.SExpression - , Tags.Taggable - , Tags.Tagging - -- Custom Prelude - , Prologue - - build-depends: base >= 4.12 && < 5 - , ansi-terminal ^>= 0.8.2 - , array ^>= 0.5.3.0 - , attoparsec ^>= 0.13.2.2 - , cmark-gfm == 0.1.8 - , cryptohash ^>= 0.11.9 - , deepseq ^>= 1.4.4.0 - , directory-tree ^>= 0.12.1 - , generic-monoid ^>= 0.1.0.0 - , ghc-prim ^>= 0.5.3 - , gitrev ^>= 1.3.1 - , haskeline ^>= 0.7.5.0 - , hostname ^>= 1.0 - , hscolour ^>= 1.24.4 - , http-client ^>= 0.6.2 - , http-client-tls ^>= 0.3.5.3 - , http-types ^>= 0.12.3 - , http-media ^>= 0.7.1.3 - , kdt ^>= 0.2.4 - , lens ^>= 4.17 - , mersenne-random-pure64 ^>= 0.2.2.0 - , network-uri ^>= 2.6.1.0 - , optparse-applicative ^>= 0.14.3.0 - , parallel ^>= 3.2.2.0 - , parsers ^>= 0.12.9 - , prettyprinter ^>= 1.2.1 - , pretty-show ^>= 1.9.5 - , profunctors ^>= 5.3 - , reducers ^>= 3.12.3 - , semigroupoids ^>= 5.3.2 - , servant ^>= 0.15 - , shelly - , split ^>= 0.2.3.3 - , stm-chans ^>= 3.0.0.4 - , template-haskell ^>= 2.14 - , time ^>= 1.8.0.2 - , unliftio-core - , unordered-containers ^>= 0.2.9.0 - , vector ^>= 0.12.0.2 - , haskell-tree-sitter - , tree-sitter-go - , tree-sitter-haskell - , tree-sitter-json - , tree-sitter-php - , tree-sitter-python - , tree-sitter-ruby - , tree-sitter-typescript - , tree-sitter-tsx - , tree-sitter-java - ghc-options: -Wall -Wmissing-export-lists -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-name-shadowing -j - if flag(release) - ghc-options: -Werror -O1 - cpp-options: -DCOMPUTE_GIT_SHA - else - ghc-options: -O0 +RTS -A128m -n2m -RTS - ghc-prof-options: -fprof-auto - -executable semantic - import: haskell, dependencies, executable-flags - hs-source-dirs: app - main-is: Main.hs - if flag(release) - ghc-options: -O1 - cpp-options: -DCOMPUTE_GIT_SHA - else - ghc-options: -O0 - build-depends: base - , semantic - -test-suite test - import: haskell, dependencies, executable-flags - type: exitcode-stdio-1.0 - hs-source-dirs: test - main-is: Spec.hs - other-modules: Analysis.Go.Spec - , Analysis.PHP.Spec - , Analysis.Python.Spec - , Analysis.Ruby.Spec - , Analysis.TypeScript.Spec - , Assigning.Assignment.Spec - , Control.Abstract.Evaluator.Spec - , Data.Abstract.Path.Spec - , Data.Abstract.Name.Spec - , Data.Diff.Spec - , Data.Functor.Classes.Generic.Spec - , Data.Functor.Listable - , Data.Graph.Spec - , Data.Mergeable - , Data.Range.Spec - , Data.Scientific.Spec - , Data.Semigroup.App.Spec - , Data.Source.Spec - , Data.Term.Spec - , Diffing.Algorithm.RWS.Spec - , Diffing.Algorithm.SES.Spec - , Diffing.Interpreter.Spec - , Graphing.Calls.Spec - , Integration.Spec - , Numeric.Spec - , Parsing.Spec - , Reprinting.Spec - , Rewriting.Go.Spec - , Rewriting.JSON.Spec - , Rewriting.Python.Spec - , Rendering.TOC.Spec - , Semantic.Spec - , Semantic.CLI.Spec - , Semantic.IO.Spec - , Semantic.Stat.Spec - , Tags.Spec - , SpecHelpers - , Test.Hspec.LeanCheck - build-depends: semantic - , tree-sitter-json - , Glob - , hspec >= 2.6 && <3 - , hspec-core >= 2.6 && <3 - , hspec-expectations-pretty-diff ^>= 0.7.2.5 - , HUnit ^>= 1.6.0.0 - , leancheck >= 0.8 && <1 - , temporary - ghc-options: -O0 - if flag(release) - ghc-options: -dynamic - -test-suite parse-examples - import: haskell, dependencies, executable-flags - type: exitcode-stdio-1.0 - hs-source-dirs: test - main-is: Examples.hs - build-depends: semantic - , Glob - , hspec >= 2.4.1 - , hspec-core - , hspec-expectations-pretty-diff - -benchmark evaluation - import: haskell, executable-flags - hs-source-dirs: bench/evaluation - type: exitcode-stdio-1.0 - main-is: Main.hs - ghc-options: -static -O1 - build-depends: base - , criterion - , semantic - -source-repository head - type: git - location: https://github.com/github/semantic diff --git a/semantic/BUILD.bazel b/semantic/BUILD.bazel new file mode 100644 index 0000000000..f7b6528e75 --- /dev/null +++ b/semantic/BUILD.bazel @@ -0,0 +1,204 @@ +package(default_visibility = ["//visibility:public"]) + +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_binary", + "haskell_library", + "haskell_test", +) +load( + "@rules_haskell//haskell:cabal.bzl", + "haskell_cabal_binary", + "haskell_cabal_library", +) +load( + "//:build/common.bzl", + "EXECUTABLE_FLAGS", + "GHC_FLAGS", +) +load( + "//:build/example_repos.bzl", + "SEMANTIC_EXTERNAL_TEST_REPOSITORIES", +) + +semantic_common_dependencies = [ + "//:bytestring", + "//:containers", + "//:process", + "//:text", + "//semantic-analysis", + "//semantic-ast", + "//semantic-source", + "@stackage//:aeson", + "@stackage//:algebraic-graphs", + "@stackage//:async", + "@stackage//:directory", + "@stackage//:fused-effects", + "@stackage//:fused-effects-exceptions", + "@stackage//:hashable", + "@stackage//:network", + "@stackage//:pathtype", + "@stackage//:recursion-schemes", + "@stackage//:safe-exceptions", + "@stackage//:scientific", + "@stackage//:semilattices", + "@stackage//:streaming", + "@stackage//:unix", +] + +haskell_library( + name = "semantic", + srcs = glob(["src/**/*.hs"]), + compiler_flags = GHC_FLAGS + ["-XStrictData"], + version = "0.11.0.1", + deps = semantic_common_dependencies + [ + "//:base", + "//:deepseq", + "//:filepath", + "//:template-haskell", + "//semantic-codeql", + "//semantic-go", + "//semantic-java", + "//semantic-json", + "//semantic-php", + "//semantic-proto", + "//semantic-python", + "//semantic-ruby", + "//semantic-scope-graph", + "//semantic-tags", + "//semantic-tsx", + "//semantic-typescript", + "//:ghc-prim", + "@stackage//:ansi-terminal", + "@stackage//:attoparsec", + "@stackage//:bifunctors", + "@stackage//:directory-tree", + "@stackage//:generic-lens", + "@stackage//:haskeline", + "@stackage//:hostname", + "@stackage//:hscolour", + "@stackage//:lens", + "@stackage//:network-uri", + "@stackage//:optparse-applicative", + "@stackage//:parsers", + "@stackage//:pretty-show", + "@stackage//:prettyprinter", + "@stackage//:proto-lens", + "@stackage//:proto-lens-runtime", + "@stackage//:reducers", + "@stackage//:semigroupoids", + "@stackage//:split", + "@stackage//:stm-chans", + "@stackage//:time", + "@stackage//:tree-sitter", + "@stackage//:tree-sitter-tsx", + "@stackage//:unordered-containers", + "@stackage//:vector", + ], +) + +haskell_binary( + name = "exe", + srcs = glob(["app/**/*.hs"]), + compiler_flags = GHC_FLAGS + EXECUTABLE_FLAGS + ["-XStrictData"], + deps = [ + ":semantic", + "//:base", + "//:filepath", + "//semantic-analysis", + "//semantic-proto", + "@stackage//:optparse-applicative", + "@stackage//:unix", + ], +) + +haskell_binary( + name = "bench", + srcs = glob(["bench/**/*.hs"]), + compiler_flags = GHC_FLAGS + EXECUTABLE_FLAGS, + deps = [ + ":semantic", + "//:base", + "//semantic-analysis", + "//semantic-proto", + "@stackage//:Glob", + "@stackage//:fused-effects", + "@stackage//:gauge", + "@stackage//:pathtype", + ], +) + +haskell_test( + name = "spec", + srcs = glob( + include = ["test/**/*.hs"], + exclude = [ + "test/fixtures/**/*.hs", + "test/Examples.hs", + "test/System/Path/Fixture.hs", + ], + ), + compiler_flags = GHC_FLAGS + EXECUTABLE_FLAGS + [ + "-XStrictData", + ], + data = glob(include = [ + "test/fixtures/**/*.json", + "test/fixtures/go/**/*.go", + "test/fixtures/python/**/*.py", + "test/fixtures/ruby/**/*.rb", + "test/fixtures/javascript/**/*.js", + "test/fixtures/typescript/**/*.ts", + "test/fixtures/cli/*.json", + ]), + deps = semantic_common_dependencies + [ + "//:base", + "//semantic", + "//semantic-proto", + "//semantic-json", + "//semantic-tags", + "@stackage//:Glob", + "@stackage//:HUnit", + "@stackage//:bazel-runfiles", + "@stackage//:bifunctors", + "@stackage//:hedgehog", + "@stackage//:hspec", + "@stackage//:hspec-core", + "@stackage//:hspec-expectations", + "@stackage//:tasty", + "@stackage//:tasty-golden", + "@stackage//:tasty-hedgehog", + "@stackage//:tasty-hspec", + "@stackage//:tasty-hunit", + "@stackage//:temporary", + "@stackage//:tree-sitter", + ], +) + +haskell_test( + name = "parse-examples", + srcs = [ + "test/Examples.hs", + ], + compiler_flags = GHC_FLAGS + EXECUTABLE_FLAGS + [ + "-XStrictData", + ], + data = glob(include = [ + "test/fixtures/**/*.json", + "test/fixtures/go/**/*.go", + "test/fixtures/python/**/*.py", + "test/fixtures/ruby/**/*.rb", + "test/fixtures/javascript/**/*.js", + "test/fixtures/typescript/**/*.ts", + "test/fixtures/cli/*.json", + ]) + SEMANTIC_EXTERNAL_TEST_REPOSITORIES, + deps = semantic_common_dependencies + [ + "//:base", + "//semantic", + "//semantic-proto", + "@stackage//:Glob", + "@stackage//:bazel-runfiles", + "@stackage//:lens", + "@stackage//:tasty", + "@stackage//:tasty-hunit", + ], +) diff --git a/semantic/LICENSE b/semantic/LICENSE new file mode 100644 index 0000000000..53779fcc2c --- /dev/null +++ b/semantic/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2015-2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/semantic/README.md b/semantic/README.md new file mode 100644 index 0000000000..aa12d8dd9d --- /dev/null +++ b/semantic/README.md @@ -0,0 +1 @@ +This package provides the `semantic` executable and its needed infrastructure. diff --git a/semantic/Setup.hs b/semantic/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/semantic/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/app/Main.hs b/semantic/app/Main.hs similarity index 100% rename from app/Main.hs rename to semantic/app/Main.hs diff --git a/semantic/bench/Main.hs b/semantic/bench/Main.hs new file mode 100644 index 0000000000..c26905c0dd --- /dev/null +++ b/semantic/bench/Main.hs @@ -0,0 +1,9 @@ +module Main (main) where + +import Gauge +import qualified Tagging + +main :: IO () +main = defaultMain + [ Tagging.benchmarks + ] diff --git a/semantic/bench/Tagging.hs b/semantic/bench/Tagging.hs new file mode 100644 index 0000000000..1327d18c0b --- /dev/null +++ b/semantic/bench/Tagging.hs @@ -0,0 +1,84 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} + +module Tagging +( benchmarks +, runTagging +, pythonBenchmarks +, goBenchmarks +, rubyBenchmarks +) where + +import Control.Carrier.Parse.Measured +import Control.Exception (throwIO) +import Control.Monad +import Data.Foldable +import Gauge +import System.FilePath.Glob +import qualified System.Path as Path + +import qualified Analysis.File as File +import Data.Flag +import Proto.Semantic as P hiding (Blob) +import Semantic.Api.Symbols (parseSymbols) +import Semantic.Config as Config +import Semantic.Task +import Semantic.Task.Files + +benchmarks :: Benchmark +benchmarks = bgroup "tagging" + [ bench "jquery" $ runTagging' (Path.relFile "semantic/test/fixtures/jquery-3.5.1.min.js") + , bench "sinatra" $ runTagging' (Path.relFile "semantic/test/fixtures/base.rb") + ] + -- Feel free to turn these on or write other benchmarks + -- [ pythonBenchmarks + -- , goBenchmarks + -- , rubyBenchmarks + -- ] + +runTagging' :: Path.RelFile -> Benchmarkable +runTagging' path = nfIO . withOptions testOptions $ \ config logger statter -> do + let session = TaskSession config "-" False logger statter + runTask session (runParse (parseSymbolsFilePath path)) >>= either throwIO pure + +pythonBenchmarks :: Benchmark +pythonBenchmarks = bgroup "python" + [ bench "precise" $ runTagging pyDir "*.py" + ] + where pyDir = Path.relDir "tmp/python-examples/keras/keras" + +goBenchmarks :: Benchmark +goBenchmarks = bgroup "go" + [ bench "precise" $ runTagging dir "*.go" + ] + where dir = Path.relDir "tmp/go-examples/go/src/database/sql" + +rubyBenchmarks :: Benchmark +rubyBenchmarks = bgroup "ruby" + [ bench "precise" $ runTagging dir "*.rb" + ] + where dir = Path.relDir "tmp/ruby-examples/ruby_spec/command_line" + +runTagging :: Path.RelDir -> String -> Benchmarkable +runTagging dir glob = nfIO . withOptions testOptions $ \ config logger statter -> do + let session = TaskSession config "-" False logger statter + files <- globDir1 (compile glob) (Path.toString dir) + when (null files) (fail ("No files in " <> Path.toString dir)) + let paths = Path.relFile <$> files + for_ paths (runTask session . runParse . parseSymbolsFilePath >=> either throwIO pure) + +parseSymbolsFilePath :: + ( Has (Error SomeException) sig m + , Has Parse sig m + , Has Files sig m + ) + => Path.RelFile + -> m ParseTreeSymbolResponse +parseSymbolsFilePath path = readBlob (File.fromPath path) >>= parseSymbols . pure @[] + +testOptions :: Config.Options +testOptions = defaultOptions + { optionsFailOnWarning = flag FailOnWarning True + , optionsLogLevel = Nothing + } diff --git a/bench/bench-fixtures/python/function-definition.py b/semantic/bench/bench-fixtures/python/function-definition.py similarity index 100% rename from bench/bench-fixtures/python/function-definition.py rename to semantic/bench/bench-fixtures/python/function-definition.py diff --git a/bench/bench-fixtures/python/if-statement-functions.py b/semantic/bench/bench-fixtures/python/if-statement-functions.py similarity index 100% rename from bench/bench-fixtures/python/if-statement-functions.py rename to semantic/bench/bench-fixtures/python/if-statement-functions.py diff --git a/bench/bench-fixtures/python/simple-assignment.py b/semantic/bench/bench-fixtures/python/simple-assignment.py similarity index 100% rename from bench/bench-fixtures/python/simple-assignment.py rename to semantic/bench/bench-fixtures/python/simple-assignment.py diff --git a/bench/bench-fixtures/ruby/function-definition.rb b/semantic/bench/bench-fixtures/ruby/function-definition.rb similarity index 100% rename from bench/bench-fixtures/ruby/function-definition.rb rename to semantic/bench/bench-fixtures/ruby/function-definition.rb diff --git a/bench/bench-fixtures/ruby/if-statement-functions.rb b/semantic/bench/bench-fixtures/ruby/if-statement-functions.rb similarity index 100% rename from bench/bench-fixtures/ruby/if-statement-functions.rb rename to semantic/bench/bench-fixtures/ruby/if-statement-functions.rb diff --git a/bench/bench-fixtures/ruby/simple-assignment.rb b/semantic/bench/bench-fixtures/ruby/simple-assignment.rb similarity index 100% rename from bench/bench-fixtures/ruby/simple-assignment.rb rename to semantic/bench/bench-fixtures/ruby/simple-assignment.rb diff --git a/semantic/semantic.cabal b/semantic/semantic.cabal new file mode 100644 index 0000000000..ed31c85f49 --- /dev/null +++ b/semantic/semantic.cabal @@ -0,0 +1,239 @@ +cabal-version: 2.4 + +name: semantic +version: 0.11.0.1 +synopsis: Framework and executable for analyzing and diffing untrusted code. +description: Semantic is a library for parsing, analyzing, and comparing source code across many languages. +homepage: http://github.com/github/semantic#readme +bug-reports: https://github.com/github/semantic/issues +license: MIT +license-file: LICENSE +author: The Semantic authors +maintainer: opensource+semantic@github.com +copyright: (c) 2015-2020 GitHub, Inc. +category: Language +build-type: Simple +stability: alpha +extra-source-files: README.md + +tested-with: GHC == 8.10.1 + +flag release + description: Build with optimizations on (for CI or deployment builds) + default: False + +-- GHC extensions shared between targets +common haskell + default-language: Haskell2010 + default-extensions: StrictData + ghc-options: + -Weverything + -Wno-missing-local-signatures + -Wno-missing-import-lists + -Wno-implicit-prelude + -Wno-safe + -Wno-unsafe + -Wno-name-shadowing + -Wno-monomorphism-restriction + -Wno-missed-specialisations + -Wno-all-missed-specialisations + -Wno-star-is-type + cpp-options: + -DBAZEL_BUILD=0 + if (impl(ghc >= 8.8)) + ghc-options: -Wno-missing-deriving-strategies + if (impl(ghc >= 8.10)) + ghc-options: + -Wno-missing-safe-haskell-mode + -Wno-prepositive-qualified-module + if (impl(ghc >= 9.2)) + ghc-options: + -Wno-missing-kind-signatures + +common executable-flags + ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" + +library + import: haskell + hs-source-dirs: src + exposed-modules: Control.Carrier.Parse.Measured + , Control.Carrier.Parse.Simple + -- Effects + , Control.Effect.Parse + , Control.Effect.Sum.Project + , Control.Effect.Timeout + -- General datatype definitions & generic algorithms + , Data.Blob + , Data.Blob.IO + , Data.Duration + , Data.Edit + , Data.Error + , Data.Flag + , Data.Graph.Algebraic + , Data.Handle + , Data.Maybe.Exts + , Data.Semigroup.App + -- Parser glue + , Parsing.Parser + , Parsing.TreeSitter + -- API + , Semantic.Api + , Semantic.Api.Bridge + , Semantic.Api.StackGraph + , Semantic.Api.Symbols + , Semantic.Api.Terms + , Semantic.CLI + , Semantic.Config + , Semantic.Env + , Semantic.IO + , Semantic.Task + , Semantic.Task.Files + , Semantic.Telemetry + , Semantic.Telemetry.AsyncQueue + , Semantic.Telemetry.Error + , Semantic.Telemetry.Log + , Semantic.Telemetry.Stat + , Semantic.Util + , Semantic.Util.Pretty + , Semantic.Version + -- Serialization + , Serializing.Format + , Serializing.SExpression.Precise + -- Custom Prelude + autogen-modules: Paths_semantic + other-modules: Paths_semantic + -- Except in case of vendored dependencies, these deps should be expressed + -- as caret-operator bounds relative to a version in Stackage. + -- These are currently pinned to lts-13.13. + build-depends: + , aeson >= 1.4.2.0 && < 3 + , algebraic-graphs >= 0.3 && < 0.7 + , ansi-terminal >= 0.8.2 && <1 + , async ^>= 2.2.1 + , base >= 4.13 && < 5 + , bytestring >= 0.10.8.2 && < 0.13 + , containers ^>= 0.6.2 + , directory-tree ^>= 0.12.1 + , filepath ^>= 1.4.2.1 + , fused-effects ^>= 1.1 + , hostname ^>= 1.0 + , hscolour ^>= 1.24.4 + , lens >= 4.17 && < 5.3 + , network >= 2.8 && < 3.2 + , network-uri ^>= 2.6.1.0 + , optparse-applicative >= 0.14.3 && < 0.16 + , pretty-show ^>= 1.9.5 + , proto-lens >= 0.5 && < 0.8 + , semantic-analysis ^>= 0 + , semantic-ast + , semantic-codeql ^>= 0 + , semantic-go ^>= 0 + , semantic-java ^>= 0 + , semantic-json ^>= 0 + , semantic-php ^>= 0 + , semantic-proto ^>= 0 + , semantic-python ^>= 0 + , semantic-ruby ^>= 0 + , semantic-scope-graph ^>= 0 + , semantic-source ^>= 0.2 + , semantic-tags ^>= 0 + , semantic-tsx ^>= 0 + , semantic-typescript ^>= 0 + , semilattices ^>= 0.0.0.3 + , split ^>= 0.2.3.3 + , stm-chans ^>= 3.0.0.4 + , text ^>= 1.2.3.2 + , time >= 1.8.0.2 && < 1.10 + , tree-sitter ^>= 0.9.0.1 + , unix ^>= 2.7.2.2 + +executable semantic + import: haskell, executable-flags + hs-source-dirs: app + main-is: Main.hs + build-depends: + , base + , semantic + +test-suite test + import: haskell, executable-flags + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Spec.hs + other-modules: Data.Graph.Spec + , Data.Language.Spec + , Data.Semigroup.App.Spec + , Integration.Spec + , Semantic.Spec + , Semantic.CLI.Spec + , Semantic.IO.Spec + , Semantic.Stat.Spec + , Tags.Spec + , SpecHelpers + , Generators + , Properties + build-depends: + , algebraic-graphs >= 0.3 && < 0.7 + , base >= 4.13 && < 5 + , bytestring >= 0.10.8.2 && < 0.13 + , directory + , filepath + , fused-effects + , Glob ^>= 0.10.0 + , hedgehog >= 1 && < 1.2 + , hspec >= 2.6 && <3 + , hspec-expectations ^>= 0.8.2 + , network >= 2.8 && < 3.2 + , semantic + , semantic-analysis + , semantic-ast + , semantic-proto + , semantic-source ^>= 0.2 + , semantic-tags + , semilattices + , tasty ^>= 1.2.3 + , tasty-golden ^>= 2.3.2 + , tasty-hedgehog >= 1.0.0.1 && < 1.3 + , tasty-hspec >= 1.1.5.1 && < 1.3 + , tasty-hunit ^>= 0.10.0.2 + +test-suite parse-examples + import: haskell, executable-flags + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Examples.hs + build-depends: + , async ^>= 2.2.1 + , base + , filepath + , fused-effects ^>= 1.1 + , Glob + , lens >= 4.17 && < 5.2 + , process ^>= 1.6.3.0 + , semantic + , semantic-analysis ^>= 0 + , semantic-ast + , semantic-proto ^>= 0 + , tasty + , tasty-hunit + , text ^>= 1.2.3.2 + +benchmark benchmarks + import: haskell, executable-flags + hs-source-dirs: bench + type: exitcode-stdio-1.0 + main-is: Main.hs + other-modules: Tagging + ghc-options: -static + build-depends: + , base + , fused-effects ^>= 1.1 + , gauge ^>= 0.2.5 + , Glob + , semantic + , semantic-analysis ^>= 0 + , semantic-proto + +source-repository head + type: git + location: https://github.com/github/semantic diff --git a/semantic/src/Control/Carrier/Parse/Measured.hs b/semantic/src/Control/Carrier/Parse/Measured.hs new file mode 100644 index 0000000000..ff8011115c --- /dev/null +++ b/semantic/src/Control/Carrier/Parse/Measured.hs @@ -0,0 +1,81 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +-- | A carrier for 'Parse' effects suitable for use in production. +module Control.Carrier.Parse.Measured +( -- * Parse carrier + ParseC(..) + -- * Exceptions +, ParsingTimedOut(..) + -- * Parse effect +, module Control.Effect.Parse +) where + +import Control.Algebra +import Control.Effect.Error +import Control.Effect.Lift +import Control.Effect.Parse +import Control.Effect.Reader +import Control.Effect.Trace +import Control.Exception +import Control.Monad +import Control.Monad.IO.Class +import Data.Blob +import qualified Data.Flag as Flag +import Parsing.Parser +import Parsing.TreeSitter +import Semantic.Config +import Semantic.Task (TaskSession (..)) +import Semantic.Telemetry + +newtype ParseC m a = ParseC { runParse :: m a } + deriving (Applicative, Functor, Monad, MonadFail, MonadIO) + +instance ( Has (Error SomeException) sig m + , Has (Reader TaskSession) sig m + , Has Telemetry sig m + , Has Trace sig m + , Has (Lift IO) sig m + , MonadIO m + ) + => Algebra (Parse :+: sig) (ParseC m) where + alg hdl sig ctx = case sig of + L (Parse parser blob) -> (<$ ctx) <$> runParser blob parser + R other -> ParseC (alg (runParse . hdl) other ctx) + +-- | Parse a 'Blob' in 'IO'. +runParser :: + ( Has (Error SomeException) sig m + , Has (Reader TaskSession) sig m + , Has Telemetry sig m + , Has Trace sig m + , MonadIO m + ) + => Blob + -> Parser term + -> m term +runParser blob parser = case parser of + + UnmarshalParser language -> + time "parse.tree_sitter_precise_ast_parse" languageTag $ do + config <- asks config + executeParserAction (parseToPreciseAST (configTreeSitterParseTimeout config) (configTreeSitterUnmarshalTimeout config) language blob) + `catchError` \(SomeException e) -> do + writeStat (increment "parse.precise_ast_parse_failures" languageTag) + writeLog Error "precise parsing failed" (("task", "parse") : ("exception", "\"" <> displayException e <> "\"") : languageTag) + throwError (SomeException e) + + where + languageTag = [("language" :: String, show (blobLanguage blob))] + executeParserAction act = do + -- Test harnesses can specify that parsing must fail, for testing purposes. + shouldFailFlag <- asks (Flag.toBool FailTestParsing . configFailParsingForTesting . config) + when shouldFailFlag (throwError (SomeException ParsingTimedOut)) + act >>= either (\e -> trace (displayException e) *> throwError (SomeException e)) pure + +data ParsingTimedOut = ParsingTimedOut deriving (Eq, Show) +instance Exception ParsingTimedOut diff --git a/semantic/src/Control/Carrier/Parse/Simple.hs b/semantic/src/Control/Carrier/Parse/Simple.hs new file mode 100644 index 0000000000..7321ce7a55 --- /dev/null +++ b/semantic/src/Control/Carrier/Parse/Simple.hs @@ -0,0 +1,60 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +-- | A carrier for 'Parse' effects suitable for use in the repl, tests, etc. +module Control.Carrier.Parse.Simple +( -- * Parse carrier + ParseC(ParseC) +, runParse + -- * Exceptions +, ParseFailure(..) + -- * Parse effect +, module Control.Effect.Parse +) where + +import Control.Algebra +import Control.Carrier.Reader +import Control.Effect.Error +import Control.Effect.Parse +import Control.Exception +import Control.Monad.IO.Class +import Data.Blob +import Parsing.Parser +import Parsing.TreeSitter + +runParse :: Duration -> ParseC m a -> m a +runParse timeout = runReader timeout . runParseC + +newtype ParseC m a = ParseC { runParseC :: ReaderC Duration m a } + deriving (Applicative, Functor, Monad, MonadFail, MonadIO) + +instance ( Has (Error SomeException) sig m + , MonadIO m + ) + => Algebra (Parse :+: sig) (ParseC m) where + alg hdl sig ctx = case sig of + L (Parse parser blob) -> ParseC ask >>= \ timeout -> (<$ ctx) <$> runParser timeout blob parser + R other -> ParseC (alg (runParseC . hdl) (R other) ctx) + +-- | Parse a 'Blob' in 'IO'. +runParser + :: ( Has (Error SomeException) sig m + , MonadIO m + ) + => Duration + -> Blob + -> Parser term + -> m term +runParser timeout blob parser = case parser of + UnmarshalParser language -> + parseToPreciseAST timeout timeout language blob + >>= either (throwError . SomeException) pure + +newtype ParseFailure = ParseFailure String + deriving (Show) + +instance Exception ParseFailure diff --git a/semantic/src/Control/Effect/Parse.hs b/semantic/src/Control/Effect/Parse.hs new file mode 100644 index 0000000000..a7c71f9b81 --- /dev/null +++ b/semantic/src/Control/Effect/Parse.hs @@ -0,0 +1,73 @@ +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE RankNTypes #-} +module Control.Effect.Parse +( -- * Parse effect + Parse(..) +, parse +, parserForLanguage +, parserForBlob +, parseWith +, parsePairWith + -- * Re-exports +, Algebra +, Has +, run +) where + +import Control.Algebra +import Control.Effect.Error +import Control.Exception (SomeException) +import Data.Bitraversable +import Data.Blob +import Data.Edit +import Data.Kind (Type) +import qualified Data.Map as Map +import Parsing.Parser +import Source.Language (Language (..)) + +data Parse (m :: Type -> Type) k where + Parse :: Parser term -> Blob -> Parse m term + + +-- | Parse a 'Blob' with the given 'Parser'. +parse :: Has Parse sig m + => Parser term + -> Blob + -> m term +parse parser blob = send (Parse parser blob) + + +-- | Select a parser for the given 'Language'. +parserForLanguage :: Map.Map Language (SomeParser c ann) -> Language -> Maybe (SomeParser c ann) +parserForLanguage = flip Map.lookup + +-- | Select a parser for the given 'Blob'. +parserForBlob :: Map.Map Language (SomeParser c ann) -> Blob -> Maybe (SomeParser c ann) +parserForBlob parsers = parserForLanguage parsers . blobLanguage + + +-- | Parse a 'Blob' with one of the provided parsers, and run an action on the abstracted term. +parseWith + :: (Has (Error SomeException) sig m, Has Parse sig m) + => Map.Map Language (SomeParser c ann) -- ^ The set of parsers to select from. + -> (forall term . c term => term ann -> m a) -- ^ A function to run on the parsed term. Note that the term is abstract, but constrained by @c@, allowing you to do anything @c@ allows, and requiring that all the input parsers produce terms supporting @c@. + -> Blob -- ^ The blob to parse. + -> m a +parseWith parsers with blob = case parserForBlob parsers blob of + Just (SomeParser parser) -> parse parser blob >>= with + _ -> noLanguageForBlob (blobPath blob) + +-- | Parse a 'BlobPair' with one of the provided parsers, and run an action on the abstracted term pair. +parsePairWith + :: (Has (Error SomeException) sig m, Has Parse sig m) + => Map.Map Language (SomeParser c ann) -- ^ The set of parsers to select from. + -> (forall term . c term => Edit (Blob, term ann) (Blob, term ann) -> m a) -- ^ A function to run on the parsed terms. Note that the terms are abstract, but constrained by @c@, allowing you to do anything @c@ allows, and requiring that all the input parsers produce terms supporting @c@. + -> BlobPair -- ^ The blob pair to parse. + -> m a +parsePairWith parsers with blobPair = case parserForLanguage parsers (languageForBlobPair blobPair) of + Just (SomeParser parser) -> bitraverse (p parser) (p parser) blobPair >>= with + _ -> noLanguageForBlob (pathForBlobPair blobPair) + where p parser blob = (,) blob <$> parse parser blob diff --git a/semantic/src/Control/Effect/Sum/Project.hs b/semantic/src/Control/Effect/Sum/Project.hs new file mode 100644 index 0000000000..a962eea5a4 --- /dev/null +++ b/semantic/src/Control/Effect/Sum/Project.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE FlexibleInstances, KindSignatures, MultiParamTypeClasses, TypeOperators #-} + +module Control.Effect.Sum.Project +( Project (..) +) where + +import Control.Effect.Sum + +class Member sub sup => Project (sub :: (* -> *) -> (* -> *)) sup where + prj :: sup m a -> Maybe (sub m a) + +instance Project sub sub where + prj = Just + +instance {-# OVERLAPPABLE #-} Project sub (sub :+: sup) where + prj (L f) = Just f + prj _ = Nothing + +instance {-# OVERLAPPABLE #-} Project sub sup => Project sub (sub' :+: sup) where + prj (R g) = prj g + prj _ = Nothing diff --git a/semantic/src/Control/Effect/Timeout.hs b/semantic/src/Control/Effect/Timeout.hs new file mode 100644 index 0000000000..09588db508 --- /dev/null +++ b/semantic/src/Control/Effect/Timeout.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE ScopedTypeVariables #-} +module Control.Effect.Timeout +( timeout +) where + +import Control.Algebra +import Control.Effect.Lift +import Data.Duration +import qualified System.Timeout as System + +-- | Run an action with a timeout. Returns 'Nothing' when no result is available +-- within the specified duration. Uses 'System.Timeout.timeout' so all caveats +-- about not operating over FFI boundaries apply. +-- +-- Any state changes in the action are discarded if the timeout fails. +timeout :: Has (Lift IO) sig m => Duration -> m a -> m (Maybe a) +timeout n m = liftWith $ \ hdl ctx + -> maybe + -- Restore the old state if it timed out. + (Nothing <$ ctx) + -- Apply it if it succeeded. + (fmap Just) <$> System.timeout (toMicroseconds n) (hdl (m <$ ctx)) diff --git a/semantic/src/Data/Blob.hs b/semantic/src/Data/Blob.hs new file mode 100644 index 0000000000..d2cae089e6 --- /dev/null +++ b/semantic/src/Data/Blob.hs @@ -0,0 +1,104 @@ +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE ExplicitNamespaces #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} +-- | Semantic-specific functionality for blob handling. +module Data.Blob +( Blobs(..) +, NoLanguageForBlob (..) +, decodeBlobs +, moduleForBlob +, noLanguageForBlob +, BlobPair +, maybeBlobPair +, decodeBlobPairs +, languageForBlobPair +, languageTagForBlobPair +, pathForBlobPair +, pathKeyForBlobPair +, module Analysis.Blob +) where + + +import Analysis.Blob +import Control.Effect.Error +import Control.Exception +import Data.Aeson +import Data.Bifunctor +import qualified Data.ByteString.Lazy as BL +import Data.Edit +import Data.List (stripPrefix) +import Data.Maybe.Exts +import Data.Module +import GHC.Generics (Generic) +import Source.Language as Language +import qualified System.FilePath as Path + + +newtype Blobs a = Blobs { blobs :: [a] } + deriving (Generic, FromJSON) + +decodeBlobs :: BL.ByteString -> Either String [Blob] +decodeBlobs = fmap blobs <$> eitherDecode + +-- | An exception indicating that we’ve tried to diff or parse a blob of unknown language. +newtype NoLanguageForBlob = NoLanguageForBlob FilePath + deriving (Eq, Exception, Ord, Show) + +noLanguageForBlob :: Has (Error SomeException) sig m => FilePath -> m a +noLanguageForBlob blobPath = throwError (SomeException (NoLanguageForBlob blobPath)) + +-- | Construct a 'Module' for a 'Blob' and @term@, relative to some root 'FilePath'. +moduleForBlob :: Maybe FilePath -- ^ The root directory relative to which the module will be resolved, if any. TODO: typed paths + -> Blob -- ^ The 'Blob' containing the module. + -> term -- ^ The @term@ representing the body of the module. + -> Module term -- ^ A 'Module' named appropriate for the 'Blob', holding the @term@, and constructed relative to the root 'FilePath', if any. +moduleForBlob rootDir b = Module info + where root = fromMaybe (Path.takeDirectory $ blobPath b) rootDir + info = ModuleInfo (dropRelative root (blobPath b)) (languageToText (blobLanguage b)) mempty + +dropRelative :: FilePath -> FilePath -> FilePath +dropRelative a' b' = case as `stripPrefix` bs of + Just rs | ra == rb -> foldl (Path.) "." rs Path. bf + _ -> b' + where (ra, as) = splitPath $ Path.normalise a' + (rb, bs) = splitPath $ Path.normalise $ Path.takeDirectory b' + bf = Path.takeFileName b' + splitPath p = (Path.isAbsolute p, Path.splitDirectories p) + +-- | Represents a blobs suitable for diffing which can be either a blob to +-- delete, a blob to insert, or a pair of blobs to diff. +type BlobPair = Edit Blob Blob + +instance FromJSON BlobPair where + parseJSON = withObject "BlobPair" $ \o -> + fromMaybes <$> (o .:? "before") <*> (o .:? "after") + >>= maybeM (Prelude.fail "Expected object with 'before' and/or 'after' keys only") + +maybeBlobPair :: MonadFail m => Maybe Blob -> Maybe Blob -> m BlobPair +maybeBlobPair a b = maybeM (fail "expected file pair with content on at least one side") (fromMaybes a b) + +languageForBlobPair :: BlobPair -> Language +languageForBlobPair = mergeEdit combine . bimap blobLanguage blobLanguage where + combine a b + | a == Unknown || b == Unknown = Unknown + | otherwise = b + +pathForBlobPair :: BlobPair -> FilePath +pathForBlobPair = blobPath . mergeEdit (const id) + +languageTagForBlobPair :: BlobPair -> [(String, String)] +languageTagForBlobPair pair = showLanguage (languageForBlobPair pair) + where showLanguage = pure . (,) "language" . show + +pathKeyForBlobPair :: BlobPair -> FilePath +pathKeyForBlobPair = mergeEdit combine . bimap blobFilePath blobFilePath where + combine before after | before == after = after + | otherwise = before <> " -> " <> after + +decodeBlobPairs :: BL.ByteString -> Either String [BlobPair] +decodeBlobPairs = fmap blobs <$> eitherDecode diff --git a/semantic/src/Data/Blob/IO.hs b/semantic/src/Data/Blob/IO.hs new file mode 100644 index 0000000000..0fa65dcec5 --- /dev/null +++ b/semantic/src/Data/Blob/IO.hs @@ -0,0 +1,65 @@ +{-# LANGUAGE ViewPatterns #-} +-- | These are primitive file IO methods for use in ghci and as internal functions. +-- Instead of using these, consider if you can use the Files DSL instead. +module Data.Blob.IO + ( readBlobFromFile + , readBlobFromFile' + , readBlobFromPath + , readFilePair + , readProjectFromPaths + ) where + +import Analysis.Blob +import Analysis.File as File +import Analysis.Project +import Analysis.Reference +import Control.Monad.IO.Class +import Data.Blob +import qualified Data.ByteString as B +import Data.Maybe.Exts +import Semantic.IO +import Source.Language +import qualified Source.Source as Source +import Source.Span + +-- | Deprecated: this has very weird semantics. +readProjectFromPaths :: MonadIO m + => Maybe FilePath -- ^ An optional root directory for the project + -> FilePath -- ^ A file or directory to parse. Passing a file path loads all files in that file's parent directory. + -> Language + -> [FilePath] -- ^ Directories to exclude. + -> m Project +readProjectFromPaths maybeRoot path lang excludeDirs = do + let rootDir = fromMaybe path maybeRoot + + paths <- liftIO $ findFilesInDir rootDir exts excludeDirs + blobs <- liftIO $ traverse (readBlobFromFile' . toFile) paths + pure $ Project rootDir blobs lang excludeDirs + where + toFile path = File (Reference path (point (Pos 1 1))) lang + exts = extensionsForLanguage lang + + +-- | Read a utf8-encoded file to a 'Blob'. +readBlobFromFile :: MonadIO m => File Language -> m (Maybe Blob) +readBlobFromFile (File (Reference "/dev/null" _) _) = pure Nothing +readBlobFromFile file@(File (Reference path _) _language) = do + raw <- liftIO $ B.readFile path + let newblob = Blob (Source.fromUTF8 raw) file + pure . Just $ newblob + +-- | Read a utf8-encoded file to a 'Blob', failing if it can't be found. +readBlobFromFile' :: (MonadFail m, MonadIO m) => File Language -> m Blob +readBlobFromFile' file = do + maybeFile <- readBlobFromFile file + maybeM (fail ("cannot read '" <> show file <> "', file not found or language not supported.")) maybeFile + +-- | Read a blob from the provided absolute or relative path , failing if it can't be found. +readBlobFromPath :: (MonadFail m, MonadIO m) => FilePath -> m Blob +readBlobFromPath = readBlobFromFile' . File.fromPath + +readFilePair :: MonadIO m => File Language -> File Language -> m BlobPair +readFilePair a b = do + before <- readBlobFromFile a + after <- readBlobFromFile b + liftIO $ maybeBlobPair before after diff --git a/src/Data/Duration.hs b/semantic/src/Data/Duration.hs similarity index 100% rename from src/Data/Duration.hs rename to semantic/src/Data/Duration.hs diff --git a/semantic/src/Data/Edit.hs b/semantic/src/Data/Edit.hs new file mode 100644 index 0000000000..4f17bb588e --- /dev/null +++ b/semantic/src/Data/Edit.hs @@ -0,0 +1,71 @@ +{-# LANGUAGE DeriveGeneric, DeriveTraversable, LambdaCase #-} +module Data.Edit +( Edit(..) +, edit +, mergeEdit +, fromMaybes +) where + +import Control.Applicative ((<|>), liftA2) +import Data.Bifoldable +import Data.Bifunctor +import Data.Bitraversable +import Data.Functor.Classes +import GHC.Generics (Generic, Generic1) + +-- | The deletion, insertion, or comparison of values. +data Edit a b + = Delete a + | Insert b + | Compare a b + deriving (Eq, Foldable, Functor, Generic, Generic1, Ord, Show, Traversable) + + +-- | Eliminate an 'Edit' by case analysis. +edit :: (l -> a) -> (r -> a) -> (l -> r -> a) -> Edit l r -> a +edit delete insert compare = \case + Delete a -> delete a + Insert b -> insert b + Compare a b -> compare a b + +-- | Extract the values from an 'Edit', combining 'Compare's with the passed function. +mergeEdit :: (a -> a -> a) -> Edit a a -> a +mergeEdit = edit id id + +fromMaybes :: Maybe a -> Maybe b -> Maybe (Edit a b) +fromMaybes a b = liftA2 Compare a b <|> Delete <$> a <|> Insert <$> b + + +instance Bifunctor Edit where + bimap = bimapDefault + +instance Bifoldable Edit where + bifoldMap = bifoldMapDefault + +instance Bitraversable Edit where + bitraverse f g = \case + Delete a -> Delete <$> f a + Insert b -> Insert <$> g b + Compare a b -> Compare <$> f a <*> g b + +instance Eq2 Edit where + liftEq2 eql eqr = curry $ \case + (Delete a1 , Delete a2 ) -> eql a1 a2 + (Insert b1, Insert b2) -> eqr b1 b2 + (Compare a1 b1, Compare a2 b2) -> eql a1 a2 && eqr b1 b2 + _ -> False + +instance Ord2 Edit where + liftCompare2 cmpl cmpr = curry $ \case + (Delete a1 , Delete a2 ) -> cmpl a1 a2 + (Delete _ , _ ) -> LT + (Insert b1, Insert b2) -> cmpr b1 b2 + (Insert _ , _ ) -> LT + (Compare a1 b1, Compare a2 b2) -> cmpl a1 a2 <> cmpr b1 b2 + _ -> GT + +instance Show2 Edit where + liftShowsPrec2 spl _ spr _ d = \case + Delete a -> showsUnaryWith spl "Delete" d a + Insert b -> showsUnaryWith spr "Insert" d b + Compare a b -> showsBinaryWith spl spr "Compare" d a b diff --git a/semantic/src/Data/Error.hs b/semantic/src/Data/Error.hs new file mode 100644 index 0000000000..3d851d36d0 --- /dev/null +++ b/semantic/src/Data/Error.hs @@ -0,0 +1,108 @@ +{-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE RecordWildCards #-} +module Data.Error + ( Error (..) + , formatError + , makeError + , showExpectation + , showExcerpt + , withSGRCode + -- * Flags affecting 'Error' values + , LogPrintSource (..) + , Colourize (..) + ) where + +import Control.Exception (Exception) +import Data.ByteString.Char8 (unpack) +import Data.Foldable +import Data.Ix (inRange) +import Data.List (intersperse, isSuffixOf) +import GHC.Stack +import System.Console.ANSI + +import Data.Blob +import Data.Flag as Flag +import qualified Source.Source as Source +import Source.Span + +data LogPrintSource = LogPrintSource +data Colourize = Colourize + +-- | Rather than using the Error constructor directly, you probably +-- want to call 'makeError', which takes care of inserting the call +-- stack for you. +data Error grammar = Error + { errorSpan :: Span + , errorExpected :: [grammar] + , errorActual :: Maybe grammar + , errorCallStack :: CallStack + } deriving (Show, Functor) + +-- | This instance does not take into account the call stack. +instance Eq grammar => Eq (Error grammar) where + (Error s e a _) == (Error s' e' a' _) = (s == s') && (e == e') && (a == a') + +instance Exception (Error String) + +makeError :: HasCallStack => Span -> [grammar] -> Maybe grammar -> Error grammar +makeError s e a = withFrozenCallStack (Error s e a callStack) + +-- | Format an 'Error', optionally with reference to the source where it occurred. +formatError :: Flag LogPrintSource -> Flag Colourize -> Blob -> Error String -> String +formatError includeSource colourize blob Error{..} + = ($ "") + $ withSGRCode colourize [SetConsoleIntensity BoldIntensity] (showSpan path errorSpan . showString ": ") + . withSGRCode colourize [SetColor Foreground Vivid Red] (showString "error") . showString ": " . showExpectation colourize errorExpected errorActual . showChar '\n' + . (if Flag.toBool LogPrintSource includeSource then showExcerpt colourize errorSpan blob else id) + . showCallStack colourize callStack . showChar '\n' + where + path = Just $ if Flag.toBool LogPrintSource includeSource then blobFilePath blob else "" + +showExcerpt :: Flag Colourize -> Span -> Blob -> ShowS +showExcerpt colourize Span{..} Blob{..} + = showString context . (if "\n" `isSuffixOf` context then id else showChar '\n') + . showString (replicate (caretPaddingWidth + lineNumberDigits) ' ') . withSGRCode colourize [SetColor Foreground Vivid Green] (showString caret) . showChar '\n' + where context = fold contextLines + contextLines = [ showLineNumber i <> ": " <> unpack (Source.bytes l) + | (i, l) <- zip [1..] (Source.lines blobSource) + , inRange (line start - 2, line start) i + ] + showLineNumber n = let s = show n in replicate (lineNumberDigits - length s) ' ' <> s + lineNumberDigits = succ (floor (logBase 10 (fromIntegral (line start) :: Double))) + caretPaddingWidth = succ (column start) + caret | line start == line end = replicate (max 1 (column end - column start)) '^' + | otherwise = "^..." + +withSGRCode :: Flag Colourize -> [SGR] -> ShowS -> ShowS +withSGRCode useColour code content + | Flag.toBool Colourize useColour = showString (setSGRCode code) . content . showString (setSGRCode []) + | otherwise = content + +showExpectation :: Flag Colourize -> [String] -> Maybe String -> ShowS +showExpectation colourize = go + where go [] Nothing = showString "no rule to match at " . showActual "end of branch" + go expected Nothing = showString "expected " . showSymbols colourize expected . showString " at " . showActual "end of branch" + go expected (Just actual) = showString "expected " . showSymbols colourize expected . showString ", but got " . showActual actual + showActual = withSGRCode colourize [SetColor Foreground Vivid Green] . showString + +showSymbols :: Flag Colourize -> [String] -> ShowS +showSymbols colourize = go + where go [] = showString "end of input nodes" + go [symbol] = showSymbol symbol + go [a, b] = showSymbol a . showString " or " . showSymbol b + go [a, b, c] = showSymbol a . showString ", " . showSymbol b . showString ", or " . showSymbol c + go (h:t) = showSymbol h . showString ", " . go t + showSymbol = withSGRCode colourize [SetColor Foreground Vivid Red] . showString + +showSpan :: Maybe FilePath -> Span -> ShowS +showSpan path Span{..} = maybe (showParen True (showString "interactive")) showString path . showChar ':' . (if start == end then showPos start else showPos start . showChar '-' . showPos end) + where showPos Pos{..} = shows line . showChar ':' . shows column + +showCallStack :: Flag Colourize -> CallStack -> ShowS +showCallStack colourize callStack = foldr (.) id (intersperse (showChar '\n') (uncurry (showCallSite colourize) <$> getCallStack callStack)) + +showCallSite :: Flag Colourize -> String -> SrcLoc -> ShowS +showCallSite colourize symbol loc@SrcLoc{..} = showString symbol . showChar ' ' . withSGRCode colourize [SetConsoleIntensity BoldIntensity] (showParen True (showSpan (Just srcLocFile) (spanFromSrcLoc loc))) diff --git a/src/Data/Flag.hs b/semantic/src/Data/Flag.hs similarity index 86% rename from src/Data/Flag.hs rename to semantic/src/Data/Flag.hs index 785d369cdc..653ece241f 100644 --- a/src/Data/Flag.hs +++ b/semantic/src/Data/Flag.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DerivingStrategies, GeneralizedNewtypeDeriving, RankNTypes, KindSignatures #-} - -- | -- This technique is due to Oleg Grenrus: -- The implementation is clean-room due to unclear licensing of the original post. module Data.Flag @@ -10,7 +8,7 @@ module Data.Flag , choose ) where -import Prologue +import Data.Coerce -- | To declare a new flag, declare a singly-inhabited type: -- @data MyFlag = MyFlag@ @@ -18,9 +16,8 @@ import Prologue -- This is more verbose than using 'Bool' for everything but prevents classes of errors when -- working with multiple flag values in flight, as the 'toBool' deconstructor provides a witness -- that you really want the given semantic flag value from the flag datum. -newtype Flag (t :: *) = Flag Bool - deriving stock (Eq, Show) - deriving newtype NFData +newtype Flag t = Flag Bool + deriving (Eq, Show) -- | The constructor for a 'Flag'. You specify @t@ with a visible type application. flag :: t -> Bool -> Flag t diff --git a/semantic/src/Data/Graph/Algebraic.hs b/semantic/src/Data/Graph/Algebraic.hs new file mode 100644 index 0000000000..54ffa21c5e --- /dev/null +++ b/semantic/src/Data/Graph/Algebraic.hs @@ -0,0 +1,118 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} +module Data.Graph.Algebraic +( Graph(..) +, overlay +, connect +, vertex +, Lower(..) +, simplify +, topologicalSort +, VertexTag(..) +, Edge(..) +, vertexList +, edgeList +) where + +import qualified Algebra.Graph as G +import qualified Algebra.Graph.AdjacencyMap as A +import Algebra.Graph.Class (connect, overlay, vertex) +import qualified Algebra.Graph.Class as Class +import qualified Algebra.Graph.ToGraph as Class +import Control.Applicative +import Control.Carrier.State.Strict +import Data.Aeson +import Data.Foldable +import Data.Function +import Data.Semilattice.Lower +import Data.Set (Set) +import qualified Data.Set as Set + +-- | An algebraic graph with 'Ord', 'Semigroup', and 'Monoid' instances. +newtype Graph vertex = Graph { unGraph :: G.Graph vertex } + deriving (Alternative, Applicative, Eq, Functor, Monad, Show, Class.Graph) + +instance Ord t => Class.ToGraph (Graph t) where + type ToVertex (Graph t) = t + toGraph = Class.toGraph . unGraph + +simplify :: Ord vertex => Graph vertex -> Graph vertex +simplify (Graph graph) = Graph (G.simplify graph) + + +-- | Sort a graph’s vertices topologically. Specced in @Data.Graph.Spec@. +topologicalSort :: forall v . Ord v => Graph v -> [v] +topologicalSort = go . Class.toAdjacencyMap . G.transpose . unGraph + where go :: A.AdjacencyMap v -> [v] + go graph + = visitedOrder . fst + . run + . runState (Visited lowerBound []) + . traverse_ visit + . A.vertexList + $ graph + where visit :: Has (State (Visited v)) sig m => v -> m () + visit v = do + isMarked <- Set.member v . visitedVertices <$> get + if isMarked then + pure () + else do + modify (extendVisited (Set.insert v)) + traverse_ visit (Set.toList (A.postSet v graph)) + modify (extendOrder (v :)) + +data Visited v = Visited { visitedVertices :: !(Set v), visitedOrder :: [v] } + +extendVisited :: (Set v -> Set v) -> Visited v -> Visited v +extendVisited f (Visited a b) = Visited (f a) b + +extendOrder :: ([v] -> [v]) -> Visited v -> Visited v +extendOrder f (Visited a b) = Visited a (f b) + +vertexList :: Ord v => Graph v -> [v] +vertexList = G.vertexList . unGraph + +edgeList :: Ord v => Graph v -> [Edge v] +edgeList = fmap Edge . G.edgeList . unGraph + +-- Instances + +instance Lower (Graph vertex) where + lowerBound = Class.empty + +instance Semigroup (Graph vertex) where + (<>) = overlay + +instance Monoid (Graph vertex) where + mempty = Class.empty + mappend = (<>) + +instance Ord vertex => Ord (Graph vertex) where + compare (Graph G.Empty) (Graph G.Empty) = EQ + compare (Graph G.Empty) _ = LT + compare _ (Graph G.Empty) = GT + compare (Graph (G.Vertex a)) (Graph (G.Vertex b)) = compare a b + compare (Graph (G.Vertex _)) _ = LT + compare _ (Graph (G.Vertex _)) = GT + compare (Graph (G.Overlay a1 a2)) (Graph (G.Overlay b1 b2)) = (compare `on` Graph) a1 b1 <> (compare `on` Graph) a2 b2 + compare (Graph (G.Overlay _ _)) _ = LT + compare _ (Graph (G.Overlay _ _)) = GT + compare (Graph (G.Connect a1 a2)) (Graph (G.Connect b1 b2)) = (compare `on` Graph) a1 b1 <> (compare `on` Graph) a2 b2 + + +class VertexTag vertex where + uniqueTag :: vertex -> Int + +instance (Ord vertex, ToJSON vertex, VertexTag vertex) => ToJSON (Graph vertex) where + toJSON (Graph graph) = object ["vertices" .= G.vertexList graph, "edges" .= (Edge <$> G.edgeList graph)] + toEncoding (Graph graph) = pairs ("vertices" .= G.vertexList graph <> "edges" .= (Edge <$> G.edgeList graph)) + +newtype Edge vertex = Edge (vertex, vertex) + +instance (ToJSON vertex, VertexTag vertex) => ToJSON (Edge vertex) where + toJSON (Edge (a, b)) = object ["source" .= show (uniqueTag a), "target" .= show (uniqueTag b)] + toEncoding (Edge (a, b)) = pairs ("source" .= show (uniqueTag a) <> "target" .= show (uniqueTag b)) diff --git a/src/Data/Handle.hs b/semantic/src/Data/Handle.hs similarity index 78% rename from src/Data/Handle.hs rename to semantic/src/Data/Handle.hs index 6917c39e93..c4c01932dc 100644 --- a/src/Data/Handle.hs +++ b/semantic/src/Data/Handle.hs @@ -1,4 +1,7 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE GADTs #-} +{-# LANGUAGE StandaloneDeriving #-} module Data.Handle ( Handle (..) @@ -11,18 +14,17 @@ module Data.Handle , readBlobPairsFromHandle , readFromHandle , openFileForReading + , InvalidJSONException (..) ) where -import Prologue - +import Control.Exception (Exception, throw) +import Control.Monad.IO.Class import Data.Aeson +import Data.Blob import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy.Char8 as BLC -import System.Exit import qualified System.IO as IO -import Data.Blob - data Handle mode where ReadHandle :: IO.Handle -> Handle 'IO.ReadMode WriteHandle :: IO.Handle -> Handle 'IO.WriteMode @@ -58,9 +60,14 @@ readPathsFromHandle (ReadHandle h) = liftIO $ fmap BLC.unpack . BLC.lines <$> BL readBlobPairsFromHandle :: MonadIO m => Handle 'IO.ReadMode -> m [BlobPair] readBlobPairsFromHandle = fmap blobs <$> readFromHandle +newtype InvalidJSONException = InvalidJSONException String + deriving (Eq, Show, Exception) + +-- | Read JSON-encoded data from a 'Handle'. Throws +-- 'InvalidJSONException' on parse failure. readFromHandle :: (FromJSON a, MonadIO m) => Handle 'IO.ReadMode -> m a readFromHandle (ReadHandle h) = do input <- liftIO $ BL.hGetContents h case eitherDecode input of - Left e -> liftIO (die (e <> ". Invalid input on " <> show h <> ", expecting JSON")) + Left e -> throw (InvalidJSONException e) Right d -> pure d diff --git a/semantic/src/Data/Maybe/Exts.hs b/semantic/src/Data/Maybe/Exts.hs new file mode 100644 index 0000000000..363482203f --- /dev/null +++ b/semantic/src/Data/Maybe/Exts.hs @@ -0,0 +1,20 @@ +module Data.Maybe.Exts +( module Data.Maybe +, maybeLast +, fromMaybeLast +, maybeM +) where + +import Data.Maybe +import Data.Monoid + +maybeLast :: Foldable t => b -> (a -> b) -> t a -> b +maybeLast b f = maybe b f . getLast . foldMap (Last . Just) + +fromMaybeLast :: Foldable t => a -> t a -> a +fromMaybeLast b = fromMaybe b . getLast . foldMap (Last . Just) + +-- | Extract the 'Just' of a 'Maybe' in an 'Applicative' context or, given 'Nothing', run the provided action. +maybeM :: Applicative f => f a -> Maybe a -> f a +maybeM f = maybe f pure +{-# INLINE maybeM #-} diff --git a/src/Data/Semigroup/App.hs b/semantic/src/Data/Semigroup/App.hs similarity index 92% rename from src/Data/Semigroup/App.hs rename to semantic/src/Data/Semigroup/App.hs index 54455a9861..330aebc135 100644 --- a/src/Data/Semigroup/App.hs +++ b/semantic/src/Data/Semigroup/App.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE DeriveTraversable, GeneralizedNewtypeDeriving #-} module Data.Semigroup.App ( App(..) , AppMerge(..) diff --git a/semantic/src/Parsing/Parser.hs b/semantic/src/Parsing/Parser.hs new file mode 100644 index 0000000000..83e5958eb1 --- /dev/null +++ b/semantic/src/Parsing/Parser.hs @@ -0,0 +1,141 @@ +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} + +-- TODO: Now that a la carte syntax has been removed, this whole abstraction is of perhaps questionable utility + +module Parsing.Parser +( Parser(..) + -- * Parsers + -- $abstract +, SomeParser(..) +, goParser +, javaParser +, javascriptParser +, jsonParser +, jsxParser +, phpParserPrecise +, pythonParser +, codeQLParserPrecise +, rubyParser +, tsxParser +, typescriptParser + -- * Canonical sets of parsers +, preciseParsers +) where + +import AST.Unmarshal +import Data.Map (Map) +import qualified Data.Map as Map +import Foreign.Ptr +import qualified Language.CodeQL as CodeQLPrecise +import qualified Language.Go as GoPrecise +import qualified Language.Java as Java +import qualified Language.JSON as JSON +import qualified Language.PHP as PHPPrecise +import qualified Language.Python as PythonPrecise +import qualified Language.Ruby as RubyPrecise +import qualified Language.TSX as TSXPrecise +import qualified Language.TypeScript as TypeScriptPrecise +import Prelude hiding (fail) +import Source.Language (Language (..)) +import Source.Loc +import qualified TreeSitter.Language as TS (Language) + +-- | A parser from 'Source' onto some term type. +data Parser term where + -- | A parser 'Unmarshal'ing to a precise AST type using a 'TS.Language'. + UnmarshalParser :: Unmarshal t => Ptr TS.Language -> Parser (t Loc) + +-- $abstract +-- Most of our features are intended to operate over multiple languages, each represented by disjoint term types. Thus, we typically implement them using typeclasses, allowing us to share a single interface to invoke the feature, while specializing the implementation(s) as appropriate for each distinct term type. +-- +-- In order to accomplish this, we employ 'SomeParser', which abstracts over parsers of various term types, while ensuring that some desired constraint holds. Constructing a @'SomeParser' c@ requires satisfiyng the constraint @c@ against the underlying 'Parser'’s term type, and so it can be used to parse with any of a map of parsers whose terms support @c@. +-- +-- In practice, this means using 'Control.Effect.Parse.parseWith', and passing in a map of parsers to select from for your feature. It is recommended to define the map as a concrete top-level binding using the abstract parsers or ideally the canonical maps of parsers, below; using the abstracted parsers or canonical maps directly with 'Control.Effect.Parse.parseWith' will lead to significantly slower compiles. +-- +-- Bad: +-- +-- @ +-- isFancy :: (Carrier sig m, Member Parse sig) => Blob -> m Bool +-- isFancy = parseWith (preciseParsers @Fancy) (pure . isTermFancy) -- slow compiles! +-- @ +-- +-- Good: +-- +-- @ +-- fancyParsers :: 'Map' 'Language' ('SomeParser' Fancy 'Loc') +-- fancyParsers = preciseParsers +-- +-- isFancy :: (Carrier sig m, Member Parse sig) => Blob -> m Bool +-- isFancy = parseWith fancyParsers (pure . isTermFancy) -- much faster compiles +-- @ + + +-- | A parser producing terms of existentially-quantified type under some constraint @c@. +-- +-- This can be used to perform actions on terms supporting some feature abstracted using a typeclass, without knowing (or caring) what the specific term types are. +data SomeParser c a where + SomeParser :: c t => Parser (t a) -> SomeParser c a + +goParser :: c GoPrecise.Term => (Language, SomeParser c Loc) +goParser = (Go, SomeParser (UnmarshalParser @GoPrecise.Term GoPrecise.tree_sitter_go)) + +javaParser :: c Java.Term => (Language, SomeParser c Loc) +javaParser = (Java, SomeParser (UnmarshalParser @Java.Term Java.tree_sitter_java)) + +javascriptParser :: c TSXPrecise.Term => (Language, SomeParser c Loc) +javascriptParser = (JavaScript, SomeParser (UnmarshalParser @TSXPrecise.Term TSXPrecise.tree_sitter_tsx)) + +jsonParser :: c JSON.Term => (Language, SomeParser c Loc) +jsonParser = (JSON, SomeParser (UnmarshalParser @JSON.Term JSON.tree_sitter_json)) + +jsxParser :: c TSXPrecise.Term => (Language, SomeParser c Loc) +jsxParser = (JSX, SomeParser (UnmarshalParser @TSXPrecise.Term TSXPrecise.tree_sitter_tsx)) + +phpParserPrecise :: c PHPPrecise.Term => (Language, SomeParser c Loc) +phpParserPrecise = (PHP, SomeParser (UnmarshalParser @PHPPrecise.Term PHPPrecise.tree_sitter_php)) + +pythonParser :: c PythonPrecise.Term => (Language, SomeParser c Loc) +pythonParser = (Python, SomeParser (UnmarshalParser @PythonPrecise.Term PythonPrecise.tree_sitter_python)) + +codeQLParserPrecise :: c CodeQLPrecise.Term => (Language, SomeParser c Loc) +codeQLParserPrecise = (CodeQL, SomeParser (UnmarshalParser @CodeQLPrecise.Term CodeQLPrecise.tree_sitter_ql)) + +rubyParser :: c RubyPrecise.Term => (Language, SomeParser c Loc) +rubyParser = (Ruby, SomeParser (UnmarshalParser @RubyPrecise.Term RubyPrecise.tree_sitter_ruby)) + +tsxParser :: c TSXPrecise.Term => (Language, SomeParser c Loc) +tsxParser = (TSX, SomeParser (UnmarshalParser @TSXPrecise.Term TSXPrecise.tree_sitter_tsx)) + +typescriptParser :: c TypeScriptPrecise.Term => (Language, SomeParser c Loc) +typescriptParser = (TypeScript, SomeParser (UnmarshalParser @TypeScriptPrecise.Term TypeScriptPrecise.tree_sitter_typescript)) + +-- | The canonical set of parsers producing precise terms. +preciseParsers + :: ( c Java.Term + , c JSON.Term + , c PythonPrecise.Term + , c CodeQLPrecise.Term + , c RubyPrecise.Term + , c GoPrecise.Term + , c PHPPrecise.Term + , c TypeScriptPrecise.Term + , c TSXPrecise.Term + ) + => Map Language (SomeParser c Loc) +preciseParsers = Map.fromList + [ goParser + , javascriptParser + , jsonParser + , jsxParser + , pythonParser + , phpParserPrecise + , codeQLParserPrecise + , rubyParser + , tsxParser + , typescriptParser + , javaParser + ] diff --git a/semantic/src/Parsing/TreeSitter.hs b/semantic/src/Parsing/TreeSitter.hs new file mode 100644 index 0000000000..a4f275e621 --- /dev/null +++ b/semantic/src/Parsing/TreeSitter.hs @@ -0,0 +1,86 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeOperators #-} +module Parsing.TreeSitter +( TSParseException (..) +, Duration(..) +, parseToPreciseAST +) where + +import Control.Carrier.Reader +import Control.Exception as Exc +import Control.Monad.IO.Class +import Foreign +import GHC.Generics + +import Data.Blob +import Data.Duration +import Data.Maybe.Exts +import Source.Loc +import qualified Source.Source as Source +import qualified System.Timeout as System + +import qualified TreeSitter.Cursor as TS +import qualified TreeSitter.Language as TS +import qualified TreeSitter.Node as TS +import qualified TreeSitter.Parser as TS +import qualified TreeSitter.Tree as TS +import qualified AST.Unmarshal as TS + +data TSParseException + = ParserTimedOut + | IncompatibleVersions + | UnmarshalTimedOut + | UnmarshalFailure String + deriving (Eq, Show, Generic) + +parseToPreciseAST + :: ( MonadIO m + , TS.Unmarshal t + ) + => Duration + -> Duration + -> Ptr TS.Language + -> Blob + -> m (Either TSParseException (t Loc)) +parseToPreciseAST parseTimeout unmarshalTimeout language blob = runParse parseTimeout language blob $ \ rootPtr -> + withTimeout $ + TS.withCursor (castPtr rootPtr) $ \ cursor -> + runReader (TS.UnmarshalState (Source.bytes (blobSource blob)) cursor) (liftIO (peek rootPtr) >>= TS.unmarshalNode) + `Exc.catch` (Exc.throw . UnmarshalFailure . TS.getUnmarshalError) + where + withTimeout :: IO a -> IO a + withTimeout action = System.timeout (toMicroseconds unmarshalTimeout) action >>= maybeM (Exc.throw UnmarshalTimedOut) + +instance Exc.Exception TSParseException where + displayException = \case + ParserTimedOut -> "tree-sitter: parser timed out" + IncompatibleVersions -> "tree-sitter: incompatible versions" + UnmarshalTimedOut -> "tree-sitter: unmarshal timed out" + UnmarshalFailure s -> "tree-sitter: unmarshal failure: " <> s + +runParse + :: MonadIO m + => Duration + -> Ptr TS.Language + -> Blob + -> (Ptr TS.Node -> IO a) + -> m (Either TSParseException a) +runParse parseTimeout language Blob{..} action = + liftIO . Exc.tryJust fromException . TS.withParser language $ \ parser -> do + let timeoutMicros = fromIntegral $ toMicroseconds parseTimeout + TS.ts_parser_set_timeout_micros parser timeoutMicros + compatible <- TS.ts_parser_set_language parser language + if compatible then + TS.withParseTree parser (Source.bytes blobSource) $ \ treePtr -> do + if treePtr == nullPtr then + Exc.throw ParserTimedOut + else + TS.withRootNode treePtr action + else + Exc.throw IncompatibleVersions diff --git a/semantic/src/Semantic/Api.hs b/semantic/src/Semantic/Api.hs new file mode 100644 index 0000000000..0f7d9ab9c5 --- /dev/null +++ b/semantic/src/Semantic/Api.hs @@ -0,0 +1,11 @@ +module Semantic.Api + ( module SymbolsAPI + , module StackGraphAPI + , module TermsAPI + , module Types + ) where + +import Semantic.Api.Symbols as SymbolsAPI +import Semantic.Api.StackGraph as StackGraphAPI +import Semantic.Api.Terms as TermsAPI +import Proto.Semantic as Types diff --git a/semantic/src/Semantic/Api/Bridge.hs b/semantic/src/Semantic/Api/Bridge.hs new file mode 100644 index 0000000000..f80aaf27d4 --- /dev/null +++ b/semantic/src/Semantic/Api/Bridge.hs @@ -0,0 +1,85 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE RecordWildCards #-} +module Semantic.Api.Bridge + ( APIBridge (..) + , APIConvert (..) + , (#?) + ) where + +import Analysis.File +import Analysis.Reference +import Control.Lens +import qualified Data.Blob as Data +import Data.ProtoLens (defMessage) +import qualified Data.Text as T +import Data.Text.Lens +import qualified Proto.Semantic as API +import Proto.Semantic_Fields as P hiding (to) +import qualified Source.Language as Data +import qualified Source.Range as Source +import qualified Source.Source as Source (fromText, toText, totalSpan) +import qualified Source.Span as Source + +-- | An @APIBridge x y@ instance describes an isomorphism between @x@ and @y@. +-- This is suitable for types such as 'Pos' which are representationally equivalent +-- in their API, legacy, and native forms. All 'Lens' laws apply. +-- +-- Foreign to native: @x ^. bridging@ +-- Native to foreign: @bridging # x@ +-- Native to 'Just' foreign: @bridging #? x@. +-- 'Maybe' foreign to 'Maybe' native: @x >>= preview bridging@ +class APIBridge api native | api -> native where + bridging :: Iso' api native + +-- | An @APIConvert x y@ instance describes a partial isomorphism between @x@ and @y@. +-- This is suitable for types containing nested records therein, such as 'Span'. +-- (The isomorphism must be partial, given that a protobuf record can have Nothing +-- for all its fields, which means we cannot convert to a native format.) +-- +-- Foreign to native: this is a type error, unless the native is a Monoid +-- Foreign to 'Maybe' native: @x^?converting@ +-- Native to foreign: @converting # x@ +-- Native to 'Just' foreign: @converting #? x@ +class APIConvert api native | api -> native where + converting :: Prism' api native + +-- | A helper function for turning 'bridging' around and +-- extracting 'Just' values from it. +(#?) :: AReview t s -> s -> Maybe t +rev #? item = item ^? re rev +infixr 8 #? + +instance APIBridge API.Position Source.Pos where + bridging = iso fromAPI toAPI where + toAPI Source.Pos{..} = defMessage & P.line .~ fromIntegral line & P.column .~ fromIntegral column + fromAPI position = Source.Pos (fromIntegral (position ^. line)) (fromIntegral (position ^. column)) + +instance APIConvert API.Span Source.Span where + converting = prism' toAPI fromAPI where + toAPI Source.Span{..} = defMessage & P.maybe'start .~ (bridging #? start) & P.maybe'end .~ (bridging #? end) + fromAPI span = Source.Span <$> (span ^. maybe'start >>= preview bridging) <*> (span ^. maybe'end >>= preview bridging) + +instance APIBridge API.ByteRange Source.Range where + bridging = iso fromAPI toAPI where + toAPI Source.Range{..} = defMessage & P.start .~ fromIntegral start & P.end .~ fromIntegral end + fromAPI range = Source.Range (fromIntegral (range ^. start)) (fromIntegral (range ^. end)) + +instance APIBridge T.Text Data.Language where + bridging = iso Data.textToLanguage Data.languageToText + +instance APIBridge API.Blob Data.Blob where + bridging = iso apiBlobToBlob blobToApiBlob where + blobToApiBlob b + = defMessage + & P.content .~ Source.toText (Data.blobSource b) + & P.path .~ T.pack (Data.blobFilePath b) + & P.language .~ (bridging # Data.blobLanguage b) + apiBlobToBlob blob = + let src = blob ^. content.to Source.fromText + pth = blob ^. path._Text + in Data.Blob + { blobSource = src + , blobFile = File (Reference pth (Source.totalSpan src)) (blob ^. language.bridging) + } diff --git a/semantic/src/Semantic/Api/StackGraph.hs b/semantic/src/Semantic/Api/StackGraph.hs new file mode 100644 index 0000000000..2e447ad474 --- /dev/null +++ b/semantic/src/Semantic/Api/StackGraph.hs @@ -0,0 +1,127 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE LambdaCase #-} +module Semantic.Api.StackGraph + ( parseStackGraph + , TempStackGraph(..) + , SGNode(..) + , SGPath(..) + ) where + + +import Control.Effect.Error +import Control.Effect.Parse +import Control.Exception +import Control.Lens +import Data.Blob +import Data.Foldable +import Data.Int +import Data.Map.Strict (Map) +import Data.ProtoLens (defMessage) +import Data.Text (Text, pack) +import qualified Parsing.Parser as Parser +import Proto.Semantic as P hiding (Blob) +import Proto.Semantic_Fields as P +import Proto.Semantic_JSON () +import Semantic.Api.Bridge +import Source.Language +import Source.Loc as Loc + +parseStackGraph :: ( Has (Error SomeException) sig m + , Has Parse sig m + , Traversable t + ) + => t Blob + -> m StackGraphResponse +parseStackGraph blobs = do + terms <- traverse go blobs + pure $ defMessage & P.files .~ toList terms + where + go :: ( Has (Error SomeException) sig m + , Has Parse sig m + ) + => Blob + -> m StackGraphFile + go blob = catching $ graphToFile <$> graphForBlob blob + where + catching m = m `catchError` (\(SomeException e) -> pure $ errorFile (show e)) + blobLanguage' = blobLanguage blob + blobPath' = pack $ blobFilePath blob + errorFile e = defMessage + & P.path .~ blobPath' + & P.language .~ (bridging # blobLanguage') + & P.nodes .~ mempty + & P.paths .~ mempty + & P.errors .~ [defMessage & P.error .~ pack e] + + graphToFile :: TempStackGraph -> StackGraphFile + graphToFile graph + = defMessage + & P.path .~ blobPath' + & P.language .~ (bridging # blobLanguage') + & P.nodes .~ fmap nodeToNode (scopeGraphNodes graph) + & P.paths .~ fmap pathToPath (scopeGraphPaths graph) + + nodeToNode :: SGNode -> StackGraphNode + nodeToNode node + = defMessage + & P.id .~ nodeId node + & P.name .~ nodeName node + & P.line .~ nodeLine node + & P.maybe'span ?~ converting # nodeSpan node + & P.syntaxType .~ nodeSyntaxType node + & P.nodeType .~ nodeNodeType node + + pathToPath :: SGPath -> StackGraphPath + pathToPath path + = defMessage + & P.startingSymbolStack .~ pathStartingSymbolStack path + & P.startingScopeStackSize .~ pathStartingScopeStackSize path + & P.from .~ pathFrom path + & P.edges .~ pathEdges path + & P.to .~ pathTo path + & P.endingScopeStack .~ pathEndingScopeStack path + & P.endingSymbolStack .~ pathEndingSymbolStack path + +-- TODO: These are temporary, will replace with proper datatypes from the scope graph work. +data TempStackGraph + = TempStackGraph + { scopeGraphNodes :: [SGNode] + , scopeGraphPaths :: [SGPath] + } + +data SGPath + = SGPath + { pathStartingSymbolStack :: [Text] + , pathStartingScopeStackSize :: Int64 + , pathFrom :: Int64 + , pathEdges :: Text + , pathTo :: Int64 + , pathEndingScopeStack :: [Int64] + , pathEndingSymbolStack :: [Text] + } + deriving (Eq, Show) + +data SGNode + = SGNode + { nodeId :: Int64, + nodeName :: Text, + nodeLine :: Text, + nodeSpan :: Loc.Span, + nodeSyntaxType :: P.SyntaxType, + nodeNodeType :: P.NodeType + } + deriving (Eq, Show) + +graphForBlob :: (Has (Error SomeException) sig m, Has Parse sig m) => Blob -> m TempStackGraph +graphForBlob blob = parseWith toStackGraphParsers (pure . toStackGraph blob) blob + where + toStackGraphParsers :: Map Language (Parser.SomeParser ToStackGraph Loc) + toStackGraphParsers = Parser.preciseParsers + +class ToStackGraph term where + toStackGraph :: Blob -> term Loc -> TempStackGraph + +instance ToStackGraph term where + -- TODO: Need to produce the graph here + toStackGraph _ _ = TempStackGraph mempty mempty diff --git a/semantic/src/Semantic/Api/Symbols.hs b/semantic/src/Semantic/Api/Symbols.hs new file mode 100644 index 0000000000..a1ba9ebc13 --- /dev/null +++ b/semantic/src/Semantic/Api/Symbols.hs @@ -0,0 +1,84 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} + +module Semantic.Api.Symbols + ( parseSymbols, + parseSymbolsBuilder, + tagsForBlob, + ) +where + +import Control.Effect.Error +import Control.Effect.Parse +import Control.Effect.Reader +import Control.Exception +import Control.Lens +import Data.Blob +import Data.ByteString.Builder +import Data.Foldable +import Data.Map.Strict (Map) +import Data.ProtoLens (defMessage) +import Data.Text (pack, toTitle) +import qualified Parsing.Parser as Parser +import Proto.Semantic as P hiding (Blob) +import Proto.Semantic_Fields as P +import Proto.Semantic_JSON () +import Semantic.Api.Bridge +import Semantic.Config +import Semantic.Task +import Serializing.Format (Format) +import Source.Language +import Source.Loc as Loc +import Tags.Tagging.Precise + +parseSymbolsBuilder :: (Has (Error SomeException) sig m, Has Parse sig m, Has (Reader Config) sig m, Traversable t) => Format ParseTreeSymbolResponse -> t Blob -> m Builder +parseSymbolsBuilder format blobs = parseSymbols blobs >>= serialize format + +parseSymbols :: (Has (Error SomeException) sig m, Has Parse sig m, Traversable t) => t Blob -> m ParseTreeSymbolResponse +parseSymbols blobs = do + terms <- traverse go blobs + pure $ defMessage & P.files .~ toList terms + where + go :: (Has (Error SomeException) sig m, Has Parse sig m) => Blob -> m File + go blob = catching $ tagsToFile <$> tagsForBlob blob + where + catching m = m `catchError` (\(SomeException e) -> pure $ errorFile (show e)) + blobLanguage' = blobLanguage blob + blobPath' = pack $ blobFilePath blob + errorFile e = + defMessage + & P.path .~ blobPath' + & P.language .~ (bridging # blobLanguage') + & P.symbols .~ mempty + & P.errors .~ [defMessage & P.error .~ pack e] + tagsToFile :: [Tag] -> File + tagsToFile tags = + defMessage + & P.path .~ blobPath' + & P.language .~ (bridging # blobLanguage') + & P.symbols .~ fmap tagToSymbol tags + & P.errors .~ mempty + tagToSymbol :: Tag -> Symbol + tagToSymbol tag = + defMessage + & P.symbol .~ tagName tag + & P.kind .~ toKind tag + & P.nodeType .~ tagNodeType tag + & P.syntaxType .~ tagSyntaxType tag + & P.line .~ tagLine tag + & P.maybe'span ?~ converting # unOneIndexedSpan (tagOneIndexedSpan tag) + & P.maybe'utf16CodeUnitSpan ?~ converting # unUTF16CodeUnitSpan (tagUTF16CodeUnitSpan tag) + & P.byteRange .~ bridging # tagByteRange tag + where + toKind = toTitle . pack . show . tagSyntaxType + +tagsForBlob :: (Has (Error SomeException) sig m, Has Parse sig m) => Blob -> m [Tag] +tagsForBlob blob = parseWith toTagsParsers (pure . tags (blobSource blob)) blob + where + toTagsParsers :: Map Language (Parser.SomeParser ToTags Loc) + toTagsParsers = Parser.preciseParsers diff --git a/semantic/src/Semantic/Api/Terms.hs b/semantic/src/Semantic/Api/Terms.hs new file mode 100644 index 0000000000..d16c20fb11 --- /dev/null +++ b/semantic/src/Semantic/Api/Terms.hs @@ -0,0 +1,168 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -freduction-depth=0 #-} +module Semantic.Api.Terms + ( parseTermBuilder + , TermOutputFormat(..) + ) where + +import Control.Effect.Error +import Control.Effect.Parse +import Control.Effect.Reader +import Control.Monad +import Control.Monad.IO.Class +import Data.Blob +import Data.ByteString.Builder +import Data.Either +import Data.Foldable (fold) +import Data.Map.Strict (Map) +import qualified Language.CodeQL as CodeQL +import qualified Language.Go as Go +import qualified Language.Java as Java +import qualified Language.JSON as JSON +import qualified Language.PHP as PHP +import qualified Language.Python as Python +import qualified Language.Ruby as Ruby +import qualified Language.TSX as TSX +import qualified Language.TypeScript as TypeScript +import Parsing.Parser +import Semantic.Config +import Semantic.Task +import Serializing.Format hiding (JSON) +import qualified Serializing.SExpression.Precise as SExpr.Precise (serializeSExpression) +import Source.Language +import Source.Loc + + +data TermOutputFormat + = TermSExpression + | TermShow + | TermJSON + | TermQuiet + deriving (Eq, Show) + +parseTermBuilder :: (Traversable t, Has (Error SomeException) sig m, Has Parse sig m, Has (Reader Config) sig m, MonadIO m) + => TermOutputFormat -> t Blob -> m Builder +parseTermBuilder TermSExpression = foldMapM (parseWith sexprTermParsers (pure . sexprTerm)) +parseTermBuilder TermShow = foldMapM (parseWith showTermParsers showTerm) +parseTermBuilder TermJSON = foldMapM (parseWith jsonTermParsers jsonTerm) +parseTermBuilder TermQuiet = foldMapM quietTerm + +foldMapM :: (Traversable t, Monoid out, Applicative m) => (a -> m out) -> t a -> m out +foldMapM f = fmap fold . traverse f + +quietTerm :: (Has (Error SomeException) sig m, Has Parse sig m, Has (Reader Config) sig m, MonadIO m) => Blob -> m Builder +quietTerm blob = showTiming <$> time' (parseWith showTermParsers (fmap (const (Right ())) . showTerm) blob `catchError` timingError) + where + timingError (SomeException e) = pure (Left (show e)) + showTiming (res, duration) = + let status = if isLeft res then "ERR" else "OK" + in stringUtf8 (status <> "\t" <> show (blobLanguage blob) <> "\t" <> blobFilePath blob <> "\t" <> show duration <> " ms\n") + + +showTermParsers :: Map Language (SomeParser ShowTerm Loc) +showTermParsers = preciseParsers + +class ShowTerm term where + showTerm :: (Has (Reader Config) sig m) => term Loc -> m Builder + +instance ShowTerm Go.Term where + showTerm = serialize Show . void . Go.getTerm + +instance ShowTerm Java.Term where + showTerm = serialize Show . void . Java.getTerm + +instance ShowTerm JSON.Term where + showTerm = serialize Show . void . JSON.getTerm + +instance ShowTerm PHP.Term where + showTerm = serialize Show . void . PHP.getTerm + +instance ShowTerm Python.Term where + showTerm = serialize Show . void . Python.getTerm + +instance ShowTerm CodeQL.Term where + showTerm = serialize Show . void . CodeQL.getTerm + +instance ShowTerm Ruby.Term where + showTerm = serialize Show . void . Ruby.getTerm + +instance ShowTerm TSX.Term where + showTerm = serialize Show . void . TSX.getTerm + +instance ShowTerm TypeScript.Term where + showTerm = serialize Show . void . TypeScript.getTerm + +jsonTermParsers :: Map Language (SomeParser JSONTerm Loc) +jsonTermParsers = preciseParsers + +class JSONTerm term where + jsonTerm :: (Has (Reader Config) sig m) => term Loc -> m Builder + +instance JSONTerm Go.Term where + jsonTerm = serialize Marshal . Go.getTerm + +instance JSONTerm Java.Term where + jsonTerm = serialize Marshal . Java.getTerm + +instance JSONTerm JSON.Term where + jsonTerm = serialize Marshal . JSON.getTerm + +instance JSONTerm PHP.Term where + jsonTerm = serialize Marshal . PHP.getTerm + +instance JSONTerm Python.Term where + jsonTerm = serialize Marshal . Python.getTerm + +instance JSONTerm CodeQL.Term where + jsonTerm = serialize Marshal . CodeQL.getTerm + +instance JSONTerm Ruby.Term where + jsonTerm = serialize Marshal . Ruby.getTerm + +instance JSONTerm TSX.Term where + jsonTerm = serialize Marshal . TSX.getTerm + +instance JSONTerm TypeScript.Term where + jsonTerm = serialize Marshal . TypeScript.getTerm + +sexprTermParsers :: Map Language (SomeParser SExprTerm Loc) +sexprTermParsers = preciseParsers + +class SExprTerm term where + sexprTerm :: term Loc -> Builder + +instance SExprTerm Go.Term where + sexprTerm = SExpr.Precise.serializeSExpression . Go.getTerm + +instance SExprTerm Java.Term where + sexprTerm = SExpr.Precise.serializeSExpression . Java.getTerm + +instance SExprTerm JSON.Term where + sexprTerm = SExpr.Precise.serializeSExpression . JSON.getTerm + +instance SExprTerm PHP.Term where + sexprTerm = SExpr.Precise.serializeSExpression . PHP.getTerm + +instance SExprTerm Python.Term where + sexprTerm = SExpr.Precise.serializeSExpression . Python.getTerm + +instance SExprTerm CodeQL.Term where + sexprTerm = SExpr.Precise.serializeSExpression . CodeQL.getTerm + +instance SExprTerm Ruby.Term where + sexprTerm = SExpr.Precise.serializeSExpression . Ruby.getTerm + +instance SExprTerm TSX.Term where + sexprTerm = SExpr.Precise.serializeSExpression . TSX.getTerm + +instance SExprTerm TypeScript.Term where + sexprTerm = SExpr.Precise.serializeSExpression . TypeScript.getTerm diff --git a/semantic/src/Semantic/CLI.hs b/semantic/src/Semantic/CLI.hs new file mode 100644 index 0000000000..eec7a957eb --- /dev/null +++ b/semantic/src/Semantic/CLI.hs @@ -0,0 +1,123 @@ +{-# LANGUAGE ApplicativeDo #-} +{-# LANGUAGE FlexibleContexts #-} +module Semantic.CLI (main) where + +import qualified Analysis.File as File +import qualified Control.Carrier.Parse.Measured as Parse +import Control.Exception +import qualified Data.Flag as Flag +import Data.Foldable +import Data.Handle +import Data.List (intercalate) +import Options.Applicative hiding (style) +import Semantic.Api hiding (File) +import Semantic.Config +import qualified Semantic.Task as Task +import Semantic.Task.Files +import Semantic.Telemetry +import qualified Semantic.Telemetry.Log as Log +import Semantic.Version +import Serializing.Format +import qualified Source.Language as Language +import System.Exit (die) + +import Control.Concurrent (mkWeakThreadId, myThreadId) +import Proto.Semantic_JSON () +import System.Mem.Weak (deRefWeak) +import System.Posix.Signals + +newtype SignalException = SignalException Signal + deriving (Show) +instance Exception SignalException + +installSignalHandlers :: IO () +installSignalHandlers = do + mainThreadId <- myThreadId + weakTid <- mkWeakThreadId mainThreadId + for_ [ sigABRT, sigBUS, sigHUP, sigILL, sigQUIT, sigSEGV, + sigSYS, sigTERM, sigUSR1, sigUSR2, sigXCPU, sigXFSZ ] $ \sig -> + installHandler sig (Catch $ sendException weakTid sig) Nothing + where + sendException weakTid sig = do + m <- deRefWeak weakTid + case m of + Nothing -> pure () + Just tid -> throwTo tid (toException $ SignalException sig) + +main :: IO () +main = do + installSignalHandlers + (options, task) <- customExecParser (prefs showHelpOnEmpty) arguments + config <- defaultConfig options + res <- withTelemetry config $ \ (TelemetryQueues logger statter _) -> + Task.runTask (Task.TaskSession config "-" (optionsLogPathsOnError options) logger statter) (Parse.runParse task) + either (die . displayException) pure res + +-- | A parser for the application's command-line arguments. +-- +-- Returns a 'Task' to read the input, run the requested operation, and write the output to the specified output path or stdout. +arguments :: ParserInfo (Options, Parse.ParseC Task.TaskC ()) +arguments = info (version <*> helper <*> ((,) <$> optionsParser <*> argumentsParser)) description + where + version = infoOption versionString (long "version" <> short 'v' <> help "Output the version of the program") + versionString = "semantic version " <> buildVersion <> " (" <> buildSHA <> ")" + description = fullDesc <> header "semantic -- Semantic (syntax-aware) diffs, program analysis toolkit" + +optionsParser :: Parser Options +optionsParser = do + logLevel <- options [ ("error", Just Log.Error) , ("warning", Just Log.Warning) , ("info", Just Log.Info) , ("debug", Just Log.Debug) , ("none", Nothing)] + (long "log-level" <> value (Just Log.Warning) <> help "Log messages at or above this level, or disable logging entirely.") + failOnWarning <- switch (long "fail-on-warning" <> help "Fail on assignment warnings.") + failOnParseError <- switch (long "fail-on-parse-error" <> help "Fail on tree-sitter parse errors.") + logPathsOnError <- switch (long "log-paths" <> help "Log source paths on parse and assignment error.") + pure $ Options logLevel logPathsOnError (Flag.flag FailOnWarning failOnWarning) (Flag.flag FailOnParseError failOnParseError) + +argumentsParser :: Parser (Parse.ParseC Task.TaskC ()) +argumentsParser = do + subparser <- hsubparser parseCommand + output <- ToPath <$> pathOption (long "output" <> short 'o' <> help "Output path, defaults to stdout") <|> pure (ToHandle stdout) + pure $ subparser >>= Task.write output + +parseCommand :: Mod CommandFields (Parse.ParseC Task.TaskC Builder) +parseCommand = command "parse" (info parseArgumentsParser (progDesc "Generate parse trees for path(s)")) + where + parseArgumentsParser = do + renderer + <- flag (parseTermBuilder TermSExpression) + (parseTermBuilder TermSExpression) + ( long "sexpression" + <> help "Output s-expression parse trees (default)") + <|> flag' (parseSymbolsBuilder JSON) + ( long "symbols" + <> long "json-symbols" + <> help "Output JSON symbol list") + <|> flag' (parseSymbolsBuilder Proto) + ( long "proto-symbols" + <> help "Output protobufs symbol list") + <|> flag' (parseTermBuilder TermJSON) + ( long "json" + <> help "Output JSON AST dump") + <|> flag' (parseTermBuilder TermShow) + ( long "show" + <> help "Output using the Show instance (debug only, format subject to change without notice)") + <|> flag' (parseTermBuilder TermQuiet) + ( long "quiet" + <> help "Don't produce output, but show timing stats") + filesOrStdin <- FilesFromPaths <$> some (argument filePathReader (metavar "FILES...")) + <|> pure (FilesFromHandle stdin) + pure $ Task.readBlobs filesOrStdin >>= renderer + +filePathReader :: ReadM (File.File Language.Language) +filePathReader = File.fromPath <$> path + +path :: ReadM FilePath +path = eitherReader Right + +pathOption :: Mod OptionFields FilePath -> Parser FilePath +pathOption = option path + +options :: Eq a => [(String, a)] -> Mod OptionFields a -> Parser a +options options fields = option (optionsReader options) (fields <> showDefaultWith (findOption options) <> metavar (intercalate "|" (fmap fst options))) + where + optionsReader options = eitherReader $ \ str -> maybe (Left ("expected one of: " <> intercalate ", " (fmap fst options))) (Right . snd) (find ((== str) . fst) options) + findOption options value = maybe "" fst (find ((== value) . snd) options) diff --git a/semantic/src/Semantic/Config.hs b/semantic/src/Semantic/Config.hs new file mode 100644 index 0000000000..2dbd5a188a --- /dev/null +++ b/semantic/src/Semantic/Config.hs @@ -0,0 +1,163 @@ +{-# LANGUAGE RecordWildCards #-} +module Semantic.Config + ( Config (..) + , defaultConfig + , Options (..) + , defaultOptions + , debugOptions + , infoOptions + , lookupStatsAddr + , withErrorReporterFromConfig + , logOptionsFromConfig + , withLoggerFromConfig + , withStatterFromConfig + , withTelemetry + -- * Flags + , IsTerminal (..) + , LogPrintSource (..) + , FailTestParsing (..) + , FailOnWarning (..) + , FailOnParseError (..) + ) where + +import Data.Duration +import Data.Error (LogPrintSource (..)) +import Data.Flag +import Data.Maybe +import Network.HostName +import Network.URI +import Semantic.Env +import Semantic.Telemetry +import qualified Semantic.Telemetry.Error as Error +import qualified Semantic.Telemetry.Stat as Stat +import Semantic.Version (buildSHA) +import System.Environment +import System.IO (hIsTerminalDevice, stdout) +import System.Posix.Process +import System.Posix.Types + +data IsTerminal = IsTerminal +data FailTestParsing = FailTestParsing +data FailOnWarning = FailOnWarning +data FailOnParseError = FailOnParseError + +data Config + = Config + { configAppName :: String -- ^ Application name ("semantic") + , configHostName :: String -- ^ HostName from getHostName + , configProcessID :: ProcessID -- ^ ProcessID from getProcessID + , configStatsHost :: Stat.Host -- ^ Host of statsd/datadog (default: "127.0.0.1") + , configStatsPort :: Stat.Port -- ^ Port of statsd/datadog (default: "28125") + , configTreeSitterParseTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter parsing (default: 6000). + , configTreeSitterUnmarshalTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter unmarshalling (default: 4000). + , configAssignmentTimeout :: Duration -- ^ Millisecond timeout for assignment (default: 4000) + , configMaxTelemetyQueueSize :: Int -- ^ Max size of telemetry queues before messages are dropped (default: 1000). + , configIsTerminal :: Flag IsTerminal -- ^ Whether a terminal is attached (set automaticaly at runtime). + , configLogPrintSource :: Flag LogPrintSource -- ^ Whether to print the source reference when logging errors (set automatically at runtime). + , configLogFormatter :: LogFormatter -- ^ Log formatter to use (set automatically at runtime). + , configSHA :: String -- ^ SHA to include in log messages (set automatically). + , configFailParsingForTesting :: Flag FailTestParsing -- ^ Simulate internal parse failure for testing (default: False). + , configOptions :: Options -- ^ Options configurable via command line arguments. + } + +-- Options configurable via command line arguments. +data Options + = Options + { optionsLogLevel :: Maybe Level -- ^ What level of messages to log. 'Nothing' disables logging. + , optionsLogPathsOnError :: Bool -- ^ Should semantic log source path on parse or assignment errors (default: False). + , optionsFailOnWarning :: Flag FailOnWarning -- ^ Should semantic fail fast on assignment warnings (for testing) + , optionsFailOnParseError :: Flag FailOnParseError -- ^ Should semantic fail fast on tree-sitter parser errors (for testing) + } + +defaultOptions :: Options +defaultOptions = Options (Just Warning) False (flag FailOnWarning False) (flag FailOnParseError False) + +debugOptions :: Options +debugOptions = defaultOptions { optionsLogLevel = Just Debug } + +infoOptions :: Options +infoOptions = defaultOptions { optionsLogLevel = Just Info } + +defaultConfig :: Options -> IO Config +defaultConfig options = do + pid <- getProcessID + hostName <- getHostName + isTerminal <- hIsTerminalDevice stdout + (statsHost, statsPort) <- lookupStatsAddr + size <- envLookupNum 1000 "MAX_TELEMETRY_QUEUE_SIZE" + parseTimeout <- envLookupNum 6000 "TREE_SITTER_PARSE_TIMEOUT" + unmarshalTimeout <- envLookupNum 4000 "TREE_SITTER_UNMARSHAL_TIMEOUT" + assignTimeout <- envLookupNum 4000 "SEMANTIC_ASSIGNMENT_TIMEOUT" + pure Config + { configAppName = "semantic" + , configHostName = hostName + , configProcessID = pid + , configStatsHost = statsHost + , configStatsPort = statsPort + + , configTreeSitterParseTimeout = fromMilliseconds parseTimeout + , configTreeSitterUnmarshalTimeout = fromMilliseconds unmarshalTimeout + , configAssignmentTimeout = fromMilliseconds assignTimeout + , configMaxTelemetyQueueSize = size + , configIsTerminal = flag IsTerminal isTerminal + , configLogPrintSource = flag LogPrintSource isTerminal + , configLogFormatter = if isTerminal then terminalFormatter else logfmtFormatter + , configSHA = buildSHA + , configFailParsingForTesting = flag FailTestParsing False + + , configOptions = options + } + +withTelemetry :: Config -> (TelemetryQueues -> IO c) -> IO c +withTelemetry config action = + withLoggerFromConfig config $ \logger -> + withErrorReporterFromConfig config (queueLogMessage logger Error) $ \errorReporter -> + withStatterFromConfig config $ \statter -> + action (TelemetryQueues logger statter errorReporter) + +logOptionsFromConfig :: Config -> LogOptions +logOptionsFromConfig Config{..} = LogOptions + { logOptionsLevel = optionsLogLevel configOptions + , logOptionsFormatter = configLogFormatter + , logOptionsContext = logOptionsContext' + } + where logOptionsContext' + | toBool IsTerminal configIsTerminal = [] + | otherwise = [ ("app", configAppName) + , ("pid", show configProcessID) + , ("hostname", configHostName) + , ("sha", configSHA) + ] + + +withLoggerFromConfig :: Config -> (LogQueue -> IO c) -> IO c +withLoggerFromConfig config = withLogger (logOptionsFromConfig config) (configMaxTelemetyQueueSize config) + + +withErrorReporterFromConfig :: Config -> Error.ErrorLogger -> (ErrorQueue -> IO c) -> IO c +withErrorReporterFromConfig Config{..} errorLogger = + withErrorReporter (nullErrorReporter errorLogger) configMaxTelemetyQueueSize + +withStatterFromConfig :: Config -> (StatQueue -> IO c) -> IO c +withStatterFromConfig Config{..} = + withStatter configStatsHost configStatsPort configAppName configMaxTelemetyQueueSize + +lookupStatsAddr :: IO (Stat.Host, Stat.Port) +lookupStatsAddr = do + addr <- lookupEnv "STATS_ADDR" + let (host', port) = parseAddr (fmap ("statsd://" <>) addr) + + -- When running in Kubes, DOGSTATSD_HOST is set with the dogstatsd host. + kubesHost <- lookupEnv "DOGSTATSD_HOST" + let host = fromMaybe host' kubesHost + + pure (host, port) + where + defaultHost = "127.0.0.1" + defaultPort = "28125" + parseAddr a | Just s <- a + , Just (Just (URIAuth _ host port)) <- uriAuthority <$> parseURI s + = (parseHost host, parsePort port) + | otherwise = (defaultHost, defaultPort) + parseHost s = if null s then defaultHost else s + parsePort s = if null s then defaultPort else dropWhile (':' ==) s diff --git a/semantic/src/Semantic/Env.hs b/semantic/src/Semantic/Env.hs new file mode 100644 index 0000000000..d485be994e --- /dev/null +++ b/semantic/src/Semantic/Env.hs @@ -0,0 +1,19 @@ +{-# OPTIONS_GHC -Wno-redundant-constraints #-} +module Semantic.Env + ( envLookupNum + , envLookupString + ) where + +import Control.Monad.IO.Class +import Data.Maybe +import System.Environment +import Text.Read (readMaybe) + +envLookupString :: MonadIO io => String -> String -> io String +envLookupString defaultVal k = liftIO $ fromMaybe defaultVal <$> lookupEnv k + +-- | Although the `Num a` constraint is redundant (hence -Wno-redundant-constraints), we use this constraint to communicate this function is meant to read Num values. +envLookupNum :: (MonadIO io, Num a, Read a) => a -> String -> io a +envLookupNum defaultVal k = liftIO $ parse <$> lookupEnv k + where parse x | Just s <- x, Just p <- readMaybe s = p + | otherwise = defaultVal diff --git a/semantic/src/Semantic/IO.hs b/semantic/src/Semantic/IO.hs new file mode 100644 index 0000000000..07cc4c07ba --- /dev/null +++ b/semantic/src/Semantic/IO.hs @@ -0,0 +1,43 @@ +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Semantic.IO + ( findFilesInDir + ) where + +import Prelude hiding (readFile) + +import Control.Monad.IO.Class +import System.Directory.Tree (AnchoredDirTree (..)) +import qualified System.Directory.Tree as Tree +import System.FilePath + +pathIsMinified :: FilePath -> Bool +pathIsMinified = isExtensionOf ".min.js" + +-- Recursively find files in a directory. +findFilesInDir :: MonadIO m => FilePath -> [String] -> [FilePath] -> m [FilePath] +findFilesInDir path exts excludeDirs = do + _:/dir <- liftIO $ Tree.build path + pure $ (onlyFiles . Tree.filterDir (withExtensions exts) . Tree.filterDir (notIn excludeDirs)) dir + where + -- Build a list of only FilePath's (remove directories and failures) + onlyFiles (Tree.Dir _ fs) = concatMap onlyFiles fs + onlyFiles (Tree.Failed _ _) = [] + onlyFiles (Tree.File _ f) = [f] + + -- Predicate for Files with one of the extensions in 'exts'. + withExtensions exts (Tree.File n _) + | pathIsMinified n = False + | takeExtension n `elem` exts = True + | otherwise = False + withExtensions _ _ = True + + -- Predicate for contents NOT in a directory + notIn dirs (Tree.Dir n _) + | (x:_) <- n, x == '.' = False -- Don't include directories that start with '.'. + | n `elem` dirs = False + | otherwise = True + notIn _ _ = True diff --git a/semantic/src/Semantic/Task.hs b/semantic/src/Semantic/Task.hs new file mode 100644 index 0000000000..6384713be4 --- /dev/null +++ b/semantic/src/Semantic/Task.hs @@ -0,0 +1,123 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Semantic.Task +( TaskC +, Level(..) +-- * I/O +, Files.readBlob +, Files.readBlobs +, Files.readBlobPairs +, Files.readProject +, Files.findFiles +, Files.write +, Files.FilesArg(..) +-- * Telemetry +, writeLog +, writeStat +, time +, time' +-- * High-level flow +, serialize +-- * Configuration +, debugOptions +, defaultOptions +, defaultConfig +, terminalFormatter +, logfmtFormatter +-- * Interpreting +, runTask +, runTaskWithOptions +, withOptions +, TaskSession(..) +, runTraceInTelemetry +, Error +, Lift +, throwError +, SomeException(..) +, Telemetry +) where + +import Control.Algebra +import Control.Carrier.Error.Either +import Control.Carrier.Lift +import Control.Carrier.Reader +import Control.Effect.Trace +import Control.Exception +import Control.Monad.IO.Class +import Data.ByteString.Builder +import qualified Data.Flag as Flag +import Semantic.Config +import qualified Semantic.Task.Files as Files +import Semantic.Telemetry +import Serializing.Format + +-- | A high-level task producing some result, e.g. parsing, diffing, rendering. +type TaskC + = Files.FilesC + ( ReaderC Config + ( ReaderC TaskSession + ( TraceInTelemetryC + ( TelemetryC + ( ErrorC SomeException + ( LiftC IO)))))) + +serialize :: Has (Reader Config) sig m + => Format input + -> input + -> m Builder +serialize format input = do + formatStyle <- asks (Flag.choose IsTerminal Plain Colourful . configIsTerminal) + pure (runSerialize formatStyle format input) + +data TaskSession + = TaskSession + { config :: Config + , requestID :: String + , isPublic :: Bool + , logger :: LogQueue + , statter :: StatQueue + } + +-- | Execute a 'TaskC' yielding its result value in 'IO'. +runTask :: TaskSession -> TaskC a -> IO (Either SomeException a) +runTask taskSession@TaskSession{..} task = do + (result, stat) <- withTiming "run" [] $ do + let run :: TaskC a -> IO (Either SomeException a) + run + = runM + . runError + . runTelemetry logger statter + . runTraceInTelemetry + . runReader taskSession + . runReader config + . Files.runFiles + run task + queueStat statter stat + pure result + +-- | Execute a 'TaskC' yielding its result value in 'IO' using all default options and configuration. +runTaskWithOptions :: Options -> TaskC a -> IO (Either SomeException a) +runTaskWithOptions options task = withOptions options $ \ config logger statter -> + runTask (TaskSession config "-" False logger statter) task + +-- | Yield config and telemetry queues for options. +withOptions :: Options -> (Config -> LogQueue -> StatQueue -> IO a) -> IO a +withOptions options with = do + config <- defaultConfig options + withTelemetry config (\ (TelemetryQueues logger statter _) -> with config logger statter) + +newtype TraceInTelemetryC m a = TraceInTelemetryC { runTraceInTelemetry :: m a } + deriving (Applicative, Functor, Monad, MonadFail, MonadIO) + +instance Has Telemetry sig m => Algebra (Trace :+: sig) (TraceInTelemetryC m) where + alg hdl sig ctx = case sig of + L (Trace str) -> ctx <$ writeLog Debug str [] + R other -> TraceInTelemetryC (alg (runTraceInTelemetry . hdl) other ctx) diff --git a/semantic/src/Semantic/Task/Files.hs b/semantic/src/Semantic/Task/Files.hs new file mode 100644 index 0000000000..d2b664ec1b --- /dev/null +++ b/semantic/src/Semantic/Task/Files.hs @@ -0,0 +1,102 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} + +module Semantic.Task.Files + ( Files + , Destination (..) + , Source (..) + , readBlob + , readBlobs + , readBlobPairs + , readProject + , findFiles + , write + , Handle (..) + , FilesC(..) + , FilesArg(..) + ) where + +import Analysis.File +import Analysis.Project +import Control.Algebra +import Control.Effect.Error +import Control.Exception +import Control.Monad.IO.Class +import Data.Blob +import Data.Blob.IO +import qualified Data.ByteString.Builder as B +import Data.Handle +import Prelude hiding (readFile) +import Semantic.IO +import Source.Language (Language) +import qualified System.IO as IO + +data Source blob where + FromPath :: File Language -> Source Blob + FromHandle :: Handle 'IO.ReadMode -> Source [Blob] + FromPathPair :: File Language -> File Language -> Source BlobPair + FromPairHandle :: Handle 'IO.ReadMode -> Source [BlobPair] + +data Destination = ToPath FilePath | ToHandle (Handle 'IO.WriteMode) + +-- | An effect to read/write 'Blob's from 'Handle's or 'FilePath's. +data Files (m :: * -> *) k where + Read :: Source a -> Files m a + ReadProject :: Maybe FilePath -> FilePath -> Language -> [FilePath] -> Files m Project + FindFiles :: FilePath -> [String] -> [FilePath] -> Files m [FilePath] + Write :: Destination -> B.Builder -> Files m () + + +newtype FilesC m a = FilesC + { -- | Run a 'Files' effect in 'IO' + runFiles :: m a + } + deriving (Functor, Applicative, Monad, MonadFail, MonadIO) + +instance (Has (Error SomeException) sig m, MonadFail m, MonadIO m) => Algebra (Files :+: sig) (FilesC m) where + alg hdl sig ctx = case sig of + L op -> (<$ ctx) <$> case op of + Read (FromPath path) -> readBlobFromFile' path + Read (FromHandle handle) -> readBlobsFromHandle handle + Read (FromPathPair p1 p2) -> readFilePair p1 p2 + Read (FromPairHandle handle) -> readBlobPairsFromHandle handle + ReadProject rootDir dir language excludeDirs -> readProjectFromPaths rootDir dir language excludeDirs + FindFiles dir exts excludeDirs -> findFilesInDir dir exts excludeDirs + Write (ToPath path) builder -> liftIO (IO.withBinaryFile path IO.WriteMode (`B.hPutBuilder` builder)) + Write (ToHandle (WriteHandle handle)) builder -> liftIO (B.hPutBuilder handle builder) + R other -> FilesC (alg (runFiles . hdl) other ctx) + +readBlob :: Has Files sig m => File Language -> m Blob +readBlob file = send (Read (FromPath file)) + +-- Various ways to read in files +data FilesArg + = FilesFromHandle (Handle 'IO.ReadMode) + | FilesFromPaths [File Language] + +-- | A task which reads a list of 'Blob's from a 'Handle' or a list of 'FilePath's optionally paired with 'Language's. +readBlobs :: Has Files sig m => FilesArg -> m [Blob] +readBlobs (FilesFromHandle handle) = send (Read (FromHandle handle)) +readBlobs (FilesFromPaths paths) = traverse (send . Read . FromPath) paths + +-- | A task which reads a list of pairs of 'Blob's from a 'Handle' or a list of pairs of 'FilePath's optionally paired with 'Language's. +readBlobPairs :: Has Files sig m => Either (Handle 'IO.ReadMode) [(File Language, File Language)] -> m [BlobPair] +readBlobPairs (Left handle) = send (Read (FromPairHandle handle)) +readBlobPairs (Right paths) = traverse (send . Read . uncurry FromPathPair) paths + +readProject :: Has Files sig m => Maybe FilePath -> FilePath -> Language -> [FilePath] -> m Project +readProject rootDir dir lang excludeDirs = send (ReadProject rootDir dir lang excludeDirs) + +findFiles :: Has Files sig m => FilePath -> [String] -> [FilePath] -> m [FilePath] +findFiles dir exts paths = send (FindFiles dir exts paths) + +-- | A task which writes a 'B.Builder' to a 'Handle' or a 'FilePath'. +write :: Has Files sig m => Destination -> B.Builder -> m () +write dest builder = send (Write dest builder) diff --git a/semantic/src/Semantic/Telemetry.hs b/semantic/src/Semantic/Telemetry.hs new file mode 100644 index 0000000000..02132b115a --- /dev/null +++ b/semantic/src/Semantic/Telemetry.hs @@ -0,0 +1,178 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} +module Semantic.Telemetry +( + -- Async telemetry interface + withLogger +, withErrorReporter +, withStatter +, LogQueue +, StatQueue +, ErrorQueue +, TelemetryQueues(..) +, queueLogMessage +, queueErrorReport +, queueStat + +-- Create stats +, Stat.increment +, Stat.decrement +, Stat.count +, Stat.gauge +, Stat.timing +, Stat.withTiming +, Stat.histogram +, Stat.set + +-- Statsd client +, statsClient +, StatsClient + +-- Error reporters +, nullErrorReporter + +-- Logging options and formatters +, Level(..) +, LogOptions(..) +, logfmtFormatter +, terminalFormatter +, LogFormatter + +-- Eff interface for telemetry +, writeLog +, writeStat +, time +, time' +, Telemetry(..) +, runTelemetry +, TelemetryC(..) +, ignoreTelemetry +, IgnoreTelemetryC(..) +) where + +import Control.Algebra +import Control.Carrier.Reader +import Control.Exception +import Control.Monad.IO.Class +import qualified Data.Time.Clock.POSIX as Time (getCurrentTime) +import qualified Data.Time.LocalTime as LocalTime +import Semantic.Telemetry.AsyncQueue +import Semantic.Telemetry.Error +import Semantic.Telemetry.Log +import Semantic.Telemetry.Stat as Stat + +type LogQueue = AsyncQueue Message LogOptions +type StatQueue = AsyncQueue Stat StatsClient +type ErrorQueue = AsyncQueue ErrorReport ErrorReporter + +data TelemetryQueues + = TelemetryQueues + { telemetryLogger :: LogQueue + , telemetryStatter :: StatQueue + , telemetryErrorReporter :: ErrorQueue + } + +-- | Execute an action in IO with access to a logger (async log queue). +withLogger :: LogOptions -- ^ Log options + -> Int -- ^ Max stats queue size before dropping stats + -> (LogQueue -> IO c) -- ^ Action in IO + -> IO c +withLogger options size = bracket setup closeAsyncQueue + where setup = newAsyncQueue size writeLogMessage options + +-- | Execute an action in IO with access to an error reporter (async error reporting queue). +withErrorReporter :: IO ErrorReporter -> Int -> (ErrorQueue -> IO c) -> IO c +withErrorReporter errorReporter size = bracket setup closeAsyncQueue + where setup = errorReporter >>= newAsyncQueue size ($) + +-- | Execute an action in IO with access to a statter (async stat queue). +-- Handles the bracketed setup and teardown of the underlying 'AsyncQueue' and +-- 'StatsClient'. +withStatter :: Host -- ^ Statsd host + -> Port -- ^ Statsd port + -> Namespace -- ^ Namespace prefix for stats + -> Int -- ^ Max stats queue size before dropping stats + -> (StatQueue -> IO c) -- ^ Action in IO + -> IO c +withStatter host port ns size = bracket setup teardown + where setup = statsClient host port ns >>= newAsyncQueue size sendStat + teardown statter = closeAsyncQueue statter >> Stat.closeStatClient (asyncQueueExtra statter) + +-- | Queue a message to be logged. +queueLogMessage :: MonadIO io => LogQueue -> Level -> String -> [(String, String)] -> io () +queueLogMessage q@AsyncQueue{..} level message pairs + | Just logLevel <- logOptionsLevel asyncQueueExtra + , level <= logLevel = liftIO Time.getCurrentTime >>= liftIO . LocalTime.utcToLocalZonedTime >>= liftIO . writeAsyncQueue q . Message level message pairs + | otherwise = pure () + +-- | Queue an error to be reported. +queueErrorReport :: MonadIO io => ErrorQueue -> SomeException -> [(String, String)] -> io () +queueErrorReport q message = liftIO . writeAsyncQueue q . ErrorReport message + +-- | Queue a stat to be sent to statsd. +queueStat :: MonadIO io => StatQueue -> Stat -> io () +queueStat q = liftIO . writeAsyncQueue q + + +-- Eff interface + +-- | A task which logs a message at a specific log level to stderr. +writeLog :: Has Telemetry sig m => Level -> String -> [(String, String)] -> m () +writeLog level message pairs = send (WriteLog level message pairs) + +-- | A task which writes a stat. +writeStat :: Has Telemetry sig m => Stat -> m () +writeStat stat = send (WriteStat stat) + +-- | A task which measures and stats the timing of another task. +time :: (Has Telemetry sig m, MonadIO m) => String -> [(String, String)] -> m output -> m output +time statName tags task = do + (a, stat) <- withTiming statName tags task + a <$ writeStat stat + +-- | A task which measures and returns the timing of another task. +time' :: MonadIO m => m output -> m (output, Double) +time' = withTiming' + +-- | Statting and logging effects. +data Telemetry (m :: * -> *) k where + WriteStat :: Stat -> Telemetry m () + WriteLog :: Level -> String -> [(String, String)] -> Telemetry m () + +-- | Run a 'Telemetry' effect by expecting a 'Reader' of 'Queue's to write stats and logs to. +runTelemetry :: LogQueue -> StatQueue -> TelemetryC m a -> m a +runTelemetry logger statter = runReader (logger, statter) . runTelemetryC + +newtype TelemetryC m a = TelemetryC { runTelemetryC :: ReaderC (LogQueue, StatQueue) m a } + deriving (Applicative, Functor, Monad, MonadFail, MonadIO) + +instance (Algebra sig m, MonadIO m) => Algebra (Telemetry :+: sig) (TelemetryC m) where + alg hdl sig ctx = case sig of + L op -> do + queues <- TelemetryC (ask @(LogQueue, StatQueue)) + case op of + WriteStat stat -> ctx <$ queueStat (snd queues) stat + WriteLog level message pairs -> ctx <$ queueLogMessage (fst queues) level message pairs + R other -> TelemetryC (alg (runTelemetryC . hdl) (R other) ctx) + +-- | Run a 'Telemetry' effect by ignoring statting/logging. +ignoreTelemetry :: IgnoreTelemetryC m a -> m a +ignoreTelemetry = runIgnoreTelemetryC + +newtype IgnoreTelemetryC m a = IgnoreTelemetryC { runIgnoreTelemetryC :: m a } + deriving (Applicative, Functor, Monad) + +instance Algebra sig m => Algebra (Telemetry :+: sig) (IgnoreTelemetryC m) where + alg hdl sig ctx = case sig of + L WriteStat{} -> pure ctx + L WriteLog{} -> pure ctx + R other -> IgnoreTelemetryC (alg (runIgnoreTelemetryC . hdl) other ctx) diff --git a/src/Semantic/Telemetry/AsyncQueue.hs b/semantic/src/Semantic/Telemetry/AsyncQueue.hs similarity index 98% rename from src/Semantic/Telemetry/AsyncQueue.hs rename to semantic/src/Semantic/Telemetry/AsyncQueue.hs index f484665cba..7292ef6536 100644 --- a/src/Semantic/Telemetry/AsyncQueue.hs +++ b/semantic/src/Semantic/Telemetry/AsyncQueue.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE RecordWildCards #-} module Semantic.Telemetry.AsyncQueue ( AsyncQueue(..) diff --git a/semantic/src/Semantic/Telemetry/Error.hs b/semantic/src/Semantic/Telemetry/Error.hs new file mode 100644 index 0000000000..5adc2e6e28 --- /dev/null +++ b/semantic/src/Semantic/Telemetry/Error.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE RecordWildCards #-} +module Semantic.Telemetry.Error + ( ErrorLogger + , ErrorReport (..) + , ErrorReporter + , nullErrorReporter + ) where + +import Control.Exception + +data ErrorReport + = ErrorReport + { errorReportException :: SomeException + , errorReportContext :: [(String, String)] + } deriving (Show) + +-- | Function to log if there are errors reporting an error. +type ErrorLogger = String -> [(String, String)] -> IO () + +type ErrorReporter = ErrorReport -> IO () + +-- | Doesn't send error reports anywhere. Useful in tests or for basic command-line usage. +nullErrorReporter :: ErrorLogger -> IO ErrorReporter +nullErrorReporter logger = pure reportError + where + reportError ErrorReport{..} = let + msg = takeWhile (/= '\n') (displayException errorReportException) + in logger msg errorReportContext diff --git a/src/Semantic/Telemetry/Log.hs b/semantic/src/Semantic/Telemetry/Log.hs similarity index 90% rename from src/Semantic/Telemetry/Log.hs rename to semantic/src/Semantic/Telemetry/Log.hs index 2510017daa..c6d8374007 100644 --- a/src/Semantic/Telemetry/Log.hs +++ b/semantic/src/Semantic/Telemetry/Log.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE RecordWildCards #-} module Semantic.Telemetry.Log ( Level (..) , LogOptions (..) @@ -8,12 +9,13 @@ module Semantic.Telemetry.Log , writeLogMessage ) where +import Control.Monad.IO.Class +import Data.Bifunctor import Data.Error (Colourize (..), withSGRCode) import Data.Flag as Flag import Data.List (intersperse) import qualified Data.Time.Format as Time import qualified Data.Time.LocalTime as LocalTime -import Prologue import System.Console.ANSI import System.IO import Text.Printf @@ -35,9 +37,9 @@ data Level -- | Options for controlling logging data LogOptions = LogOptions - { logOptionsLevel :: Maybe Level -- ^ What level of messages to log. 'Nothing' disabled logging. - , logOptionsFormatter :: LogFormatter -- ^ Log formatter to use. - , logOptionsContext :: [(String, String)] + { logOptionsLevel :: Maybe Level -- ^ What level of messages to log. 'Nothing' disabled logging. + , logOptionsFormatter :: LogFormatter -- ^ Log formatter to use. + , logOptionsContext :: [(String, String)] } -- | Write a log a message to stderr. diff --git a/src/Semantic/Telemetry/Stat.hs b/semantic/src/Semantic/Telemetry/Stat.hs similarity index 95% rename from src/Semantic/Telemetry/Stat.hs rename to semantic/src/Semantic/Telemetry/Stat.hs index d969e83028..12ba93752d 100644 --- a/src/Semantic/Telemetry/Stat.hs +++ b/semantic/src/Semantic/Telemetry/Stat.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE RecordWildCards #-} module Semantic.Telemetry.Stat ( -- Primary API for creating stats. @@ -27,16 +29,16 @@ module Semantic.Telemetry.Stat ) where +import Control.Monad +import Control.Monad.IO.Class import qualified Data.ByteString.Char8 as B import Data.List (intercalate) import Data.List.Split (splitOneOf) import qualified Data.Time.Clock as Time -import qualified Data.Time.Clock.POSIX as Time (getCurrentTime) import Network.Socket - (Socket (..), SocketType (..), addrAddress, addrFamily, close, connect, defaultProtocol, getAddrInfo, socket) + (Socket, SocketType (..), addrAddress, addrFamily, close, connect, defaultProtocol, getAddrInfo, socket) import Network.Socket.ByteString import Numeric -import Prologue import System.IO.Error -- | A named piece of data you wish to record a specific 'Metric' for. diff --git a/semantic/src/Semantic/Util.hs b/semantic/src/Semantic/Util.hs new file mode 100644 index 0000000000..adbb335b21 --- /dev/null +++ b/semantic/src/Semantic/Util.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +{-# OPTIONS_GHC -Wno-missing-signatures -Wno-missing-exported-signatures -Wno-partial-type-signatures -O0 #-} +module Semantic.Util + ( parseFile + , parseFileQuiet + ) where + +import Prelude hiding (readFile) + +import Analysis.File +import Analysis.Reference +import Control.Carrier.Parse.Simple +import Control.Effect.Reader +import Control.Exception hiding (evaluate) +import Control.Monad +import Parsing.Parser +import Semantic.Config +import Semantic.Task +import qualified Source.Language as Language +import Source.Span (Pos (..), point) +import System.Exit (die) + +parseFile, parseFileQuiet :: Parser term -> FilePath -> IO term +parseFile parser = runTask' . (parse parser <=< readBlob . fileForPath) +parseFileQuiet parser = runTaskQuiet . (parse parser <=< readBlob . fileForPath) + +fileForPath :: FilePath -> File Language.Language +fileForPath p = File (Reference p (point (Pos 1 1))) (Language.forPath p) + +runTask', runTaskQuiet :: ParseC TaskC a -> IO a +runTask' task = runTaskWithOptions debugOptions (asks configTreeSitterParseTimeout >>= \ timeout -> runParse timeout task) >>= either (die . displayException) pure +runTaskQuiet task = runTaskWithOptions defaultOptions (asks configTreeSitterParseTimeout >>= \ timeout -> runParse timeout task) >>= either (die . displayException) pure diff --git a/src/Semantic/Util/Pretty.hs b/semantic/src/Semantic/Util/Pretty.hs similarity index 100% rename from src/Semantic/Util/Pretty.hs rename to semantic/src/Semantic/Util/Pretty.hs diff --git a/semantic/src/Semantic/Version.hs b/semantic/src/Semantic/Version.hs new file mode 100644 index 0000000000..204da7caae --- /dev/null +++ b/semantic/src/Semantic/Version.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE CPP #-} +module Semantic.Version + ( buildSHA + , buildVersion + ) where + + +#if !BAZEL_BUILD +import Data.Version (showVersion) +import Paths_semantic (version) +#endif + +-- The version string of this build of semantic. +buildVersion :: String +#if BAZEL_BUILD +buildVersion = "0.11.0.0" +#else +buildVersion = showVersion version +#endif + +-- The SHA1 hash of this build of semantic. +-- If compiled as a development build, this will be @@. +buildSHA :: String +buildSHA = "" diff --git a/semantic/src/Serializing/Format.hs b/semantic/src/Serializing/Format.hs new file mode 100644 index 0000000000..5d57e3e9f7 --- /dev/null +++ b/semantic/src/Serializing/Format.hs @@ -0,0 +1,40 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE OverloadedStrings #-} + +module Serializing.Format + ( Format (..), + FormatStyle (..), + Builder, + runSerialize, + ) +where + +import AST.Marshal.JSON +import Algebra.Graph.Export.Dot +import Algebra.Graph.ToGraph +import Data.Aeson (ToJSON (..), fromEncoding) +import Data.ByteString.Builder +import Data.ProtoLens.Encoding as Proto +import Data.ProtoLens.Message (Message) +import Language.Haskell.HsColour +import Language.Haskell.HsColour.Colourise +import Source.Loc +import Text.Show.Pretty + +data Format input where + DOT :: (Ord vertex, ToGraph graph, ToVertex graph ~ vertex) => Style vertex Builder -> Format graph + JSON :: ToJSON input => Format input + Marshal :: MarshalJSON input => Format (input Loc) + Show :: Show input => Format input + Proto :: Message input => Format input + +data FormatStyle = Colourful | Plain + +runSerialize :: FormatStyle -> Format input -> input -> Builder +runSerialize _ (DOT style) = export style +runSerialize _ JSON = (<> "\n") . fromEncoding . toEncoding +runSerialize _ Marshal = fromEncoding . toEncoding . marshal +runSerialize Colourful Show = (<> "\n") . stringUtf8 . hscolour TTY defaultColourPrefs False False "" False . ppShow +runSerialize Plain Show = (<> "\n") . stringUtf8 . show +runSerialize _ Proto = Proto.buildMessage diff --git a/semantic/src/Serializing/SExpression/Precise.hs b/semantic/src/Serializing/SExpression/Precise.hs new file mode 100644 index 0000000000..44d983bdbc --- /dev/null +++ b/semantic/src/Serializing/SExpression/Precise.hs @@ -0,0 +1,82 @@ +{-# LANGUAGE AllowAmbiguousTypes, DataKinds, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings, ScopedTypeVariables, TypeApplications, TypeFamilies, TypeOperators, UndecidableInstances #-} +module Serializing.SExpression.Precise +( serializeSExpression +, ToSExpression(..) +) where + +import Data.ByteString.Builder +import Data.Foldable (fold) +import Data.List (intersperse) +import GHC.Generics + +serializeSExpression :: ToSExpression t => t ann -> Builder +serializeSExpression t = toSExpression t 0 <> "\n" + + +nl :: Int -> Builder +nl n | n <= 0 = "" + | otherwise = "\n" + +pad :: Int -> Builder +pad n = stringUtf8 (replicate (2 * n) ' ') + + +class ToSExpression (t :: * -> *) where + toSExpression :: t ann -> Int -> Builder + +instance (ToSExpressionBy strategy t, strategy ~ ToSExpressionStrategy t) => ToSExpression t where + toSExpression = toSExpression' @strategy + + +data Strategy = Generic | Custom + +type family ToSExpressionStrategy (t :: * -> *) :: Strategy where + ToSExpressionStrategy (_ :+: _) = 'Custom + ToSExpressionStrategy _ = 'Generic + +class ToSExpressionBy (strategy :: Strategy) t where + toSExpression' :: t ann -> Int -> Builder + +instance (ToSExpression l, ToSExpression r) => ToSExpressionBy 'Custom (l :+: r) where + toSExpression' (L1 l) = toSExpression l + toSExpression' (R1 r) = toSExpression r + +instance (Generic1 t, GToSExpression (Rep1 t)) => ToSExpressionBy 'Generic t where + toSExpression' t n = nl n <> pad n <> "(" <> fold (intersperse " " (gtoSExpression (from1 t) n)) <> ")" + + +class GToSExpression f where + gtoSExpression :: f ann -> Int -> [Builder] + +instance GToSExpression f => GToSExpression (M1 D d f) where + gtoSExpression = gtoSExpression . unM1 + +instance (GToSExpression f, GToSExpression g) => GToSExpression (f :+: g) where + gtoSExpression (L1 l) = gtoSExpression l + gtoSExpression (R1 r) = gtoSExpression r + +instance (Constructor c, GToSExpression f) => GToSExpression (M1 C c f) where + gtoSExpression m n = stringUtf8 (conName m) : gtoSExpression (unM1 m) (n + 1) + +instance (GToSExpression f, GToSExpression g) => GToSExpression (f :*: g) where + gtoSExpression (l :*: r) = gtoSExpression l <> gtoSExpression r + +instance GToSExpression U1 where + gtoSExpression _ _ = [] + +instance GToSExpression f => GToSExpression (M1 S s f) where + gtoSExpression = gtoSExpression . unM1 -- FIXME: show the selector name, if any + +instance Show k => GToSExpression (K1 R k) where + gtoSExpression k _ = [stringUtf8 (show (unK1 k))] + +instance GToSExpression Par1 where + gtoSExpression _ _ = [] + +instance ToSExpression t => GToSExpression (Rec1 t) where + gtoSExpression (Rec1 t) = pure . toSExpression t + +instance (Foldable f, GToSExpression g) => GToSExpression (f :.: g) where + gtoSExpression (Comp1 fs) n + | null fs = mempty + | otherwise = foldMap gtoSExpression fs n diff --git a/semantic/test/Data/Graph/Spec.hs b/semantic/test/Data/Graph/Spec.hs new file mode 100644 index 0000000000..950b1d8830 --- /dev/null +++ b/semantic/test/Data/Graph/Spec.hs @@ -0,0 +1,18 @@ +module Data.Graph.Spec (spec) where + +import SpecHelpers + +import Data.Graph.Algebraic +import qualified Algebra.Graph.Class as Class + +spec :: Spec +spec = describe "Data.Graph" $ + it "has a valid topological sort" $ do + let topo = topologicalSort + topo (Class.path "ab") `shouldBe` "ba" + topo (Class.path "abc") `shouldBe` "cba" + topo ((vertex 'a' `connect` vertex 'b') `connect` vertex 'c') `shouldBe` "cba" + topo (vertex 'a' `connect` (vertex 'b' `connect` vertex 'c')) `shouldBe` "cba" + topo ((vertex 'a' `connect` vertex 'b') <> (vertex 'a' `connect` vertex 'c')) `shouldBe` "cba" + topo (Class.path "abd" <> Class.path "acd") `shouldBe` "dcba" + topo (Class.path "aba") `shouldBe` "ab" diff --git a/semantic/test/Data/Language/Spec.hs b/semantic/test/Data/Language/Spec.hs new file mode 100644 index 0000000000..6d24c5bc20 --- /dev/null +++ b/semantic/test/Data/Language/Spec.hs @@ -0,0 +1,13 @@ +module Data.Language.Spec (testTree) where + +import Source.Language as Language +import Test.Tasty +import Test.Tasty.HUnit + +testTree :: TestTree +testTree = testGroup "Data.Language" + [ testCase "languageForFilePath works for languages with ambiguous lingo extensions" $ do + Language.forPath "foo.php" @=? PHP + Language.forPath "foo.md" @=? Markdown + Language.forPath "foo.tsx" @=? TSX + ] diff --git a/semantic/test/Data/Semigroup/App/Spec.hs b/semantic/test/Data/Semigroup/App/Spec.hs new file mode 100644 index 0000000000..2005f5d8f7 --- /dev/null +++ b/semantic/test/Data/Semigroup/App/Spec.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE OverloadedStrings #-} +module Data.Semigroup.App.Spec (testTree) where + +import Data.Semigroup.App +import Hedgehog +import qualified Hedgehog.Gen as Gen +import qualified Hedgehog.Range as Range +import Properties +import qualified Test.Tasty as Tasty +import qualified Test.Tasty.Hedgehog as Tasty + +app :: MonadGen m => m (App Maybe Integer) +app = App <$> Gen.maybe (Gen.integral (Range.linear 0 10000)) + +merge :: MonadGen m => m (AppMerge Maybe String) +merge = AppMerge <$> Gen.maybe (Gen.string (Range.linear 0 10) Gen.ascii) + +testTree :: Tasty.TestTree +testTree = Tasty.testGroup "Data.Semigroup.App" + [ Tasty.testGroup "App" + [ Tasty.testPropertyNamed "is associative" "App_is_associative" (associative (<>) app) + ] + , Tasty.testGroup "AppMerge" + [ Tasty.testPropertyNamed "is associative" "AppMerge_is_associative" (associative (<>) merge) + , Tasty.testPropertyNamed "is monoidal" "AppMerge_is_monoidal" (monoidal merge) + ] + ] diff --git a/semantic/test/Examples.hs b/semantic/test/Examples.hs new file mode 100644 index 0000000000..f2c30bb97a --- /dev/null +++ b/semantic/test/Examples.hs @@ -0,0 +1,188 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} + +{-# OPTIONS_GHC -O1 #-} +{-# OPTIONS_GHC -Wno-unused-top-binds -Wno-unused-imports #-} +module Main (main) where + +import qualified Analysis.File as File +import Control.Carrier.Parse.Measured +import Control.Carrier.Reader +import Control.Concurrent.Async (forConcurrently) +import Control.Exception (displayException) +import Control.Lens +import Control.Monad +import Data.Blob +import Data.Flag +import Data.Foldable +import Data.Int +import qualified Data.Text as Text +import Data.Traversable +import Proto.Semantic as P hiding (Blob) +import Proto.Semantic_Fields as P +import Semantic.Api.Symbols (parseSymbols) +import Semantic.Config as Config +import Semantic.Task +import Semantic.Task.Files +import System.FilePath +import System.FilePath.Glob +import qualified System.Path.Fixture as Fixture +import qualified System.Process as Process +import qualified Test.Tasty as Tasty +import qualified Test.Tasty.HUnit as HUnit + +data LanguageExample = + LanguageExample + { languageName :: String + , languageExtension :: String + , languageSkips :: [FilePath] + , languageDirSkips :: [FilePath] + } + deriving (Eq, Show) + +le :: String -> String -> [FilePath] -> [FilePath] -> LanguageExample +le = LanguageExample + +examples :: [LanguageExample] +examples = + [ le "go" "**/*.go" goFileSkips goDirSkips + , le "python" "**/*.py" pythonFileSkips mempty + , le "ruby" "**/*.rb" rubySkips mempty + , le "typescript" "**/*.[jt]s" typescriptSkips mempty + -- , le "typescript" "**/*.[jt]sx" tsxSkips mempty + ] + +goFileSkips :: [FilePath] +goFileSkips = + [ + -- Super slow + "go/src/vendor/golang_org/x/text/unicode/norm/tables.go" + , "go/src/vendor/golang_org/x/text/unicode/bidi/tables.go" + , "go/src/vendor/golang_org/x/net/idna/tables.go" + , "go/src/cmd/vendor/golang.org/x/arch/x86/x86asm/tables.go" + , "moby/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go" + , "moby/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go" + + -- Parser timeouts + , "moby/vendor/github.com/ugorji/go/codec/fast-path.generated.go" + + -- Parse errors + , "go/src/math/big/arith.go" -- Unhandled identifier character: 'ŝ' + , "go/src/cmd/go/testdata/src/badpkg/x.go" + , "go/src/cmd/go/testdata/src/notest/hello.go" + , "go/src/cmd/vet/testdata/deadcode.go" + , "go/src/cmd/vet/testdata/testingpkg/tests_test.go" + , "moby/vendor/github.com/beorn7/perks/quantile/stream.go" -- Unhandled identifier character: 'Ζ’' + + ] + +goDirSkips :: [FilePath] +goDirSkips = + [ "go/src/cmd/compile/internal/ssa" + , "go/test/fixedbugs" + , "go/test/syntax" + , "go/test/method4.dir" + , "go/test" + ] + +pythonFileSkips :: [FilePath] +pythonFileSkips = [] + +rubySkips :: [FilePath] +rubySkips = + [ + -- Doesn't parse b/c of issue with r< TaskSession -> LanguageExample -> FilePath -> IO Tasty.TestTree +buildExamples session lang tsDir = do + let fileSkips = fmap (tsDir ) (languageSkips lang) + dirSkips = fmap (tsDir ) (languageDirSkips lang) + + files <- globDir1 (compile (languageExtension lang)) tsDir + when (null files) + (fail ("Nothing in dir " <> tsDir)) + + let paths = filter (\x -> takeDirectory x `notElem` dirSkips) . filter (`notElem` fileSkips) $ files + trees <- for paths $ \file -> do + pure . HUnit.testCase file $ do + precise <- runTask session (runParse (parseSymbolsFilePath file)) + assertOK "precise" precise + pure (Tasty.testGroup (languageName lang) trees) + + where + assertOK msg = either (\e -> HUnit.assertFailure (msg <> " failed to parse" <> show e)) (refuteErrors msg) + refuteErrors msg a = case toList (a^.files) of + [x] | (e:_) <- toList (x^.errors) -> HUnit.assertFailure (msg <> " parse errors " <> show e) + _ -> pure () + +data SortableSymbol = SortableSymbol Text.Text Int32 Int32 Int32 Int32 + deriving (Eq, Show, Ord) + + +testOptions :: Config.Options +testOptions = defaultOptions + { optionsFailOnWarning = flag FailOnWarning True + , optionsLogLevel = Nothing + } + +main :: IO () +-- main = putStrLn "nothing" +main = withOptions testOptions $ \ config logger statter -> do + -- void $ Process.system "script/clone-example-repos" + +#if BAZEL_BUILD + rf <- Fixture.create + let ?runfiles = rf + let ?project = FilePath "semantic" +#endif + + let session = TaskSession config "-" False logger statter + + allTests <- forConcurrently examples $ \lang -> do + let tsDir = Fixture.absRelDir ".." + buildExamples session lang tsDir + + Tasty.defaultMain $ Tasty.testGroup "parse-examples" allTests + +parseSymbolsFilePath :: + ( Has (Error SomeException) sig m + , Has Parse sig m + , Has Files sig m + ) + => FilePath + -> m ParseTreeSymbolResponse +parseSymbolsFilePath path = readBlob (File.fromPath path) >>= parseSymbols . pure @[] diff --git a/semantic/test/Generators.hs b/semantic/test/Generators.hs new file mode 100644 index 0000000000..fc023af5a6 --- /dev/null +++ b/semantic/test/Generators.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE OverloadedStrings #-} +module Generators + ( source + ) where + +import Hedgehog +import qualified Hedgehog.Gen as Gen +import qualified Source.Source + +source :: MonadGen m => Hedgehog.Range Int -> m Source.Source.Source +source r = Gen.frequency [ (1, empty), (20, nonEmpty) ] + where empty = pure mempty + nonEmpty = Source.Source.fromUTF8 <$> Gen.utf8 r (Gen.frequency [ (1, pure '\r'), (1, pure '\n'), (20, Gen.unicode) ]) diff --git a/semantic/test/Integration/Spec.hs b/semantic/test/Integration/Spec.hs new file mode 100644 index 0000000000..cdda5abdda --- /dev/null +++ b/semantic/test/Integration/Spec.hs @@ -0,0 +1,85 @@ +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE LambdaCase #-} +module Integration.Spec (testTree) where + +import Control.Exception (throw) +import qualified Data.ByteString.Lazy as BL +import Data.Foldable (find) +import Data.List (transpose, union) +import SpecHelpers +import System.FilePath +import System.FilePath.Glob +import System.IO.Unsafe +import Test.Tasty +import Test.Tasty.Golden + +languages :: [FilePath] +languages = ["go", "javascript", "json", "python", "ruby", "typescript", "tsx"] + +testTree :: (?session :: TaskSession) => TestTree +testTree = testGroup "Integration (golden tests)" $ fmap testsForLanguage languages + +testsForLanguage :: (?session :: TaskSession) => FilePath -> TestTree +testsForLanguage language = do + let dir = "test/fixtures" language "corpus" + let items = unsafePerformIO (examples dir) + localOption (mkTimeout 3000000) $ testGroup language $ fmap testForExample items +{-# NOINLINE testsForLanguage #-} + +data Example = ParseExample FilePath FilePath + deriving (Eq, Show) + +testForExample :: (?session :: TaskSession) => Example -> TestTree +testForExample (ParseExample file parseOutput) = + goldenVsStringDiff + ("parses " <> parseOutput) + (\ref new -> ["git", "diff", ref, new]) + parseOutput + (parseFilePath ?session file >>= either throw (pure . BL.fromStrict)) + + +-- | Return all the examples from the given directory. Examples are expected to +-- | have the form: +-- | +-- | example-name.A.rb - The left hand side of the diff. +-- | example-name.B.rb - The right hand side of the diff. +-- | +-- | example-name.diffA-B.txt - The expected sexpression diff output for A -> B. +-- | example-name.diffB-A.txt - The expected sexpression diff output for B -> A. +-- | +-- | example-name.parseA.txt - The expected sexpression parse tree for example-name.A.rb +-- | example-name.parseB.txt - The expected sexpression parse tree for example-name.B.rb +examples :: FilePath -> IO [Example] +examples directory = do + as <- globFor "*.A.*" + bs <- globFor "*.B.*" + sExpAs <- globFor "*.parseA.txt" + sExpBs <- globFor "*.parseB.txt" + + let exampleParse files out name = ParseExample (lookupNormalized name files) out + + let keys = (normalizeName <$> as) `union` (normalizeName <$> bs) + pure $ merge [ getExamples (exampleParse as) sExpAs keys + , getExamples (exampleParse bs) sExpBs keys ] + where + merge = concat . transpose + -- Only returns examples if they exist + getExamples f list = foldr (go f list) [] + where go f list name acc = case lookupNormalized' name list of + Just out -> f out name : acc + Nothing -> acc + + lookupNormalized :: FilePath -> [FilePath] -> FilePath + lookupNormalized name xs = fromMaybe + (error ("cannot find " <> name <> " make sure .A, .B and exist.")) + (lookupNormalized' name xs) + + lookupNormalized' :: FilePath -> [FilePath] -> Maybe FilePath + lookupNormalized' name = find ((== name) . normalizeName) + + globFor :: String -> IO [FilePath] + globFor p = globDir1 (compile p) directory + +-- | Given a test name like "foo.A.js", return "foo". +normalizeName :: FilePath -> FilePath +normalizeName = dropExtension . dropExtension diff --git a/semantic/test/Properties.hs b/semantic/test/Properties.hs new file mode 100644 index 0000000000..15b492e253 --- /dev/null +++ b/semantic/test/Properties.hs @@ -0,0 +1,24 @@ +-- | Defines useful Hedgehog checkers based around the properties of +-- standard typeclasses (associativity, reflexivity, etc.) This module +-- is similar to the hedgehog-checkers package on Hackage, but said +-- package doesn't work with hedgehog-1.0, so we reproduce these +-- (largely-trivial) functions here. + +module Properties + ( associative + , monoidal + ) where + +import GHC.Stack +import Hedgehog + +associative :: (Eq a, Show a) => (a -> a -> a) -> Gen a -> Property +associative fn gen = property $ withFrozenCallStack $ do + (a, b, c) <- forAll ((,,) <$> gen <*> gen <*> gen) + fn a (fn b c) === fn (fn a b) c + +monoidal :: (Eq a, Show a, Monoid a) => Gen a -> Property +monoidal gen = property $ withFrozenCallStack $ do + it <- forAll gen + mempty <> it === it + it <> mempty === it diff --git a/semantic/test/Semantic/CLI/Spec.hs b/semantic/test/Semantic/CLI/Spec.hs new file mode 100644 index 0000000000..b320de6ae1 --- /dev/null +++ b/semantic/test/Semantic/CLI/Spec.hs @@ -0,0 +1,63 @@ +{-# OPTIONS_GHC -Wno-unused-imports #-} + +module Semantic.CLI.Spec (testTree) where + +import Analysis.File +import Analysis.Reference +import Control.Carrier.Parse.Simple +import Control.Carrier.Reader +import Control.Exception +import Data.ByteString.Builder +import Semantic.Api hiding (Blob, File) +import Semantic.Task +import Serializing.Format +import Source.Language +import SpecHelpers +import System.Directory +import System.FilePath +import System.IO.Unsafe +import qualified System.Path.Fixture as Fixture +import Test.Tasty +import Test.Tasty.Golden + +testTree :: TestTree +testTree = testGroup "Semantic.CLI" + [ testGroup "parseTermBuilder" $ fmap testForParseFixture parseFixtures + ] + +-- We provide this function to the golden tests so as to have better +-- output when diffing JSON outputs. If you're investigating these +-- tests and find this output hard to read, install the `jd` CLI tool +-- (https://github.com/josephburnett/jd), which will print a detailed +-- summary of the differences between these JSON files. +renderDiff :: String -> String -> [String] +renderDiff ref new = unsafePerformIO $ do + let check p = do + exists <- doesFileExist p + unless exists (throwIO (userError ("Can't find path " <> p))) + + check ref + check new + useJD <- (takeExtension ref == ".json" &&) <$> fmap isJust (findExecutable "jd") + pure $ if useJD + then ["jd", "-set", ref, new] + else ["diff", ref, new] +{-# NOINLINE renderDiff #-} + + +testForParseFixture :: (String, [Blob] -> ParseC TaskC Builder, [File Language], FilePath) -> TestTree +testForParseFixture (format, runParse, files, expected) = + goldenVsStringDiff + ("parse fixture renders to " <> format) + renderDiff + expected + (fmap toLazyByteString . runTaskOrDie $ readBlobs (FilesFromPaths files) >>= runParse) + +parseFixtures :: [(String, [Blob] -> ParseC TaskC Builder, [File Language], FilePath)] +parseFixtures = + [ ("s-expression", parseTermBuilder TermSExpression, path, "semantic/test/fixtures/ruby/corpus/and-or.parseA.txt") + , ("symbols", parseSymbolsBuilder Serializing.Format.JSON, path'', "semantic/test/fixtures/cli/parse-tree.symbols.json") + , ("protobuf symbols", parseSymbolsBuilder Serializing.Format.Proto, path'', "semantic/test/fixtures/cli/parse-tree.symbols.protobuf.bin") + ] + where path = [File (Reference "semantic/test/fixtures/ruby/corpus/and-or.A.rb" lowerBound) Ruby] + path'' = [File (Reference "semantic/test/fixtures/ruby/corpus/method-declaration.A.rb" lowerBound) Ruby] diff --git a/semantic/test/Semantic/IO/Spec.hs b/semantic/test/Semantic/IO/Spec.hs new file mode 100644 index 0000000000..2be5b13092 --- /dev/null +++ b/semantic/test/Semantic/IO/Spec.hs @@ -0,0 +1,97 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE OverloadedStrings #-} +{-# OPTIONS_GHC -Wno-unused-imports #-} +{-# OPTIONS_GHC -Wno-redundant-constraints #-} + +module Semantic.IO.Spec (spec) where + +import Prelude hiding (readFile) + +import Analysis.File as File +import Analysis.Reference as Ref +import Data.Blob as Blob +import Data.Handle +import SpecHelpers +import qualified System.Path.Fixture as Fixture + +spec :: Fixture.HasFixture => Spec +spec = do +#if BAZEL_BUILD + rf <- runIO Fixture.create + let ?project = "semantic" + ?runfiles = rf +#endif + let blobsFromFilePath path = do + h <- openFileForReading (Fixture.absRelFile path) + blobs <- readBlobPairsFromHandle h + pure blobs + describe "readFile" $ do + + it "returns a blob for extant files" $ do + let path = Fixture.absRelFile "test/fixtures/cli/diff.json" + Just blob <- readBlobFromFile (File (Reference path lowerBound) Unknown) + blobFilePath blob `shouldBe` path + + it "throws for absent files" $ do + readBlobFromFile (File (Reference "/dev/doesnotexist" lowerBound) Unknown) `shouldThrow` anyIOException + + describe "readBlobPairsFromHandle" $ do + let a = Blob.fromSource "method.rb" Ruby "def foo; end" + let b = Blob.fromSource "method.rb" Ruby "def bar(x); end" + it "returns blobs for valid JSON encoded diff input" $ do + blobs <- blobsFromFilePath "test/fixtures/cli/diff.json" + blobs `shouldBe` [Compare a b] + + it "returns blobs when there's no before" $ do + blobs <- blobsFromFilePath "test/fixtures/cli/diff-no-before.json" + blobs `shouldBe` [Insert b] + + it "returns blobs when there's null before" $ do + blobs <- blobsFromFilePath "test/fixtures/cli/diff-null-before.json" + blobs `shouldBe` [Insert b] + + it "returns blobs when there's no after" $ do + blobs <- blobsFromFilePath "test/fixtures/cli/diff-no-after.json" + blobs `shouldBe` [Delete a] + + it "returns blobs when there's null after" $ do + blobs <- blobsFromFilePath "test/fixtures/cli/diff-null-after.json" + blobs `shouldBe` [Delete a] + + + it "returns blobs for unsupported language" $ do + h <- openFileForReading (Fixture.absRelFile "test/fixtures/cli/diff-unsupported-language.json") + blobs <- readBlobPairsFromHandle h + let b' = Blob.fromSource "test.kt" Unknown "fun main(args: Array) {\nprintln(\"hi\")\n}\n" + blobs `shouldBe` [Insert b'] + + it "detects language based on filepath for empty language" $ do + blobs <- blobsFromFilePath "test/fixtures/cli/diff-empty-language.json" + blobs `shouldBe` [Compare a b] + + it "throws on blank input" $ do + h <- openFileForReading (Fixture.absRelFile "test/fixtures/cli/blank.json") + readBlobPairsFromHandle h `shouldThrow` jsonException + + it "throws if language field not given" $ do + h <- openFileForReading (Fixture.absRelFile "test/fixtures/cli/diff-no-language.json") + readBlobsFromHandle h `shouldThrow` jsonException + + it "throws if null on before and after" $ do + h <- openFileForReading (Fixture.absRelFile "test/fixtures/cli/diff-null-both-sides.json") + readBlobPairsFromHandle h `shouldThrow` jsonException + + describe "readBlobsFromHandle" $ do + it "returns blobs for valid JSON encoded parse input" $ do + h <- openFileForReading (Fixture.absRelFile "test/fixtures/cli/parse.json") + blobs <- readBlobsFromHandle h + let a = Blob.fromSource "method.rb" Ruby "def foo; end" + blobs `shouldBe` [a] + + it "throws on blank input" $ do + h <- openFileForReading (Fixture.absRelFile "test/fixtures/cli/blank.json") + readBlobsFromHandle h `shouldThrow` jsonException + +jsonException :: Selector InvalidJSONException +jsonException = const True diff --git a/semantic/test/Semantic/Spec.hs b/semantic/test/Semantic/Spec.hs new file mode 100644 index 0000000000..a5b35341f9 --- /dev/null +++ b/semantic/test/Semantic/Spec.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE OverloadedStrings #-} +module Semantic.Spec (spec) where + +import Analysis.File +import Control.Exception (fromException) +import qualified Data.Blob as Blob +import SpecHelpers + +import Semantic.Api hiding (Blob) + + -- we need some lenses here, oof +setBlobLanguage :: Language -> Blob -> Blob +setBlobLanguage lang b = b { blobFile = (blobFile b) { fileBody = lang }} + +spec :: Spec +spec = do + describe "parseBlob" $ do + let methodsBlob = Blob.fromSource "methods.rb" Ruby "def foo\nend\n" + + it "throws if given an unknown language for sexpression output" $ do + res <- runTaskWithOptions defaultOptions (runParseWithConfig (parseTermBuilder TermSExpression [setBlobLanguage Unknown methodsBlob])) + case res of + Left exc -> fromException exc `shouldBe` Just (NoLanguageForBlob "methods.rb") + Right _bad -> fail "Expected parseTermBuilder to fail for an unknown language" + + it "renders with the specified renderer" $ do + output <- fmap runBuilder . runTaskOrDie $ parseTermBuilder TermSExpression [methodsBlob] + output `shouldBe` "(Program \n (Statement \n (Arg \n (Primary \n (Method \n (MethodName \n (Identifier \"foo\")))))))\n" diff --git a/semantic/test/Semantic/Stat/Spec.hs b/semantic/test/Semantic/Stat/Spec.hs new file mode 100644 index 0000000000..36f801e95f --- /dev/null +++ b/semantic/test/Semantic/Stat/Spec.hs @@ -0,0 +1,104 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} + +module Semantic.Stat.Spec (testTree) where + +import Control.Exception +import Network.Socket (Family (..), Socket, SocketType (..), close, defaultProtocol, socketPair) +import Network.Socket.ByteString +import Semantic.Config +import Semantic.Telemetry.Stat +import System.Environment + +import Test.Tasty +import Test.Tasty.HUnit + +withSocketPair :: ((Socket, Socket) -> IO c) -> IO c +withSocketPair = bracket create release + where create = socketPair AF_UNIX Datagram defaultProtocol + release (client, server) = close client >> close server + +withEnvironment :: String -> String -> IO () -> IO () +withEnvironment key value = bracket_ (setEnv key value) (unsetEnv key) + +-- NOTE: These cannot easily run in parallel because we test things like +-- setting/unsetting the environment. +testTree :: TestTree +testTree = testCaseSteps "Semantic.Stat.Spec" $ \step -> do + step "Sets appropriate defaults" + case_sets_appropriate_defaults + step "Takes stats addr from environment" + case_takes_stats_addr_from_environment + step "Handles stats addr with just hostname" + case_handles_stats_addr_with_just_hostname + step "takes dogstats host from environment" + case_takes_dogstats_host_from_environment + step "rendering" + case_render_counters *> case_render_tags + step "stats deliver datagram" + case_sendstat_delivers_datagram + + +case_sets_appropriate_defaults :: Assertion +case_sets_appropriate_defaults = do + StatsClient{..} <- defaultStatsClient + statsClientNamespace @?= "semantic" + statsClientUDPHost @?= "127.0.0.1" + statsClientUDPPort @?= "28125" + +case_takes_stats_addr_from_environment :: Assertion +case_takes_stats_addr_from_environment = + withEnvironment "STATS_ADDR" "localhost:8125" $ do + StatsClient{..} <- defaultStatsClient + statsClientUDPHost @?= "localhost" + statsClientUDPPort @?= "8125" + +case_handles_stats_addr_with_just_hostname :: Assertion +case_handles_stats_addr_with_just_hostname = + withEnvironment "STATS_ADDR" "localhost" $ do + StatsClient{..} <- defaultStatsClient + statsClientUDPHost @?= "localhost" + statsClientUDPPort @?= "28125" + +case_takes_dogstats_host_from_environment :: Assertion +case_takes_dogstats_host_from_environment = + withEnvironment "DOGSTATSD_HOST" "0.0.0.0" $ do + StatsClient{..} <- defaultStatsClient + statsClientUDPHost @?= "0.0.0.0" + statsClientUDPPort @?= "28125" + +key :: String +key = "app.metric" + +case_render_counters :: Assertion +case_render_counters = do + renderDatagram "" (increment key []) @?= "app.metric:1|c" + renderDatagram "" (decrement key []) @?= "app.metric:-1|c" + renderDatagram "" (count key 8 []) @?= "app.metric:8|c" + renderDatagram "pre" (increment key []) @?= "pre.app.metric:1|c" + +case_render_tags :: Assertion +case_render_tags = do + let incTag = increment key [("key", "value")] + renderDatagram "" incTag @?= "app.metric:1|c|#key:value" + + let tagWithoutValue = increment key [("a", "")] + renderDatagram "" tagWithoutValue @?= "app.metric:1|c|#a" + + let tags = increment key [("key", "value"), ("a", "true")] + renderDatagram "" tags @?= "app.metric:1|c|#key:value,a:true" + + let tagsWithoutValue = increment key [("key", "value"), ("a", "")] + renderDatagram "" tagsWithoutValue @?= "app.metric:1|c|#key:value,a" + +case_sendstat_delivers_datagram :: Assertion +case_sendstat_delivers_datagram = do + client <- defaultStatsClient + withSocketPair $ \(clientSoc, serverSoc) -> do + sendStat client { statsClientUDPSocket = clientSoc } (increment "app.metric" []) + info <- recv serverSoc 1024 + info @?= "semantic.app.metric:1|c" + +-- Defaults are all driven by defaultConfig. +defaultStatsClient :: IO StatsClient +defaultStatsClient = defaultConfig defaultOptions >>= \Config{..} -> statsClient configStatsHost configStatsPort configAppName diff --git a/semantic/test/Spec.hs b/semantic/test/Spec.hs new file mode 100644 index 0000000000..89b3c558be --- /dev/null +++ b/semantic/test/Spec.hs @@ -0,0 +1,62 @@ +{-# LANGUAGE ImplicitParams #-} +{-# OPTIONS_GHC -Wno-redundant-constraints #-} + +module Main (allTests, legacySpecs, main, tests) where + +import qualified Data.Graph.Spec +import qualified Data.Language.Spec +import qualified Data.Semigroup.App.Spec +import qualified Integration.Spec +import qualified Semantic.CLI.Spec +import Semantic.Config (defaultOptions, optionsLogLevel) +import qualified Semantic.IO.Spec +import qualified Semantic.Spec +import qualified Semantic.Stat.Spec +import Semantic.Task (TaskSession (..), withOptions) +import qualified System.Path.Fixture as Fixture +import qualified Tags.Spec +import Test.Hspec +import Test.Tasty as Tasty +import Test.Tasty.Hspec as Tasty + +tests :: (?session :: TaskSession, Fixture.HasFixture) => [TestTree] +tests = + [ Data.Language.Spec.testTree + , Data.Semigroup.App.Spec.testTree + , Integration.Spec.testTree + , Semantic.CLI.Spec.testTree + , Semantic.Stat.Spec.testTree + ] + +-- We can't bring this out of the IO monad until we divest +-- from hspec, since testSpec operates in IO. +allTests :: (?session :: TaskSession, Fixture.HasFixture) => IO TestTree +allTests = do + asTastySpecs <- Tasty.testSpecs legacySpecs + let allSpecs = tests <> asTastySpecs + pure (testGroup "semantic" allSpecs) + +-- If you're writing new test modules, please don't add to this +-- stanza: it is only there to prevent massive rewrites, and is +-- converted into a Tasty TestTree in 'main'. (Quoth the tasty-hspec +-- documentation: "hspec and tasty serve similar purposes; consider +-- using one or the other.") Instead, create a new TestTree value +-- in your spec module and add it to the above 'tests' list. +legacySpecs :: Fixture.HasFixture => Spec +legacySpecs = parallel $ do + describe "Data.Graph" Data.Graph.Spec.spec + describe "Tags.Spec" Tags.Spec.spec + describe "Semantic" Semantic.Spec.spec + describe "Semantic.IO" Semantic.IO.Spec.spec + + +main :: IO () +main = do + runfiles <- Fixture.create + let ?runfiles = runfiles + ?project = "semantic" + + withOptions defaultOptions { optionsLogLevel = Nothing } $ \ config logger statter -> + let ?session = TaskSession config "-" False logger statter + + in allTests >>= defaultMain diff --git a/semantic/test/SpecHelpers.hs b/semantic/test/SpecHelpers.hs new file mode 100644 index 0000000000..6b2ab6fabd --- /dev/null +++ b/semantic/test/SpecHelpers.hs @@ -0,0 +1,80 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} + +module SpecHelpers +( module X +, runBuilder +, parseFilePath +, readFilePathPair +, runTaskOrDie +, runParseWithConfig +, TaskSession(..) +, toList +, Config +, LogQueue +, StatQueue +) where + +import qualified Analysis.File as File +import Analysis.Name as X hiding (Level) +import Analysis.Project as X +import Control.Carrier.Fresh.Strict +import Control.Carrier.Lift +import Control.Carrier.Parse.Simple +import Control.Carrier.Reader as X +import Control.Exception (displayException) +import Control.Monad as X +import Data.Blob as X +import Data.Blob.IO as X +import Data.ByteString as X (ByteString) +import Data.ByteString.Builder (Builder, toLazyByteString) +import Data.ByteString.Lazy (toStrict) +import Data.Edit as X +import Data.Foldable (toList) +import Data.List.NonEmpty as X (NonEmpty (..)) +import Data.Maybe as X +import Data.Monoid as X (First (..), Last (..), Monoid (..)) +import Data.Proxy as X +import Data.Semigroup as X (Semigroup (..)) +import Data.Semilattice.Lower as X +import Data.Traversable as X (for) +import Debug.Trace as X (traceM, traceShowM) +import Parsing.Parser as X +import Semantic.Api hiding (Blob, File) +import Semantic.Config (Config (..), optionsLogLevel) +import Semantic.Task as X +import Semantic.Telemetry (LogQueue, StatQueue) +import Semantic.Util as X +import Source.Language as X +import Source.Range as X hiding (end, point, start) +import Source.Source as X (Source) +import Source.Span as X hiding (HasSpan (..), end, point, start) +import qualified Source.Span +import System.Exit (die) +import Test.Hspec as X (Spec, SpecWith, around, context, describe, it, parallel, pendingWith, runIO, xit) +import Test.Hspec.Expectations as X + +instance Lower X.Span where + lowerBound = Source.Span.point (Pos 1 1) + +runBuilder :: Builder -> ByteString +runBuilder = toStrict . toLazyByteString + +-- | Returns an s-expression parse tree for the specified path. +parseFilePath :: TaskSession -> FilePath -> IO (Either SomeException ByteString) +parseFilePath session path = do + blob <- readBlobFromFile (File.fromPath path) + res <- runTask session . runParse (configTreeSitterParseTimeout (config session)) $ parseTermBuilder TermSExpression (toList blob) + pure (runBuilder <$> res) + +runParseWithConfig :: Has (Reader Config) sig m => ParseC m a -> m a +runParseWithConfig task = asks configTreeSitterParseTimeout >>= \ timeout -> runParse timeout task + +-- | Read two files to a BlobPair. +readFilePathPair :: FilePath -> FilePath -> IO BlobPair +readFilePathPair p1 p2 = readFilePair (File.fromPath p1) (File.fromPath p2) + +-- Run a Task and call `die` if it returns an Exception. +runTaskOrDie :: ParseC TaskC a -> IO a +runTaskOrDie task = runTaskWithOptions defaultOptions { optionsLogLevel = Nothing } (runParseWithConfig task) >>= either (die . displayException) pure diff --git a/semantic/test/Tags/Spec.hs b/semantic/test/Tags/Spec.hs new file mode 100644 index 0000000000..fb7efd75d9 --- /dev/null +++ b/semantic/test/Tags/Spec.hs @@ -0,0 +1,97 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Tags.Spec + ( spec, + ) +where + +import qualified Analysis.File as File +import Proto.Semantic as P +import Semantic.Api.Symbols +import Source.Loc +import SpecHelpers +import qualified System.Path.Fixture as Fixture +import Tags.Tagging.Precise + +spec :: Fixture.HasFixture => Spec +spec = do + describe "go" $ do + it "produces tags for functions with docs (TODO)" $ + parseTestFile [P.FUNCTION] (Fixture.absRelFile "test/fixtures/go/tags/simple_functions.go") + `shouldReturn` [ Tag "TestFromBits" P.FUNCTION P.DEFINITION (Range 56 68) (OneIndexedSpan (Span (Pos 6 6) (Pos 6 18))) "func TestFromBits(t *testing.T) {" (UTF16CodeUnitSpan (Span (Pos 5 5) (Pos 5 17))), + Tag "Hi" P.FUNCTION P.DEFINITION (Range 99 101) (OneIndexedSpan (Span (Pos 10 6) (Pos 10 8))) "func Hi() {" (UTF16CodeUnitSpan (Span (Pos 9 5) (Pos 9 7))) + ] + it "produces tags for methods" $ + parseTestFile [] (Fixture.absRelFile "test/fixtures/go/tags/method.go") + `shouldReturn` [ Tag "CheckAuth" P.METHOD P.DEFINITION (Range 39 48) (OneIndexedSpan (Span (Pos 3 21) (Pos 3 30))) "func (c *apiClient) CheckAuth(req *http.Request, user, repo string) (*authenticatedActor, error) {}" (UTF16CodeUnitSpan (Span (Pos 2 20) (Pos 2 29))) + ] + it "produces tags for calls" $ + parseTestFile [P.CALL] (Fixture.absRelFile "test/fixtures/go/tags/simple_functions.go") + `shouldReturn` [ Tag "Hi" P.CALL P.REFERENCE (Range 86 88) (OneIndexedSpan (Span (Pos 7 2) (Pos 7 4))) "Hi()" (UTF16CodeUnitSpan (Span (Pos 6 1) (Pos 6 3))) + ] + describe "javascript and typescript" $ do + it "produces tags for functions with docs (TODO)" $ + parseTestFile [] (Fixture.absRelFile "test/fixtures/javascript/tags/simple_function_with_docs.js") + `shouldReturn` [ Tag "myFunction" P.FUNCTION P.DEFINITION (Range 31 41) (OneIndexedSpan (Span (Pos 2 10) (Pos 2 20))) "function myFunction() {" (UTF16CodeUnitSpan (Span (Pos 1 9) (Pos 1 19))) + ] + it "produces tags for classes" $ + parseTestFile [] (Fixture.absRelFile "test/fixtures/typescript/tags/class.ts") + `shouldReturn` [ Tag "FooBar" P.CLASS P.DEFINITION (Range 6 12) (OneIndexedSpan (Span (Pos 1 7) (Pos 1 13))) "class FooBar {}" (UTF16CodeUnitSpan (Span (Pos 0 6) (Pos 0 12))) + ] + it "produces tags for modules" $ + parseTestFile [] (Fixture.absRelFile "test/fixtures/typescript/tags/module.ts") + `shouldReturn` [ Tag "APromise" P.MODULE P.DEFINITION (Range 7 15) (OneIndexedSpan (Span (Pos 1 8) (Pos 1 16))) "module APromise { }" (UTF16CodeUnitSpan (Span (Pos 0 7) (Pos 0 15))) + ] + describe "python" $ do + it "produces tags for functions" $ + parseTestFile [] (Fixture.absRelFile "test/fixtures/python/tags/simple_functions.py") + `shouldReturn` [ Tag "Foo" P.FUNCTION P.DEFINITION (Range 4 7) (OneIndexedSpan (Span (Pos 1 5) (Pos 1 8))) "def Foo(x):" (UTF16CodeUnitSpan (Span (Pos 0 4) (Pos 0 7))), + Tag "Bar" P.FUNCTION P.DEFINITION (Range 74 77) (OneIndexedSpan (Span (Pos 7 5) (Pos 7 8))) "def Bar():" (UTF16CodeUnitSpan (Span (Pos 6 4) (Pos 6 7))), + Tag "local" P.FUNCTION P.DEFINITION (Range 89 94) (OneIndexedSpan (Span (Pos 8 9) (Pos 8 14))) "def local():" (UTF16CodeUnitSpan (Span (Pos 7 8) (Pos 7 13))) + ] + it "produces tags for functions with docs" $ + parseTestFile [] (Fixture.absRelFile "test/fixtures/python/tags/simple_function_with_docs.py") + `shouldReturn` [ Tag "Foo" P.FUNCTION P.DEFINITION (Range 4 7) (OneIndexedSpan (Span (Pos 1 5) (Pos 1 8))) "def Foo(x):" (UTF16CodeUnitSpan (Span (Pos 0 4) (Pos 0 7))) + ] + it "produces tags for classes" $ + parseTestFile [] (Fixture.absRelFile "test/fixtures/python/tags/class.py") + `shouldReturn` [ Tag "Foo" P.CLASS P.DEFINITION (Range 6 9) (OneIndexedSpan (Span (Pos 1 7) (Pos 1 10))) "class Foo:" (UTF16CodeUnitSpan (Span (Pos 0 6) (Pos 0 9))), + Tag "f" P.FUNCTION P.DEFINITION (Range 43 44 ) (OneIndexedSpan (Span (Pos 3 9) (Pos 3 10))) "def f(self):" (UTF16CodeUnitSpan (Span (Pos 2 8) (Pos 2 9))) + ] + it "produces tags for multi-line functions" $ + parseTestFile [P.FUNCTION] (Fixture.absRelFile "test/fixtures/python/tags/multiline.py") + `shouldReturn` [ Tag "Foo" P.FUNCTION P.DEFINITION (Range 4 7) (OneIndexedSpan (Span (Pos 1 5) (Pos 1 8))) "def Foo(x," (UTF16CodeUnitSpan (Span (Pos 0 4) (Pos 0 7))) + ] + describe "ruby" $ do + it "produces tags for methods" $ + parseTestFile [P.METHOD] (Fixture.absRelFile "test/fixtures/ruby/tags/simple_method.rb") + `shouldReturn` [ Tag "foo" P.METHOD P.DEFINITION (Range 4 7) (OneIndexedSpan (Span (Pos 1 5) (Pos 1 8))) "def foo" (UTF16CodeUnitSpan (Span (Pos 0 4) (Pos 0 7))) + ] + it "produces tags for sends" $ + parseTestFile [P.CALL] (Fixture.absRelFile "test/fixtures/ruby/tags/simple_method.rb") + `shouldReturn` [ Tag "puts" P.CALL P.REFERENCE (Range 10 14) (OneIndexedSpan (Span (Pos 2 3) (Pos 2 7))) "puts \"hi\"" (UTF16CodeUnitSpan (Span (Pos 1 2) (Pos 1 6))), + Tag "bar" P.CALL P.REFERENCE (Range 24 27) (OneIndexedSpan (Span (Pos 3 5) (Pos 3 8))) "a.bar" (UTF16CodeUnitSpan (Span (Pos 2 4) (Pos 2 7))), + Tag "a" P.CALL P.REFERENCE (Range 22 23) (OneIndexedSpan (Span (Pos 3 3) (Pos 3 4))) "a.bar" (UTF16CodeUnitSpan (Span (Pos 2 2) (Pos 2 3))) + ] + it "produces tags for methods with docs (TODO)" $ + parseTestFile [] (Fixture.absRelFile "test/fixtures/ruby/tags/simple_method_with_docs.rb") + `shouldReturn` [ Tag "foo" P.METHOD P.DEFINITION (Range 18 21) (OneIndexedSpan (Span (Pos 2 5) (Pos 2 8))) "def foo" (UTF16CodeUnitSpan (Span (Pos 1 4) (Pos 1 7))) + ] + it "correctly tags files containing multibyte UTF-8 characters (TODO)" $ + parseTestFile [] (Fixture.absRelFile "test/fixtures/ruby/tags/unicode_identifiers.rb") + `shouldReturn` [ Tag "ζ—₯本θͺž" P.METHOD P.DEFINITION (Range 20 29) (OneIndexedSpan (Span (Pos 2 5) (Pos 2 14))) "def ζ—₯本θͺž" (UTF16CodeUnitSpan (Span (Pos 1 4) (Pos 1 7))) + ] + it "produces tags for methods and classes with docs (TODO)" $ + parseTestFile [P.MODULE, P.CLASS, P.METHOD] (Fixture.absRelFile "test/fixtures/ruby/tags/class_module.rb") + `shouldReturn` [ Tag "Foo" P.MODULE P.DEFINITION (Range 21 24) (OneIndexedSpan (Span (Pos 2 8) (Pos 2 11))) "module Foo" (UTF16CodeUnitSpan (Span (Pos 1 7) (Pos 1 10))), + Tag "Bar" P.CLASS P.DEFINITION (Range 50 53) (OneIndexedSpan (Span (Pos 5 9) (Pos 5 12))) "class Bar" (UTF16CodeUnitSpan (Span (Pos 4 8) (Pos 4 11))), + Tag "baz" P.METHOD P.DEFINITION (Range 81 84) (OneIndexedSpan (Span (Pos 8 9) (Pos 8 12))) "def baz(a)" (UTF16CodeUnitSpan (Span (Pos 7 8) (Pos 7 11))), + Tag "C" P.CLASS P.DEFINITION (Range 132 133) (OneIndexedSpan (Span (Pos 14 13) (Pos 14 14))) "class A::B::C" (UTF16CodeUnitSpan (Span (Pos 13 12) (Pos 13 13))), + Tag "foo" P.METHOD P.DEFINITION (Range 140 143) (OneIndexedSpan (Span (Pos 15 7) (Pos 15 10))) "def foo" (UTF16CodeUnitSpan (Span (Pos 14 6) (Pos 14 9))), + Tag "foo" P.METHOD P.DEFINITION (Range 175 178) (OneIndexedSpan (Span (Pos 18 12) (Pos 18 15))) "def self.foo" (UTF16CodeUnitSpan (Span (Pos 17 11) (Pos 17 14))) + ] + +parseTestFile :: Foldable t => t P.SyntaxType -> FilePath -> IO [Tag] +parseTestFile include path = runTaskOrDie $ readBlob (File.fromPath path) >>= fmap (filter only) . tagsForBlob + where + only t = null include || (`elem` include) (tagSyntaxType t) diff --git a/semantic/test/fixtures/base.rb b/semantic/test/fixtures/base.rb new file mode 100644 index 0000000000..28be7b424a --- /dev/null +++ b/semantic/test/fixtures/base.rb @@ -0,0 +1,2020 @@ +# coding: utf-8 +# frozen_string_literal: true + +# external dependencies +require 'rack' +require 'tilt' +require 'rack/protection' +require 'mustermann' +require 'mustermann/sinatra' +require 'mustermann/regular' + +# stdlib dependencies +require 'thread' +require 'time' +require 'uri' + +# other files we need +require 'sinatra/indifferent_hash' +require 'sinatra/show_exceptions' +require 'sinatra/version' + +module Sinatra + # The request object. See Rack::Request for more info: + # http://rubydoc.info/github/rack/rack/master/Rack/Request + class Request < Rack::Request + HEADER_PARAM = /\s*[\w.]+=(?:[\w.]+|"(?:[^"\\]|\\.)*")?\s*/ + HEADER_VALUE_WITH_PARAMS = /(?:(?:\w+|\*)\/(?:\w+(?:\.|\-|\+)?|\*)*)\s*(?:;#{HEADER_PARAM})*/ + + # Returns an array of acceptable media types for the response + def accept + @env['sinatra.accept'] ||= begin + if @env.include? 'HTTP_ACCEPT' and @env['HTTP_ACCEPT'].to_s != '' + @env['HTTP_ACCEPT'].to_s.scan(HEADER_VALUE_WITH_PARAMS). + map! { |e| AcceptEntry.new(e) }.sort + else + [AcceptEntry.new('*/*')] + end + end + end + + def accept?(type) + preferred_type(type).to_s.include?(type) + end + + def preferred_type(*types) + return accept.first if types.empty? + types.flatten! + return types.first if accept.empty? + accept.detect do |accept_header| + type = types.detect { |t| MimeTypeEntry.new(t).accepts?(accept_header) } + return type if type + end + end + + alias secure? ssl? + + def forwarded? + @env.include? "HTTP_X_FORWARDED_HOST" + end + + def safe? + get? or head? or options? or trace? + end + + def idempotent? + safe? or put? or delete? or link? or unlink? + end + + def link? + request_method == "LINK" + end + + def unlink? + request_method == "UNLINK" + end + + def params + super + rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e + raise BadRequest, "Invalid query parameters: #{Rack::Utils.escape_html(e.message)}" + end + + class AcceptEntry + attr_accessor :params + attr_reader :entry + + def initialize(entry) + params = entry.scan(HEADER_PARAM).map! do |s| + key, value = s.strip.split('=', 2) + value = value[1..-2].gsub(/\\(.)/, '\1') if value.start_with?('"') + [key, value] + end + + @entry = entry + @type = entry[/[^;]+/].delete(' ') + @params = Hash[params] + @q = @params.delete('q') { 1.0 }.to_f + end + + def <=>(other) + other.priority <=> self.priority + end + + def priority + # We sort in descending order; better matches should be higher. + [ @q, -@type.count('*'), @params.size ] + end + + def to_str + @type + end + + def to_s(full = false) + full ? entry : to_str + end + + def respond_to?(*args) + super or to_str.respond_to?(*args) + end + + def method_missing(*args, &block) + to_str.send(*args, &block) + end + end + + class MimeTypeEntry + attr_reader :params + + def initialize(entry) + params = entry.scan(HEADER_PARAM).map! do |s| + key, value = s.strip.split('=', 2) + value = value[1..-2].gsub(/\\(.)/, '\1') if value.start_with?('"') + [key, value] + end + + @type = entry[/[^;]+/].delete(' ') + @params = Hash[params] + end + + def accepts?(entry) + File.fnmatch(entry, self) && matches_params?(entry.params) + end + + def to_str + @type + end + + def matches_params?(params) + return true if @params.empty? + + params.all? { |k,v| !@params.has_key?(k) || @params[k] == v } + end + end + end + + # The response object. See Rack::Response and Rack::Response::Helpers for + # more info: + # http://rubydoc.info/github/rack/rack/master/Rack/Response + # http://rubydoc.info/github/rack/rack/master/Rack/Response/Helpers + class Response < Rack::Response + DROP_BODY_RESPONSES = [204, 304] + + def body=(value) + value = value.body while Rack::Response === value + @body = String === value ? [value.to_str] : value + end + + def each + block_given? ? super : enum_for(:each) + end + + def finish + result = body + + if drop_content_info? + headers.delete "Content-Length" + headers.delete "Content-Type" + end + + if drop_body? + close + result = [] + end + + if calculate_content_length? + # if some other code has already set Content-Length, don't muck with it + # currently, this would be the static file-handler + headers["Content-Length"] = body.map(&:bytesize).reduce(0, :+).to_s + end + + [status.to_i, headers, result] + end + + private + + def calculate_content_length? + headers["Content-Type"] and not headers["Content-Length"] and Array === body + end + + def drop_content_info? + status.to_i / 100 == 1 or drop_body? + end + + def drop_body? + DROP_BODY_RESPONSES.include?(status.to_i) + end + end + + # Some Rack handlers (Thin, Rainbows!) implement an extended body object protocol, however, + # some middleware (namely Rack::Lint) will break it by not mirroring the methods in question. + # This middleware will detect an extended body object and will make sure it reaches the + # handler directly. We do this here, so our middleware and middleware set up by the app will + # still be able to run. + class ExtendedRack < Struct.new(:app) + def call(env) + result, callback = app.call(env), env['async.callback'] + return result unless callback and async?(*result) + after_response { callback.call result } + setup_close(env, *result) + throw :async + end + + private + + def setup_close(env, status, headers, body) + return unless body.respond_to? :close and env.include? 'async.close' + env['async.close'].callback { body.close } + env['async.close'].errback { body.close } + end + + def after_response(&block) + raise NotImplementedError, "only supports EventMachine at the moment" unless defined? EventMachine + EventMachine.next_tick(&block) + end + + def async?(status, headers, body) + return true if status == -1 + body.respond_to? :callback and body.respond_to? :errback + end + end + + # Behaves exactly like Rack::CommonLogger with the notable exception that it does nothing, + # if another CommonLogger is already in the middleware chain. + class CommonLogger < Rack::CommonLogger + def call(env) + env['sinatra.commonlogger'] ? @app.call(env) : super + end + + superclass.class_eval do + alias call_without_check call unless method_defined? :call_without_check + def call(env) + env['sinatra.commonlogger'] = true + call_without_check(env) + end + end + end + + class BadRequest < TypeError #:nodoc: + def http_status; 400 end + end + + class NotFound < NameError #:nodoc: + def http_status; 404 end + end + + # Methods available to routes, before/after filters, and views. + module Helpers + # Set or retrieve the response status code. + def status(value = nil) + response.status = Rack::Utils.status_code(value) if value + response.status + end + + # Set or retrieve the response body. When a block is given, + # evaluation is deferred until the body is read with #each. + def body(value = nil, &block) + if block_given? + def block.each; yield(call) end + response.body = block + elsif value + # Rack 2.0 returns a Rack::File::Iterator here instead of + # Rack::File as it was in the previous API. + unless request.head? || value.is_a?(Rack::File::Iterator) || value.is_a?(Stream) + headers.delete 'Content-Length' + end + response.body = value + else + response.body + end + end + + # Halt processing and redirect to the URI provided. + def redirect(uri, *args) + if env['HTTP_VERSION'] == 'HTTP/1.1' and env["REQUEST_METHOD"] != 'GET' + status 303 + else + status 302 + end + + # According to RFC 2616 section 14.30, "the field value consists of a + # single absolute URI" + response['Location'] = uri(uri.to_s, settings.absolute_redirects?, settings.prefixed_redirects?) + halt(*args) + end + + # Generates the absolute URI for a given path in the app. + # Takes Rack routers and reverse proxies into account. + def uri(addr = nil, absolute = true, add_script_name = true) + return addr if addr =~ /\A[a-z][a-z0-9\+\.\-]*:/i + uri = [host = String.new] + if absolute + host << "http#{'s' if request.secure?}://" + if request.forwarded? or request.port != (request.secure? ? 443 : 80) + host << request.host_with_port + else + host << request.host + end + end + uri << request.script_name.to_s if add_script_name + uri << (addr ? addr : request.path_info).to_s + File.join uri + end + + alias url uri + alias to uri + + # Halt processing and return the error status provided. + def error(code, body = nil) + code, body = 500, code.to_str if code.respond_to? :to_str + response.body = body unless body.nil? + halt code + end + + # Halt processing and return a 404 Not Found. + def not_found(body = nil) + error 404, body + end + + # Set multiple response headers with Hash. + def headers(hash = nil) + response.headers.merge! hash if hash + response.headers + end + + # Access the underlying Rack session. + def session + request.session + end + + # Access shared logger object. + def logger + request.logger + end + + # Look up a media type by file extension in Rack's mime registry. + def mime_type(type) + Base.mime_type(type) + end + + # Set the Content-Type of the response body given a media type or file + # extension. + def content_type(type = nil, params = {}) + return response['Content-Type'] unless type + default = params.delete :default + mime_type = mime_type(type) || default + fail "Unknown media type: %p" % type if mime_type.nil? + mime_type = mime_type.dup + unless params.include? :charset or settings.add_charset.all? { |p| not p === mime_type } + params[:charset] = params.delete('charset') || settings.default_encoding + end + params.delete :charset if mime_type.include? 'charset' + unless params.empty? + mime_type << (mime_type.include?(';') ? ', ' : ';') + mime_type << params.map do |key, val| + val = val.inspect if val =~ /[";,]/ + "#{key}=#{val}" + end.join(', ') + end + response['Content-Type'] = mime_type + end + + # Set the Content-Disposition to "attachment" with the specified filename, + # instructing the user agents to prompt to save. + def attachment(filename = nil, disposition = :attachment) + response['Content-Disposition'] = disposition.to_s.dup + if filename + params = '; filename="%s"' % File.basename(filename) + response['Content-Disposition'] << params + ext = File.extname(filename) + content_type(ext) unless response['Content-Type'] or ext.empty? + end + end + + # Use the contents of the file at +path+ as the response body. + def send_file(path, opts = {}) + if opts[:type] or not response['Content-Type'] + content_type opts[:type] || File.extname(path), :default => 'application/octet-stream' + end + + disposition = opts[:disposition] + filename = opts[:filename] + disposition = :attachment if disposition.nil? and filename + filename = path if filename.nil? + attachment(filename, disposition) if disposition + + last_modified opts[:last_modified] if opts[:last_modified] + + file = Rack::File.new(File.dirname(settings.app_file)) + result = file.serving(request, path) + + result[1].each { |k,v| headers[k] ||= v } + headers['Content-Length'] = result[1]['Content-Length'] + opts[:status] &&= Integer(opts[:status]) + halt (opts[:status] || result[0]), result[2] + rescue Errno::ENOENT + not_found + end + + # Class of the response body in case you use #stream. + # + # Three things really matter: The front and back block (back being the + # block generating content, front the one sending it to the client) and + # the scheduler, integrating with whatever concurrency feature the Rack + # handler is using. + # + # Scheduler has to respond to defer and schedule. + class Stream + def self.schedule(*) yield end + def self.defer(*) yield end + + def initialize(scheduler = self.class, keep_open = false, &back) + @back, @scheduler, @keep_open = back.to_proc, scheduler, keep_open + @callbacks, @closed = [], false + end + + def close + return if closed? + @closed = true + @scheduler.schedule { @callbacks.each { |c| c.call } } + end + + def each(&front) + @front = front + @scheduler.defer do + begin + @back.call(self) + rescue Exception => e + @scheduler.schedule { raise e } + end + close unless @keep_open + end + end + + def <<(data) + @scheduler.schedule { @front.call(data.to_s) } + self + end + + def callback(&block) + return yield if closed? + @callbacks << block + end + + alias errback callback + + def closed? + @closed + end + end + + # Allows to start sending data to the client even though later parts of + # the response body have not yet been generated. + # + # The close parameter specifies whether Stream#close should be called + # after the block has been executed. This is only relevant for evented + # servers like Thin or Rainbows. + def stream(keep_open = false) + scheduler = env['async.callback'] ? EventMachine : Stream + current = @params.dup + body Stream.new(scheduler, keep_open) { |out| with_params(current) { yield(out) } } + end + + # Specify response freshness policy for HTTP caches (Cache-Control header). + # Any number of non-value directives (:public, :private, :no_cache, + # :no_store, :must_revalidate, :proxy_revalidate) may be passed along with + # a Hash of value directives (:max_age, :s_maxage). + # + # cache_control :public, :must_revalidate, :max_age => 60 + # => Cache-Control: public, must-revalidate, max-age=60 + # + # See RFC 2616 / 14.9 for more on standard cache control directives: + # http://tools.ietf.org/html/rfc2616#section-14.9.1 + def cache_control(*values) + if values.last.kind_of?(Hash) + hash = values.pop + hash.reject! { |k, v| v == false } + hash.reject! { |k, v| values << k if v == true } + else + hash = {} + end + + values.map! { |value| value.to_s.tr('_','-') } + hash.each do |key, value| + key = key.to_s.tr('_', '-') + value = value.to_i if ['max-age', 's-maxage'].include? key + values << "#{key}=#{value}" + end + + response['Cache-Control'] = values.join(', ') if values.any? + end + + # Set the Expires header and Cache-Control/max-age directive. Amount + # can be an integer number of seconds in the future or a Time object + # indicating when the response should be considered "stale". The remaining + # "values" arguments are passed to the #cache_control helper: + # + # expires 500, :public, :must_revalidate + # => Cache-Control: public, must-revalidate, max-age=500 + # => Expires: Mon, 08 Jun 2009 08:50:17 GMT + # + def expires(amount, *values) + values << {} unless values.last.kind_of?(Hash) + + if amount.is_a? Integer + time = Time.now + amount.to_i + max_age = amount + else + time = time_for amount + max_age = time - Time.now + end + + values.last.merge!(:max_age => max_age) + cache_control(*values) + + response['Expires'] = time.httpdate + end + + # Set the last modified time of the resource (HTTP 'Last-Modified' header) + # and halt if conditional GET matches. The +time+ argument is a Time, + # DateTime, or other object that responds to +to_time+. + # + # When the current request includes an 'If-Modified-Since' header that is + # equal or later than the time specified, execution is immediately halted + # with a '304 Not Modified' response. + def last_modified(time) + return unless time + time = time_for time + response['Last-Modified'] = time.httpdate + return if env['HTTP_IF_NONE_MATCH'] + + if status == 200 and env['HTTP_IF_MODIFIED_SINCE'] + # compare based on seconds since epoch + since = Time.httpdate(env['HTTP_IF_MODIFIED_SINCE']).to_i + halt 304 if since >= time.to_i + end + + if (success? or status == 412) and env['HTTP_IF_UNMODIFIED_SINCE'] + # compare based on seconds since epoch + since = Time.httpdate(env['HTTP_IF_UNMODIFIED_SINCE']).to_i + halt 412 if since < time.to_i + end + rescue ArgumentError + end + + ETAG_KINDS = [:strong, :weak] + # Set the response entity tag (HTTP 'ETag' header) and halt if conditional + # GET matches. The +value+ argument is an identifier that uniquely + # identifies the current version of the resource. The +kind+ argument + # indicates whether the etag should be used as a :strong (default) or :weak + # cache validator. + # + # When the current request includes an 'If-None-Match' header with a + # matching etag, execution is immediately halted. If the request method is + # GET or HEAD, a '304 Not Modified' response is sent. + def etag(value, options = {}) + # Before touching this code, please double check RFC 2616 14.24 and 14.26. + options = {:kind => options} unless Hash === options + kind = options[:kind] || :strong + new_resource = options.fetch(:new_resource) { request.post? } + + unless ETAG_KINDS.include?(kind) + raise ArgumentError, ":strong or :weak expected" + end + + value = '"%s"' % value + value = "W/#{value}" if kind == :weak + response['ETag'] = value + + if success? or status == 304 + if etag_matches? env['HTTP_IF_NONE_MATCH'], new_resource + halt(request.safe? ? 304 : 412) + end + + if env['HTTP_IF_MATCH'] + halt 412 unless etag_matches? env['HTTP_IF_MATCH'], new_resource + end + end + end + + # Sugar for redirect (example: redirect back) + def back + request.referer + end + + # whether or not the status is set to 1xx + def informational? + status.between? 100, 199 + end + + # whether or not the status is set to 2xx + def success? + status.between? 200, 299 + end + + # whether or not the status is set to 3xx + def redirect? + status.between? 300, 399 + end + + # whether or not the status is set to 4xx + def client_error? + status.between? 400, 499 + end + + # whether or not the status is set to 5xx + def server_error? + status.between? 500, 599 + end + + # whether or not the status is set to 404 + def not_found? + status == 404 + end + + # whether or not the status is set to 400 + def bad_request? + status == 400 + end + + # Generates a Time object from the given value. + # Used by #expires and #last_modified. + def time_for(value) + if value.is_a? Numeric + Time.at value + elsif value.respond_to? :to_s + Time.parse value.to_s + else + value.to_time + end + rescue ArgumentError => boom + raise boom + rescue Exception + raise ArgumentError, "unable to convert #{value.inspect} to a Time object" + end + + private + + # Helper method checking if a ETag value list includes the current ETag. + def etag_matches?(list, new_resource = request.post?) + return !new_resource if list == '*' + list.to_s.split(/\s*,\s*/).include? response['ETag'] + end + + def with_params(temp_params) + original, @params = @params, temp_params + yield + ensure + @params = original if original + end + end + + # Template rendering methods. Each method takes the name of a template + # to render as a Symbol and returns a String with the rendered output, + # as well as an optional hash with additional options. + # + # `template` is either the name or path of the template as symbol + # (Use `:'subdir/myview'` for views in subdirectories), or a string + # that will be rendered. + # + # Possible options are: + # :content_type The content type to use, same arguments as content_type. + # :layout If set to something falsy, no layout is rendered, otherwise + # the specified layout is used (Ignored for `sass` and `less`) + # :layout_engine Engine to use for rendering the layout. + # :locals A hash with local variables that should be available + # in the template + # :scope If set, template is evaluate with the binding of the given + # object rather than the application instance. + # :views Views directory to use. + module Templates + module ContentTyped + attr_accessor :content_type + end + + def initialize + super + @default_layout = :layout + @preferred_extension = nil + end + + def erb(template, options = {}, locals = {}, &block) + render(:erb, template, options, locals, &block) + end + + def erubis(template, options = {}, locals = {}) + warn "Sinatra::Templates#erubis is deprecated and will be removed, use #erb instead.\n" \ + "If you have Erubis installed, it will be used automatically." + render :erubis, template, options, locals + end + + def haml(template, options = {}, locals = {}, &block) + render(:haml, template, options, locals, &block) + end + + def sass(template, options = {}, locals = {}) + options.merge! :layout => false, :default_content_type => :css + render :sass, template, options, locals + end + + def scss(template, options = {}, locals = {}) + options.merge! :layout => false, :default_content_type => :css + render :scss, template, options, locals + end + + def less(template, options = {}, locals = {}) + options.merge! :layout => false, :default_content_type => :css + render :less, template, options, locals + end + + def stylus(template, options = {}, locals = {}) + options.merge! :layout => false, :default_content_type => :css + render :styl, template, options, locals + end + + def builder(template = nil, options = {}, locals = {}, &block) + options[:default_content_type] = :xml + render_ruby(:builder, template, options, locals, &block) + end + + def liquid(template, options = {}, locals = {}, &block) + render(:liquid, template, options, locals, &block) + end + + def markdown(template, options = {}, locals = {}) + options[:exclude_outvar] = true + render :markdown, template, options, locals + end + + def textile(template, options = {}, locals = {}) + render :textile, template, options, locals + end + + def rdoc(template, options = {}, locals = {}) + render :rdoc, template, options, locals + end + + def asciidoc(template, options = {}, locals = {}) + render :asciidoc, template, options, locals + end + + def radius(template, options = {}, locals = {}) + render :radius, template, options, locals + end + + def markaby(template = nil, options = {}, locals = {}, &block) + render_ruby(:mab, template, options, locals, &block) + end + + def coffee(template, options = {}, locals = {}) + options.merge! :layout => false, :default_content_type => :js + render :coffee, template, options, locals + end + + def nokogiri(template = nil, options = {}, locals = {}, &block) + options[:default_content_type] = :xml + render_ruby(:nokogiri, template, options, locals, &block) + end + + def slim(template, options = {}, locals = {}, &block) + render(:slim, template, options, locals, &block) + end + + def creole(template, options = {}, locals = {}) + render :creole, template, options, locals + end + + def mediawiki(template, options = {}, locals = {}) + render :mediawiki, template, options, locals + end + + def wlang(template, options = {}, locals = {}, &block) + render(:wlang, template, options, locals, &block) + end + + def yajl(template, options = {}, locals = {}) + options[:default_content_type] = :json + render :yajl, template, options, locals + end + + def rabl(template, options = {}, locals = {}) + Rabl.register! + render :rabl, template, options, locals + end + + # Calls the given block for every possible template file in views, + # named name.ext, where ext is registered on engine. + def find_template(views, name, engine) + yield ::File.join(views, "#{name}.#{@preferred_extension}") + + Tilt.default_mapping.extensions_for(engine).each do |ext| + yield ::File.join(views, "#{name}.#{ext}") unless ext == @preferred_extension + end + end + + private + + # logic shared between builder and nokogiri + def render_ruby(engine, template, options = {}, locals = {}, &block) + options, template = template, nil if template.is_a?(Hash) + template = Proc.new { block } if template.nil? + render engine, template, options, locals + end + + def render(engine, data, options = {}, locals = {}, &block) + # merge app-level options + engine_options = settings.respond_to?(engine) ? settings.send(engine) : {} + options.merge!(engine_options) { |key, v1, v2| v1 } + + # extract generic options + locals = options.delete(:locals) || locals || {} + views = options.delete(:views) || settings.views || "./views" + layout = options[:layout] + layout = false if layout.nil? && options.include?(:layout) + eat_errors = layout.nil? + layout = engine_options[:layout] if layout.nil? or (layout == true && engine_options[:layout] != false) + layout = @default_layout if layout.nil? or layout == true + layout_options = options.delete(:layout_options) || {} + content_type = options.delete(:default_content_type) + content_type = options.delete(:content_type) || content_type + layout_engine = options.delete(:layout_engine) || engine + scope = options.delete(:scope) || self + exclude_outvar = options.delete(:exclude_outvar) + options.delete(:layout) + + # set some defaults + options[:outvar] ||= '@_out_buf' unless exclude_outvar + options[:default_encoding] ||= settings.default_encoding + + # compile and render template + begin + layout_was = @default_layout + @default_layout = false + template = compile_template(engine, data, options, views) + output = template.render(scope, locals, &block) + ensure + @default_layout = layout_was + end + + # render layout + if layout + options = options.merge(:views => views, :layout => false, :eat_errors => eat_errors, :scope => scope). + merge!(layout_options) + catch(:layout_missing) { return render(layout_engine, layout, options, locals) { output } } + end + + output.extend(ContentTyped).content_type = content_type if content_type + output + end + + def compile_template(engine, data, options, views) + eat_errors = options.delete :eat_errors + template_cache.fetch engine, data, options, views do + template = Tilt[engine] + raise "Template engine not found: #{engine}" if template.nil? + + case data + when Symbol + body, path, line = settings.templates[data] + if body + body = body.call if body.respond_to?(:call) + template.new(path, line.to_i, options) { body } + else + found = false + @preferred_extension = engine.to_s + find_template(views, data, template) do |file| + path ||= file # keep the initial path rather than the last one + if found = File.exist?(file) + path = file + break + end + end + throw :layout_missing if eat_errors and not found + template.new(path, 1, options) + end + when Proc, String + body = data.is_a?(String) ? Proc.new { data } : data + caller = settings.caller_locations.first + path = options[:path] || caller[0] + line = options[:line] || caller[1] + template.new(path, line.to_i, options, &body) + else + raise ArgumentError, "Sorry, don't know how to render #{data.inspect}." + end + end + end + end + + # Base class for all Sinatra applications and middleware. + class Base + include Rack::Utils + include Helpers + include Templates + + URI_INSTANCE = URI::Parser.new + + attr_accessor :app, :env, :request, :response, :params + attr_reader :template_cache + + def initialize(app = nil) + super() + @app = app + @template_cache = Tilt::Cache.new + @pinned_response = nil # whether a before! filter pinned the content-type + yield self if block_given? + end + + # Rack call interface. + def call(env) + dup.call!(env) + end + + def call!(env) # :nodoc: + @env = env + @params = IndifferentHash.new + @request = Request.new(env) + @response = Response.new + template_cache.clear if settings.reload_templates + + invoke { dispatch! } + invoke { error_block!(response.status) } unless @env['sinatra.error'] + + unless @response['Content-Type'] + if Array === body && body[0].respond_to?(:content_type) + content_type body[0].content_type + elsif default = settings.default_content_type + content_type default + end + end + + @response.finish + end + + # Access settings defined with Base.set. + def self.settings + self + end + + # Access settings defined with Base.set. + def settings + self.class.settings + end + + def options + warn "Sinatra::Base#options is deprecated and will be removed, " \ + "use #settings instead." + settings + end + + # Exit the current block, halts any further processing + # of the request, and returns the specified response. + def halt(*response) + response = response.first if response.length == 1 + throw :halt, response + end + + # Pass control to the next matching route. + # If there are no more matching routes, Sinatra will + # return a 404 response. + def pass(&block) + throw :pass, block + end + + # Forward the request to the downstream app -- middleware only. + def forward + fail "downstream app not set" unless @app.respond_to? :call + status, headers, body = @app.call env + @response.status = status + @response.body = body + @response.headers.merge! headers + nil + end + + private + + # Run filters defined on the class and all superclasses. + # Accepts an optional block to call after each filter is applied. + def filter!(type, base = settings) + filter! type, base.superclass if base.superclass.respond_to?(:filters) + base.filters[type].each do |args| + result = process_route(*args) + yield result if block_given? + end + end + + # Run routes defined on the class and all superclasses. + def route!(base = settings, pass_block = nil) + if routes = base.routes[@request.request_method] + routes.each do |pattern, conditions, block| + @response.delete_header('Content-Type') unless @pinned_response + + returned_pass_block = process_route(pattern, conditions) do |*args| + env['sinatra.route'] = "#{@request.request_method} #{pattern}" + route_eval { block[*args] } + end + + # don't wipe out pass_block in superclass + pass_block = returned_pass_block if returned_pass_block + end + end + + # Run routes defined in superclass. + if base.superclass.respond_to?(:routes) + return route!(base.superclass, pass_block) + end + + route_eval(&pass_block) if pass_block + route_missing + end + + # Run a route block and throw :halt with the result. + def route_eval + throw :halt, yield + end + + # If the current request matches pattern and conditions, fill params + # with keys and call the given block. + # Revert params afterwards. + # + # Returns pass block. + def process_route(pattern, conditions, block = nil, values = []) + route = @request.path_info + route = '/' if route.empty? and not settings.empty_path_info? + route = route[0..-2] if !settings.strict_paths? && route != '/' && route.end_with?('/') + return unless params = pattern.params(route) + + params.delete("ignore") # TODO: better params handling, maybe turn it into "smart" object or detect changes + force_encoding(params) + @params = @params.merge(params) if params.any? + + regexp_exists = pattern.is_a?(Mustermann::Regular) || (pattern.respond_to?(:patterns) && pattern.patterns.any? {|subpattern| subpattern.is_a?(Mustermann::Regular)} ) + if regexp_exists + captures = pattern.match(route).captures.map { |c| URI_INSTANCE.unescape(c) if c } + values += captures + @params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty? + else + values += params.values.flatten + end + + catch(:pass) do + conditions.each { |c| throw :pass if c.bind(self).call == false } + block ? block[self, values] : yield(self, values) + end + rescue + @env['sinatra.error.params'] = @params + raise + ensure + params ||= {} + params.each { |k, _| @params.delete(k) } unless @env['sinatra.error.params'] + end + + # No matching route was found or all routes passed. The default + # implementation is to forward the request downstream when running + # as middleware (@app is non-nil); when no downstream app is set, raise + # a NotFound exception. Subclasses can override this method to perform + # custom route miss logic. + def route_missing + if @app + forward + else + raise NotFound, "#{request.request_method} #{request.path_info}" + end + end + + # Attempt to serve static files from public directory. Throws :halt when + # a matching file is found, returns nil otherwise. + def static!(options = {}) + return if (public_dir = settings.public_folder).nil? + path = "#{public_dir}#{URI_INSTANCE.unescape(request.path_info)}" + return unless valid_path?(path) + + path = File.expand_path(path) + return unless File.file?(path) + + env['sinatra.static_file'] = path + cache_control(*settings.static_cache_control) if settings.static_cache_control? + send_file path, options.merge(:disposition => nil) + end + + # Run the block with 'throw :halt' support and apply result to the response. + def invoke + res = catch(:halt) { yield } + + res = [res] if Integer === res or String === res + if Array === res and Integer === res.first + res = res.dup + status(res.shift) + body(res.pop) + headers(*res) + elsif res.respond_to? :each + body res + end + nil # avoid double setting the same response tuple twice + end + + # Dispatch a request with error handling. + def dispatch! + # Avoid passing frozen string in force_encoding + @params.merge!(@request.params).each do |key, val| + next unless val.respond_to?(:force_encoding) + val = val.dup if val.frozen? + @params[key] = force_encoding(val) + end + + invoke do + static! if settings.static? && (request.get? || request.head?) + filter! :before do + @pinned_response = !@response['Content-Type'].nil? + end + route! + end + rescue ::Exception => boom + invoke { handle_exception!(boom) } + ensure + begin + filter! :after unless env['sinatra.static_file'] + rescue ::Exception => boom + invoke { handle_exception!(boom) } unless @env['sinatra.error'] + end + end + + # Error handling during requests. + def handle_exception!(boom) + if error_params = @env['sinatra.error.params'] + @params = @params.merge(error_params) + end + @env['sinatra.error'] = boom + + if boom.respond_to? :http_status + status(boom.http_status) + elsif settings.use_code? and boom.respond_to? :code and boom.code.between? 400, 599 + status(boom.code) + else + status(500) + end + + status(500) unless status.between? 400, 599 + + if server_error? + dump_errors! boom if settings.dump_errors? + raise boom if settings.show_exceptions? and settings.show_exceptions != :after_handler + elsif not_found? + headers['X-Cascade'] = 'pass' if settings.x_cascade? + end + + if res = error_block!(boom.class, boom) || error_block!(status, boom) + return res + end + + if not_found? || bad_request? + if boom.message && boom.message != boom.class.name + body boom.message + else + content_type 'text/html' + body '

' + (not_found? ? 'Not Found' : 'Bad Request') + '

' + end + end + + return unless server_error? + raise boom if settings.raise_errors? or settings.show_exceptions? + error_block! Exception, boom + end + + # Find an custom error block for the key(s) specified. + def error_block!(key, *block_params) + base = settings + while base.respond_to?(:errors) + next base = base.superclass unless args_array = base.errors[key] + args_array.reverse_each do |args| + first = args == args_array.first + args += [block_params] + resp = process_route(*args) + return resp unless resp.nil? && !first + end + end + return false unless key.respond_to? :superclass and key.superclass < Exception + error_block!(key.superclass, *block_params) + end + + def dump_errors!(boom) + msg = ["#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} - #{boom.class} - #{boom.message}:", *boom.backtrace].join("\n\t") + @env['rack.errors'].puts(msg) + end + + class << self + CALLERS_TO_IGNORE = [ # :nodoc: + /\/sinatra(\/(base|main|show_exceptions))?\.rb$/, # all sinatra code + /lib\/tilt.*\.rb$/, # all tilt code + /^\(.*\)$/, # generated code + /rubygems\/(custom|core_ext\/kernel)_require\.rb$/, # rubygems require hacks + /active_support/, # active_support require hacks + /bundler(\/(?:runtime|inline))?\.rb/, # bundler require hacks + /= 1.9.2 + /src\/kernel\/bootstrap\/[A-Z]/ # maglev kernel files + ] + + # contrary to what the comment said previously, rubinius never supported this + if defined?(RUBY_IGNORE_CALLERS) + warn "RUBY_IGNORE_CALLERS is deprecated and will no longer be supported by Sinatra 2.0" + CALLERS_TO_IGNORE.concat(RUBY_IGNORE_CALLERS) + end + + attr_reader :routes, :filters, :templates, :errors + + # Removes all routes, filters, middleware and extension hooks from the + # current class (not routes/filters/... defined by its superclass). + def reset! + @conditions = [] + @routes = {} + @filters = {:before => [], :after => []} + @errors = {} + @middleware = [] + @prototype = nil + @extensions = [] + + if superclass.respond_to?(:templates) + @templates = Hash.new { |hash, key| superclass.templates[key] } + else + @templates = {} + end + end + + # Extension modules registered on this class and all superclasses. + def extensions + if superclass.respond_to?(:extensions) + (@extensions + superclass.extensions).uniq + else + @extensions + end + end + + # Middleware used in this class and all superclasses. + def middleware + if superclass.respond_to?(:middleware) + superclass.middleware + @middleware + else + @middleware + end + end + + # Sets an option to the given value. If the value is a proc, + # the proc will be called every time the option is accessed. + def set(option, value = (not_set = true), ignore_setter = false, &block) + raise ArgumentError if block and !not_set + value, not_set = block, false if block + + if not_set + raise ArgumentError unless option.respond_to?(:each) + option.each { |k,v| set(k, v) } + return self + end + + if respond_to?("#{option}=") and not ignore_setter + return __send__("#{option}=", value) + end + + setter = proc { |val| set option, val, true } + getter = proc { value } + + case value + when Proc + getter = value + when Symbol, Integer, FalseClass, TrueClass, NilClass + getter = value.inspect + when Hash + setter = proc do |val| + val = value.merge val if Hash === val + set option, val, true + end + end + + define_singleton("#{option}=", setter) + define_singleton(option, getter) + define_singleton("#{option}?", "!!#{option}") unless method_defined? "#{option}?" + self + end + + # Same as calling `set :option, true` for each of the given options. + def enable(*opts) + opts.each { |key| set(key, true) } + end + + # Same as calling `set :option, false` for each of the given options. + def disable(*opts) + opts.each { |key| set(key, false) } + end + + # Define a custom error handler. Optionally takes either an Exception + # class, or an HTTP status code to specify which errors should be + # handled. + def error(*codes, &block) + args = compile! "ERROR", /.*/, block + codes = codes.flat_map(&method(:Array)) + codes << Exception if codes.empty? + codes << Sinatra::NotFound if codes.include?(404) + codes.each { |c| (@errors[c] ||= []) << args } + end + + # Sugar for `error(404) { ... }` + def not_found(&block) + error(404, &block) + end + + # Define a named template. The block must return the template source. + def template(name, &block) + filename, line = caller_locations.first + templates[name] = [block, filename, line.to_i] + end + + # Define the layout template. The block must return the template source. + def layout(name = :layout, &block) + template name, &block + end + + # Load embedded templates from the file; uses the caller's __FILE__ + # when no file is specified. + def inline_templates=(file = nil) + file = (file.nil? || file == true) ? (caller_files.first || File.expand_path($0)) : file + + begin + io = ::IO.respond_to?(:binread) ? ::IO.binread(file) : ::IO.read(file) + app, data = io.gsub("\r\n", "\n").split(/^__END__$/, 2) + rescue Errno::ENOENT + app, data = nil + end + + if data + if app and app =~ /([^\n]*\n)?#[^\n]*coding: *(\S+)/m + encoding = $2 + else + encoding = settings.default_encoding + end + lines = app.count("\n") + 1 + template = nil + force_encoding data, encoding + data.each_line do |line| + lines += 1 + if line =~ /^@@\s*(.*\S)\s*$/ + template = force_encoding(String.new, encoding) + templates[$1.to_sym] = [template, file, lines] + elsif template + template << line + end + end + end + end + + # Lookup or register a mime type in Rack's mime registry. + def mime_type(type, value = nil) + return type if type.nil? + return type.to_s if type.to_s.include?('/') + type = ".#{type}" unless type.to_s[0] == ?. + return Rack::Mime.mime_type(type, nil) unless value + Rack::Mime::MIME_TYPES[type] = value + end + + # provides all mime types matching type, including deprecated types: + # mime_types :html # => ['text/html'] + # mime_types :js # => ['application/javascript', 'text/javascript'] + def mime_types(type) + type = mime_type type + type =~ /^application\/(xml|javascript)$/ ? [type, "text/#$1"] : [type] + end + + # Define a before filter; runs before all requests within the same + # context as route handlers and may access/modify the request and + # response. + def before(path = /.*/, **options, &block) + add_filter(:before, path, **options, &block) + end + + # Define an after filter; runs after all requests within the same + # context as route handlers and may access/modify the request and + # response. + def after(path = /.*/, **options, &block) + add_filter(:after, path, **options, &block) + end + + # add a filter + def add_filter(type, path = /.*/, **options, &block) + filters[type] << compile!(type, path, block, **options) + end + + # Add a route condition. The route is considered non-matching when the + # block returns false. + def condition(name = "#{caller.first[/`.*'/]} condition", &block) + @conditions << generate_method(name, &block) + end + + def public=(value) + warn ":public is no longer used to avoid overloading Module#public, use :public_folder or :public_dir instead" + set(:public_folder, value) + end + + def public_dir=(value) + self.public_folder = value + end + + def public_dir + public_folder + end + + # Defining a `GET` handler also automatically defines + # a `HEAD` handler. + def get(path, opts = {}, &block) + conditions = @conditions.dup + route('GET', path, opts, &block) + + @conditions = conditions + route('HEAD', path, opts, &block) + end + + def put(path, opts = {}, &bk) route 'PUT', path, opts, &bk end + def post(path, opts = {}, &bk) route 'POST', path, opts, &bk end + def delete(path, opts = {}, &bk) route 'DELETE', path, opts, &bk end + def head(path, opts = {}, &bk) route 'HEAD', path, opts, &bk end + def options(path, opts = {}, &bk) route 'OPTIONS', path, opts, &bk end + def patch(path, opts = {}, &bk) route 'PATCH', path, opts, &bk end + def link(path, opts = {}, &bk) route 'LINK', path, opts, &bk end + def unlink(path, opts = {}, &bk) route 'UNLINK', path, opts, &bk end + + # Makes the methods defined in the block and in the Modules given + # in `extensions` available to the handlers and templates + def helpers(*extensions, &block) + class_eval(&block) if block_given? + prepend(*extensions) if extensions.any? + end + + # Register an extension. Alternatively take a block from which an + # extension will be created and registered on the fly. + def register(*extensions, &block) + extensions << Module.new(&block) if block_given? + @extensions += extensions + extensions.each do |extension| + extend extension + extension.registered(self) if extension.respond_to?(:registered) + end + end + + def development?; environment == :development end + def production?; environment == :production end + def test?; environment == :test end + + # Set configuration options for Sinatra and/or the app. + # Allows scoping of settings for certain environments. + def configure(*envs) + yield self if envs.empty? || envs.include?(environment.to_sym) + end + + # Use the specified Rack middleware + def use(middleware, *args, &block) + @prototype = nil + @middleware << [middleware, args, block] + end + + # Stop the self-hosted server if running. + def quit! + return unless running? + # Use Thin's hard #stop! if available, otherwise just #stop. + running_server.respond_to?(:stop!) ? running_server.stop! : running_server.stop + $stderr.puts "== Sinatra has ended his set (crowd applauds)" unless suppress_messages? + set :running_server, nil + set :handler_name, nil + end + + alias_method :stop!, :quit! + + # Run the Sinatra app as a self-hosted server using + # Thin, Puma, Mongrel, or WEBrick (in that order). If given a block, will call + # with the constructed handler once we have taken the stage. + def run!(options = {}, &block) + return if running? + set options + handler = detect_rack_handler + handler_name = handler.name.gsub(/.*::/, '') + server_settings = settings.respond_to?(:server_settings) ? settings.server_settings : {} + server_settings.merge!(:Port => port, :Host => bind) + + begin + start_server(handler, server_settings, handler_name, &block) + rescue Errno::EADDRINUSE + $stderr.puts "== Someone is already performing on port #{port}!" + raise + ensure + quit! + end + end + + alias_method :start!, :run! + + # Check whether the self-hosted server is running or not. + def running? + running_server? + end + + # The prototype instance used to process requests. + def prototype + @prototype ||= new + end + + # Create a new instance without middleware in front of it. + alias new! new unless method_defined? :new! + + # Create a new instance of the class fronted by its middleware + # pipeline. The object is guaranteed to respond to #call but may not be + # an instance of the class new was called on. + def new(*args, &bk) + instance = new!(*args, &bk) + Wrapper.new(build(instance).to_app, instance) + end + + # Creates a Rack::Builder instance with all the middleware set up and + # the given +app+ as end point. + def build(app) + builder = Rack::Builder.new + setup_default_middleware builder + setup_middleware builder + builder.run app + builder + end + + def call(env) + synchronize { prototype.call(env) } + end + + # Like Kernel#caller but excluding certain magic entries and without + # line / method information; the resulting array contains filenames only. + def caller_files + cleaned_caller(1).flatten + end + + # Like caller_files, but containing Arrays rather than strings with the + # first element being the file, and the second being the line. + def caller_locations + cleaned_caller 2 + end + + private + + # Starts the server by running the Rack Handler. + def start_server(handler, server_settings, handler_name) + # Ensure we initialize middleware before startup, to match standard Rack + # behavior, by ensuring an instance exists: + prototype + # Run the instance we created: + handler.run(self, **server_settings) do |server| + unless suppress_messages? + $stderr.puts "== Sinatra (v#{Sinatra::VERSION}) has taken the stage on #{port} for #{environment} with backup from #{handler_name}" + end + + setup_traps + set :running_server, server + set :handler_name, handler_name + server.threaded = settings.threaded if server.respond_to? :threaded= + + yield server if block_given? + end + end + + def suppress_messages? + handler_name =~ /cgi/i || quiet + end + + def setup_traps + if traps? + at_exit { quit! } + + [:INT, :TERM].each do |signal| + old_handler = trap(signal) do + quit! + old_handler.call if old_handler.respond_to?(:call) + end + end + + set :traps, false + end + end + + # Dynamically defines a method on settings. + def define_singleton(name, content = Proc.new) + singleton_class.class_eval do + undef_method(name) if method_defined? name + String === content ? class_eval("def #{name}() #{content}; end") : define_method(name, &content) + end + end + + # Condition for matching host name. Parameter might be String or Regexp. + def host_name(pattern) + condition { pattern === request.host } + end + + # Condition for matching user agent. Parameter should be Regexp. + # Will set params[:agent]. + def user_agent(pattern) + condition do + if request.user_agent.to_s =~ pattern + @params[:agent] = $~[1..-1] + true + else + false + end + end + end + alias_method :agent, :user_agent + + # Condition for matching mimetypes. Accepts file extensions. + def provides(*types) + types.map! { |t| mime_types(t) } + types.flatten! + condition do + if type = response['Content-Type'] + types.include? type or types.include? type[/^[^;]+/] + elsif type = request.preferred_type(types) + params = (type.respond_to?(:params) ? type.params : {}) + content_type(type, params) + true + else + false + end + end + end + + def route(verb, path, options = {}, &block) + enable :empty_path_info if path == "" and empty_path_info.nil? + signature = compile!(verb, path, block, **options) + (@routes[verb] ||= []) << signature + invoke_hook(:route_added, verb, path, block) + signature + end + + def invoke_hook(name, *args) + extensions.each { |e| e.send(name, *args) if e.respond_to?(name) } + end + + def generate_method(method_name, &block) + define_method(method_name, &block) + method = instance_method method_name + remove_method method_name + method + end + + def compile!(verb, path, block, **options) + # Because of self.options.host + host_name(options.delete(:host)) if options.key?(:host) + # Pass Mustermann opts to compile() + route_mustermann_opts = options.key?(:mustermann_opts) ? options.delete(:mustermann_opts) : {}.freeze + + options.each_pair { |option, args| send(option, *args) } + + pattern = compile(path, route_mustermann_opts) + method_name = "#{verb} #{path}" + unbound_method = generate_method(method_name, &block) + conditions, @conditions = @conditions, [] + wrapper = block.arity != 0 ? + proc { |a, p| unbound_method.bind(a).call(*p) } : + proc { |a, p| unbound_method.bind(a).call } + + [ pattern, conditions, wrapper ] + end + + def compile(path, route_mustermann_opts = {}) + Mustermann.new(path, **mustermann_opts.merge(route_mustermann_opts)) + end + + def setup_default_middleware(builder) + builder.use ExtendedRack + builder.use ShowExceptions if show_exceptions? + builder.use Rack::MethodOverride if method_override? + builder.use Rack::Head + setup_logging builder + setup_sessions builder + setup_protection builder + end + + def setup_middleware(builder) + middleware.each { |c,a,b| builder.use(c, *a, &b) } + end + + def setup_logging(builder) + if logging? + setup_common_logger(builder) + setup_custom_logger(builder) + elsif logging == false + setup_null_logger(builder) + end + end + + def setup_null_logger(builder) + builder.use Rack::NullLogger + end + + def setup_common_logger(builder) + builder.use Sinatra::CommonLogger + end + + def setup_custom_logger(builder) + if logging.respond_to? :to_int + builder.use Rack::Logger, logging + else + builder.use Rack::Logger + end + end + + def setup_protection(builder) + return unless protection? + options = Hash === protection ? protection.dup : {} + options = { + img_src: "'self' data:", + font_src: "'self'" + }.merge options + + protect_session = options.fetch(:session) { sessions? } + options[:without_session] = !protect_session + + options[:reaction] ||= :drop_session + + builder.use Rack::Protection, options + end + + def setup_sessions(builder) + return unless sessions? + options = {} + options[:secret] = session_secret if session_secret? + options.merge! sessions.to_hash if sessions.respond_to? :to_hash + builder.use session_store, options + end + + def detect_rack_handler + servers = Array(server) + servers.each do |server_name| + begin + return Rack::Handler.get(server_name.to_s) + rescue LoadError, NameError + end + end + fail "Server handler (#{servers.join(',')}) not found." + end + + def inherited(subclass) + subclass.reset! + subclass.set :app_file, caller_files.first unless subclass.app_file? + super + end + + @@mutex = Mutex.new + def synchronize(&block) + if lock? + @@mutex.synchronize(&block) + else + yield + end + end + + # used for deprecation warnings + def warn(message) + super message + "\n\tfrom #{cleaned_caller.first.join(':')}" + end + + # Like Kernel#caller but excluding certain magic entries + def cleaned_caller(keep = 3) + caller(1). + map! { |line| line.split(/:(?=\d|in )/, 3)[0,keep] }. + reject { |file, *_| CALLERS_TO_IGNORE.any? { |pattern| file =~ pattern } } + end + end + + # Force data to specified encoding. It defaults to settings.default_encoding + # which is UTF-8 by default + def self.force_encoding(data, encoding = default_encoding) + return if data == settings || data.is_a?(Tempfile) + if data.respond_to? :force_encoding + data.force_encoding(encoding).encode! + elsif data.respond_to? :each_value + data.each_value { |v| force_encoding(v, encoding) } + elsif data.respond_to? :each + data.each { |v| force_encoding(v, encoding) } + end + data + end + + def force_encoding(*args) settings.force_encoding(*args) end + + reset! + + set :environment, (ENV['APP_ENV'] || ENV['RACK_ENV'] || :development).to_sym + set :raise_errors, Proc.new { test? } + set :dump_errors, Proc.new { !test? } + set :show_exceptions, Proc.new { development? } + set :sessions, false + set :session_store, Rack::Session::Cookie + set :logging, false + set :protection, true + set :method_override, false + set :use_code, false + set :default_encoding, "utf-8" + set :x_cascade, true + set :add_charset, %w[javascript xml xhtml+xml].map { |t| "application/#{t}" } + settings.add_charset << /^text\// + set :mustermann_opts, {} + set :default_content_type, 'text/html' + + # explicitly generating a session secret eagerly to play nice with preforking + begin + require 'securerandom' + set :session_secret, SecureRandom.hex(64) + rescue LoadError, NotImplementedError + # SecureRandom raises a NotImplementedError if no random device is available + set :session_secret, "%064x" % Kernel.rand(2**256-1) + end + + class << self + alias_method :methodoverride?, :method_override? + alias_method :methodoverride=, :method_override= + end + + set :run, false # start server via at-exit hook? + set :running_server, nil + set :handler_name, nil + set :traps, true + set :server, %w[HTTP webrick] + set :bind, Proc.new { development? ? 'localhost' : '0.0.0.0' } + set :port, Integer(ENV['PORT'] && !ENV['PORT'].empty? ? ENV['PORT'] : 4567) + set :quiet, false + + ruby_engine = defined?(RUBY_ENGINE) && RUBY_ENGINE + + if ruby_engine == 'macruby' + server.unshift 'control_tower' + else + server.unshift 'reel' + server.unshift 'puma' + server.unshift 'mongrel' if ruby_engine.nil? + server.unshift 'thin' if ruby_engine != 'jruby' + server.unshift 'trinidad' if ruby_engine == 'jruby' + end + + set :absolute_redirects, true + set :prefixed_redirects, false + set :empty_path_info, nil + set :strict_paths, true + + set :app_file, nil + set :root, Proc.new { app_file && File.expand_path(File.dirname(app_file)) } + set :views, Proc.new { root && File.join(root, 'views') } + set :reload_templates, Proc.new { development? } + set :lock, false + set :threaded, true + + set :public_folder, Proc.new { root && File.join(root, 'public') } + set :static, Proc.new { public_folder && File.exist?(public_folder) } + set :static_cache_control, false + + error ::Exception do + response.status = 500 + content_type 'text/html' + '

Internal Server Error

' + end + + configure :development do + get '/__sinatra__/:image.png' do + filename = __dir__ + "/images/#{params[:image].to_i}.png" + content_type :png + send_file filename + end + + error NotFound do + content_type 'text/html' + + if self.class == Sinatra::Application + code = <<-RUBY.gsub(/^ {12}/, '') + #{request.request_method.downcase} '#{request.path_info}' do + "Hello World" + end + RUBY + else + code = <<-RUBY.gsub(/^ {12}/, '') + class #{self.class} + #{request.request_method.downcase} '#{request.path_info}' do + "Hello World" + end + end + RUBY + + file = settings.app_file.to_s.sub(settings.root.to_s, '').sub(/^\//, '') + code = "# in #{file}\n#{code}" unless file.empty? + end + + (<<-HTML).gsub(/^ {10}/, '') + + + + + + +

Sinatra doesn’t know this ditty.

+ +
+ Try this: +
#{Rack::Utils.escape_html(code)}
+
+ + + HTML + end + end + end + + # Execution context for classic style (top-level) applications. All + # DSL methods executed on main are delegated to this class. + # + # The Application class should not be subclassed, unless you want to + # inherit all settings, routes, handlers, and error pages from the + # top-level. Subclassing Sinatra::Base is highly recommended for + # modular applications. + class Application < Base + set :logging, Proc.new { !test? } + set :method_override, true + set :run, Proc.new { !test? } + set :app_file, nil + + def self.register(*extensions, &block) #:nodoc: + added_methods = extensions.flat_map(&:public_instance_methods) + Delegator.delegate(*added_methods) + super(*extensions, &block) + end + end + + # Sinatra delegation mixin. Mixing this module into an object causes all + # methods to be delegated to the Sinatra::Application class. Used primarily + # at the top-level. + module Delegator #:nodoc: + def self.delegate(*methods) + methods.each do |method_name| + define_method(method_name) do |*args, &block| + return super(*args, &block) if respond_to? method_name + Delegator.target.send(method_name, *args, &block) + end + private method_name + end + end + + delegate :get, :patch, :put, :post, :delete, :head, :options, :link, :unlink, + :template, :layout, :before, :after, :error, :not_found, :configure, + :set, :mime_type, :enable, :disable, :use, :development?, :test?, + :production?, :helpers, :settings, :register + + class << self + attr_accessor :target + end + + self.target = Application + end + + class Wrapper + def initialize(stack, instance) + @stack, @instance = stack, instance + end + + def settings + @instance.settings + end + + def helpers + @instance + end + + def call(env) + @stack.call(env) + end + + def inspect + "#<#{@instance.class} app_file=#{settings.app_file.inspect}>" + end + end + + # Create a new Sinatra application; the block is evaluated in the class scope. + def self.new(base = Base, &block) + base = Class.new(base) + base.class_eval(&block) if block_given? + base + end + + # Extend the top-level DSL with the modules provided. + def self.register(*extensions, &block) + Delegator.target.register(*extensions, &block) + end + + # Include the helper modules provided in Sinatra's request context. + def self.helpers(*extensions, &block) + Delegator.target.helpers(*extensions, &block) + end + + # Use the middleware for classic applications. + def self.use(*args, &block) + Delegator.target.use(*args, &block) + end +end diff --git a/test/fixtures/go/corpus/single-import-declarationsA.parseA.txt b/semantic/test/fixtures/cli/blank.json similarity index 100% rename from test/fixtures/go/corpus/single-import-declarationsA.parseA.txt rename to semantic/test/fixtures/cli/blank.json diff --git a/test/fixtures/cli/diff-empty-language.json b/semantic/test/fixtures/cli/diff-empty-language.json similarity index 100% rename from test/fixtures/cli/diff-empty-language.json rename to semantic/test/fixtures/cli/diff-empty-language.json diff --git a/test/fixtures/cli/diff-no-after.json b/semantic/test/fixtures/cli/diff-no-after.json similarity index 100% rename from test/fixtures/cli/diff-no-after.json rename to semantic/test/fixtures/cli/diff-no-after.json diff --git a/test/fixtures/cli/diff-no-before.json b/semantic/test/fixtures/cli/diff-no-before.json similarity index 100% rename from test/fixtures/cli/diff-no-before.json rename to semantic/test/fixtures/cli/diff-no-before.json diff --git a/test/fixtures/cli/diff-no-language.json b/semantic/test/fixtures/cli/diff-no-language.json similarity index 100% rename from test/fixtures/cli/diff-no-language.json rename to semantic/test/fixtures/cli/diff-no-language.json diff --git a/test/fixtures/cli/diff-null-after.json b/semantic/test/fixtures/cli/diff-null-after.json similarity index 100% rename from test/fixtures/cli/diff-null-after.json rename to semantic/test/fixtures/cli/diff-null-after.json diff --git a/test/fixtures/cli/diff-null-before.json b/semantic/test/fixtures/cli/diff-null-before.json similarity index 100% rename from test/fixtures/cli/diff-null-before.json rename to semantic/test/fixtures/cli/diff-null-before.json diff --git a/test/fixtures/cli/diff-null-both-sides.json b/semantic/test/fixtures/cli/diff-null-both-sides.json similarity index 100% rename from test/fixtures/cli/diff-null-both-sides.json rename to semantic/test/fixtures/cli/diff-null-both-sides.json diff --git a/semantic/test/fixtures/cli/diff-tree.json b/semantic/test/fixtures/cli/diff-tree.json new file mode 100644 index 0000000000..d8c9bcfafb --- /dev/null +++ b/semantic/test/fixtures/cli/diff-tree.json @@ -0,0 +1 @@ +{"diffs":[{"diff":{"merge":{"term":"Statements","statements":[{"merge":{"term":"Method","methodAccessControl":"Public","methodBody":{"merge":{"children":[{"patch":{"insert":{"term":"Send","sourceRange":[13,16],"sendReceiver":null,"sendBlock":null,"sendArgs":[],"sourceSpan":{"start":[2,3],"end":[2,6]},"sendSelector":{"patch":{"insert":{"term":"Identifier","name":"baz","sourceRange":[13,16],"sourceSpan":{"start":[2,3],"end":[2,6]}}}}}}}],"before":{"sourceRange":[8,11],"sourceSpan":{"start":[2,1],"end":[2,4]}},"after":{"sourceRange":[13,16],"sourceSpan":{"start":[2,3],"end":[2,6]}}}},"methodContext":[],"methodName":{"patch":{"replace":[{"term":"Identifier","name":"foo","sourceRange":[4,7],"sourceSpan":{"start":[1,5],"end":[1,8]}},{"term":"Identifier","name":"bar","sourceRange":[4,7],"sourceSpan":{"start":[1,5],"end":[1,8]}}]}},"methodParameters":[{"patch":{"insert":{"term":"Identifier","name":"a","sourceRange":[8,9],"sourceSpan":{"start":[1,9],"end":[1,10]}}}}],"methodReceiver":{"merge":{"term":"Empty","before":{"sourceRange":[0,0],"sourceSpan":{"start":[1,1],"end":[1,1]}},"after":{"sourceRange":[0,0],"sourceSpan":{"start":[1,1],"end":[1,1]}}}},"before":{"sourceRange":[0,11],"sourceSpan":{"start":[1,1],"end":[2,4]}},"after":{"sourceRange":[0,20],"sourceSpan":{"start":[1,1],"end":[3,4]}}}}],"before":{"sourceRange":[0,12],"sourceSpan":{"start":[1,1],"end":[3,1]}},"after":{"sourceRange":[0,21],"sourceSpan":{"start":[1,1],"end":[4,1]}}}},"stat":{"path":"test/fixtures/ruby/corpus/method-declaration.A.rb -> test/fixtures/ruby/corpus/method-declaration.B.rb","replace":[{"path":"test/fixtures/ruby/corpus/method-declaration.A.rb","language":"Ruby"},{"path":"test/fixtures/ruby/corpus/method-declaration.B.rb","language":"Ruby"}]}}]} diff --git a/semantic/test/fixtures/cli/diff-tree.toc.json b/semantic/test/fixtures/cli/diff-tree.toc.json new file mode 100644 index 0000000000..f0e0a42e42 --- /dev/null +++ b/semantic/test/fixtures/cli/diff-tree.toc.json @@ -0,0 +1 @@ +{"files":[{"path":"test/fixtures/ruby/corpus/method-declaration.A.rb -> test/fixtures/ruby/corpus/method-declaration.B.rb","language":"Ruby","changes":[{"category":"Method","term":"bar","span":{"start":{"line":1,"column":1},"end":{"line":3,"column":4}},"changeType":"MODIFIED"}]}]} diff --git a/semantic/test/fixtures/cli/diff-tree.toc.protobuf.bin b/semantic/test/fixtures/cli/diff-tree.toc.protobuf.bin new file mode 100644 index 0000000000..d1aa72db94 --- /dev/null +++ b/semantic/test/fixtures/cli/diff-tree.toc.protobuf.bin @@ -0,0 +1,5 @@ + + +ftest/fixtures/ruby/corpus/method-declaration.A.rb -> test/fixtures/ruby/corpus/method-declaration.B.rbRuby +Methodbar +  \ No newline at end of file diff --git a/test/fixtures/cli/diff-unsupported-language.json b/semantic/test/fixtures/cli/diff-unsupported-language.json similarity index 100% rename from test/fixtures/cli/diff-unsupported-language.json rename to semantic/test/fixtures/cli/diff-unsupported-language.json diff --git a/test/fixtures/cli/diff.json b/semantic/test/fixtures/cli/diff.json similarity index 100% rename from test/fixtures/cli/diff.json rename to semantic/test/fixtures/cli/diff.json diff --git a/semantic/test/fixtures/cli/parse-tree-empty.json b/semantic/test/fixtures/cli/parse-tree-empty.json new file mode 100644 index 0000000000..9cb7d5b7c5 --- /dev/null +++ b/semantic/test/fixtures/cli/parse-tree-empty.json @@ -0,0 +1 @@ +{"trees":[]} diff --git a/semantic/test/fixtures/cli/parse-tree.json b/semantic/test/fixtures/cli/parse-tree.json new file mode 100644 index 0000000000..60ffc95547 --- /dev/null +++ b/semantic/test/fixtures/cli/parse-tree.json @@ -0,0 +1 @@ +{"trees":[{"tree":{"term":"Statements","statements":[{"term":"LowPrecedenceAnd","lhs":{"term":"Send","sendArgs":[],"sendBlock":null,"sendReceiver":null,"sendSelector":{"term":"Identifier","name":"foo","sourceRange":[0,3],"sourceSpan":{"start":[1,1],"end":[1,4]}},"sourceRange":[0,3],"sourceSpan":{"start":[1,1],"end":[1,4]}},"rhs":{"term":"Send","sendArgs":[],"sendBlock":null,"sendReceiver":null,"sendSelector":{"term":"Identifier","name":"bar","sourceRange":[8,11],"sourceSpan":{"start":[1,9],"end":[1,12]}},"sourceRange":[8,11],"sourceSpan":{"start":[1,9],"end":[1,12]}},"sourceRange":[0,11],"sourceSpan":{"start":[1,1],"end":[1,12]}}],"sourceRange":[0,12],"sourceSpan":{"start":[1,1],"end":[2,1]}},"path":"test/fixtures/ruby/corpus/and-or.A.rb","language":"Ruby"}]} diff --git a/semantic/test/fixtures/cli/parse-tree.symbols.json b/semantic/test/fixtures/cli/parse-tree.symbols.json new file mode 100644 index 0000000000..f656019a25 --- /dev/null +++ b/semantic/test/fixtures/cli/parse-tree.symbols.json @@ -0,0 +1 @@ +{"files":[{"path":"semantic/test/fixtures/ruby/corpus/method-declaration.A.rb","language":"Ruby","symbols":[{"symbol":"foo","kind":"Method","line":"def foo","span":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}},"nodeType":"DEFINITION","syntaxType":"METHOD","utf16CodeUnitSpan":{"start":{"column":4},"end":{"column":7}},"byteRange":{"start":4,"end":7}}]}]} diff --git a/semantic/test/fixtures/cli/parse-tree.symbols.protobuf.bin b/semantic/test/fixtures/cli/parse-tree.symbols.protobuf.bin new file mode 100644 index 0000000000..463755d3a0 --- /dev/null +++ b/semantic/test/fixtures/cli/parse-tree.symbols.protobuf.bin @@ -0,0 +1,6 @@ + +| +:semantic/test/fixtures/ruby/corpus/method-declaration.A.rbRuby8 +fooMethoddef foo" +08B +J \ No newline at end of file diff --git a/semantic/test/fixtures/cli/parse-trees.json b/semantic/test/fixtures/cli/parse-trees.json new file mode 100644 index 0000000000..5fad80b6d1 --- /dev/null +++ b/semantic/test/fixtures/cli/parse-trees.json @@ -0,0 +1 @@ +{"trees":[{"tree":{"term":"Statements","statements":[{"term":"LowPrecedenceAnd","lhs":{"term":"Send","sendArgs":[],"sendBlock":null,"sendReceiver":null,"sendSelector":{"term":"Identifier","name":"foo","sourceRange":[0,3],"sourceSpan":{"start":[1,1],"end":[1,4]}},"sourceRange":[0,3],"sourceSpan":{"start":[1,1],"end":[1,4]}},"rhs":{"term":"Send","sendArgs":[],"sendBlock":null,"sendReceiver":null,"sendSelector":{"term":"Identifier","name":"bar","sourceRange":[8,11],"sourceSpan":{"start":[1,9],"end":[1,12]}},"sourceRange":[8,11],"sourceSpan":{"start":[1,9],"end":[1,12]}},"sourceRange":[0,11],"sourceSpan":{"start":[1,1],"end":[1,12]}}],"sourceRange":[0,12],"sourceSpan":{"start":[1,1],"end":[2,1]}},"path":"test/fixtures/ruby/corpus/and-or.A.rb","language":"Ruby"},{"tree":{"term":"Statements","statements":[{"term":"LowPrecedenceOr","lhs":{"term":"Send","sendArgs":[],"sendBlock":null,"sendReceiver":null,"sendSelector":{"term":"Identifier","name":"foo","sourceRange":[0,3],"sourceSpan":{"start":[1,1],"end":[1,4]}},"sourceRange":[0,3],"sourceSpan":{"start":[1,1],"end":[1,4]}},"rhs":{"term":"Send","sendArgs":[],"sendBlock":null,"sendReceiver":null,"sendSelector":{"term":"Identifier","name":"bar","sourceRange":[7,10],"sourceSpan":{"start":[1,8],"end":[1,11]}},"sourceRange":[7,10],"sourceSpan":{"start":[1,8],"end":[1,11]}},"sourceRange":[0,10],"sourceSpan":{"start":[1,1],"end":[1,11]}},{"term":"LowPrecedenceAnd","lhs":{"term":"LowPrecedenceOr","lhs":{"term":"Send","sendArgs":[],"sendBlock":null,"sendReceiver":null,"sendSelector":{"term":"Identifier","name":"a","sourceRange":[11,12],"sourceSpan":{"start":[2,1],"end":[2,2]}},"sourceRange":[11,12],"sourceSpan":{"start":[2,1],"end":[2,2]}},"rhs":{"term":"Send","sendArgs":[],"sendBlock":null,"sendReceiver":null,"sendSelector":{"term":"Identifier","name":"b","sourceRange":[16,17],"sourceSpan":{"start":[2,6],"end":[2,7]}},"sourceRange":[16,17],"sourceSpan":{"start":[2,6],"end":[2,7]}},"sourceRange":[11,17],"sourceSpan":{"start":[2,1],"end":[2,7]}},"rhs":{"term":"Send","sendArgs":[],"sendBlock":null,"sendReceiver":null,"sendSelector":{"term":"Identifier","name":"c","sourceRange":[22,23],"sourceSpan":{"start":[2,12],"end":[2,13]}},"sourceRange":[22,23],"sourceSpan":{"start":[2,12],"end":[2,13]}},"sourceRange":[11,23],"sourceSpan":{"start":[2,1],"end":[2,13]}}],"sourceRange":[0,24],"sourceSpan":{"start":[1,1],"end":[3,1]}},"path":"test/fixtures/ruby/corpus/and-or.B.rb","language":"Ruby"}]} diff --git a/test/fixtures/cli/parse.json b/semantic/test/fixtures/cli/parse.json similarity index 100% rename from test/fixtures/cli/parse.json rename to semantic/test/fixtures/cli/parse.json diff --git a/test/fixtures/go/analysis/bar/bar.go b/semantic/test/fixtures/go/analysis/bar/bar.go similarity index 100% rename from test/fixtures/go/analysis/bar/bar.go rename to semantic/test/fixtures/go/analysis/bar/bar.go diff --git a/test/fixtures/go/analysis/bar/rab.go b/semantic/test/fixtures/go/analysis/bar/rab.go similarity index 100% rename from test/fixtures/go/analysis/bar/rab.go rename to semantic/test/fixtures/go/analysis/bar/rab.go diff --git a/test/fixtures/go/analysis/foo/foo.go b/semantic/test/fixtures/go/analysis/foo/foo.go similarity index 100% rename from test/fixtures/go/analysis/foo/foo.go rename to semantic/test/fixtures/go/analysis/foo/foo.go diff --git a/test/fixtures/go/analysis/main.go b/semantic/test/fixtures/go/analysis/main.go similarity index 100% rename from test/fixtures/go/analysis/main.go rename to semantic/test/fixtures/go/analysis/main.go diff --git a/test/fixtures/go/analysis/main1.go b/semantic/test/fixtures/go/analysis/main1.go similarity index 100% rename from test/fixtures/go/analysis/main1.go rename to semantic/test/fixtures/go/analysis/main1.go diff --git a/test/fixtures/go/corpus/array-types.A.go b/semantic/test/fixtures/go/corpus/array-types.A.go similarity index 100% rename from test/fixtures/go/corpus/array-types.A.go rename to semantic/test/fixtures/go/corpus/array-types.A.go diff --git a/test/fixtures/go/corpus/array-types.B.go b/semantic/test/fixtures/go/corpus/array-types.B.go similarity index 100% rename from test/fixtures/go/corpus/array-types.B.go rename to semantic/test/fixtures/go/corpus/array-types.B.go diff --git a/test/fixtures/go/corpus/array-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/array-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/array-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/array-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/array-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/array-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/array-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/array-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/array-types.parseA.txt b/semantic/test/fixtures/go/corpus/array-types.parseA.txt new file mode 100644 index 0000000000..fe64546858 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/array-types.parseA.txt @@ -0,0 +1,63 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "a") + (Type + (SimpleType + (ArrayType + (Expression + (BinaryExpression + (Token) + (Expression + (IntLiteral "2")) + (Expression + (IntLiteral "2")))) + (Type + (SimpleType + (TypeIdentifier "x"))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "b") + (Type + (SimpleType + (ArrayType + (Expression + (IntLiteral "3")) + (Type + (SimpleType + (ArrayType + (Expression + (IntLiteral "5")) + (Type + (SimpleType + (TypeIdentifier "int")))))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "c") + (Type + (SimpleType + (ArrayType + (Expression + (IntLiteral "2")) + (Type + (SimpleType + (ArrayType + (Expression + (IntLiteral "2")) + (Type + (SimpleType + (ArrayType + (Expression + (IntLiteral "2")) + (Type + (SimpleType + (TypeIdentifier "float64")))))))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/array-types.parseB.txt b/semantic/test/fixtures/go/corpus/array-types.parseB.txt new file mode 100644 index 0000000000..ffe393ea90 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/array-types.parseB.txt @@ -0,0 +1,63 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "a") + (Type + (SimpleType + (ArrayType + (Expression + (BinaryExpression + (Token) + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "1")))) + (Type + (SimpleType + (TypeIdentifier "y"))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "d") + (Type + (SimpleType + (ArrayType + (Expression + (IntLiteral "6")) + (Type + (SimpleType + (ArrayType + (Expression + (IntLiteral "9")) + (Type + (SimpleType + (TypeIdentifier "int")))))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "e") + (Type + (SimpleType + (ArrayType + (Expression + (IntLiteral "1")) + (Type + (SimpleType + (ArrayType + (Expression + (IntLiteral "2")) + (Type + (SimpleType + (ArrayType + (Expression + (IntLiteral "3")) + (Type + (SimpleType + (TypeIdentifier "float64")))))))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/array-with-implicit-length.A.go b/semantic/test/fixtures/go/corpus/array-with-implicit-length.A.go similarity index 100% rename from test/fixtures/go/corpus/array-with-implicit-length.A.go rename to semantic/test/fixtures/go/corpus/array-with-implicit-length.A.go diff --git a/test/fixtures/go/corpus/array-with-implicit-length.B.go b/semantic/test/fixtures/go/corpus/array-with-implicit-length.B.go similarity index 100% rename from test/fixtures/go/corpus/array-with-implicit-length.B.go rename to semantic/test/fixtures/go/corpus/array-with-implicit-length.B.go diff --git a/test/fixtures/go/corpus/array-with-implicit-length.diffA-B.txt b/semantic/test/fixtures/go/corpus/array-with-implicit-length.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/array-with-implicit-length.diffA-B.txt rename to semantic/test/fixtures/go/corpus/array-with-implicit-length.diffA-B.txt diff --git a/test/fixtures/go/corpus/array-with-implicit-length.diffB-A.txt b/semantic/test/fixtures/go/corpus/array-with-implicit-length.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/array-with-implicit-length.diffB-A.txt rename to semantic/test/fixtures/go/corpus/array-with-implicit-length.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/array-with-implicit-length.parseA.txt b/semantic/test/fixtures/go/corpus/array-with-implicit-length.parseA.txt new file mode 100644 index 0000000000..d9de4d3b57 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/array-with-implicit-length.parseA.txt @@ -0,0 +1,28 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (Element + (Expression + (IntLiteral "1"))) + (Element + (Expression + (IntLiteral "2"))) + (Element + (Expression + (IntLiteral "3")))) + (ImplicitLengthArrayType + (Type + (SimpleType + (TypeIdentifier "int"))))))) + (Identifier "a1"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/array-with-implicit-length.parseB.txt b/semantic/test/fixtures/go/corpus/array-with-implicit-length.parseB.txt new file mode 100644 index 0000000000..a1736313de --- /dev/null +++ b/semantic/test/fixtures/go/corpus/array-with-implicit-length.parseB.txt @@ -0,0 +1,28 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (Element + (Expression + (IntLiteral "4"))) + (Element + (Expression + (IntLiteral "5"))) + (Element + (Expression + (IntLiteral "6")))) + (ImplicitLengthArrayType + (Type + (SimpleType + (TypeIdentifier "int"))))))) + (Identifier "a1"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/assignment-statements.A.go b/semantic/test/fixtures/go/corpus/assignment-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/assignment-statements.A.go rename to semantic/test/fixtures/go/corpus/assignment-statements.A.go diff --git a/test/fixtures/go/corpus/assignment-statements.B.go b/semantic/test/fixtures/go/corpus/assignment-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/assignment-statements.B.go rename to semantic/test/fixtures/go/corpus/assignment-statements.B.go diff --git a/semantic/test/fixtures/go/corpus/assignment-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/assignment-statements.diffA-B.txt new file mode 100644 index 0000000000..e33855be5c --- /dev/null +++ b/semantic/test/fixtures/go/corpus/assignment-statements.diffA-B.txt @@ -0,0 +1,109 @@ +(Statements + (Package + (Identifier)) + (Function + (Identifier) + (Statements + (Assignment + { (Identifier) + ->(Identifier) } + (Integer)) + (AugmentedAssignment + (Plus + (Statements + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Statements + (Integer) + (Integer)))) + {+(AugmentedAssignment + {+(Times + {+(Identifier)+} + {+(Integer)+})+})+} + {+(AugmentedAssignment + {+(Plus + {+(Identifier)+} + {+(Integer)+})+})+} + {+(AugmentedAssignment + {+(LShift + {+(Identifier)+} + {+(Integer)+})+})+} + (AugmentedAssignment + { (Times + {-(Identifier)-} + {-(Integer)-}) + ->(RShift + {+(Identifier)+} + {+(Integer)+}) }) + {+(AugmentedAssignment + {+(DividedBy + {+(Identifier)+} + {+(Integer)+})+})+} + {+(AugmentedAssignment + {+(BXOr + {+(Identifier)+} + {+(Integer)+})+})+} + {+(AugmentedAssignment + {+(Modulo + {+(Identifier)+} + {+(Integer)+})+})+} + {+(AugmentedAssignment + {+(Not + {+(BAnd + {+(Identifier)+} + {+(Integer)+})+})+})+} + {+(Assignment + {+(Identifier)+} + {+(Statements + {+(Pointer + {+(Identifier)+})+} + {+(Reference + {+(Composite + {+(Identifier)+} + {+(Statements + {+(KeyValue + {+(Identifier)+} + {+(Integer)+})+})+})+})+})+})+} + {-(AugmentedAssignment + {-(Plus + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(LShift + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(RShift + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(DividedBy + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(BXOr + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(Modulo + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(Not + {-(BAnd + {-(Identifier)-} + {-(Integer)-})-})-})-} + {-(Assignment + {-(Identifier)-} + {-(Statements + {-(Pointer + {-(Identifier)-})-} + {-(Reference + {-(Composite + {-(Identifier)-} + {-(Statements + {-(KeyValue + {-(Identifier)-} + {-(Integer)-})-})-})-})-})-})-}))) diff --git a/semantic/test/fixtures/go/corpus/assignment-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/assignment-statements.diffB-A.txt new file mode 100644 index 0000000000..7a9cd8bfcc --- /dev/null +++ b/semantic/test/fixtures/go/corpus/assignment-statements.diffB-A.txt @@ -0,0 +1,109 @@ +(Statements + (Package + (Identifier)) + (Function + (Identifier) + (Statements + (Assignment + { (Identifier) + ->(Identifier) } + (Integer)) + (AugmentedAssignment + (Plus + (Statements + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Statements + (Integer) + (Integer)))) + {+(AugmentedAssignment + {+(Times + {+(Identifier)+} + {+(Integer)+})+})+} + (AugmentedAssignment + { (Times + {-(Identifier)-} + {-(Integer)-}) + ->(Plus + {+(Identifier)+} + {+(Integer)+}) }) + {+(AugmentedAssignment + {+(LShift + {+(Identifier)+} + {+(Integer)+})+})+} + {+(AugmentedAssignment + {+(RShift + {+(Identifier)+} + {+(Integer)+})+})+} + {+(AugmentedAssignment + {+(DividedBy + {+(Identifier)+} + {+(Integer)+})+})+} + {+(AugmentedAssignment + {+(BXOr + {+(Identifier)+} + {+(Integer)+})+})+} + {+(AugmentedAssignment + {+(Modulo + {+(Identifier)+} + {+(Integer)+})+})+} + {+(AugmentedAssignment + {+(Not + {+(BAnd + {+(Identifier)+} + {+(Integer)+})+})+})+} + {+(Assignment + {+(Identifier)+} + {+(Statements + {+(Pointer + {+(Identifier)+})+} + {+(Reference + {+(Composite + {+(Identifier)+} + {+(Statements + {+(KeyValue + {+(Identifier)+} + {+(Integer)+})+})+})+})+})+})+} + {-(AugmentedAssignment + {-(Plus + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(LShift + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(RShift + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(DividedBy + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(BXOr + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(Modulo + {-(Identifier)-} + {-(Integer)-})-})-} + {-(AugmentedAssignment + {-(Not + {-(BAnd + {-(Identifier)-} + {-(Integer)-})-})-})-} + {-(Assignment + {-(Identifier)-} + {-(Statements + {-(Pointer + {-(Identifier)-})-} + {-(Reference + {-(Composite + {-(Identifier)-} + {-(Statements + {-(KeyValue + {-(Identifier)-} + {-(Integer)-})-})-})-})-})-})-}))) diff --git a/semantic/test/fixtures/go/corpus/assignment-statements.parseA.txt b/semantic/test/fixtures/go/corpus/assignment-statements.parseA.txt new file mode 100644 index 0000000000..aaad86171d --- /dev/null +++ b/semantic/test/fixtures/go/corpus/assignment-statements.parseA.txt @@ -0,0 +1,133 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "a"))) + (ExpressionList + (Expression + (IntLiteral "1")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "b")) + (Expression + (Identifier "c"))) + (ExpressionList + (Expression + (IntLiteral "2")) + (Expression + (IntLiteral "3")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "d"))) + (ExpressionList + (Expression + (IntLiteral "3")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "e"))) + (ExpressionList + (Expression + (IntLiteral "1")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f"))) + (ExpressionList + (Expression + (IntLiteral "1")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "g"))) + (ExpressionList + (Expression + (IntLiteral "2")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "h"))) + (ExpressionList + (Expression + (IntLiteral "2")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "i"))) + (ExpressionList + (Expression + (IntLiteral "2")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "j"))) + (ExpressionList + (Expression + (IntLiteral "2")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "k"))) + (ExpressionList + (Expression + (IntLiteral "2")))))) + (Statement + (VarDeclaration + (VarSpec + (ExpressionList + (Expression + (UnaryExpression + (Token) + (Expression + (CompositeLiteral + (LiteralValue + (KeyedElement + (FieldIdentifier "y") + (Expression + (IntLiteral "1000")))) + (TypeIdentifier "Point3D")))))) + (Identifier "pointer") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Point3D")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/assignment-statements.parseB.txt b/semantic/test/fixtures/go/corpus/assignment-statements.parseB.txt new file mode 100644 index 0000000000..022725371e --- /dev/null +++ b/semantic/test/fixtures/go/corpus/assignment-statements.parseB.txt @@ -0,0 +1,133 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "l"))) + (ExpressionList + (Expression + (IntLiteral "1")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "m")) + (Expression + (Identifier "n"))) + (ExpressionList + (Expression + (IntLiteral "2")) + (Expression + (IntLiteral "3")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "o"))) + (ExpressionList + (Expression + (IntLiteral "3")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "p"))) + (ExpressionList + (Expression + (IntLiteral "1")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "q"))) + (ExpressionList + (Expression + (IntLiteral "1")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "s"))) + (ExpressionList + (Expression + (IntLiteral "2")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "t"))) + (ExpressionList + (Expression + (IntLiteral "2")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "u"))) + (ExpressionList + (Expression + (IntLiteral "2")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "v"))) + (ExpressionList + (Expression + (IntLiteral "2")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "w"))) + (ExpressionList + (Expression + (IntLiteral "2")))))) + (Statement + (VarDeclaration + (VarSpec + (ExpressionList + (Expression + (UnaryExpression + (Token) + (Expression + (CompositeLiteral + (LiteralValue + (KeyedElement + (FieldIdentifier "x") + (Expression + (IntLiteral "1000")))) + (TypeIdentifier "Point2D")))))) + (Identifier "pointer") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Point2D")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/binary-expressions.A.go b/semantic/test/fixtures/go/corpus/binary-expressions.A.go similarity index 100% rename from test/fixtures/go/corpus/binary-expressions.A.go rename to semantic/test/fixtures/go/corpus/binary-expressions.A.go diff --git a/test/fixtures/go/corpus/binary-expressions.B.go b/semantic/test/fixtures/go/corpus/binary-expressions.B.go similarity index 100% rename from test/fixtures/go/corpus/binary-expressions.B.go rename to semantic/test/fixtures/go/corpus/binary-expressions.B.go diff --git a/test/fixtures/go/corpus/binary-expressions.diffA-B.txt b/semantic/test/fixtures/go/corpus/binary-expressions.diffA-B.txt similarity index 84% rename from test/fixtures/go/corpus/binary-expressions.diffA-B.txt rename to semantic/test/fixtures/go/corpus/binary-expressions.diffA-B.txt index f50051d43b..5e0070d973 100644 --- a/test/fixtures/go/corpus/binary-expressions.diffA-B.txt +++ b/semantic/test/fixtures/go/corpus/binary-expressions.diffA-B.txt @@ -20,16 +20,22 @@ ->(Identifier) } { (Identifier) ->(Identifier) })) - {+(Equal - {+(Identifier)+} - {+(Identifier)+})+} - {+(Not - {+(Equal - {+(Identifier)+} - {+(Identifier)+})+})+} - {+(LessThan - {+(Identifier)+} - {+(Identifier)+})+} + (Equal + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Not + (Equal + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) + (LessThan + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) {+(LessThanEqual {+(Identifier)+} {+(Identifier)+})+} @@ -72,16 +78,6 @@ {+(BAnd {+(Identifier)+} {+(Identifier)+})+} - {-(Equal - {-(Identifier)-} - {-(Identifier)-})-} - {-(Not - {-(Equal - {-(Identifier)-} - {-(Identifier)-})-})-} - {-(LessThan - {-(Identifier)-} - {-(Identifier)-})-} {-(LessThanEqual {-(Identifier)-} {-(Identifier)-})-} diff --git a/test/fixtures/go/corpus/binary-expressions.diffB-A.txt b/semantic/test/fixtures/go/corpus/binary-expressions.diffB-A.txt similarity index 84% rename from test/fixtures/go/corpus/binary-expressions.diffB-A.txt rename to semantic/test/fixtures/go/corpus/binary-expressions.diffB-A.txt index f50051d43b..5e0070d973 100644 --- a/test/fixtures/go/corpus/binary-expressions.diffB-A.txt +++ b/semantic/test/fixtures/go/corpus/binary-expressions.diffB-A.txt @@ -20,16 +20,22 @@ ->(Identifier) } { (Identifier) ->(Identifier) })) - {+(Equal - {+(Identifier)+} - {+(Identifier)+})+} - {+(Not - {+(Equal - {+(Identifier)+} - {+(Identifier)+})+})+} - {+(LessThan - {+(Identifier)+} - {+(Identifier)+})+} + (Equal + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Not + (Equal + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) + (LessThan + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) {+(LessThanEqual {+(Identifier)+} {+(Identifier)+})+} @@ -72,16 +78,6 @@ {+(BAnd {+(Identifier)+} {+(Identifier)+})+} - {-(Equal - {-(Identifier)-} - {-(Identifier)-})-} - {-(Not - {-(Equal - {-(Identifier)-} - {-(Identifier)-})-})-} - {-(LessThan - {-(Identifier)-} - {-(Identifier)-})-} {-(LessThanEqual {-(Identifier)-} {-(Identifier)-})-} diff --git a/semantic/test/fixtures/go/corpus/binary-expressions.parseA.txt b/semantic/test/fixtures/go/corpus/binary-expressions.parseA.txt new file mode 100644 index 0000000000..fac41f8219 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/binary-expressions.parseA.txt @@ -0,0 +1,178 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "a")) + (Expression + (Identifier "b")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "c")) + (Expression + (Identifier "d")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "e")) + (Expression + (Identifier "f")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "g")) + (Expression + (Identifier "h")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "j")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "k")) + (Expression + (Identifier "l")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "m")) + (Expression + (Identifier "n")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "o")) + (Expression + (Identifier "p")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "q")) + (Expression + (Identifier "r")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "s")) + (Expression + (Identifier "t")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "u")) + (Expression + (Identifier "v")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (Identifier "y")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "z")) + (Expression + (Identifier "aa")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "bb")) + (Expression + (Identifier "cc")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "dd")) + (Expression + (Identifier "ee")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "ff")) + (Expression + (Identifier "gg")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "hh")) + (Expression + (Identifier "ii")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "jj")) + (Expression + (Identifier "kk")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "ll")) + (Expression + (Identifier "mm"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/binary-expressions.parseB.txt b/semantic/test/fixtures/go/corpus/binary-expressions.parseB.txt new file mode 100644 index 0000000000..9c7a55fc9a --- /dev/null +++ b/semantic/test/fixtures/go/corpus/binary-expressions.parseB.txt @@ -0,0 +1,178 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "b")) + (Expression + (Identifier "c")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "d")) + (Expression + (Identifier "c")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "f")) + (Expression + (Identifier "e")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "h")) + (Expression + (Identifier "g")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "j")) + (Expression + (Identifier "i")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "l")) + (Expression + (Identifier "k")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "n")) + (Expression + (Identifier "m")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "p")) + (Expression + (Identifier "o")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "r")) + (Expression + (Identifier "q")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "t")) + (Expression + (Identifier "s")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "v")) + (Expression + (Identifier "u")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "y")) + (Expression + (Identifier "x")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "aa")) + (Expression + (Identifier "z")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "cc")) + (Expression + (Identifier "bb")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "ee")) + (Expression + (Identifier "dd")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "gg")) + (Expression + (Identifier "ff")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "ii")) + (Expression + (Identifier "hh")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "kk")) + (Expression + (Identifier "jj")))))) + (Statement + (SimpleStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "mm")) + (Expression + (Identifier "ll"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/call-expressions.A.go b/semantic/test/fixtures/go/corpus/call-expressions.A.go similarity index 100% rename from test/fixtures/go/corpus/call-expressions.A.go rename to semantic/test/fixtures/go/corpus/call-expressions.A.go diff --git a/test/fixtures/go/corpus/call-expressions.B.go b/semantic/test/fixtures/go/corpus/call-expressions.B.go similarity index 100% rename from test/fixtures/go/corpus/call-expressions.B.go rename to semantic/test/fixtures/go/corpus/call-expressions.B.go diff --git a/test/fixtures/go/corpus/call-expressions.diffA-B.txt b/semantic/test/fixtures/go/corpus/call-expressions.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/call-expressions.diffA-B.txt rename to semantic/test/fixtures/go/corpus/call-expressions.diffA-B.txt diff --git a/test/fixtures/go/corpus/call-expressions.diffB-A.txt b/semantic/test/fixtures/go/corpus/call-expressions.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/call-expressions.diffB-A.txt rename to semantic/test/fixtures/go/corpus/call-expressions.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/call-expressions.parseA.txt b/semantic/test/fixtures/go/corpus/call-expressions.parseA.txt new file mode 100644 index 0000000000..6bbd20e023 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/call-expressions.parseA.txt @@ -0,0 +1,49 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "x")) + (ArgumentList + (Expression + (Identifier "b")) + (VariadicArgument + (Expression + (Identifier "c")))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "y")) + (ArgumentList + (Expression + (Identifier "b")) + (Expression + (Identifier "c"))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "z")) + (ArgumentList + (Expression + (Identifier "b")) + (VariadicArgument + (Expression + (Identifier "c")))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList)))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/call-expressions.parseB.txt b/semantic/test/fixtures/go/corpus/call-expressions.parseB.txt new file mode 100644 index 0000000000..9e57476d95 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/call-expressions.parseB.txt @@ -0,0 +1,42 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList + (Expression + (Identifier "b")) + (VariadicArgument + (Expression + (Identifier "c")))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList + (Expression + (Identifier "b")) + (Expression + (Identifier "c"))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "c")) + (ArgumentList + (Expression + (Identifier "b")) + (VariadicArgument + (Expression + (Identifier "c"))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/case-statements.A.go b/semantic/test/fixtures/go/corpus/case-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/case-statements.A.go rename to semantic/test/fixtures/go/corpus/case-statements.A.go diff --git a/test/fixtures/go/corpus/case-statements.B.go b/semantic/test/fixtures/go/corpus/case-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/case-statements.B.go rename to semantic/test/fixtures/go/corpus/case-statements.B.go diff --git a/semantic/test/fixtures/go/corpus/case-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/case-statements.diffA-B.txt new file mode 100644 index 0000000000..3e54e29638 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/case-statements.diffA-B.txt @@ -0,0 +1,46 @@ +(Statements + (Package + (Identifier)) + (Function + (Identifier) + { (Match + {-(Empty)-} + {-(Statements)-}) + ->(Statements + {+(Match + {+(Statements)+} + {+(Pattern + {+(Statements + {+(Identifier)+} + {+(Call + {+(Identifier)+} + {+(Statements)+} + {+(Empty)+})+})+} + {+(Statements)+})+})+} + {+(Match + {+(Statements + {+(Identifier)+})+} + {+(Pattern + {+(Statements + {+(Statements + {+(Integer)+} + {+(Integer)+})+} + {+(Call + {+(Identifier)+} + {+(Statements)+} + {+(Empty)+})+} + {+(Call + {+(Identifier)+} + {+(Statements)+} + {+(Empty)+})+} + {+(Pattern + {+(Identifier)+} + {+(Empty)+})+})+} + {+(DefaultPattern + {+(Statements + {+(Call + {+(Identifier)+} + {+(Statements)+} + {+(Empty)+})+} + {+(Break + {+(Empty)+})+})+})+})+})+}) })) diff --git a/semantic/test/fixtures/go/corpus/case-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/case-statements.diffB-A.txt new file mode 100644 index 0000000000..025a18023c --- /dev/null +++ b/semantic/test/fixtures/go/corpus/case-statements.diffB-A.txt @@ -0,0 +1,46 @@ +(Statements + (Package + (Identifier)) + (Function + (Identifier) + { (Statements + {-(Match + {-(Statements)-} + {-(Pattern + {-(Statements + {-(Identifier)-} + {-(Call + {-(Identifier)-} + {-(Statements)-} + {-(Empty)-})-})-} + {-(Statements)-})-})-} + {-(Match + {-(Statements + {-(Identifier)-})-} + {-(Pattern + {-(Statements + {-(Statements + {-(Integer)-} + {-(Integer)-})-} + {-(Call + {-(Identifier)-} + {-(Statements)-} + {-(Empty)-})-} + {-(Call + {-(Identifier)-} + {-(Statements)-} + {-(Empty)-})-} + {-(Pattern + {-(Identifier)-} + {-(Empty)-})-})-} + {-(DefaultPattern + {-(Statements + {-(Call + {-(Identifier)-} + {-(Statements)-} + {-(Empty)-})-} + {-(Break + {-(Empty)-})-})-})-})-})-}) + ->(Match + {+(Empty)+} + {+(Statements)+}) })) diff --git a/semantic/test/fixtures/go/corpus/case-statements.parseA.txt b/semantic/test/fixtures/go/corpus/case-statements.parseA.txt new file mode 100644 index 0000000000..6b6504c544 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/case-statements.parseA.txt @@ -0,0 +1,9 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ExpressionSwitchStatement))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/case-statements.parseB.txt b/semantic/test/fixtures/go/corpus/case-statements.parseB.txt new file mode 100644 index 0000000000..78ca30c243 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/case-statements.parseB.txt @@ -0,0 +1,56 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ExpressionSwitchStatement + (ExpressionCase + (ExpressionList + (Expression + (Identifier "foo"))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "f1")) + (ArgumentList)))))))) + (Statement + (ExpressionSwitchStatement + (Expression + (Identifier "e")) + (ExpressionCase + (ExpressionList + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2"))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList))))) + (Statement + (FallthroughStatement "fallthrough"))) + (DefaultCase + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "c")) + (ArgumentList))))) + (Statement + (BreakStatement)))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/channel-types.A.go b/semantic/test/fixtures/go/corpus/channel-types.A.go similarity index 100% rename from test/fixtures/go/corpus/channel-types.A.go rename to semantic/test/fixtures/go/corpus/channel-types.A.go diff --git a/test/fixtures/go/corpus/channel-types.B.go b/semantic/test/fixtures/go/corpus/channel-types.B.go similarity index 100% rename from test/fixtures/go/corpus/channel-types.B.go rename to semantic/test/fixtures/go/corpus/channel-types.B.go diff --git a/test/fixtures/go/corpus/channel-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/channel-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/channel-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/channel-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/channel-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/channel-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/channel-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/channel-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/channel-types.parseA.txt b/semantic/test/fixtures/go/corpus/channel-types.parseA.txt new file mode 100644 index 0000000000..e6163ebcd7 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/channel-types.parseA.txt @@ -0,0 +1,67 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "c1") + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int")))))))))) + (TypeSpec + (TypeIdentifier "c2") + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (StructType + (FieldDeclarationList))))))))))) + (TypeSpec + (TypeIdentifier "c3") + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int")))))))))) + (TypeSpec + (TypeIdentifier "c4") + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int")))))))))) + (TypeSpec + (TypeIdentifier "c5") + (Type + (SimpleType + (ChannelType + (Type + (ParenthesizedType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int"))))))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/channel-types.parseB.txt b/semantic/test/fixtures/go/corpus/channel-types.parseB.txt new file mode 100644 index 0000000000..6a69c29768 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/channel-types.parseB.txt @@ -0,0 +1,67 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "c2") + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "string")))))))))) + (TypeSpec + (TypeIdentifier "c3") + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (StructType + (FieldDeclarationList))))))))))) + (TypeSpec + (TypeIdentifier "c4") + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "string")))))))))) + (TypeSpec + (TypeIdentifier "c4") + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "string")))))))))) + (TypeSpec + (TypeIdentifier "c5") + (Type + (SimpleType + (ChannelType + (Type + (ParenthesizedType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "string"))))))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/comment.A.go b/semantic/test/fixtures/go/corpus/comment.A.go similarity index 100% rename from test/fixtures/go/corpus/comment.A.go rename to semantic/test/fixtures/go/corpus/comment.A.go diff --git a/test/fixtures/go/corpus/comment.B.go b/semantic/test/fixtures/go/corpus/comment.B.go similarity index 100% rename from test/fixtures/go/corpus/comment.B.go rename to semantic/test/fixtures/go/corpus/comment.B.go diff --git a/test/fixtures/go/corpus/comment.diffA-B.txt b/semantic/test/fixtures/go/corpus/comment.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/comment.diffA-B.txt rename to semantic/test/fixtures/go/corpus/comment.diffA-B.txt diff --git a/test/fixtures/go/corpus/comment.diffB-A.txt b/semantic/test/fixtures/go/corpus/comment.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/comment.diffB-A.txt rename to semantic/test/fixtures/go/corpus/comment.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/comment.parseA.txt b/semantic/test/fixtures/go/corpus/comment.parseA.txt new file mode 100644 index 0000000000..571db1db81 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/comment.parseA.txt @@ -0,0 +1,7 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/comment.parseB.txt b/semantic/test/fixtures/go/corpus/comment.parseB.txt new file mode 100644 index 0000000000..571db1db81 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/comment.parseB.txt @@ -0,0 +1,7 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/const-declarations-with-types.A.go b/semantic/test/fixtures/go/corpus/const-declarations-with-types.A.go similarity index 100% rename from test/fixtures/go/corpus/const-declarations-with-types.A.go rename to semantic/test/fixtures/go/corpus/const-declarations-with-types.A.go diff --git a/test/fixtures/go/corpus/const-declarations-with-types.B.go b/semantic/test/fixtures/go/corpus/const-declarations-with-types.B.go similarity index 100% rename from test/fixtures/go/corpus/const-declarations-with-types.B.go rename to semantic/test/fixtures/go/corpus/const-declarations-with-types.B.go diff --git a/test/fixtures/go/corpus/const-declarations-with-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/const-declarations-with-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/const-declarations-with-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/const-declarations-with-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/const-declarations-with-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/const-declarations-with-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/const-declarations-with-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/const-declarations-with-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/const-declarations-with-types.parseA.txt b/semantic/test/fixtures/go/corpus/const-declarations-with-types.parseA.txt new file mode 100644 index 0000000000..ae151692c6 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/const-declarations-with-types.parseA.txt @@ -0,0 +1,17 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (IntLiteral "0"))) + (Identifier "zero") + (Type + (SimpleType + (TypeIdentifier "int"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/const-declarations-with-types.parseB.txt b/semantic/test/fixtures/go/corpus/const-declarations-with-types.parseB.txt new file mode 100644 index 0000000000..07239b3b8b --- /dev/null +++ b/semantic/test/fixtures/go/corpus/const-declarations-with-types.parseB.txt @@ -0,0 +1,21 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2"))) + (Identifier "one") + (Token) + (Identifier "two") + (Type + (SimpleType + (TypeIdentifier "uiint64"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/const-declarations-without-types.A.go b/semantic/test/fixtures/go/corpus/const-declarations-without-types.A.go similarity index 100% rename from test/fixtures/go/corpus/const-declarations-without-types.A.go rename to semantic/test/fixtures/go/corpus/const-declarations-without-types.A.go diff --git a/test/fixtures/go/corpus/const-declarations-without-types.B.go b/semantic/test/fixtures/go/corpus/const-declarations-without-types.B.go similarity index 100% rename from test/fixtures/go/corpus/const-declarations-without-types.B.go rename to semantic/test/fixtures/go/corpus/const-declarations-without-types.B.go diff --git a/test/fixtures/go/corpus/const-declarations-without-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/const-declarations-without-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/const-declarations-without-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/const-declarations-without-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/const-declarations-without-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/const-declarations-without-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/const-declarations-without-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/const-declarations-without-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/const-declarations-without-types.parseA.txt b/semantic/test/fixtures/go/corpus/const-declarations-without-types.parseA.txt new file mode 100644 index 0000000000..a185e23cf1 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/const-declarations-without-types.parseA.txt @@ -0,0 +1,14 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (IntLiteral "0"))) + (Identifier "zero"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/const-declarations-without-types.parseB.txt b/semantic/test/fixtures/go/corpus/const-declarations-without-types.parseB.txt new file mode 100644 index 0000000000..81c9d57818 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/const-declarations-without-types.parseB.txt @@ -0,0 +1,18 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2"))) + (Identifier "one") + (Token) + (Identifier "two"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/const-with-implicit-values.A.go b/semantic/test/fixtures/go/corpus/const-with-implicit-values.A.go similarity index 100% rename from test/fixtures/go/corpus/const-with-implicit-values.A.go rename to semantic/test/fixtures/go/corpus/const-with-implicit-values.A.go diff --git a/test/fixtures/go/corpus/const-with-implicit-values.B.go b/semantic/test/fixtures/go/corpus/const-with-implicit-values.B.go similarity index 100% rename from test/fixtures/go/corpus/const-with-implicit-values.B.go rename to semantic/test/fixtures/go/corpus/const-with-implicit-values.B.go diff --git a/test/fixtures/go/corpus/const-with-implicit-values.diffA-B.txt b/semantic/test/fixtures/go/corpus/const-with-implicit-values.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/const-with-implicit-values.diffA-B.txt rename to semantic/test/fixtures/go/corpus/const-with-implicit-values.diffA-B.txt diff --git a/test/fixtures/go/corpus/const-with-implicit-values.diffB-A.txt b/semantic/test/fixtures/go/corpus/const-with-implicit-values.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/const-with-implicit-values.diffB-A.txt rename to semantic/test/fixtures/go/corpus/const-with-implicit-values.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/const-with-implicit-values.parseA.txt b/semantic/test/fixtures/go/corpus/const-with-implicit-values.parseA.txt new file mode 100644 index 0000000000..a514a76e04 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/const-with-implicit-values.parseA.txt @@ -0,0 +1,18 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (Identifier "iota"))) + (Identifier "zero")) + (ConstSpec + (Identifier "one")) + (ConstSpec + (Identifier "two"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/const-with-implicit-values.parseB.txt b/semantic/test/fixtures/go/corpus/const-with-implicit-values.parseB.txt new file mode 100644 index 0000000000..26941fc533 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/const-with-implicit-values.parseB.txt @@ -0,0 +1,18 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (Identifier "iota"))) + (Identifier "a")) + (ConstSpec + (Identifier "b")) + (ConstSpec + (Identifier "c"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/constructors.A.go b/semantic/test/fixtures/go/corpus/constructors.A.go similarity index 100% rename from test/fixtures/go/corpus/constructors.A.go rename to semantic/test/fixtures/go/corpus/constructors.A.go diff --git a/test/fixtures/go/corpus/constructors.B.go b/semantic/test/fixtures/go/corpus/constructors.B.go similarity index 100% rename from test/fixtures/go/corpus/constructors.B.go rename to semantic/test/fixtures/go/corpus/constructors.B.go diff --git a/test/fixtures/go/corpus/constructors.diffA-B.txt b/semantic/test/fixtures/go/corpus/constructors.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/constructors.diffA-B.txt rename to semantic/test/fixtures/go/corpus/constructors.diffA-B.txt diff --git a/test/fixtures/go/corpus/constructors.diffB-A.txt b/semantic/test/fixtures/go/corpus/constructors.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/constructors.diffB-A.txt rename to semantic/test/fixtures/go/corpus/constructors.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/constructors.parseA.txt b/semantic/test/fixtures/go/corpus/constructors.parseA.txt new file mode 100644 index 0000000000..5f48e73dc1 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/constructors.parseA.txt @@ -0,0 +1,75 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "make")) + (ArgumentList + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int"))))))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "make")) + (ArgumentList + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int")))))) + (Expression + (ParenthesizedExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "new")) + (Expression + (Identifier "old"))))))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "make")) + (ArgumentList + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int")))))) + (Expression + (IntLiteral "5")) + (Expression + (IntLiteral "10"))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "new")) + (ArgumentList + (Type + (SimpleType + (MapType + (Type + (SimpleType + (TypeIdentifier "string"))) + (Type + (SimpleType + (TypeIdentifier "string")))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/constructors.parseB.txt b/semantic/test/fixtures/go/corpus/constructors.parseB.txt new file mode 100644 index 0000000000..d1990c9348 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/constructors.parseB.txt @@ -0,0 +1,75 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "make")) + (ArgumentList + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "string"))))))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "make")) + (ArgumentList + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "string")))))) + (Expression + (ParenthesizedExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "new")) + (Expression + (Identifier "old"))))))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "make")) + (ArgumentList + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "string")))))) + (Expression + (IntLiteral "7")) + (Expression + (IntLiteral "11"))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "new")) + (ArgumentList + (Type + (SimpleType + (MapType + (Type + (SimpleType + (TypeIdentifier "int"))) + (Type + (SimpleType + (TypeIdentifier "int")))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/float-literals.A.go b/semantic/test/fixtures/go/corpus/float-literals.A.go similarity index 100% rename from test/fixtures/go/corpus/float-literals.A.go rename to semantic/test/fixtures/go/corpus/float-literals.A.go diff --git a/test/fixtures/go/corpus/float-literals.B.go b/semantic/test/fixtures/go/corpus/float-literals.B.go similarity index 100% rename from test/fixtures/go/corpus/float-literals.B.go rename to semantic/test/fixtures/go/corpus/float-literals.B.go diff --git a/test/fixtures/go/corpus/float-literals.diffA-B.txt b/semantic/test/fixtures/go/corpus/float-literals.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/float-literals.diffA-B.txt rename to semantic/test/fixtures/go/corpus/float-literals.diffA-B.txt diff --git a/test/fixtures/go/corpus/float-literals.diffB-A.txt b/semantic/test/fixtures/go/corpus/float-literals.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/float-literals.diffB-A.txt rename to semantic/test/fixtures/go/corpus/float-literals.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/float-literals.parseA.txt b/semantic/test/fixtures/go/corpus/float-literals.parseA.txt new file mode 100644 index 0000000000..6682b4b443 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/float-literals.parseA.txt @@ -0,0 +1,57 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f1"))) + (ExpressionList + (Expression + (FloatLiteral "1.5")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f2"))) + (ExpressionList + (Expression + (FloatLiteral "1.5e100")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f3"))) + (ExpressionList + (Expression + (FloatLiteral "1.5e+50")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f4"))) + (ExpressionList + (Expression + (FloatLiteral "1.5e-5")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f5"))) + (ExpressionList + (Expression + (FloatLiteral ".5e-50"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/float-literals.parseB.txt b/semantic/test/fixtures/go/corpus/float-literals.parseB.txt new file mode 100644 index 0000000000..fbee5fc704 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/float-literals.parseB.txt @@ -0,0 +1,57 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f1"))) + (ExpressionList + (Expression + (FloatLiteral "2.6")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f2"))) + (ExpressionList + (Expression + (FloatLiteral "2.6e211")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f3"))) + (ExpressionList + (Expression + (FloatLiteral "2.6e+60")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f4"))) + (ExpressionList + (Expression + (FloatLiteral "2.6e-7")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (Identifier "f5"))) + (ExpressionList + (Expression + (FloatLiteral ".6e-60"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/for-statements.A.go b/semantic/test/fixtures/go/corpus/for-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/for-statements.A.go rename to semantic/test/fixtures/go/corpus/for-statements.A.go diff --git a/test/fixtures/go/corpus/for-statements.B.go b/semantic/test/fixtures/go/corpus/for-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/for-statements.B.go rename to semantic/test/fixtures/go/corpus/for-statements.B.go diff --git a/test/fixtures/go/corpus/for-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/for-statements.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/for-statements.diffA-B.txt rename to semantic/test/fixtures/go/corpus/for-statements.diffA-B.txt diff --git a/test/fixtures/go/corpus/for-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/for-statements.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/for-statements.diffB-A.txt rename to semantic/test/fixtures/go/corpus/for-statements.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/for-statements.parseA.txt b/semantic/test/fixtures/go/corpus/for-statements.parseA.txt new file mode 100644 index 0000000000..435ee833ba --- /dev/null +++ b/semantic/test/fixtures/go/corpus/for-statements.parseA.txt @@ -0,0 +1,178 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (GotoStatement + (LabelName "loop")))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (BreakStatement + (LabelName "loop")))) + (ForClause + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "i"))) + (ExpressionList + (Expression + (IntLiteral "0"))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (IntLiteral "5")))) + (SimpleStatement + (IncStatement + (Expression + (Identifier "i"))))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (ContinueStatement + (LabelName "loop2")))) + (ForClause + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (IntLiteral "10")))) + (SimpleStatement + (IncStatement + (Expression + (Identifier "i"))))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (ContinueStatement))) + (ForClause))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList + (Expression + (Identifier "x"))))))) + (Statement + (BreakStatement))) + (RangeClause + (ExpressionList + (Expression + (Identifier "x"))) + (Expression + (Identifier "y"))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "g")) + (ArgumentList + (Expression + (Identifier "i")) + (Expression + (Identifier "s")))))))) + (RangeClause + (ExpressionList + (Expression + (Identifier "i")) + (Expression + (Identifier "s"))) + (Expression + (Identifier "a"))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "h")) + (ArgumentList + (Expression + (Identifier "key")) + (Expression + (Identifier "val")))))))) + (RangeClause + (ExpressionList + (Expression + (Identifier "key")) + (Expression + (Identifier "val"))) + (Expression + (Identifier "m"))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "i")) + (ArgumentList)))))) + (Expression + (BinaryExpression + (Token) + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2")))))) + (Statement + (ForStatement + (Block) + (RangeClause + (Expression + (Identifier "ch")))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/for-statements.parseB.txt b/semantic/test/fixtures/go/corpus/for-statements.parseB.txt new file mode 100644 index 0000000000..e00ad87f6e --- /dev/null +++ b/semantic/test/fixtures/go/corpus/for-statements.parseB.txt @@ -0,0 +1,159 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (GotoStatement + (LabelName "loop")))) + (ForClause))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (BreakStatement + (LabelName "loop")))) + (RangeClause + (ExpressionList + (Expression + (Identifier "x"))) + (Expression + (Identifier "y"))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (ContinueStatement + (LabelName "loop2")))) + (ForClause))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (ContinueStatement))) + (ForClause + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (IntLiteral "10")))) + (SimpleStatement + (IncStatement + (Expression + (Identifier "i"))))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList + (Expression + (Identifier "x"))))))) + (Statement + (BreakStatement))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "g")) + (ArgumentList + (Expression + (Identifier "i")) + (Expression + (Identifier "s")))))))) + (RangeClause + (ExpressionList + (Expression + (Identifier "s")) + (Expression + (Identifier "i"))) + (Expression + (Identifier "b"))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "h")) + (ArgumentList + (Expression + (Identifier "k")) + (Expression + (Identifier "v")))))))) + (RangeClause + (ExpressionList + (Expression + (Identifier "k")) + (Expression + (Identifier "v"))) + (Expression + (Identifier "m"))))) + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "j")) + (ArgumentList)))))) + (Expression + (BinaryExpression + (Token) + (Expression + (IntLiteral "2")) + (Expression + (IntLiteral "1")))))) + (Statement + (ForStatement + (Block) + (RangeClause + (Expression + (Identifier "b")))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/function-declarations.A.go b/semantic/test/fixtures/go/corpus/function-declarations.A.go similarity index 100% rename from test/fixtures/go/corpus/function-declarations.A.go rename to semantic/test/fixtures/go/corpus/function-declarations.A.go diff --git a/test/fixtures/go/corpus/function-declarations.B.go b/semantic/test/fixtures/go/corpus/function-declarations.B.go similarity index 100% rename from test/fixtures/go/corpus/function-declarations.B.go rename to semantic/test/fixtures/go/corpus/function-declarations.B.go diff --git a/test/fixtures/go/corpus/function-declarations.diffA-B.txt b/semantic/test/fixtures/go/corpus/function-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/function-declarations.diffA-B.txt rename to semantic/test/fixtures/go/corpus/function-declarations.diffA-B.txt diff --git a/test/fixtures/go/corpus/function-declarations.diffB-A.txt b/semantic/test/fixtures/go/corpus/function-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/function-declarations.diffB-A.txt rename to semantic/test/fixtures/go/corpus/function-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/function-declarations.parseA.txt b/semantic/test/fixtures/go/corpus/function-declarations.parseA.txt new file mode 100644 index 0000000000..26508a1271 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/function-declarations.parseA.txt @@ -0,0 +1,76 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList)) + (FunctionDeclaration + (Block) + (Identifier "f1") + (ParameterList)) + (FunctionDeclaration + (Block) + (SimpleType + (TypeIdentifier "int")) + (Identifier "f2") + (ParameterList + (ParameterDeclaration + (Identifier "a") + (Type + (SimpleType + (TypeIdentifier "int")))) + (ParameterDeclaration + (Identifier "b") + (Token) + (Identifier "c") + (Token) + (Identifier "d") + (Type + (SimpleType + (TypeIdentifier "string")))))) + (FunctionDeclaration + (Block) + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "int")))) + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "error"))))) + (Identifier "f2") + (ParameterList)) + (FunctionDeclaration + (Block) + (ParameterList + (ParameterDeclaration + (Identifier "result") + (Type + (SimpleType + (TypeIdentifier "int")))) + (ParameterDeclaration + (Identifier "err") + (Type + (SimpleType + (TypeIdentifier "error"))))) + (Identifier "f2") + (ParameterList)) + (FunctionDeclaration + (SimpleType + (TypeIdentifier "bool")) + (Identifier "lockedOSThread") + (ParameterList)) + (FunctionDeclaration + (Block) + (Identifier "getcontext") + (ParameterList + (ParameterDeclaration + (Identifier "c") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "u")))))))))) diff --git a/semantic/test/fixtures/go/corpus/function-declarations.parseB.txt b/semantic/test/fixtures/go/corpus/function-declarations.parseB.txt new file mode 100644 index 0000000000..f823f5df17 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/function-declarations.parseB.txt @@ -0,0 +1,83 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList)) + (FunctionDeclaration + (Block) + (Identifier "fa") + (ParameterList)) + (FunctionDeclaration + (Block) + (SimpleType + (TypeIdentifier "int")) + (Identifier "fb") + (ParameterList + (ParameterDeclaration + (Identifier "a") + (Type + (SimpleType + (TypeIdentifier "int")))) + (ParameterDeclaration + (Identifier "b") + (Token) + (Identifier "c") + (Token) + (Identifier "d") + (Type + (SimpleType + (TypeIdentifier "string")))))) + (FunctionDeclaration + (Block) + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "int")))) + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "error"))))) + (Identifier "fc") + (ParameterList)) + (FunctionDeclaration + (Block) + (ParameterList + (ParameterDeclaration + (Identifier "result") + (Type + (SimpleType + (TypeIdentifier "int")))) + (ParameterDeclaration + (Identifier "err") + (Type + (SimpleType + (TypeIdentifier "error"))))) + (Identifier "fd") + (ParameterList)) + (FunctionDeclaration + (Block + (Statement + (EmptyStatement ";"))) + (ParameterList) + (Identifier "fe") + (ParameterList)) + (FunctionDeclaration + (SimpleType + (TypeIdentifier "int")) + (Identifier "lockOSThread") + (ParameterList)) + (FunctionDeclaration + (Block) + (Identifier "setcontext") + (ParameterList + (ParameterDeclaration + (Identifier "c") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "u")))))))))) diff --git a/test/fixtures/go/corpus/function-literals.A.go b/semantic/test/fixtures/go/corpus/function-literals.A.go similarity index 100% rename from test/fixtures/go/corpus/function-literals.A.go rename to semantic/test/fixtures/go/corpus/function-literals.A.go diff --git a/test/fixtures/go/corpus/function-literals.B.go b/semantic/test/fixtures/go/corpus/function-literals.B.go similarity index 100% rename from test/fixtures/go/corpus/function-literals.B.go rename to semantic/test/fixtures/go/corpus/function-literals.B.go diff --git a/test/fixtures/go/corpus/function-literals.diffA-B.txt b/semantic/test/fixtures/go/corpus/function-literals.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/function-literals.diffA-B.txt rename to semantic/test/fixtures/go/corpus/function-literals.diffA-B.txt diff --git a/test/fixtures/go/corpus/function-literals.diffB-A.txt b/semantic/test/fixtures/go/corpus/function-literals.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/function-literals.diffB-A.txt rename to semantic/test/fixtures/go/corpus/function-literals.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/function-literals.parseA.txt b/semantic/test/fixtures/go/corpus/function-literals.parseA.txt new file mode 100644 index 0000000000..4ab8313e20 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/function-literals.parseA.txt @@ -0,0 +1,37 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (FuncLiteral + (Block + (Statement + (ReturnStatement + (ExpressionList + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2")))))) + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "int")))) + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "int"))))) + (ParameterList + (ParameterDeclaration + (Identifier "s") + (Type + (SimpleType + (TypeIdentifier "string")))))))) + (Identifier "s1"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/function-literals.parseB.txt b/semantic/test/fixtures/go/corpus/function-literals.parseB.txt new file mode 100644 index 0000000000..9a52fcac77 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/function-literals.parseB.txt @@ -0,0 +1,37 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (FuncLiteral + (Block + (Statement + (ReturnStatement + (ExpressionList + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2")))))) + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "string")))) + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "string"))))) + (ParameterList + (ParameterDeclaration + (Identifier "b") + (Type + (SimpleType + (TypeIdentifier "int")))))))) + (Identifier "s1"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/function-types.A.go b/semantic/test/fixtures/go/corpus/function-types.A.go similarity index 100% rename from test/fixtures/go/corpus/function-types.A.go rename to semantic/test/fixtures/go/corpus/function-types.A.go diff --git a/test/fixtures/go/corpus/function-types.B.go b/semantic/test/fixtures/go/corpus/function-types.B.go similarity index 100% rename from test/fixtures/go/corpus/function-types.B.go rename to semantic/test/fixtures/go/corpus/function-types.B.go diff --git a/test/fixtures/go/corpus/function-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/function-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/function-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/function-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/function-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/function-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/function-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/function-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/function-types.parseA.txt b/semantic/test/fixtures/go/corpus/function-types.parseA.txt new file mode 100644 index 0000000000..949a2247f3 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/function-types.parseA.txt @@ -0,0 +1,44 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "a") + (Type + (SimpleType + (FunctionType + (SimpleType + (TypeIdentifier "int")) + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "int"))))))))) + (TypeSpec + (TypeIdentifier "b") + (Type + (SimpleType + (FunctionType + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "bool")))) + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "error"))))) + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "int")))) + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "string")))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/function-types.parseB.txt b/semantic/test/fixtures/go/corpus/function-types.parseB.txt new file mode 100644 index 0000000000..7fcae2997b --- /dev/null +++ b/semantic/test/fixtures/go/corpus/function-types.parseB.txt @@ -0,0 +1,47 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "x") + (Type + (SimpleType + (FunctionType + (SimpleType + (TypeIdentifier "string")) + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "string"))))))))) + (TypeSpec + (TypeIdentifier "y") + (Type + (SimpleType + (FunctionType + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "x"))))))) + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "error"))))) + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "string")))) + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "int")))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/go-and-defer-statements.A.go b/semantic/test/fixtures/go/corpus/go-and-defer-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/go-and-defer-statements.A.go rename to semantic/test/fixtures/go/corpus/go-and-defer-statements.A.go diff --git a/test/fixtures/go/corpus/go-and-defer-statements.B.go b/semantic/test/fixtures/go/corpus/go-and-defer-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/go-and-defer-statements.B.go rename to semantic/test/fixtures/go/corpus/go-and-defer-statements.B.go diff --git a/test/fixtures/go/corpus/go-and-defer-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/go-and-defer-statements.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/go-and-defer-statements.diffA-B.txt rename to semantic/test/fixtures/go/corpus/go-and-defer-statements.diffA-B.txt diff --git a/test/fixtures/go/corpus/go-and-defer-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/go-and-defer-statements.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/go-and-defer-statements.diffB-A.txt rename to semantic/test/fixtures/go/corpus/go-and-defer-statements.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/go-and-defer-statements.parseA.txt b/semantic/test/fixtures/go/corpus/go-and-defer-statements.parseA.txt new file mode 100644 index 0000000000..890c941992 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/go-and-defer-statements.parseA.txt @@ -0,0 +1,27 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (DeferStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "y") + (Expression + (Identifier "x")))) + (ArgumentList))))) + (Statement + (GoStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "y") + (Expression + (Identifier "x")))) + (ArgumentList)))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/go-and-defer-statements.parseB.txt b/semantic/test/fixtures/go/corpus/go-and-defer-statements.parseB.txt new file mode 100644 index 0000000000..2443e05b99 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/go-and-defer-statements.parseB.txt @@ -0,0 +1,27 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (DeferStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "b") + (Expression + (Identifier "a")))) + (ArgumentList))))) + (Statement + (GoStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "d") + (Expression + (Identifier "c")))) + (ArgumentList)))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/grouped-import-declarations.A.go b/semantic/test/fixtures/go/corpus/grouped-import-declarations.A.go similarity index 100% rename from test/fixtures/go/corpus/grouped-import-declarations.A.go rename to semantic/test/fixtures/go/corpus/grouped-import-declarations.A.go diff --git a/test/fixtures/go/corpus/grouped-import-declarations.B.go b/semantic/test/fixtures/go/corpus/grouped-import-declarations.B.go similarity index 100% rename from test/fixtures/go/corpus/grouped-import-declarations.B.go rename to semantic/test/fixtures/go/corpus/grouped-import-declarations.B.go diff --git a/test/fixtures/go/corpus/grouped-import-declarations.diffA-B.txt b/semantic/test/fixtures/go/corpus/grouped-import-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/grouped-import-declarations.diffA-B.txt rename to semantic/test/fixtures/go/corpus/grouped-import-declarations.diffA-B.txt diff --git a/test/fixtures/go/corpus/grouped-import-declarations.diffB-A.txt b/semantic/test/fixtures/go/corpus/grouped-import-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/grouped-import-declarations.diffB-A.txt rename to semantic/test/fixtures/go/corpus/grouped-import-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/grouped-import-declarations.parseA.txt b/semantic/test/fixtures/go/corpus/grouped-import-declarations.parseA.txt new file mode 100644 index 0000000000..6acb16d0cc --- /dev/null +++ b/semantic/test/fixtures/go/corpus/grouped-import-declarations.parseA.txt @@ -0,0 +1,17 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (ImportDeclaration + (ImportSpecList + (ImportSpec + (InterpretedStringLiteral)) + (ImportSpec + (InterpretedStringLiteral) + (Dot ".")) + (ImportSpec + (InterpretedStringLiteral) + (PackageIdentifier "alias")))) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/grouped-import-declarations.parseB.txt b/semantic/test/fixtures/go/corpus/grouped-import-declarations.parseB.txt new file mode 100644 index 0000000000..6acb16d0cc --- /dev/null +++ b/semantic/test/fixtures/go/corpus/grouped-import-declarations.parseB.txt @@ -0,0 +1,17 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (ImportDeclaration + (ImportSpecList + (ImportSpec + (InterpretedStringLiteral)) + (ImportSpec + (InterpretedStringLiteral) + (Dot ".")) + (ImportSpec + (InterpretedStringLiteral) + (PackageIdentifier "alias")))) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/grouped-var-declarations.A.go b/semantic/test/fixtures/go/corpus/grouped-var-declarations.A.go similarity index 100% rename from test/fixtures/go/corpus/grouped-var-declarations.A.go rename to semantic/test/fixtures/go/corpus/grouped-var-declarations.A.go diff --git a/test/fixtures/go/corpus/grouped-var-declarations.B.go b/semantic/test/fixtures/go/corpus/grouped-var-declarations.B.go similarity index 100% rename from test/fixtures/go/corpus/grouped-var-declarations.B.go rename to semantic/test/fixtures/go/corpus/grouped-var-declarations.B.go diff --git a/test/fixtures/go/corpus/grouped-var-declarations.diffA-B.txt b/semantic/test/fixtures/go/corpus/grouped-var-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/grouped-var-declarations.diffA-B.txt rename to semantic/test/fixtures/go/corpus/grouped-var-declarations.diffA-B.txt diff --git a/test/fixtures/go/corpus/grouped-var-declarations.diffB-A.txt b/semantic/test/fixtures/go/corpus/grouped-var-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/grouped-var-declarations.diffB-A.txt rename to semantic/test/fixtures/go/corpus/grouped-var-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/grouped-var-declarations.parseA.txt b/semantic/test/fixtures/go/corpus/grouped-var-declarations.parseA.txt new file mode 100644 index 0000000000..d6443cbb9f --- /dev/null +++ b/semantic/test/fixtures/go/corpus/grouped-var-declarations.parseA.txt @@ -0,0 +1,19 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (VarDeclaration + (VarSpec + (ExpressionList + (Expression + (IntLiteral "0"))) + (Identifier "zero")) + (VarSpec + (ExpressionList + (Expression + (IntLiteral "1"))) + (Identifier "one"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/grouped-var-declarations.parseB.txt b/semantic/test/fixtures/go/corpus/grouped-var-declarations.parseB.txt new file mode 100644 index 0000000000..4d83bcff87 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/grouped-var-declarations.parseB.txt @@ -0,0 +1,19 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (VarDeclaration + (VarSpec + (ExpressionList + (Expression + (IntLiteral "0"))) + (Identifier "a")) + (VarSpec + (ExpressionList + (Expression + (IntLiteral "1"))) + (Identifier "b"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/if-statements.A.go b/semantic/test/fixtures/go/corpus/if-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/if-statements.A.go rename to semantic/test/fixtures/go/corpus/if-statements.A.go diff --git a/test/fixtures/go/corpus/if-statements.B.go b/semantic/test/fixtures/go/corpus/if-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/if-statements.B.go rename to semantic/test/fixtures/go/corpus/if-statements.B.go diff --git a/test/fixtures/go/corpus/if-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/if-statements.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/if-statements.diffA-B.txt rename to semantic/test/fixtures/go/corpus/if-statements.diffA-B.txt diff --git a/test/fixtures/go/corpus/if-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/if-statements.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/if-statements.diffB-A.txt rename to semantic/test/fixtures/go/corpus/if-statements.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/if-statements.parseA.txt b/semantic/test/fixtures/go/corpus/if-statements.parseA.txt new file mode 100644 index 0000000000..7f2a74e1fc --- /dev/null +++ b/semantic/test/fixtures/go/corpus/if-statements.parseA.txt @@ -0,0 +1,123 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (IfStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList)))))) + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (IfStatement + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "a"))) + (ExpressionList + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList)))))) + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "d")) + (ArgumentList)))))) + (Expression + (Identifier "c")))) + (Statement + (IfStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "c")) + (ArgumentList)))))) + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList)))))) + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (IfStatement + (IfStatement + (IfStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "g")) + (ArgumentList)))))) + (Expression + (CallExpression + (Expression + (Identifier "f")) + (ArgumentList)))) + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "e")) + (ArgumentList)))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "num")) + (Expression + (IntLiteral "10"))))) + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "num"))) + (ExpressionList + (Expression + (IntLiteral "9"))))) + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "d")) + (ArgumentList)))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "num")) + (Expression + (IntLiteral "0"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/if-statements.parseB.txt b/semantic/test/fixtures/go/corpus/if-statements.parseB.txt new file mode 100644 index 0000000000..f3a2ba92cd --- /dev/null +++ b/semantic/test/fixtures/go/corpus/if-statements.parseB.txt @@ -0,0 +1,117 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (IfStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList)))))) + (Expression + (CallExpression + (Expression + (Identifier "x")) + (ArgumentList))))) + (Statement + (IfStatement + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "y"))) + (ExpressionList + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList)))))) + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "d")) + (ArgumentList)))))) + (Expression + (Identifier "c")))) + (Statement + (IfStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "c")) + (ArgumentList)))))) + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList)))))) + (Expression + (CallExpression + (Expression + (Identifier "z")) + (ArgumentList))))) + (Statement + (IfStatement + (IfStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "h")) + (ArgumentList)))))) + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "g")) + (ArgumentList)))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "num")) + (Expression + (IntLiteral "100"))))) + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "num"))) + (ExpressionList + (Expression + (IntLiteral "10"))))) + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "f")) + (ArgumentList)))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "num")) + (Expression + (IntLiteral "0"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/imaginary-literals.A.go b/semantic/test/fixtures/go/corpus/imaginary-literals.A.go similarity index 100% rename from test/fixtures/go/corpus/imaginary-literals.A.go rename to semantic/test/fixtures/go/corpus/imaginary-literals.A.go diff --git a/test/fixtures/go/corpus/imaginary-literals.B.go b/semantic/test/fixtures/go/corpus/imaginary-literals.B.go similarity index 100% rename from test/fixtures/go/corpus/imaginary-literals.B.go rename to semantic/test/fixtures/go/corpus/imaginary-literals.B.go diff --git a/test/fixtures/go/corpus/imaginary-literals.diffA-B.txt b/semantic/test/fixtures/go/corpus/imaginary-literals.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/imaginary-literals.diffA-B.txt rename to semantic/test/fixtures/go/corpus/imaginary-literals.diffA-B.txt diff --git a/test/fixtures/go/corpus/imaginary-literals.diffB-A.txt b/semantic/test/fixtures/go/corpus/imaginary-literals.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/imaginary-literals.diffB-A.txt rename to semantic/test/fixtures/go/corpus/imaginary-literals.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/imaginary-literals.parseA.txt b/semantic/test/fixtures/go/corpus/imaginary-literals.parseA.txt new file mode 100644 index 0000000000..b08eef4252 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/imaginary-literals.parseA.txt @@ -0,0 +1,19 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (ImaginaryLiteral "01i"))) + (Identifier "a")) + (ConstSpec + (ExpressionList + (Expression + (ImaginaryLiteral "1.e+100i"))) + (Identifier "b"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/imaginary-literals.parseB.txt b/semantic/test/fixtures/go/corpus/imaginary-literals.parseB.txt new file mode 100644 index 0000000000..18385141ac --- /dev/null +++ b/semantic/test/fixtures/go/corpus/imaginary-literals.parseB.txt @@ -0,0 +1,19 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (ImaginaryLiteral "02i"))) + (Identifier "a")) + (ConstSpec + (ExpressionList + (Expression + (ImaginaryLiteral "1.e+103i"))) + (Identifier "b"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/import-statements.A.go b/semantic/test/fixtures/go/corpus/import-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/import-statements.A.go rename to semantic/test/fixtures/go/corpus/import-statements.A.go diff --git a/test/fixtures/go/corpus/import-statements.B.go b/semantic/test/fixtures/go/corpus/import-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/import-statements.B.go rename to semantic/test/fixtures/go/corpus/import-statements.B.go diff --git a/test/fixtures/go/corpus/import-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/import-statements.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/import-statements.diffA-B.txt rename to semantic/test/fixtures/go/corpus/import-statements.diffA-B.txt diff --git a/test/fixtures/go/corpus/import-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/import-statements.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/import-statements.diffB-A.txt rename to semantic/test/fixtures/go/corpus/import-statements.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/import-statements.parseA.txt b/semantic/test/fixtures/go/corpus/import-statements.parseA.txt new file mode 100644 index 0000000000..4c3a68d93e --- /dev/null +++ b/semantic/test/fixtures/go/corpus/import-statements.parseA.txt @@ -0,0 +1,11 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (ImportDeclaration + (ImportSpecList + (ImportSpec + (InterpretedStringLiteral)))) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/import-statements.parseB.txt b/semantic/test/fixtures/go/corpus/import-statements.parseB.txt new file mode 100644 index 0000000000..4c3a68d93e --- /dev/null +++ b/semantic/test/fixtures/go/corpus/import-statements.parseB.txt @@ -0,0 +1,11 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (ImportDeclaration + (ImportSpecList + (ImportSpec + (InterpretedStringLiteral)))) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/increment-decrement-statements.A.go b/semantic/test/fixtures/go/corpus/increment-decrement-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/increment-decrement-statements.A.go rename to semantic/test/fixtures/go/corpus/increment-decrement-statements.A.go diff --git a/test/fixtures/go/corpus/increment-decrement-statements.B.go b/semantic/test/fixtures/go/corpus/increment-decrement-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/increment-decrement-statements.B.go rename to semantic/test/fixtures/go/corpus/increment-decrement-statements.B.go diff --git a/test/fixtures/go/corpus/increment-decrement-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/increment-decrement-statements.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/increment-decrement-statements.diffA-B.txt rename to semantic/test/fixtures/go/corpus/increment-decrement-statements.diffA-B.txt diff --git a/test/fixtures/go/corpus/increment-decrement-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/increment-decrement-statements.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/increment-decrement-statements.diffB-A.txt rename to semantic/test/fixtures/go/corpus/increment-decrement-statements.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/increment-decrement-statements.parseA.txt b/semantic/test/fixtures/go/corpus/increment-decrement-statements.parseA.txt new file mode 100644 index 0000000000..ad6eff2092 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/increment-decrement-statements.parseA.txt @@ -0,0 +1,17 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (IncStatement + (Expression + (Identifier "i"))))) + (Statement + (SimpleStatement + (DecStatement + (Expression + (Identifier "j")))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/increment-decrement-statements.parseB.txt b/semantic/test/fixtures/go/corpus/increment-decrement-statements.parseB.txt new file mode 100644 index 0000000000..49a95e1733 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/increment-decrement-statements.parseB.txt @@ -0,0 +1,17 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (IncStatement + (Expression + (Identifier "foo"))))) + (Statement + (SimpleStatement + (IncStatement + (Expression + (Identifier "x")))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/int-literals.A.go b/semantic/test/fixtures/go/corpus/int-literals.A.go similarity index 100% rename from test/fixtures/go/corpus/int-literals.A.go rename to semantic/test/fixtures/go/corpus/int-literals.A.go diff --git a/test/fixtures/go/corpus/int-literals.B.go b/semantic/test/fixtures/go/corpus/int-literals.B.go similarity index 100% rename from test/fixtures/go/corpus/int-literals.B.go rename to semantic/test/fixtures/go/corpus/int-literals.B.go diff --git a/test/fixtures/go/corpus/int-literals.diffA-B.txt b/semantic/test/fixtures/go/corpus/int-literals.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/int-literals.diffA-B.txt rename to semantic/test/fixtures/go/corpus/int-literals.diffA-B.txt diff --git a/test/fixtures/go/corpus/int-literals.diffB-A.txt b/semantic/test/fixtures/go/corpus/int-literals.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/int-literals.diffB-A.txt rename to semantic/test/fixtures/go/corpus/int-literals.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/int-literals.parseA.txt b/semantic/test/fixtures/go/corpus/int-literals.parseA.txt new file mode 100644 index 0000000000..8285427146 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/int-literals.parseA.txt @@ -0,0 +1,24 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (IntLiteral "1"))) + (Identifier "a")) + (ConstSpec + (ExpressionList + (Expression + (IntLiteral "2"))) + (Identifier "b")) + (ConstSpec + (ExpressionList + (Expression + (IntLiteral "3"))) + (Identifier "c"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/int-literals.parseB.txt b/semantic/test/fixtures/go/corpus/int-literals.parseB.txt new file mode 100644 index 0000000000..73f67df00f --- /dev/null +++ b/semantic/test/fixtures/go/corpus/int-literals.parseB.txt @@ -0,0 +1,24 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (IntLiteral "4"))) + (Identifier "a")) + (ConstSpec + (ExpressionList + (Expression + (IntLiteral "5"))) + (Identifier "b")) + (ConstSpec + (ExpressionList + (Expression + (IntLiteral "6"))) + (Identifier "c"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/interface-types.A.go b/semantic/test/fixtures/go/corpus/interface-types.A.go similarity index 100% rename from test/fixtures/go/corpus/interface-types.A.go rename to semantic/test/fixtures/go/corpus/interface-types.A.go diff --git a/test/fixtures/go/corpus/interface-types.B.go b/semantic/test/fixtures/go/corpus/interface-types.B.go similarity index 100% rename from test/fixtures/go/corpus/interface-types.B.go rename to semantic/test/fixtures/go/corpus/interface-types.B.go diff --git a/test/fixtures/go/corpus/interface-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/interface-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/interface-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/interface-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/interface-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/interface-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/interface-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/interface-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/interface-types.parseA.txt b/semantic/test/fixtures/go/corpus/interface-types.parseA.txt new file mode 100644 index 0000000000..e259e41839 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/interface-types.parseA.txt @@ -0,0 +1,59 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "i1") + (Type + (SimpleType + (InterfaceType + (MethodSpecList))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "i2") + (Type + (SimpleType + (InterfaceType + (MethodSpecList + (QualifiedType + (TypeIdentifier "Reader") + (PackageIdentifier "io"))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "i3") + (Type + (SimpleType + (InterfaceType + (MethodSpecList + (TypeIdentifier "i1") + (QualifiedType + (TypeIdentifier "Reader") + (PackageIdentifier "io")) + (MethodSpec + (SimpleType + (TypeIdentifier "error")) + (FieldIdentifier "SomeMethod") + (ParameterList + (ParameterDeclaration + (Identifier "s") + (Type + (SimpleType + (TypeIdentifier "string"))))))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "OptionA") + (Type + (SimpleType + (InterfaceType + (MethodSpecList + (MethodSpec + (FieldIdentifier "public") + (ParameterList)))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/interface-types.parseB.txt b/semantic/test/fixtures/go/corpus/interface-types.parseB.txt new file mode 100644 index 0000000000..e94bbce516 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/interface-types.parseB.txt @@ -0,0 +1,59 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "j1") + (Type + (SimpleType + (InterfaceType + (MethodSpecList))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "j2") + (Type + (SimpleType + (InterfaceType + (MethodSpecList + (QualifiedType + (TypeIdentifier "Reader") + (PackageIdentifier "io"))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "j3") + (Type + (SimpleType + (InterfaceType + (MethodSpecList + (TypeIdentifier "i1") + (QualifiedType + (TypeIdentifier "Reader") + (PackageIdentifier "io")) + (MethodSpec + (SimpleType + (TypeIdentifier "error")) + (FieldIdentifier "SomeMethod") + (ParameterList + (ParameterDeclaration + (Identifier "s") + (Type + (SimpleType + (TypeIdentifier "string"))))))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "OptionB") + (Type + (SimpleType + (InterfaceType + (MethodSpecList + (MethodSpec + (FieldIdentifier "private") + (ParameterList)))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/label-statements.A.go b/semantic/test/fixtures/go/corpus/label-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/label-statements.A.go rename to semantic/test/fixtures/go/corpus/label-statements.A.go diff --git a/test/fixtures/go/corpus/label-statements.B.go b/semantic/test/fixtures/go/corpus/label-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/label-statements.B.go rename to semantic/test/fixtures/go/corpus/label-statements.B.go diff --git a/test/fixtures/go/corpus/label-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/label-statements.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/label-statements.diffA-B.txt rename to semantic/test/fixtures/go/corpus/label-statements.diffA-B.txt diff --git a/test/fixtures/go/corpus/label-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/label-statements.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/label-statements.diffB-A.txt rename to semantic/test/fixtures/go/corpus/label-statements.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/label-statements.parseA.txt b/semantic/test/fixtures/go/corpus/label-statements.parseA.txt new file mode 100644 index 0000000000..37b48bba0b --- /dev/null +++ b/semantic/test/fixtures/go/corpus/label-statements.parseA.txt @@ -0,0 +1,57 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (LabeledStatement + (LabelName "L") + (Statement + (EmptyStatement ";")))) + (Statement + (LabeledStatement + (LabelName "L1") + (Statement + (Block + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "println")) + (ArgumentList + (Expression + (Identifier "i"))))))) + (Statement + (BreakStatement + (LabelName "L1")))) + (ForClause + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "i"))) + (ExpressionList + (Expression + (IntLiteral "0"))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (IntLiteral "10")))) + (SimpleStatement + (IncStatement + (Expression + (Identifier "i"))))))))))) + (Statement + (Block + (Statement + (LabeledStatement + (LabelName "insert")))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/label-statements.parseB.txt b/semantic/test/fixtures/go/corpus/label-statements.parseB.txt new file mode 100644 index 0000000000..9a1e41f6ab --- /dev/null +++ b/semantic/test/fixtures/go/corpus/label-statements.parseB.txt @@ -0,0 +1,57 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (LabeledStatement + (LabelName "M") + (Statement + (EmptyStatement ";")))) + (Statement + (LabeledStatement + (LabelName "M1") + (Statement + (Block + (Statement + (ForStatement + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "println")) + (ArgumentList + (Expression + (Identifier "i"))))))) + (Statement + (BreakStatement + (LabelName "M1")))) + (ForClause + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "i"))) + (ExpressionList + (Expression + (IntLiteral "0"))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (IntLiteral "10")))) + (SimpleStatement + (IncStatement + (Expression + (Identifier "i"))))))))))) + (Statement + (Block + (Statement + (LabeledStatement + (LabelName "replacement")))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/map-literals.A.go b/semantic/test/fixtures/go/corpus/map-literals.A.go similarity index 100% rename from test/fixtures/go/corpus/map-literals.A.go rename to semantic/test/fixtures/go/corpus/map-literals.A.go diff --git a/test/fixtures/go/corpus/map-literals.B.go b/semantic/test/fixtures/go/corpus/map-literals.B.go similarity index 100% rename from test/fixtures/go/corpus/map-literals.B.go rename to semantic/test/fixtures/go/corpus/map-literals.B.go diff --git a/test/fixtures/go/corpus/map-literals.diffA-B.txt b/semantic/test/fixtures/go/corpus/map-literals.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/map-literals.diffA-B.txt rename to semantic/test/fixtures/go/corpus/map-literals.diffA-B.txt diff --git a/test/fixtures/go/corpus/map-literals.diffB-A.txt b/semantic/test/fixtures/go/corpus/map-literals.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/map-literals.diffB-A.txt rename to semantic/test/fixtures/go/corpus/map-literals.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/map-literals.parseA.txt b/semantic/test/fixtures/go/corpus/map-literals.parseA.txt new file mode 100644 index 0000000000..72d5e35ab2 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/map-literals.parseA.txt @@ -0,0 +1,32 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (KeyedElement + (Expression + (InterpretedStringLiteral)) + (Expression + (InterpretedStringLiteral))) + (KeyedElement + (Expression + (InterpretedStringLiteral)) + (Expression + (InterpretedStringLiteral)))) + (MapType + (Type + (SimpleType + (TypeIdentifier "string"))) + (Type + (SimpleType + (TypeIdentifier "string"))))))) + (Identifier "s"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/map-literals.parseB.txt b/semantic/test/fixtures/go/corpus/map-literals.parseB.txt new file mode 100644 index 0000000000..0ebdec04d0 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/map-literals.parseB.txt @@ -0,0 +1,32 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (KeyedElement + (Expression + (InterpretedStringLiteral)) + (Expression + (InterpretedStringLiteral))) + (KeyedElement + (Expression + (InterpretedStringLiteral)) + (Expression + (InterpretedStringLiteral)))) + (MapType + (Type + (SimpleType + (TypeIdentifier "int"))) + (Type + (SimpleType + (TypeIdentifier "string"))))))) + (Identifier "s"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/map-types.A.go b/semantic/test/fixtures/go/corpus/map-types.A.go similarity index 100% rename from test/fixtures/go/corpus/map-types.A.go rename to semantic/test/fixtures/go/corpus/map-types.A.go diff --git a/test/fixtures/go/corpus/map-types.B.go b/semantic/test/fixtures/go/corpus/map-types.B.go similarity index 100% rename from test/fixtures/go/corpus/map-types.B.go rename to semantic/test/fixtures/go/corpus/map-types.B.go diff --git a/test/fixtures/go/corpus/map-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/map-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/map-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/map-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/map-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/map-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/map-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/map-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/map-types.parseA.txt b/semantic/test/fixtures/go/corpus/map-types.parseA.txt new file mode 100644 index 0000000000..98c0a0e08b --- /dev/null +++ b/semantic/test/fixtures/go/corpus/map-types.parseA.txt @@ -0,0 +1,20 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "m1") + (Type + (SimpleType + (MapType + (Type + (SimpleType + (TypeIdentifier "error"))) + (Type + (SimpleType + (TypeIdentifier "string")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/map-types.parseB.txt b/semantic/test/fixtures/go/corpus/map-types.parseB.txt new file mode 100644 index 0000000000..21c7db5256 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/map-types.parseB.txt @@ -0,0 +1,20 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "m1") + (Type + (SimpleType + (MapType + (Type + (SimpleType + (TypeIdentifier "error"))) + (Type + (SimpleType + (TypeIdentifier "int")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/method-declarations.A.go b/semantic/test/fixtures/go/corpus/method-declarations.A.go similarity index 100% rename from test/fixtures/go/corpus/method-declarations.A.go rename to semantic/test/fixtures/go/corpus/method-declarations.A.go diff --git a/test/fixtures/go/corpus/method-declarations.B.go b/semantic/test/fixtures/go/corpus/method-declarations.B.go similarity index 100% rename from test/fixtures/go/corpus/method-declarations.B.go rename to semantic/test/fixtures/go/corpus/method-declarations.B.go diff --git a/test/fixtures/go/corpus/method-declarations.diffA-B.txt b/semantic/test/fixtures/go/corpus/method-declarations.diffA-B.txt similarity index 93% rename from test/fixtures/go/corpus/method-declarations.diffA-B.txt rename to semantic/test/fixtures/go/corpus/method-declarations.diffA-B.txt index 4074dfb9f3..25abf759f8 100644 --- a/test/fixtures/go/corpus/method-declarations.diffA-B.txt +++ b/semantic/test/fixtures/go/corpus/method-declarations.diffA-B.txt @@ -81,19 +81,13 @@ (Empty)))) (Method (Statements - (Assignment - (MemberAccess - (Identifier) - (Identifier)) + (AugmentedAssignment (Times (MemberAccess (Identifier) (Identifier)) (Identifier))) - (Assignment - (MemberAccess - (Identifier) - (Identifier)) + (AugmentedAssignment (Times (MemberAccess (Identifier) diff --git a/test/fixtures/go/corpus/method-declarations.diffB-A.txt b/semantic/test/fixtures/go/corpus/method-declarations.diffB-A.txt similarity index 93% rename from test/fixtures/go/corpus/method-declarations.diffB-A.txt rename to semantic/test/fixtures/go/corpus/method-declarations.diffB-A.txt index 81fecf9482..94c3ba73b3 100644 --- a/test/fixtures/go/corpus/method-declarations.diffB-A.txt +++ b/semantic/test/fixtures/go/corpus/method-declarations.diffB-A.txt @@ -81,19 +81,13 @@ (Empty)))) (Method (Statements - (Assignment - (MemberAccess - (Identifier) - (Identifier)) + (AugmentedAssignment (Times (MemberAccess (Identifier) (Identifier)) (Identifier))) - (Assignment - (MemberAccess - (Identifier) - (Identifier)) + (AugmentedAssignment (Times (MemberAccess (Identifier) diff --git a/semantic/test/fixtures/go/corpus/method-declarations.parseA.txt b/semantic/test/fixtures/go/corpus/method-declarations.parseA.txt new file mode 100644 index 0000000000..6c12e8f0e5 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/method-declarations.parseA.txt @@ -0,0 +1,153 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList)) + (MethodDeclaration + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "s"))))) + (FieldIdentifier "Method") + (ParameterList)) + (MethodDeclaration + (Block) + (SimpleType + (TypeIdentifier "bool")) + (ParameterList + (ParameterDeclaration + (Identifier "self") + (Type + (SimpleType + (TypeIdentifier "Person"))))) + (FieldIdentifier "Equals") + (ParameterList + (ParameterDeclaration + (Identifier "other") + (Type + (SimpleType + (TypeIdentifier "Person")))))) + (MethodDeclaration + (Block + (Statement + (ReturnStatement + (ExpressionList + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "Sqrt") + (Expression + (Identifier "math")))) + (ArgumentList + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (SelectorExpression + (FieldIdentifier "x") + (Expression + (Identifier "p")))) + (Expression + (SelectorExpression + (FieldIdentifier "x") + (Expression + (Identifier "p")))))) + (Expression + (BinaryExpression + (Token) + (Expression + (SelectorExpression + (FieldIdentifier "y") + (Expression + (Identifier "p")))) + (Expression + (SelectorExpression + (FieldIdentifier "y") + (Expression + (Identifier "p"))))))))))))))) + (SimpleType + (TypeIdentifier "float64")) + (ParameterList + (ParameterDeclaration + (Identifier "p") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Point")))))))) + (FieldIdentifier "Length") + (ParameterList)) + (MethodDeclaration + (Block + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (SelectorExpression + (FieldIdentifier "x") + (Expression + (Identifier "p"))))) + (ExpressionList + (Expression + (Identifier "factor")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (SelectorExpression + (FieldIdentifier "y") + (Expression + (Identifier "p"))))) + (ExpressionList + (Expression + (Identifier "factor"))))))) + (ParameterList + (ParameterDeclaration + (Identifier "p") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Point")))))))) + (FieldIdentifier "Scale") + (ParameterList + (ParameterDeclaration + (Identifier "factor") + (Type + (SimpleType + (TypeIdentifier "float64")))))) + (MethodDeclaration + (Block) + (SimpleType + (TypeIdentifier "bool")) + (ParameterList + (ParameterDeclaration + (Identifier "f") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Field")))))))) + (FieldIdentifier "Alive") + (ParameterList + (ParameterDeclaration + (Identifier "x") + (Token) + (Identifier "y") + (Type + (SimpleType + (TypeIdentifier "int"))))))) diff --git a/semantic/test/fixtures/go/corpus/method-declarations.parseB.txt b/semantic/test/fixtures/go/corpus/method-declarations.parseB.txt new file mode 100644 index 0000000000..025ebca3ed --- /dev/null +++ b/semantic/test/fixtures/go/corpus/method-declarations.parseB.txt @@ -0,0 +1,173 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList)) + (MethodDeclaration + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "s"))))) + (FieldIdentifier "Methods") + (ParameterList)) + (MethodDeclaration + (Block) + (SimpleType + (TypeIdentifier "bool")) + (ParameterList + (ParameterDeclaration + (Identifier "self") + (Type + (SimpleType + (TypeIdentifier "Num"))))) + (FieldIdentifier "Equals") + (ParameterList + (ParameterDeclaration + (Identifier "other") + (Type + (SimpleType + (TypeIdentifier "Num")))))) + (MethodDeclaration + (Block + (Statement + (ReturnStatement + (ExpressionList + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "Sqrt") + (Expression + (Identifier "math")))) + (ArgumentList + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "Pow") + (Expression + (Identifier "math")))) + (ArgumentList + (Expression + (SelectorExpression + (FieldIdentifier "x") + (Expression + (Identifier "p")))) + (Expression + (IntLiteral "2"))))) + (Expression + (SelectorExpression + (FieldIdentifier "x") + (Expression + (Identifier "p")))))) + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "Pow") + (Expression + (Identifier "math")))) + (ArgumentList + (Expression + (SelectorExpression + (FieldIdentifier "y") + (Expression + (Identifier "p")))) + (Expression + (IntLiteral "2"))))))) + (Expression + (SelectorExpression + (FieldIdentifier "y") + (Expression + (Identifier "p"))))))))))))) + (SimpleType + (TypeIdentifier "float64")) + (ParameterList + (ParameterDeclaration + (Identifier "p") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Point")))))))) + (FieldIdentifier "OtherLength") + (ParameterList)) + (MethodDeclaration + (Block + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (SelectorExpression + (FieldIdentifier "x") + (Expression + (Identifier "p"))))) + (ExpressionList + (Expression + (Identifier "factor")))))) + (Statement + (SimpleStatement + (AssignmentStatement + (Token) + (ExpressionList + (Expression + (SelectorExpression + (FieldIdentifier "y") + (Expression + (Identifier "p"))))) + (ExpressionList + (Expression + (Identifier "factor"))))))) + (ParameterList + (ParameterDeclaration + (Identifier "q") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Point")))))))) + (FieldIdentifier "Scale") + (ParameterList + (ParameterDeclaration + (Identifier "factor") + (Type + (SimpleType + (TypeIdentifier "int")))))) + (MethodDeclaration + (Block) + (SimpleType + (TypeIdentifier "bool")) + (ParameterList + (ParameterDeclaration + (Identifier "f") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Field")))))))) + (FieldIdentifier "Alive") + (ParameterList + (ParameterDeclaration + (Identifier "z") + (Token) + (Identifier "h") + (Type + (SimpleType + (TypeIdentifier "int"))))))) diff --git a/test/fixtures/go/corpus/modifying-struct-fields.A.go b/semantic/test/fixtures/go/corpus/modifying-struct-fields.A.go similarity index 100% rename from test/fixtures/go/corpus/modifying-struct-fields.A.go rename to semantic/test/fixtures/go/corpus/modifying-struct-fields.A.go diff --git a/test/fixtures/go/corpus/modifying-struct-fields.B.go b/semantic/test/fixtures/go/corpus/modifying-struct-fields.B.go similarity index 100% rename from test/fixtures/go/corpus/modifying-struct-fields.B.go rename to semantic/test/fixtures/go/corpus/modifying-struct-fields.B.go diff --git a/test/fixtures/go/corpus/modifying-struct-fields.diffA-B.txt b/semantic/test/fixtures/go/corpus/modifying-struct-fields.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/modifying-struct-fields.diffA-B.txt rename to semantic/test/fixtures/go/corpus/modifying-struct-fields.diffA-B.txt diff --git a/test/fixtures/go/corpus/modifying-struct-fields.diffB-A.txt b/semantic/test/fixtures/go/corpus/modifying-struct-fields.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/modifying-struct-fields.diffB-A.txt rename to semantic/test/fixtures/go/corpus/modifying-struct-fields.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/modifying-struct-fields.parseA.txt b/semantic/test/fixtures/go/corpus/modifying-struct-fields.parseA.txt new file mode 100644 index 0000000000..bac487601b --- /dev/null +++ b/semantic/test/fixtures/go/corpus/modifying-struct-fields.parseA.txt @@ -0,0 +1,25 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "ctx"))) + (ExpressionList + (Expression + (UnaryExpression + (Token) + (Expression + (CompositeLiteral + (LiteralValue + (KeyedElement + (FieldIdentifier "Remote") + (Expression + (Identifier "remote")))) + (TypeIdentifier "uploadContext")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/modifying-struct-fields.parseB.txt b/semantic/test/fixtures/go/corpus/modifying-struct-fields.parseB.txt new file mode 100644 index 0000000000..58615e05a0 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/modifying-struct-fields.parseB.txt @@ -0,0 +1,33 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "ctx"))) + (ExpressionList + (Expression + (UnaryExpression + (Token) + (Expression + (CompositeLiteral + (LiteralValue + (KeyedElement + (FieldIdentifier "trackedLocksMu") + (Expression + (CallExpression + (Expression + (Identifier "new")) + (ArgumentList + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "Mutex") + (PackageIdentifier "sync"))))))))) + (TypeIdentifier "uploadContext")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/parameter-declarations-with-types.A.go b/semantic/test/fixtures/go/corpus/parameter-declarations-with-types.A.go similarity index 100% rename from test/fixtures/go/corpus/parameter-declarations-with-types.A.go rename to semantic/test/fixtures/go/corpus/parameter-declarations-with-types.A.go diff --git a/test/fixtures/go/corpus/parameter-declarations-with-types.B.go b/semantic/test/fixtures/go/corpus/parameter-declarations-with-types.B.go similarity index 100% rename from test/fixtures/go/corpus/parameter-declarations-with-types.B.go rename to semantic/test/fixtures/go/corpus/parameter-declarations-with-types.B.go diff --git a/test/fixtures/go/corpus/parameter-declarations-with-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/parameter-declarations-with-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/parameter-declarations-with-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/parameter-declarations-with-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/parameter-declarations-with-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/parameter-declarations-with-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/parameter-declarations-with-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/parameter-declarations-with-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/parameter-declarations-with-types.parseA.txt b/semantic/test/fixtures/go/corpus/parameter-declarations-with-types.parseA.txt new file mode 100644 index 0000000000..63a16360c4 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/parameter-declarations-with-types.parseA.txt @@ -0,0 +1,21 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList)) + (FunctionDeclaration + (Block) + (Identifier "foo") + (ParameterList + (ParameterDeclaration + (Identifier "a") + (Type + (SimpleType + (TypeIdentifier "int")))) + (ParameterDeclaration + (Identifier "b") + (Type + (SimpleType + (TypeIdentifier "string"))))))) diff --git a/semantic/test/fixtures/go/corpus/parameter-declarations-with-types.parseB.txt b/semantic/test/fixtures/go/corpus/parameter-declarations-with-types.parseB.txt new file mode 100644 index 0000000000..7dcf23aba0 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/parameter-declarations-with-types.parseB.txt @@ -0,0 +1,21 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList)) + (FunctionDeclaration + (Block) + (Identifier "foo") + (ParameterList + (ParameterDeclaration + (Identifier "x") + (Type + (SimpleType + (TypeIdentifier "string")))) + (ParameterDeclaration + (Identifier "y") + (Type + (SimpleType + (TypeIdentifier "uint64"))))))) diff --git a/test/fixtures/go/corpus/pointer-types.A.go b/semantic/test/fixtures/go/corpus/pointer-types.A.go similarity index 100% rename from test/fixtures/go/corpus/pointer-types.A.go rename to semantic/test/fixtures/go/corpus/pointer-types.A.go diff --git a/test/fixtures/go/corpus/pointer-types.B.go b/semantic/test/fixtures/go/corpus/pointer-types.B.go similarity index 100% rename from test/fixtures/go/corpus/pointer-types.B.go rename to semantic/test/fixtures/go/corpus/pointer-types.B.go diff --git a/test/fixtures/go/corpus/pointer-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/pointer-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/pointer-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/pointer-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/pointer-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/pointer-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/pointer-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/pointer-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/pointer-types.parseA.txt b/semantic/test/fixtures/go/corpus/pointer-types.parseA.txt new file mode 100644 index 0000000000..0f55ef7242 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/pointer-types.parseA.txt @@ -0,0 +1,28 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "p1") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "string"))))))) + (TypeSpec + (TypeIdentifier "p2") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "p1"))))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/pointer-types.parseB.txt b/semantic/test/fixtures/go/corpus/pointer-types.parseB.txt new file mode 100644 index 0000000000..0141010fda --- /dev/null +++ b/semantic/test/fixtures/go/corpus/pointer-types.parseB.txt @@ -0,0 +1,28 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "p1") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "int"))))))) + (TypeSpec + (TypeIdentifier "p2") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "p3"))))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/qualified-types.A.go b/semantic/test/fixtures/go/corpus/qualified-types.A.go similarity index 100% rename from test/fixtures/go/corpus/qualified-types.A.go rename to semantic/test/fixtures/go/corpus/qualified-types.A.go diff --git a/test/fixtures/go/corpus/qualified-types.B.go b/semantic/test/fixtures/go/corpus/qualified-types.B.go similarity index 100% rename from test/fixtures/go/corpus/qualified-types.B.go rename to semantic/test/fixtures/go/corpus/qualified-types.B.go diff --git a/test/fixtures/go/corpus/qualified-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/qualified-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/qualified-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/qualified-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/qualified-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/qualified-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/qualified-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/qualified-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/qualified-types.parseA.txt b/semantic/test/fixtures/go/corpus/qualified-types.parseA.txt new file mode 100644 index 0000000000..1a65541432 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/qualified-types.parseA.txt @@ -0,0 +1,16 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "a") + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "c") + (PackageIdentifier "b")))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/qualified-types.parseB.txt b/semantic/test/fixtures/go/corpus/qualified-types.parseB.txt new file mode 100644 index 0000000000..1a7709e39a --- /dev/null +++ b/semantic/test/fixtures/go/corpus/qualified-types.parseB.txt @@ -0,0 +1,16 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "x") + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "z") + (PackageIdentifier "y")))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/rune-literals.A.go b/semantic/test/fixtures/go/corpus/rune-literals.A.go similarity index 100% rename from test/fixtures/go/corpus/rune-literals.A.go rename to semantic/test/fixtures/go/corpus/rune-literals.A.go diff --git a/test/fixtures/go/corpus/rune-literals.B.go b/semantic/test/fixtures/go/corpus/rune-literals.B.go similarity index 100% rename from test/fixtures/go/corpus/rune-literals.B.go rename to semantic/test/fixtures/go/corpus/rune-literals.B.go diff --git a/test/fixtures/go/corpus/rune-literals.diffA-B.txt b/semantic/test/fixtures/go/corpus/rune-literals.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/rune-literals.diffA-B.txt rename to semantic/test/fixtures/go/corpus/rune-literals.diffA-B.txt diff --git a/test/fixtures/go/corpus/rune-literals.diffB-A.txt b/semantic/test/fixtures/go/corpus/rune-literals.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/rune-literals.diffB-A.txt rename to semantic/test/fixtures/go/corpus/rune-literals.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/rune-literals.parseA.txt b/semantic/test/fixtures/go/corpus/rune-literals.parseA.txt new file mode 100644 index 0000000000..5046c08786 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/rune-literals.parseA.txt @@ -0,0 +1,34 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\948'"))) + (Identifier "a")) + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\8984'"))) + (Identifier "b")) + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\8984'"))) + (Identifier "c")) + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\8984'"))) + (Identifier "d")) + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\8984'"))) + (Identifier "e")) + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\8984'"))) + (Identifier "f")))) diff --git a/semantic/test/fixtures/go/corpus/rune-literals.parseB.txt b/semantic/test/fixtures/go/corpus/rune-literals.parseB.txt new file mode 100644 index 0000000000..55fc61ae05 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/rune-literals.parseB.txt @@ -0,0 +1,34 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\169'"))) + (Identifier "a")) + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\169'"))) + (Identifier "b")) + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\169'"))) + (Identifier "c")) + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\169'"))) + (Identifier "d")) + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\169'"))) + (Identifier "e")) + (ConstSpec + (ExpressionList + (Expression + (RuneLiteral "'\169'"))) + (Identifier "f")))) diff --git a/test/fixtures/go/corpus/select-statements.A.go b/semantic/test/fixtures/go/corpus/select-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/select-statements.A.go rename to semantic/test/fixtures/go/corpus/select-statements.A.go diff --git a/test/fixtures/go/corpus/select-statements.B.go b/semantic/test/fixtures/go/corpus/select-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/select-statements.B.go rename to semantic/test/fixtures/go/corpus/select-statements.B.go diff --git a/test/fixtures/go/corpus/select-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/select-statements.diffA-B.txt similarity index 94% rename from test/fixtures/go/corpus/select-statements.diffA-B.txt rename to semantic/test/fixtures/go/corpus/select-statements.diffA-B.txt index a23f11fec0..fb62a6aaa5 100644 --- a/test/fixtures/go/corpus/select-statements.diffA-B.txt +++ b/semantic/test/fixtures/go/corpus/select-statements.diffA-B.txt @@ -73,9 +73,7 @@ {-(Return {-(Empty)-})-})-} {-(Empty)-})-})) - (Pattern - (DefaultPattern - (Statements)) + (DefaultPattern (Return (Empty))))) (Select @@ -93,7 +91,5 @@ (ReceiveOperator (Identifier))) (Statements)) - {-(Pattern - {-(DefaultPattern - {-(Statements)-})-} + {-(DefaultPattern {-(Statements)-})-}))))) diff --git a/test/fixtures/go/corpus/select-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/select-statements.diffB-A.txt similarity index 94% rename from test/fixtures/go/corpus/select-statements.diffB-A.txt rename to semantic/test/fixtures/go/corpus/select-statements.diffB-A.txt index 1376b0bda6..6bf01a75bc 100644 --- a/test/fixtures/go/corpus/select-statements.diffB-A.txt +++ b/semantic/test/fixtures/go/corpus/select-statements.diffB-A.txt @@ -73,9 +73,7 @@ {-(Return {-(Empty)-})-})-} {-(Empty)-})-})) - (Pattern - (DefaultPattern - (Statements)) + (DefaultPattern (Return (Empty))))) (Select @@ -93,7 +91,5 @@ (ReceiveOperator (Identifier))) (Statements)) - {+(Pattern - {+(DefaultPattern - {+(Statements)+})+} + {+(DefaultPattern {+(Statements)+})+}))))) diff --git a/semantic/test/fixtures/go/corpus/select-statements.parseA.txt b/semantic/test/fixtures/go/corpus/select-statements.parseA.txt new file mode 100644 index 0000000000..1284f25a97 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/select-statements.parseA.txt @@ -0,0 +1,114 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SelectStatement + (CommunicationCase + (ReceiveStatement + (ExpressionList + (Expression + (Identifier "x"))) + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "c"))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "println")) + (ArgumentList + (Expression + (Identifier "x")))))))) + (CommunicationCase + (SendStatement + (Expression + (Identifier "c")) + (Expression + (Identifier "y"))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "println")) + (ArgumentList + (Expression + (IntLiteral "5")))))))) + (CommunicationCase + (ReceiveStatement + (Expression + (UnaryExpression + (Token) + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "After") + (Expression + (Identifier "time")))) + (ArgumentList + (Expression + (IntLiteral "1")))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "println")) + (ArgumentList + (Expression + (IntLiteral "6"))))))) + (Statement + (SimpleStatement + (DecStatement + (Expression + (Identifier "n"))))) + (Statement + (IfStatement + (Block + (Statement + (SimpleStatement + (SendStatement + (Expression + (CompositeLiteral + (LiteralValue + (Element + (Expression + (Identifier "n"))) + (Element + (Expression + (Identifier "x")))) + (TypeIdentifier "result"))) + (Expression + (Identifier "waitDone"))))) + (Statement + (ReturnStatement))) + (Expression + (Identifier "x"))))) + (DefaultCase + (Statement + (ReturnStatement))))) + (Statement + (SelectStatement + (CommunicationCase + (ReceiveStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "ch")))))) + (CommunicationCase + (ReceiveStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "timeout")))))) + (DefaultCase)))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/select-statements.parseB.txt b/semantic/test/fixtures/go/corpus/select-statements.parseB.txt new file mode 100644 index 0000000000..90e08540ee --- /dev/null +++ b/semantic/test/fixtures/go/corpus/select-statements.parseB.txt @@ -0,0 +1,113 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SelectStatement + (CommunicationCase + (ReceiveStatement + (ExpressionList + (Expression + (Identifier "a"))) + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "c"))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "println")) + (ArgumentList + (Expression + (Identifier "x")))))))) + (CommunicationCase + (SendStatement + (Expression + (Identifier "c")) + (Expression + (Identifier "b"))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "println")) + (ArgumentList + (Expression + (IntLiteral "5")))))))) + (CommunicationCase + (ReceiveStatement + (Expression + (UnaryExpression + (Token) + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "After") + (Expression + (Identifier "time")))) + (ArgumentList + (Expression + (IntLiteral "2")))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "println")) + (ArgumentList + (Expression + (IntLiteral "6"))))))) + (Statement + (SimpleStatement + (IncStatement + (Expression + (Identifier "n"))))) + (Statement + (IfStatement + (Block + (Statement + (SimpleStatement + (SendStatement + (Expression + (CompositeLiteral + (LiteralValue + (Element + (Expression + (Identifier "n"))) + (Element + (Expression + (Identifier "v")))) + (TypeIdentifier "result"))) + (Expression + (Identifier "waitDone"))))) + (Statement + (ReturnStatement))) + (Expression + (Identifier "v"))))) + (DefaultCase + (Statement + (ReturnStatement))))) + (Statement + (SelectStatement + (CommunicationCase + (ReceiveStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "channel")))))) + (CommunicationCase + (ReceiveStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "timeout"))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/selector-expressions.A.go b/semantic/test/fixtures/go/corpus/selector-expressions.A.go similarity index 100% rename from test/fixtures/go/corpus/selector-expressions.A.go rename to semantic/test/fixtures/go/corpus/selector-expressions.A.go diff --git a/test/fixtures/go/corpus/selector-expressions.B.go b/semantic/test/fixtures/go/corpus/selector-expressions.B.go similarity index 100% rename from test/fixtures/go/corpus/selector-expressions.B.go rename to semantic/test/fixtures/go/corpus/selector-expressions.B.go diff --git a/test/fixtures/go/corpus/selector-expressions.diffA-B.txt b/semantic/test/fixtures/go/corpus/selector-expressions.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/selector-expressions.diffA-B.txt rename to semantic/test/fixtures/go/corpus/selector-expressions.diffA-B.txt diff --git a/test/fixtures/go/corpus/selector-expressions.diffB-A.txt b/semantic/test/fixtures/go/corpus/selector-expressions.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/selector-expressions.diffB-A.txt rename to semantic/test/fixtures/go/corpus/selector-expressions.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/selector-expressions.parseA.txt b/semantic/test/fixtures/go/corpus/selector-expressions.parseA.txt new file mode 100644 index 0000000000..c8e7b20c74 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/selector-expressions.parseA.txt @@ -0,0 +1,20 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "c") + (Expression + (SelectorExpression + (FieldIdentifier "b") + (Expression + (Identifier "a")))))) + (ArgumentList)))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/selector-expressions.parseB.txt b/semantic/test/fixtures/go/corpus/selector-expressions.parseB.txt new file mode 100644 index 0000000000..1d0c8e9840 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/selector-expressions.parseB.txt @@ -0,0 +1,20 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "z") + (Expression + (SelectorExpression + (FieldIdentifier "y") + (Expression + (Identifier "x")))))) + (ArgumentList)))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/send-statements.A.go b/semantic/test/fixtures/go/corpus/send-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/send-statements.A.go rename to semantic/test/fixtures/go/corpus/send-statements.A.go diff --git a/test/fixtures/go/corpus/send-statements.B.go b/semantic/test/fixtures/go/corpus/send-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/send-statements.B.go rename to semantic/test/fixtures/go/corpus/send-statements.B.go diff --git a/test/fixtures/go/corpus/send-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/send-statements.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/send-statements.diffA-B.txt rename to semantic/test/fixtures/go/corpus/send-statements.diffA-B.txt diff --git a/test/fixtures/go/corpus/send-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/send-statements.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/send-statements.diffB-A.txt rename to semantic/test/fixtures/go/corpus/send-statements.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/send-statements.parseA.txt b/semantic/test/fixtures/go/corpus/send-statements.parseA.txt new file mode 100644 index 0000000000..1dea04f02a --- /dev/null +++ b/semantic/test/fixtures/go/corpus/send-statements.parseA.txt @@ -0,0 +1,14 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (SendStatement + (Expression + (IntLiteral "5")) + (Expression + (Identifier "foo")))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/send-statements.parseB.txt b/semantic/test/fixtures/go/corpus/send-statements.parseB.txt new file mode 100644 index 0000000000..84c7aee1bc --- /dev/null +++ b/semantic/test/fixtures/go/corpus/send-statements.parseB.txt @@ -0,0 +1,14 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (SendStatement + (Expression + (IntLiteral "6")) + (Expression + (Identifier "bar")))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/short-var-declarations.A.go b/semantic/test/fixtures/go/corpus/short-var-declarations.A.go similarity index 100% rename from test/fixtures/go/corpus/short-var-declarations.A.go rename to semantic/test/fixtures/go/corpus/short-var-declarations.A.go diff --git a/test/fixtures/go/corpus/short-var-declarations.B.go b/semantic/test/fixtures/go/corpus/short-var-declarations.B.go similarity index 100% rename from test/fixtures/go/corpus/short-var-declarations.B.go rename to semantic/test/fixtures/go/corpus/short-var-declarations.B.go diff --git a/test/fixtures/go/corpus/short-var-declarations.diffA-B.txt b/semantic/test/fixtures/go/corpus/short-var-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/short-var-declarations.diffA-B.txt rename to semantic/test/fixtures/go/corpus/short-var-declarations.diffA-B.txt diff --git a/test/fixtures/go/corpus/short-var-declarations.diffB-A.txt b/semantic/test/fixtures/go/corpus/short-var-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/short-var-declarations.diffB-A.txt rename to semantic/test/fixtures/go/corpus/short-var-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/short-var-declarations.parseA.txt b/semantic/test/fixtures/go/corpus/short-var-declarations.parseA.txt new file mode 100644 index 0000000000..c4ac602a5a --- /dev/null +++ b/semantic/test/fixtures/go/corpus/short-var-declarations.parseA.txt @@ -0,0 +1,20 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "a")) + (Expression + (Identifier "b"))) + (ExpressionList + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/short-var-declarations.parseB.txt b/semantic/test/fixtures/go/corpus/short-var-declarations.parseB.txt new file mode 100644 index 0000000000..b518d37937 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/short-var-declarations.parseB.txt @@ -0,0 +1,20 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "x")) + (Expression + (Identifier "y"))) + (ExpressionList + (Expression + (IntLiteral "3")) + (Expression + (IntLiteral "4"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/single-import-declarations.A.go b/semantic/test/fixtures/go/corpus/single-import-declarations.A.go similarity index 100% rename from test/fixtures/go/corpus/single-import-declarations.A.go rename to semantic/test/fixtures/go/corpus/single-import-declarations.A.go diff --git a/test/fixtures/go/corpus/single-import-declarations.B.go b/semantic/test/fixtures/go/corpus/single-import-declarations.B.go similarity index 100% rename from test/fixtures/go/corpus/single-import-declarations.B.go rename to semantic/test/fixtures/go/corpus/single-import-declarations.B.go diff --git a/test/fixtures/go/corpus/single-import-declarations.diffA-B.txt b/semantic/test/fixtures/go/corpus/single-import-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/single-import-declarations.diffA-B.txt rename to semantic/test/fixtures/go/corpus/single-import-declarations.diffA-B.txt diff --git a/test/fixtures/go/corpus/single-import-declarations.diffB-A.txt b/semantic/test/fixtures/go/corpus/single-import-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/single-import-declarations.diffB-A.txt rename to semantic/test/fixtures/go/corpus/single-import-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/single-import-declarations.parseA.txt b/semantic/test/fixtures/go/corpus/single-import-declarations.parseA.txt new file mode 100644 index 0000000000..e330d34b3c --- /dev/null +++ b/semantic/test/fixtures/go/corpus/single-import-declarations.parseA.txt @@ -0,0 +1,18 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (ImportDeclaration + (ImportSpec + (InterpretedStringLiteral))) + (ImportDeclaration + (ImportSpec + (InterpretedStringLiteral) + (Dot "."))) + (ImportDeclaration + (ImportSpec + (InterpretedStringLiteral) + (PackageIdentifier "alias"))) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/single-import-declarations.parseB.txt b/semantic/test/fixtures/go/corpus/single-import-declarations.parseB.txt new file mode 100644 index 0000000000..e330d34b3c --- /dev/null +++ b/semantic/test/fixtures/go/corpus/single-import-declarations.parseB.txt @@ -0,0 +1,18 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (ImportDeclaration + (ImportSpec + (InterpretedStringLiteral))) + (ImportDeclaration + (ImportSpec + (InterpretedStringLiteral) + (Dot "."))) + (ImportDeclaration + (ImportSpec + (InterpretedStringLiteral) + (PackageIdentifier "alias"))) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/switch-statement.parseA.txt b/semantic/test/fixtures/go/corpus/single-import-declarationsA.parseA.txt similarity index 100% rename from test/fixtures/go/corpus/switch-statement.parseA.txt rename to semantic/test/fixtures/go/corpus/single-import-declarationsA.parseA.txt diff --git a/test/fixtures/go/corpus/single-line-function-declarations.A.go b/semantic/test/fixtures/go/corpus/single-line-function-declarations.A.go similarity index 100% rename from test/fixtures/go/corpus/single-line-function-declarations.A.go rename to semantic/test/fixtures/go/corpus/single-line-function-declarations.A.go diff --git a/test/fixtures/go/corpus/single-line-function-declarations.B.go b/semantic/test/fixtures/go/corpus/single-line-function-declarations.B.go similarity index 100% rename from test/fixtures/go/corpus/single-line-function-declarations.B.go rename to semantic/test/fixtures/go/corpus/single-line-function-declarations.B.go diff --git a/test/fixtures/go/corpus/single-line-function-declarations.diffA-B.txt b/semantic/test/fixtures/go/corpus/single-line-function-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/single-line-function-declarations.diffA-B.txt rename to semantic/test/fixtures/go/corpus/single-line-function-declarations.diffA-B.txt diff --git a/test/fixtures/go/corpus/single-line-function-declarations.diffB-A.txt b/semantic/test/fixtures/go/corpus/single-line-function-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/single-line-function-declarations.diffB-A.txt rename to semantic/test/fixtures/go/corpus/single-line-function-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/single-line-function-declarations.parseA.txt b/semantic/test/fixtures/go/corpus/single-line-function-declarations.parseA.txt new file mode 100644 index 0000000000..740476dcc8 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/single-line-function-declarations.parseA.txt @@ -0,0 +1,54 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList)) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList)))))) + (Identifier "f1") + (ParameterList)) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList)))))) + (Identifier "f2") + (ParameterList)) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList)))))) + (Identifier "f3") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/single-line-function-declarations.parseB.txt b/semantic/test/fixtures/go/corpus/single-line-function-declarations.parseB.txt new file mode 100644 index 0000000000..09ac15df47 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/single-line-function-declarations.parseB.txt @@ -0,0 +1,54 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList)) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList)))))) + (Identifier "g1") + (ParameterList)) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList)))))) + (Identifier "g2") + (ParameterList)) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (ArgumentList)))))) + (Identifier "g3") + (ParameterList))) diff --git a/test/fixtures/go/corpus/slice-expressions.A.go b/semantic/test/fixtures/go/corpus/slice-expressions.A.go similarity index 100% rename from test/fixtures/go/corpus/slice-expressions.A.go rename to semantic/test/fixtures/go/corpus/slice-expressions.A.go diff --git a/test/fixtures/go/corpus/slice-expressions.B.go b/semantic/test/fixtures/go/corpus/slice-expressions.B.go similarity index 100% rename from test/fixtures/go/corpus/slice-expressions.B.go rename to semantic/test/fixtures/go/corpus/slice-expressions.B.go diff --git a/test/fixtures/go/corpus/slice-expressions.diffA-B.txt b/semantic/test/fixtures/go/corpus/slice-expressions.diffA-B.txt similarity index 80% rename from test/fixtures/go/corpus/slice-expressions.diffA-B.txt rename to semantic/test/fixtures/go/corpus/slice-expressions.diffA-B.txt index 1b3474cdd5..9cd3c111e6 100644 --- a/test/fixtures/go/corpus/slice-expressions.diffA-B.txt +++ b/semantic/test/fixtures/go/corpus/slice-expressions.diffA-B.txt @@ -27,14 +27,16 @@ ->(Integer) } { (Empty) ->(Integer) }) - (Slice - { (Identifier) - ->(Identifier) } - { (Empty) - ->(Integer) } - { (Integer) - ->(Integer) } - (Empty)) + {+(Slice + {+(Identifier)+} + {+(Integer)+} + {+(Integer)+} + {+(Empty)+})+} + {-(Slice + {-(Identifier)-} + {-(Empty)-} + {-(Integer)-} + {-(Empty)-})-} {-(Slice {-(Identifier)-} {-(Empty)-} diff --git a/test/fixtures/go/corpus/slice-expressions.diffB-A.txt b/semantic/test/fixtures/go/corpus/slice-expressions.diffB-A.txt similarity index 80% rename from test/fixtures/go/corpus/slice-expressions.diffB-A.txt rename to semantic/test/fixtures/go/corpus/slice-expressions.diffB-A.txt index cc6efa0bdb..119edbf361 100644 --- a/test/fixtures/go/corpus/slice-expressions.diffB-A.txt +++ b/semantic/test/fixtures/go/corpus/slice-expressions.diffB-A.txt @@ -19,23 +19,21 @@ {+(Empty)+} {+(Empty)+} {+(Empty)+})+} - {+(Slice - {+(Identifier)+} - {+(Integer)+} - {+(Integer)+} - {+(Integer)+})+} (Slice { (Identifier) ->(Identifier) } (Integer) { (Empty) ->(Integer) } + { (Empty) + ->(Integer) }) + (Slice + { (Identifier) + ->(Identifier) } + { (Empty) + ->(Integer) } + (Integer) (Empty)) - {-(Slice - {-(Identifier)-} - {-(Empty)-} - {-(Integer)-} - {-(Empty)-})-} {-(Slice {-(Identifier)-} {-(Integer)-} diff --git a/semantic/test/fixtures/go/corpus/slice-expressions.parseA.txt b/semantic/test/fixtures/go/corpus/slice-expressions.parseA.txt new file mode 100644 index 0000000000..229a0e853e --- /dev/null +++ b/semantic/test/fixtures/go/corpus/slice-expressions.parseA.txt @@ -0,0 +1,51 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (SliceExpression + (Expression + (IntLiteral "2")) + (Expression + (Identifier "a")))))) + (Statement + (SimpleStatement + (Expression + (SliceExpression + (Expression + (IntLiteral "3")) + (Expression + (Identifier "b")))))) + (Statement + (SimpleStatement + (Expression + (SliceExpression + (Expression + (Identifier "c")))))) + (Statement + (SimpleStatement + (Expression + (SliceExpression + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "3")) + (Expression + (IntLiteral "2")) + (Expression + (Identifier "d")))))) + (Statement + (SimpleStatement + (Expression + (SliceExpression + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2")) + (Expression + (Identifier "e"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/slice-expressions.parseB.txt b/semantic/test/fixtures/go/corpus/slice-expressions.parseB.txt new file mode 100644 index 0000000000..b4a631c007 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/slice-expressions.parseB.txt @@ -0,0 +1,55 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (SliceExpression + (Expression + (IntLiteral "1")) + (Expression + (Identifier "a")))))) + (Statement + (SimpleStatement + (Expression + (SliceExpression + (Expression + (IntLiteral "2")) + (Expression + (Identifier "b")))))) + (Statement + (SimpleStatement + (Expression + (SliceExpression + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2")) + (Expression + (Identifier "c")))))) + (Statement + (SimpleStatement + (Expression + (SliceExpression + (Expression + (IntLiteral "2")) + (Expression + (IntLiteral "4")) + (Expression + (IntLiteral "1")) + (Expression + (Identifier "d")))))) + (Statement + (SimpleStatement + (Expression + (SliceExpression + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2")) + (Expression + (Identifier "f"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/slice-literals.A.go b/semantic/test/fixtures/go/corpus/slice-literals.A.go similarity index 100% rename from test/fixtures/go/corpus/slice-literals.A.go rename to semantic/test/fixtures/go/corpus/slice-literals.A.go diff --git a/test/fixtures/go/corpus/slice-literals.B.go b/semantic/test/fixtures/go/corpus/slice-literals.B.go similarity index 100% rename from test/fixtures/go/corpus/slice-literals.B.go rename to semantic/test/fixtures/go/corpus/slice-literals.B.go diff --git a/test/fixtures/go/corpus/slice-literals.diffA-B.txt b/semantic/test/fixtures/go/corpus/slice-literals.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/slice-literals.diffA-B.txt rename to semantic/test/fixtures/go/corpus/slice-literals.diffA-B.txt diff --git a/test/fixtures/go/corpus/slice-literals.diffB-A.txt b/semantic/test/fixtures/go/corpus/slice-literals.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/slice-literals.diffB-A.txt rename to semantic/test/fixtures/go/corpus/slice-literals.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/slice-literals.parseA.txt b/semantic/test/fixtures/go/corpus/slice-literals.parseA.txt new file mode 100644 index 0000000000..dbd057c98c --- /dev/null +++ b/semantic/test/fixtures/go/corpus/slice-literals.parseA.txt @@ -0,0 +1,52 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue) + (SliceType + (Type + (SimpleType + (TypeIdentifier "string"))))))) + (Identifier "s1")))) + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (Element + (Expression + (InterpretedStringLiteral)))) + (SliceType + (Type + (SimpleType + (TypeIdentifier "string"))))))) + (Identifier "s2")))) + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (Element + (Expression + (InterpretedStringLiteral))) + (Element + (Expression + (InterpretedStringLiteral)))) + (SliceType + (Type + (SimpleType + (TypeIdentifier "string"))))))) + (Identifier "s3"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/slice-literals.parseB.txt b/semantic/test/fixtures/go/corpus/slice-literals.parseB.txt new file mode 100644 index 0000000000..39355068f3 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/slice-literals.parseB.txt @@ -0,0 +1,55 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (Element + (Expression + (InterpretedStringLiteral)))) + (SliceType + (Type + (SimpleType + (TypeIdentifier "string"))))))) + (Identifier "s1")))) + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (Element + (Expression + (InterpretedStringLiteral)))) + (SliceType + (Type + (SimpleType + (TypeIdentifier "string"))))))) + (Identifier "s2")))) + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (Element + (Expression + (InterpretedStringLiteral))) + (Element + (Expression + (InterpretedStringLiteral)))) + (SliceType + (Type + (SimpleType + (TypeIdentifier "string"))))))) + (Identifier "s3"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/slice-types.A.go b/semantic/test/fixtures/go/corpus/slice-types.A.go similarity index 100% rename from test/fixtures/go/corpus/slice-types.A.go rename to semantic/test/fixtures/go/corpus/slice-types.A.go diff --git a/test/fixtures/go/corpus/slice-types.B.go b/semantic/test/fixtures/go/corpus/slice-types.B.go similarity index 100% rename from test/fixtures/go/corpus/slice-types.B.go rename to semantic/test/fixtures/go/corpus/slice-types.B.go diff --git a/test/fixtures/go/corpus/slice-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/slice-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/slice-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/slice-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/slice-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/slice-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/slice-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/slice-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/slice-types.parseA.txt b/semantic/test/fixtures/go/corpus/slice-types.parseA.txt new file mode 100644 index 0000000000..e4de31039b --- /dev/null +++ b/semantic/test/fixtures/go/corpus/slice-types.parseA.txt @@ -0,0 +1,30 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "a") + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (TypeIdentifier "b"))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "c") + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (TypeIdentifier "d"))))))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/slice-types.parseB.txt b/semantic/test/fixtures/go/corpus/slice-types.parseB.txt new file mode 100644 index 0000000000..233d43acc2 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/slice-types.parseB.txt @@ -0,0 +1,30 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "a") + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (TypeIdentifier "p")))))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "c") + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (TypeIdentifier "y")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/string-literals.A.go b/semantic/test/fixtures/go/corpus/string-literals.A.go similarity index 100% rename from test/fixtures/go/corpus/string-literals.A.go rename to semantic/test/fixtures/go/corpus/string-literals.A.go diff --git a/test/fixtures/go/corpus/string-literals.B.go b/semantic/test/fixtures/go/corpus/string-literals.B.go similarity index 100% rename from test/fixtures/go/corpus/string-literals.B.go rename to semantic/test/fixtures/go/corpus/string-literals.B.go diff --git a/test/fixtures/go/corpus/string-literals.diffA-B.txt b/semantic/test/fixtures/go/corpus/string-literals.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/string-literals.diffA-B.txt rename to semantic/test/fixtures/go/corpus/string-literals.diffA-B.txt diff --git a/test/fixtures/go/corpus/string-literals.diffB-A.txt b/semantic/test/fixtures/go/corpus/string-literals.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/string-literals.diffB-A.txt rename to semantic/test/fixtures/go/corpus/string-literals.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/string-literals.parseA.txt b/semantic/test/fixtures/go/corpus/string-literals.parseA.txt new file mode 100644 index 0000000000..0ce4825656 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/string-literals.parseA.txt @@ -0,0 +1,19 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (InterpretedStringLiteral))) + (Identifier "a")) + (ConstSpec + (ExpressionList + (Expression + (InterpretedStringLiteral))) + (Identifier "b"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/string-literals.parseB.txt b/semantic/test/fixtures/go/corpus/string-literals.parseB.txt new file mode 100644 index 0000000000..0ce4825656 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/string-literals.parseB.txt @@ -0,0 +1,19 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (InterpretedStringLiteral))) + (Identifier "a")) + (ConstSpec + (ExpressionList + (Expression + (InterpretedStringLiteral))) + (Identifier "b"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/struct-field-declarations.A.go b/semantic/test/fixtures/go/corpus/struct-field-declarations.A.go similarity index 100% rename from test/fixtures/go/corpus/struct-field-declarations.A.go rename to semantic/test/fixtures/go/corpus/struct-field-declarations.A.go diff --git a/test/fixtures/go/corpus/struct-field-declarations.B.go b/semantic/test/fixtures/go/corpus/struct-field-declarations.B.go similarity index 100% rename from test/fixtures/go/corpus/struct-field-declarations.B.go rename to semantic/test/fixtures/go/corpus/struct-field-declarations.B.go diff --git a/test/fixtures/go/corpus/struct-field-declarations.diffA-B.txt b/semantic/test/fixtures/go/corpus/struct-field-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/struct-field-declarations.diffA-B.txt rename to semantic/test/fixtures/go/corpus/struct-field-declarations.diffA-B.txt diff --git a/test/fixtures/go/corpus/struct-field-declarations.diffB-A.txt b/semantic/test/fixtures/go/corpus/struct-field-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/struct-field-declarations.diffB-A.txt rename to semantic/test/fixtures/go/corpus/struct-field-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/struct-field-declarations.parseA.txt b/semantic/test/fixtures/go/corpus/struct-field-declarations.parseA.txt new file mode 100644 index 0000000000..a180f2200d --- /dev/null +++ b/semantic/test/fixtures/go/corpus/struct-field-declarations.parseA.txt @@ -0,0 +1,18 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "s3") + (Type + (SimpleType + (StructType + (FieldDeclarationList + (FieldDeclaration + (FieldIdentifier "g") + (TypeIdentifier "int")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/struct-field-declarations.parseB.txt b/semantic/test/fixtures/go/corpus/struct-field-declarations.parseB.txt new file mode 100644 index 0000000000..7c64bc2801 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/struct-field-declarations.parseB.txt @@ -0,0 +1,20 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "s3") + (Type + (SimpleType + (StructType + (FieldDeclarationList + (FieldDeclaration + (FieldIdentifier "h") + (Token) + (FieldIdentifier "i") + (TypeIdentifier "int")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/struct-literals.A.go b/semantic/test/fixtures/go/corpus/struct-literals.A.go similarity index 100% rename from test/fixtures/go/corpus/struct-literals.A.go rename to semantic/test/fixtures/go/corpus/struct-literals.A.go diff --git a/test/fixtures/go/corpus/struct-literals.B.go b/semantic/test/fixtures/go/corpus/struct-literals.B.go similarity index 100% rename from test/fixtures/go/corpus/struct-literals.B.go rename to semantic/test/fixtures/go/corpus/struct-literals.B.go diff --git a/test/fixtures/go/corpus/struct-literals.diffA-B.txt b/semantic/test/fixtures/go/corpus/struct-literals.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/struct-literals.diffA-B.txt rename to semantic/test/fixtures/go/corpus/struct-literals.diffA-B.txt diff --git a/test/fixtures/go/corpus/struct-literals.diffB-A.txt b/semantic/test/fixtures/go/corpus/struct-literals.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/struct-literals.diffB-A.txt rename to semantic/test/fixtures/go/corpus/struct-literals.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/struct-literals.parseA.txt b/semantic/test/fixtures/go/corpus/struct-literals.parseA.txt new file mode 100644 index 0000000000..61f00b6ecc --- /dev/null +++ b/semantic/test/fixtures/go/corpus/struct-literals.parseA.txt @@ -0,0 +1,52 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (KeyedElement + (FieldIdentifier "name") + (Expression + (InterpretedStringLiteral))) + (KeyedElement + (FieldIdentifier "Age") + (Expression + (InterpretedStringLiteral)))) + (TypeIdentifier "Person")))) + (Identifier "s1")))) + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (KeyedElement + (FieldIdentifier "i") + (Expression + (IntLiteral "5")))) + (StructType + (FieldDeclarationList + (FieldDeclaration + (FieldIdentifier "i") + (TypeIdentifier "int"))))))) + (Identifier "s2")))) + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue) + (QualifiedType + (TypeIdentifier "Time") + (PackageIdentifier "time"))))) + (Identifier "s3"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/struct-literals.parseB.txt b/semantic/test/fixtures/go/corpus/struct-literals.parseB.txt new file mode 100644 index 0000000000..05b97511aa --- /dev/null +++ b/semantic/test/fixtures/go/corpus/struct-literals.parseB.txt @@ -0,0 +1,52 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (KeyedElement + (FieldIdentifier "name") + (Expression + (InterpretedStringLiteral))) + (KeyedElement + (FieldIdentifier "Age") + (Expression + (InterpretedStringLiteral)))) + (TypeIdentifier "Dog")))) + (Identifier "s1")))) + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue + (KeyedElement + (FieldIdentifier "j") + (Expression + (IntLiteral "6")))) + (StructType + (FieldDeclarationList + (FieldDeclaration + (FieldIdentifier "i") + (TypeIdentifier "float"))))))) + (Identifier "s2")))) + (Statement + (ConstDeclaration + (ConstSpec + (ExpressionList + (Expression + (CompositeLiteral + (LiteralValue) + (QualifiedType + (TypeIdentifier "Month") + (PackageIdentifier "time"))))) + (Identifier "s3"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/struct-types.A.go b/semantic/test/fixtures/go/corpus/struct-types.A.go similarity index 100% rename from test/fixtures/go/corpus/struct-types.A.go rename to semantic/test/fixtures/go/corpus/struct-types.A.go diff --git a/test/fixtures/go/corpus/struct-types.B.go b/semantic/test/fixtures/go/corpus/struct-types.B.go similarity index 100% rename from test/fixtures/go/corpus/struct-types.B.go rename to semantic/test/fixtures/go/corpus/struct-types.B.go diff --git a/test/fixtures/go/corpus/struct-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/struct-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/struct-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/struct-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/struct-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/struct-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/struct-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/struct-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/struct-types.parseA.txt b/semantic/test/fixtures/go/corpus/struct-types.parseA.txt new file mode 100644 index 0000000000..334ad4e29f --- /dev/null +++ b/semantic/test/fixtures/go/corpus/struct-types.parseA.txt @@ -0,0 +1,54 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "s1") + (Type + (SimpleType + (StructType + (FieldDeclarationList))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "s2") + (Type + (SimpleType + (StructType + (FieldDeclarationList + (FieldDeclaration + (TypeIdentifier "Person"))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "s3") + (Type + (SimpleType + (StructType + (FieldDeclarationList + (FieldDeclaration + (FieldIdentifier "f") + (Token) + (FieldIdentifier "g") + (TypeIdentifier "int"))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "s4") + (Type + (SimpleType + (StructType + (FieldDeclarationList + (FieldDeclaration + (QualifiedType + (TypeIdentifier "s1") + (PackageIdentifier "p"))) + (FieldDeclaration + (RawStringLiteral "`json:\"h\"`") + (FieldIdentifier "h") + (TypeIdentifier "int")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/struct-types.parseB.txt b/semantic/test/fixtures/go/corpus/struct-types.parseB.txt new file mode 100644 index 0000000000..2b49f4b39f --- /dev/null +++ b/semantic/test/fixtures/go/corpus/struct-types.parseB.txt @@ -0,0 +1,54 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "t1") + (Type + (SimpleType + (StructType + (FieldDeclarationList))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "t2") + (Type + (SimpleType + (StructType + (FieldDeclarationList + (FieldDeclaration + (TypeIdentifier "Person"))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "t3") + (Type + (SimpleType + (StructType + (FieldDeclarationList + (FieldDeclaration + (FieldIdentifier "f") + (Token) + (FieldIdentifier "g") + (TypeIdentifier "int"))))))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "t4") + (Type + (SimpleType + (StructType + (FieldDeclarationList + (FieldDeclaration + (QualifiedType + (TypeIdentifier "s1") + (PackageIdentifier "p"))) + (FieldDeclaration + (RawStringLiteral "`json:\"h\"`") + (FieldIdentifier "h") + (TypeIdentifier "int")))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/haskell/corpus/blank.A.hs b/semantic/test/fixtures/go/corpus/switch-statement.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/blank.A.hs rename to semantic/test/fixtures/go/corpus/switch-statement.parseA.txt diff --git a/test/fixtures/go/corpus/switch-statements.A.go b/semantic/test/fixtures/go/corpus/switch-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/switch-statements.A.go rename to semantic/test/fixtures/go/corpus/switch-statements.A.go diff --git a/test/fixtures/go/corpus/switch-statements.B.go b/semantic/test/fixtures/go/corpus/switch-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/switch-statements.B.go rename to semantic/test/fixtures/go/corpus/switch-statements.B.go diff --git a/semantic/test/fixtures/go/corpus/switch-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/switch-statements.diffA-B.txt new file mode 100644 index 0000000000..9291dbf7a9 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/switch-statements.diffA-B.txt @@ -0,0 +1,45 @@ +(Statements + (Package + (Identifier)) + (Function + (Identifier) + (Match + (Statements) + (Pattern + (Statements + (LessThan + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Call + (Identifier) + (Statements) + (Empty))) + (Pattern + (Statements + (LessThan + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + {-(Context + {-(Comment)-} + (Call + (Identifier) + (Statements) + (Empty)))-}) + {-(Context + {-(Comment)-} + (Pattern + (Statements + (Equal + { (Identifier) + ->(Identifier) } + (Integer)) + (Call + { (Identifier) + ->(Identifier) } + (Statements) + (Empty))) + (Statements)))-}))))) diff --git a/semantic/test/fixtures/go/corpus/switch-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/switch-statements.diffB-A.txt new file mode 100644 index 0000000000..312d208a17 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/switch-statements.diffB-A.txt @@ -0,0 +1,45 @@ +(Statements + (Package + (Identifier)) + (Function + (Identifier) + (Match + (Statements) + (Pattern + (Statements + (LessThan + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Call + (Identifier) + (Statements) + (Empty))) + (Pattern + (Statements + (LessThan + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + {+(Context + {+(Comment)+} + (Call + (Identifier) + (Statements) + (Empty)))+}) + {+(Context + {+(Comment)+} + (Pattern + (Statements + (Equal + { (Identifier) + ->(Identifier) } + (Integer)) + (Call + { (Identifier) + ->(Identifier) } + (Statements) + (Empty))) + (Statements)))+}))))) diff --git a/semantic/test/fixtures/go/corpus/switch-statements.parseA.txt b/semantic/test/fixtures/go/corpus/switch-statements.parseA.txt new file mode 100644 index 0000000000..6d8d4d5d56 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/switch-statements.parseA.txt @@ -0,0 +1,57 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ExpressionSwitchStatement + (ExpressionCase + (ExpressionList + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (Identifier "y"))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "f1")) + (ArgumentList)))))) + (ExpressionCase + (ExpressionList + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (Identifier "z"))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "g")) + (ArgumentList)))))) + (ExpressionCase + (ExpressionList + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (IntLiteral "4"))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "h")) + (ArgumentList))))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/switch-statements.parseB.txt b/semantic/test/fixtures/go/corpus/switch-statements.parseB.txt new file mode 100644 index 0000000000..0019c6854b --- /dev/null +++ b/semantic/test/fixtures/go/corpus/switch-statements.parseB.txt @@ -0,0 +1,57 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (ExpressionSwitchStatement + (ExpressionCase + (ExpressionList + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "a")) + (Expression + (Identifier "b"))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "f1")) + (ArgumentList)))))) + (ExpressionCase + (ExpressionList + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "c")) + (Expression + (Identifier "d"))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "g")) + (ArgumentList)))))) + (ExpressionCase + (ExpressionList + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "e")) + (Expression + (IntLiteral "4"))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "f")) + (ArgumentList))))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/type-aliases.A.go b/semantic/test/fixtures/go/corpus/type-aliases.A.go similarity index 100% rename from test/fixtures/go/corpus/type-aliases.A.go rename to semantic/test/fixtures/go/corpus/type-aliases.A.go diff --git a/test/fixtures/go/corpus/type-aliases.B.go b/semantic/test/fixtures/go/corpus/type-aliases.B.go similarity index 100% rename from test/fixtures/go/corpus/type-aliases.B.go rename to semantic/test/fixtures/go/corpus/type-aliases.B.go diff --git a/test/fixtures/go/corpus/type-aliases.diffA-B.txt b/semantic/test/fixtures/go/corpus/type-aliases.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/type-aliases.diffA-B.txt rename to semantic/test/fixtures/go/corpus/type-aliases.diffA-B.txt diff --git a/test/fixtures/go/corpus/type-aliases.diffB-A.txt b/semantic/test/fixtures/go/corpus/type-aliases.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/type-aliases.diffB-A.txt rename to semantic/test/fixtures/go/corpus/type-aliases.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/type-aliases.parseA.txt b/semantic/test/fixtures/go/corpus/type-aliases.parseA.txt new file mode 100644 index 0000000000..1fe4d9490b --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-aliases.parseA.txt @@ -0,0 +1,25 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeAlias + (TypeIdentifier "nodeList") + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Node")))))))))) + (TypeAlias + (TypeIdentifier "Polar") + (Type + (SimpleType + (TypeIdentifier "polar"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/type-aliases.parseB.txt b/semantic/test/fixtures/go/corpus/type-aliases.parseB.txt new file mode 100644 index 0000000000..8df7fc1411 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-aliases.parseB.txt @@ -0,0 +1,25 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeAlias + (TypeIdentifier "nodes") + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Node")))))))))) + (TypeAlias + (TypeIdentifier "Radian") + (Type + (SimpleType + (TypeIdentifier "radian"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/type-assertion-expressions.A.go b/semantic/test/fixtures/go/corpus/type-assertion-expressions.A.go similarity index 100% rename from test/fixtures/go/corpus/type-assertion-expressions.A.go rename to semantic/test/fixtures/go/corpus/type-assertion-expressions.A.go diff --git a/test/fixtures/go/corpus/type-assertion-expressions.B.go b/semantic/test/fixtures/go/corpus/type-assertion-expressions.B.go similarity index 100% rename from test/fixtures/go/corpus/type-assertion-expressions.B.go rename to semantic/test/fixtures/go/corpus/type-assertion-expressions.B.go diff --git a/test/fixtures/go/corpus/type-assertion-expressions.diffA-B.txt b/semantic/test/fixtures/go/corpus/type-assertion-expressions.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/type-assertion-expressions.diffA-B.txt rename to semantic/test/fixtures/go/corpus/type-assertion-expressions.diffA-B.txt diff --git a/test/fixtures/go/corpus/type-assertion-expressions.diffB-A.txt b/semantic/test/fixtures/go/corpus/type-assertion-expressions.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/type-assertion-expressions.diffB-A.txt rename to semantic/test/fixtures/go/corpus/type-assertion-expressions.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/type-assertion-expressions.parseA.txt b/semantic/test/fixtures/go/corpus/type-assertion-expressions.parseA.txt new file mode 100644 index 0000000000..94c6775fa1 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-assertion-expressions.parseA.txt @@ -0,0 +1,18 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (TypeAssertionExpression + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "Person") + (PackageIdentifier "z")))) + (Expression + (Identifier "x"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/type-assertion-expressions.parseB.txt b/semantic/test/fixtures/go/corpus/type-assertion-expressions.parseB.txt new file mode 100644 index 0000000000..4cb775ac6c --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-assertion-expressions.parseB.txt @@ -0,0 +1,18 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (TypeAssertionExpression + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "Dog") + (PackageIdentifier "c")))) + (Expression + (Identifier "b"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/type-conversion-expressions.A.go b/semantic/test/fixtures/go/corpus/type-conversion-expressions.A.go similarity index 100% rename from test/fixtures/go/corpus/type-conversion-expressions.A.go rename to semantic/test/fixtures/go/corpus/type-conversion-expressions.A.go diff --git a/test/fixtures/go/corpus/type-conversion-expressions.B.go b/semantic/test/fixtures/go/corpus/type-conversion-expressions.B.go similarity index 100% rename from test/fixtures/go/corpus/type-conversion-expressions.B.go rename to semantic/test/fixtures/go/corpus/type-conversion-expressions.B.go diff --git a/test/fixtures/go/corpus/type-conversion-expressions.diffA-B.txt b/semantic/test/fixtures/go/corpus/type-conversion-expressions.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/type-conversion-expressions.diffA-B.txt rename to semantic/test/fixtures/go/corpus/type-conversion-expressions.diffA-B.txt diff --git a/test/fixtures/go/corpus/type-conversion-expressions.diffB-A.txt b/semantic/test/fixtures/go/corpus/type-conversion-expressions.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/type-conversion-expressions.diffB-A.txt rename to semantic/test/fixtures/go/corpus/type-conversion-expressions.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/type-conversion-expressions.parseA.txt b/semantic/test/fixtures/go/corpus/type-conversion-expressions.parseA.txt new file mode 100644 index 0000000000..973a7700d9 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-conversion-expressions.parseA.txt @@ -0,0 +1,169 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (CallExpression + (Expression + (Identifier "Point")) + (ArgumentList + (Expression + (Identifier "p"))))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (ParenthesizedExpression + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "Point")))))) + (ArgumentList + (Expression + (Identifier "p"))))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int")))))) + (Expression + (Identifier "c")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (ParenthesizedType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int")))))))) + (Expression + (Identifier "c")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (SimpleType + (FunctionType + (ParameterList)))) + (Expression + (Identifier "x")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (ParenthesizedType + (Type + (SimpleType + (FunctionType + (ParameterList)))))) + (Expression + (Identifier "x")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (ParenthesizedType + (Type + (SimpleType + (FunctionType + (SimpleType + (TypeIdentifier "int")) + (ParameterList)))))) + (Expression + (Identifier "x")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (SimpleType + (FunctionType + (SimpleType + (TypeIdentifier "int")) + (ParameterList)))) + (Expression + (Identifier "x")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "b") + (PackageIdentifier "a"))))))) + (Expression + (SelectorExpression + (FieldIdentifier "d") + (Expression + (Identifier "c")))))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (ParenthesizedType + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "b") + (PackageIdentifier "a"))))))))) + (Expression + (SelectorExpression + (FieldIdentifier "d") + (Expression + (Identifier "c")))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "f") + (Expression + (Identifier "e")))) + (ArgumentList + (Expression + (Identifier "g"))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (ParenthesizedExpression + (Expression + (SelectorExpression + (FieldIdentifier "f") + (Expression + (Identifier "e")))))) + (ArgumentList + (Expression + (Identifier "g")))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/type-conversion-expressions.parseB.txt b/semantic/test/fixtures/go/corpus/type-conversion-expressions.parseB.txt new file mode 100644 index 0000000000..37c1300950 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-conversion-expressions.parseB.txt @@ -0,0 +1,169 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (CallExpression + (Expression + (Identifier "Point")) + (ArgumentList + (Expression + (Identifier "q"))))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (ParenthesizedExpression + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "Point")))))) + (ArgumentList + (Expression + (Identifier "q"))))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int")))))) + (Expression + (Identifier "d")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (ParenthesizedType + (Type + (SimpleType + (ChannelType + (Type + (SimpleType + (TypeIdentifier "int")))))))) + (Expression + (Identifier "d")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (SimpleType + (FunctionType + (ParameterList)))) + (Expression + (Identifier "f")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (ParenthesizedType + (Type + (SimpleType + (FunctionType + (ParameterList)))))) + (Expression + (Identifier "f")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (ParenthesizedType + (Type + (SimpleType + (FunctionType + (SimpleType + (TypeIdentifier "int")) + (ParameterList)))))) + (Expression + (Identifier "f")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (SimpleType + (FunctionType + (SimpleType + (TypeIdentifier "int")) + (ParameterList)))) + (Expression + (Identifier "f")))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "y") + (PackageIdentifier "x"))))))) + (Expression + (SelectorExpression + (FieldIdentifier "e") + (Expression + (Identifier "z")))))))) + (Statement + (SimpleStatement + (Expression + (TypeConversionExpression + (Type + (ParenthesizedType + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "g") + (PackageIdentifier "f"))))))))) + (Expression + (SelectorExpression + (FieldIdentifier "i") + (Expression + (Identifier "h")))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "k") + (Expression + (Identifier "j")))) + (ArgumentList + (Expression + (Identifier "l"))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (ParenthesizedExpression + (Expression + (SelectorExpression + (FieldIdentifier "n") + (Expression + (Identifier "m")))))) + (ArgumentList + (Expression + (Identifier "o")))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/type-declarations.A.go b/semantic/test/fixtures/go/corpus/type-declarations.A.go similarity index 100% rename from test/fixtures/go/corpus/type-declarations.A.go rename to semantic/test/fixtures/go/corpus/type-declarations.A.go diff --git a/test/fixtures/go/corpus/type-declarations.B.go b/semantic/test/fixtures/go/corpus/type-declarations.B.go similarity index 100% rename from test/fixtures/go/corpus/type-declarations.B.go rename to semantic/test/fixtures/go/corpus/type-declarations.B.go diff --git a/test/fixtures/go/corpus/type-declarations.diffA-B.txt b/semantic/test/fixtures/go/corpus/type-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/type-declarations.diffA-B.txt rename to semantic/test/fixtures/go/corpus/type-declarations.diffA-B.txt diff --git a/test/fixtures/go/corpus/type-declarations.diffB-A.txt b/semantic/test/fixtures/go/corpus/type-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/type-declarations.diffB-A.txt rename to semantic/test/fixtures/go/corpus/type-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/type-declarations.parseA.txt b/semantic/test/fixtures/go/corpus/type-declarations.parseA.txt new file mode 100644 index 0000000000..4e14cf11d1 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-declarations.parseA.txt @@ -0,0 +1,49 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "a") + (Type + (SimpleType + (TypeIdentifier "b")))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "a") + (Type + (SimpleType + (TypeIdentifier "b")))) + (TypeSpec + (TypeIdentifier "c") + (Type + (SimpleType + (TypeIdentifier "d")))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "testRead") + (Type + (SimpleType + (StructType + (FieldDeclarationList + (FieldDeclaration + (FieldIdentifier "cnt") + (TypeIdentifier "int")) + (FieldDeclaration + (FieldIdentifier "wantStr") + (TypeIdentifier "string")) + (FieldDeclaration + (FieldIdentifier "wantErr") + (TypeIdentifier "error"))))))) + (TypeSpec + (TypeIdentifier "testFnc") + (Type + (SimpleType + (InterfaceType + (MethodSpecList)))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/type-declarations.parseB.txt b/semantic/test/fixtures/go/corpus/type-declarations.parseB.txt new file mode 100644 index 0000000000..c9354bde5b --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-declarations.parseB.txt @@ -0,0 +1,49 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "x") + (Type + (SimpleType + (TypeIdentifier "y")))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "x") + (Type + (SimpleType + (TypeIdentifier "y")))) + (TypeSpec + (TypeIdentifier "e") + (Type + (SimpleType + (TypeIdentifier "f")))))) + (Statement + (TypeDeclaration + (TypeSpec + (TypeIdentifier "testWrite") + (Type + (SimpleType + (StructType + (FieldDeclarationList + (FieldDeclaration + (FieldIdentifier "cnt") + (TypeIdentifier "int")) + (FieldDeclaration + (FieldIdentifier "wantStr") + (TypeIdentifier "string")) + (FieldDeclaration + (FieldIdentifier "wantErr") + (TypeIdentifier "error"))))))) + (TypeSpec + (TypeIdentifier "testFac") + (Type + (SimpleType + (InterfaceType + (MethodSpecList)))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/type-switch-statements.A.go b/semantic/test/fixtures/go/corpus/type-switch-statements.A.go similarity index 100% rename from test/fixtures/go/corpus/type-switch-statements.A.go rename to semantic/test/fixtures/go/corpus/type-switch-statements.A.go diff --git a/test/fixtures/go/corpus/type-switch-statements.B.go b/semantic/test/fixtures/go/corpus/type-switch-statements.B.go similarity index 100% rename from test/fixtures/go/corpus/type-switch-statements.B.go rename to semantic/test/fixtures/go/corpus/type-switch-statements.B.go diff --git a/semantic/test/fixtures/go/corpus/type-switch-statements.diffA-B.txt b/semantic/test/fixtures/go/corpus/type-switch-statements.diffA-B.txt new file mode 100644 index 0000000000..5f499bf2f7 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-switch-statements.diffA-B.txt @@ -0,0 +1,124 @@ +(Statements + (Package + (Identifier)) + (Function + (Identifier) + (Statements + (TypeSwitch + (Statements + (Assignment + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + { (Identifier) + ->(Identifier) }) + (Statements + (Statements + (Identifier) + (Pointer + (MemberAccess + (Identifier) + (Identifier)))) + (Context + (Comment) + (Statements + (Slice + (Identifier)) + (Call + (Identifier) + (Statements) + (Empty)))) + (Statements + (Pointer + (Identifier)) + (Break + (Empty))) + {+(DefaultPattern + {+(Break + {+(Empty)+})+})+})) + (TypeSwitch + (Statements + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Statements + (Statements + { (Identifier) + ->(Identifier) } + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Statements + (TextElement) + {+(DividedBy + {+(Integer)+} + {+(Identifier)+})+} + {-(Times + {-(Identifier)-} + {-(Integer)-})-}) + (Empty))) + (Statements + { (Identifier) + ->(Identifier) } + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Statements + (TextElement) + {+(Times + {+(Identifier)+} + {+(Integer)+})+} + {-(DividedBy + {-(Integer)-} + {-(Identifier)-})-}) + (Empty))) + (Statements + (Identifier) + (Assignment + { (Identifier) + ->(Identifier) } + (DividedBy + (Call + (Identifier) + { (Identifier) + ->(Identifier) } + (Empty)) + (Integer))) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Statements + (TextElement) + (Plus + (Slice + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + (Empty) + (Empty)) + (Slice + { (Identifier) + ->(Identifier) } + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)))) + (Empty))) + (DefaultPattern + (Statements)))) + (TypeSwitch + (Empty) + (Statements + (Identifier) + { (Identifier) + ->(Identifier) } + (Context + { (Comment) + ->(Comment) } + (Empty))))))) diff --git a/semantic/test/fixtures/go/corpus/type-switch-statements.diffB-A.txt b/semantic/test/fixtures/go/corpus/type-switch-statements.diffB-A.txt new file mode 100644 index 0000000000..5da0cbe209 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-switch-statements.diffB-A.txt @@ -0,0 +1,124 @@ +(Statements + (Package + (Identifier)) + (Function + (Identifier) + (Statements + (TypeSwitch + (Statements + (Assignment + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + { (Identifier) + ->(Identifier) }) + (Statements + (Statements + (Identifier) + (Pointer + (MemberAccess + (Identifier) + (Identifier)))) + (Context + (Comment) + (Statements + (Slice + (Identifier)) + (Call + (Identifier) + (Statements) + (Empty)))) + (Statements + (Pointer + (Identifier)) + (Break + (Empty))) + {-(DefaultPattern + {-(Break + {-(Empty)-})-})-})) + (TypeSwitch + (Statements + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Statements + (Statements + { (Identifier) + ->(Identifier) } + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Statements + (TextElement) + {+(Times + {+(Identifier)+} + {+(Integer)+})+} + {-(DividedBy + {-(Integer)-} + {-(Identifier)-})-}) + (Empty))) + (Statements + { (Identifier) + ->(Identifier) } + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Statements + (TextElement) + {+(DividedBy + {+(Integer)+} + {+(Identifier)+})+} + {-(Times + {-(Identifier)-} + {-(Integer)-})-}) + (Empty))) + (Statements + (Identifier) + (Assignment + { (Identifier) + ->(Identifier) } + (DividedBy + (Call + (Identifier) + { (Identifier) + ->(Identifier) } + (Empty)) + (Integer))) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Statements + (TextElement) + (Plus + (Slice + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + (Empty) + (Empty)) + (Slice + { (Identifier) + ->(Identifier) } + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)))) + (Empty))) + (DefaultPattern + (Statements)))) + (TypeSwitch + (Empty) + (Statements + (Identifier) + { (Identifier) + ->(Identifier) } + (Context + { (Comment) + ->(Comment) } + (Empty))))))) diff --git a/semantic/test/fixtures/go/corpus/type-switch-statements.parseA.txt b/semantic/test/fixtures/go/corpus/type-switch-statements.parseA.txt new file mode 100644 index 0000000000..4d475c16be --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-switch-statements.parseA.txt @@ -0,0 +1,166 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeSwitchStatement + (Expression + (Identifier "f")) + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "c"))) + (ExpressionList + (Expression + (Identifier "d"))))) + (TypeCase + (Type + (SimpleType + (TypeIdentifier "nil"))) + (Token) + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "LSym") + (PackageIdentifier "obj")))))))) + (TypeCase + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (TypeIdentifier "Person")))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList)))))) + (TypeCase + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Dog")))))) + (Statement + (BreakStatement))))) + (Statement + (TypeSwitchStatement + (Expression + (Identifier "i")) + (ExpressionList + (Expression + (Identifier "v"))) + (TypeCase + (Type + (SimpleType + (TypeIdentifier "int"))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "Println") + (Expression + (Identifier "fmt")))) + (ArgumentList + (Expression + (InterpretedStringLiteral)) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "v")) + (Expression + (IntLiteral "2")))))))))) + (TypeCase + (Type + (SimpleType + (TypeIdentifier "float64"))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "Println") + (Expression + (Identifier "fmt")))) + (ArgumentList + (Expression + (InterpretedStringLiteral)) + (Expression + (BinaryExpression + (Token) + (Expression + (IntLiteral "1")) + (Expression + (Identifier "v")))))))))) + (TypeCase + (Type + (SimpleType + (TypeIdentifier "string"))) + (Statement + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "h"))) + (ExpressionList + (Expression + (BinaryExpression + (Token) + (Expression + (CallExpression + (Expression + (Identifier "len")) + (ArgumentList + (Expression + (Identifier "v"))))) + (Expression + (IntLiteral "2")))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "Println") + (Expression + (Identifier "fmt")))) + (ArgumentList + (Expression + (InterpretedStringLiteral)) + (Expression + (BinaryExpression + (Token) + (Expression + (SliceExpression + (Expression + (Identifier "h")) + (Expression + (Identifier "v")))) + (Expression + (SliceExpression + (Expression + (Identifier "h")) + (Expression + (Identifier "v")))))))))))) + (DefaultCase))) + (Statement + (TypeSwitchStatement + (Expression + (Identifier "r")) + (ExpressionList + (Expression + (Identifier "_")))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/type-switch-statements.parseB.txt b/semantic/test/fixtures/go/corpus/type-switch-statements.parseB.txt new file mode 100644 index 0000000000..822b70a6c8 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/type-switch-statements.parseB.txt @@ -0,0 +1,169 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (TypeSwitchStatement + (Expression + (Identifier "e")) + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "a"))) + (ExpressionList + (Expression + (Identifier "b"))))) + (TypeCase + (Type + (SimpleType + (TypeIdentifier "nil"))) + (Token) + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (QualifiedType + (TypeIdentifier "LSym") + (PackageIdentifier "obj")))))))) + (TypeCase + (Type + (SimpleType + (SliceType + (Type + (SimpleType + (TypeIdentifier "Person")))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (ArgumentList)))))) + (TypeCase + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "Dog")))))) + (Statement + (BreakStatement))) + (DefaultCase + (Statement + (BreakStatement))))) + (Statement + (TypeSwitchStatement + (Expression + (Identifier "j")) + (ExpressionList + (Expression + (Identifier "x"))) + (TypeCase + (Type + (SimpleType + (TypeIdentifier "float64"))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "Println") + (Expression + (Identifier "fmt")))) + (ArgumentList + (Expression + (InterpretedStringLiteral)) + (Expression + (BinaryExpression + (Token) + (Expression + (IntLiteral "1")) + (Expression + (Identifier "x")))))))))) + (TypeCase + (Type + (SimpleType + (TypeIdentifier "int"))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "Println") + (Expression + (Identifier "fmt")))) + (ArgumentList + (Expression + (InterpretedStringLiteral)) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (IntLiteral "2")))))))))) + (TypeCase + (Type + (SimpleType + (TypeIdentifier "string"))) + (Statement + (SimpleStatement + (ShortVarDeclaration + (ExpressionList + (Expression + (Identifier "l"))) + (ExpressionList + (Expression + (BinaryExpression + (Token) + (Expression + (CallExpression + (Expression + (Identifier "len")) + (ArgumentList + (Expression + (Identifier "x"))))) + (Expression + (IntLiteral "2")))))))) + (Statement + (SimpleStatement + (Expression + (CallExpression + (Expression + (SelectorExpression + (FieldIdentifier "Println") + (Expression + (Identifier "fmt")))) + (ArgumentList + (Expression + (InterpretedStringLiteral)) + (Expression + (BinaryExpression + (Token) + (Expression + (SliceExpression + (Expression + (Identifier "l")) + (Expression + (Identifier "x")))) + (Expression + (SliceExpression + (Expression + (Identifier "l")) + (Expression + (Identifier "x")))))))))))) + (DefaultCase))) + (Statement + (TypeSwitchStatement + (Expression + (Identifier "s")) + (ExpressionList + (Expression + (Identifier "_")))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/unary-expressions.A.go b/semantic/test/fixtures/go/corpus/unary-expressions.A.go similarity index 100% rename from test/fixtures/go/corpus/unary-expressions.A.go rename to semantic/test/fixtures/go/corpus/unary-expressions.A.go diff --git a/test/fixtures/go/corpus/unary-expressions.B.go b/semantic/test/fixtures/go/corpus/unary-expressions.B.go similarity index 100% rename from test/fixtures/go/corpus/unary-expressions.B.go rename to semantic/test/fixtures/go/corpus/unary-expressions.B.go diff --git a/test/fixtures/go/corpus/unary-expressions.diffA-B.txt b/semantic/test/fixtures/go/corpus/unary-expressions.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/unary-expressions.diffA-B.txt rename to semantic/test/fixtures/go/corpus/unary-expressions.diffA-B.txt diff --git a/test/fixtures/go/corpus/unary-expressions.diffB-A.txt b/semantic/test/fixtures/go/corpus/unary-expressions.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/unary-expressions.diffB-A.txt rename to semantic/test/fixtures/go/corpus/unary-expressions.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/unary-expressions.parseA.txt b/semantic/test/fixtures/go/corpus/unary-expressions.parseA.txt new file mode 100644 index 0000000000..49878f84f4 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/unary-expressions.parseA.txt @@ -0,0 +1,62 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "a")))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "b")))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "c")))))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (CallExpression + (Expression + (Identifier "foo")) + (ArgumentList))))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "h")))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "bar")))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "d"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/unary-expressions.parseB.txt b/semantic/test/fixtures/go/corpus/unary-expressions.parseB.txt new file mode 100644 index 0000000000..2e919ee6a4 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/unary-expressions.parseB.txt @@ -0,0 +1,62 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "b")))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "c")))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "d")))))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (CallExpression + (Expression + (Identifier "bar")) + (ArgumentList))))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "i")))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "foo")))))) + (Statement + (SimpleStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "e"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/var-declarations-with-no-expressions.A.go b/semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.A.go similarity index 100% rename from test/fixtures/go/corpus/var-declarations-with-no-expressions.A.go rename to semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.A.go diff --git a/test/fixtures/go/corpus/var-declarations-with-no-expressions.B.go b/semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.B.go similarity index 100% rename from test/fixtures/go/corpus/var-declarations-with-no-expressions.B.go rename to semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.B.go diff --git a/test/fixtures/go/corpus/var-declarations-with-no-expressions.diffA-B.txt b/semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/var-declarations-with-no-expressions.diffA-B.txt rename to semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.diffA-B.txt diff --git a/test/fixtures/go/corpus/var-declarations-with-no-expressions.diffB-A.txt b/semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/var-declarations-with-no-expressions.diffB-A.txt rename to semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseA.txt b/semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseA.txt new file mode 100644 index 0000000000..c6a44448ff --- /dev/null +++ b/semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseA.txt @@ -0,0 +1,23 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (VarDeclaration + (VarSpec + (Identifier "zero") + (Type + (SimpleType + (TypeIdentifier "int")))))) + (Statement + (VarDeclaration + (VarSpec + (Identifier "one") + (Token) + (Identifier "two") + (Type + (SimpleType + (TypeIdentifier "uint64"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseB.txt b/semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseB.txt new file mode 100644 index 0000000000..10a794b334 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseB.txt @@ -0,0 +1,23 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (VarDeclaration + (VarSpec + (Identifier "a") + (Type + (SimpleType + (TypeIdentifier "int")))))) + (Statement + (VarDeclaration + (VarSpec + (Identifier "b") + (Token) + (Identifier "c") + (Type + (SimpleType + (TypeIdentifier "uint64"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/var-declarations-with-types.A.go b/semantic/test/fixtures/go/corpus/var-declarations-with-types.A.go similarity index 100% rename from test/fixtures/go/corpus/var-declarations-with-types.A.go rename to semantic/test/fixtures/go/corpus/var-declarations-with-types.A.go diff --git a/test/fixtures/go/corpus/var-declarations-with-types.B.go b/semantic/test/fixtures/go/corpus/var-declarations-with-types.B.go similarity index 100% rename from test/fixtures/go/corpus/var-declarations-with-types.B.go rename to semantic/test/fixtures/go/corpus/var-declarations-with-types.B.go diff --git a/test/fixtures/go/corpus/var-declarations-with-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/var-declarations-with-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/var-declarations-with-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/var-declarations-with-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/var-declarations-with-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/var-declarations-with-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/var-declarations-with-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/var-declarations-with-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/var-declarations-with-types.parseA.txt b/semantic/test/fixtures/go/corpus/var-declarations-with-types.parseA.txt new file mode 100644 index 0000000000..75966cf8cd --- /dev/null +++ b/semantic/test/fixtures/go/corpus/var-declarations-with-types.parseA.txt @@ -0,0 +1,31 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (VarDeclaration + (VarSpec + (ExpressionList + (Expression + (IntLiteral "0"))) + (Identifier "zero") + (Type + (SimpleType + (TypeIdentifier "int")))))) + (Statement + (VarDeclaration + (VarSpec + (ExpressionList + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2"))) + (Identifier "one") + (Token) + (Identifier "two") + (Type + (SimpleType + (TypeIdentifier "uint64"))))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/var-declarations-with-types.parseB.txt b/semantic/test/fixtures/go/corpus/var-declarations-with-types.parseB.txt new file mode 100644 index 0000000000..c5b9b0f7d3 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/var-declarations-with-types.parseB.txt @@ -0,0 +1,31 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (VarDeclaration + (VarSpec + (ExpressionList + (Expression + (IntLiteral "0"))) + (Identifier "a") + (Type + (SimpleType + (TypeIdentifier "int")))))) + (Statement + (VarDeclaration + (VarSpec + (ExpressionList + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2"))) + (Identifier "b") + (Token) + (Identifier "c") + (Type + (SimpleType + (TypeIdentifier "uint64"))))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/var-declarations-without-types.A.go b/semantic/test/fixtures/go/corpus/var-declarations-without-types.A.go similarity index 100% rename from test/fixtures/go/corpus/var-declarations-without-types.A.go rename to semantic/test/fixtures/go/corpus/var-declarations-without-types.A.go diff --git a/test/fixtures/go/corpus/var-declarations-without-types.B.go b/semantic/test/fixtures/go/corpus/var-declarations-without-types.B.go similarity index 100% rename from test/fixtures/go/corpus/var-declarations-without-types.B.go rename to semantic/test/fixtures/go/corpus/var-declarations-without-types.B.go diff --git a/test/fixtures/go/corpus/var-declarations-without-types.diffA-B.txt b/semantic/test/fixtures/go/corpus/var-declarations-without-types.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/var-declarations-without-types.diffA-B.txt rename to semantic/test/fixtures/go/corpus/var-declarations-without-types.diffA-B.txt diff --git a/test/fixtures/go/corpus/var-declarations-without-types.diffB-A.txt b/semantic/test/fixtures/go/corpus/var-declarations-without-types.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/var-declarations-without-types.diffB-A.txt rename to semantic/test/fixtures/go/corpus/var-declarations-without-types.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/var-declarations-without-types.parseA.txt b/semantic/test/fixtures/go/corpus/var-declarations-without-types.parseA.txt new file mode 100644 index 0000000000..7631a4eb20 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/var-declarations-without-types.parseA.txt @@ -0,0 +1,14 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (VarDeclaration + (VarSpec + (ExpressionList + (Expression + (IntLiteral "0"))) + (Identifier "zero"))))) + (Identifier "main") + (ParameterList))) diff --git a/semantic/test/fixtures/go/corpus/var-declarations-without-types.parseB.txt b/semantic/test/fixtures/go/corpus/var-declarations-without-types.parseB.txt new file mode 100644 index 0000000000..5729785576 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/var-declarations-without-types.parseB.txt @@ -0,0 +1,18 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block + (Statement + (VarDeclaration + (VarSpec + (ExpressionList + (Expression + (IntLiteral "1")) + (Expression + (IntLiteral "2"))) + (Identifier "one") + (Token) + (Identifier "two"))))) + (Identifier "main") + (ParameterList))) diff --git a/test/fixtures/go/corpus/variadic-function-declarations.A.go b/semantic/test/fixtures/go/corpus/variadic-function-declarations.A.go similarity index 100% rename from test/fixtures/go/corpus/variadic-function-declarations.A.go rename to semantic/test/fixtures/go/corpus/variadic-function-declarations.A.go diff --git a/test/fixtures/go/corpus/variadic-function-declarations.B.go b/semantic/test/fixtures/go/corpus/variadic-function-declarations.B.go similarity index 100% rename from test/fixtures/go/corpus/variadic-function-declarations.B.go rename to semantic/test/fixtures/go/corpus/variadic-function-declarations.B.go diff --git a/test/fixtures/go/corpus/variadic-function-declarations.diffA-B.txt b/semantic/test/fixtures/go/corpus/variadic-function-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/go/corpus/variadic-function-declarations.diffA-B.txt rename to semantic/test/fixtures/go/corpus/variadic-function-declarations.diffA-B.txt diff --git a/test/fixtures/go/corpus/variadic-function-declarations.diffB-A.txt b/semantic/test/fixtures/go/corpus/variadic-function-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/go/corpus/variadic-function-declarations.diffB-A.txt rename to semantic/test/fixtures/go/corpus/variadic-function-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/go/corpus/variadic-function-declarations.parseA.txt b/semantic/test/fixtures/go/corpus/variadic-function-declarations.parseA.txt new file mode 100644 index 0000000000..a66680abf2 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/variadic-function-declarations.parseA.txt @@ -0,0 +1,39 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList)) + (FunctionDeclaration + (Block) + (Identifier "f1") + (ParameterList + (VariadicParameterDeclaration + (Identifier "a") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "int"))))))))) + (FunctionDeclaration + (Block) + (Identifier "f2") + (ParameterList + (VariadicParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "int")))))) + (FunctionDeclaration + (Block) + (Identifier "f3") + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "a")))) + (VariadicParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "bool"))))))) diff --git a/semantic/test/fixtures/go/corpus/variadic-function-declarations.parseB.txt b/semantic/test/fixtures/go/corpus/variadic-function-declarations.parseB.txt new file mode 100644 index 0000000000..7c6c7ab335 --- /dev/null +++ b/semantic/test/fixtures/go/corpus/variadic-function-declarations.parseB.txt @@ -0,0 +1,39 @@ +(SourceFile + (PackageClause + (PackageIdentifier "main")) + (FunctionDeclaration + (Block) + (Identifier "main") + (ParameterList)) + (FunctionDeclaration + (Block) + (Identifier "g1") + (ParameterList + (VariadicParameterDeclaration + (Identifier "a") + (Type + (SimpleType + (PointerType + (Type + (SimpleType + (TypeIdentifier "int"))))))))) + (FunctionDeclaration + (Block) + (Identifier "g2") + (ParameterList + (VariadicParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "int")))))) + (FunctionDeclaration + (Block) + (Identifier "g3") + (ParameterList + (ParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "a")))) + (VariadicParameterDeclaration + (Type + (SimpleType + (TypeIdentifier "bool"))))))) diff --git a/test/fixtures/go/import-graph/main.go b/semantic/test/fixtures/go/import-graph/main.go similarity index 100% rename from test/fixtures/go/import-graph/main.go rename to semantic/test/fixtures/go/import-graph/main.go diff --git a/test/fixtures/go/import-graph/main.json b/semantic/test/fixtures/go/import-graph/main.json similarity index 100% rename from test/fixtures/go/import-graph/main.json rename to semantic/test/fixtures/go/import-graph/main.json diff --git a/test/fixtures/go/matching/for.go b/semantic/test/fixtures/go/matching/for.go similarity index 100% rename from test/fixtures/go/matching/for.go rename to semantic/test/fixtures/go/matching/for.go diff --git a/test/fixtures/go/matching/integers.go b/semantic/test/fixtures/go/matching/integers.go similarity index 100% rename from test/fixtures/go/matching/integers.go rename to semantic/test/fixtures/go/matching/integers.go diff --git a/test/fixtures/go/tags/method.go b/semantic/test/fixtures/go/tags/method.go similarity index 100% rename from test/fixtures/go/tags/method.go rename to semantic/test/fixtures/go/tags/method.go diff --git a/test/fixtures/go/tags/simple_functions.go b/semantic/test/fixtures/go/tags/simple_functions.go similarity index 100% rename from test/fixtures/go/tags/simple_functions.go rename to semantic/test/fixtures/go/tags/simple_functions.go diff --git a/test/fixtures/go/toc/method-with-receiver.A.go b/semantic/test/fixtures/go/toc/method-with-receiver.A.go similarity index 100% rename from test/fixtures/go/toc/method-with-receiver.A.go rename to semantic/test/fixtures/go/toc/method-with-receiver.A.go diff --git a/test/fixtures/go/toc/method-with-receiver.B.go b/semantic/test/fixtures/go/toc/method-with-receiver.B.go similarity index 100% rename from test/fixtures/go/toc/method-with-receiver.B.go rename to semantic/test/fixtures/go/toc/method-with-receiver.B.go diff --git a/test/fixtures/haskell/corpus/algebraic-datatype-declarations.A.hs b/semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/algebraic-datatype-declarations.A.hs rename to semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.A.hs diff --git a/test/fixtures/haskell/corpus/algebraic-datatype-declarations.B.hs b/semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/algebraic-datatype-declarations.B.hs rename to semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.B.hs diff --git a/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/algebraic-datatype-declarations.parseA.txt b/semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/algebraic-datatype-declarations.parseA.txt rename to semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.parseA.txt diff --git a/test/fixtures/haskell/corpus/algebraic-datatype-declarations.parseB.txt b/semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/algebraic-datatype-declarations.parseB.txt rename to semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.parseB.txt diff --git a/test/fixtures/javascript/corpus/variadic-function-declarations.parseA.txt b/semantic/test/fixtures/haskell/corpus/blank.A.hs similarity index 100% rename from test/fixtures/javascript/corpus/variadic-function-declarations.parseA.txt rename to semantic/test/fixtures/haskell/corpus/blank.A.hs diff --git a/test/fixtures/haskell/corpus/blank.parseA.txt b/semantic/test/fixtures/haskell/corpus/blank.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/blank.parseA.txt rename to semantic/test/fixtures/haskell/corpus/blank.parseA.txt diff --git a/test/fixtures/haskell/corpus/cpp-directives.A.hs b/semantic/test/fixtures/haskell/corpus/cpp-directives.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/cpp-directives.A.hs rename to semantic/test/fixtures/haskell/corpus/cpp-directives.A.hs diff --git a/test/fixtures/haskell/corpus/cpp-directives.B.hs b/semantic/test/fixtures/haskell/corpus/cpp-directives.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/cpp-directives.B.hs rename to semantic/test/fixtures/haskell/corpus/cpp-directives.B.hs diff --git a/test/fixtures/haskell/corpus/cpp-directives.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/cpp-directives.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/cpp-directives.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/cpp-directives.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/cpp-directives.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/cpp-directives.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/cpp-directives.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/cpp-directives.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/cpp-directives.parseA.txt b/semantic/test/fixtures/haskell/corpus/cpp-directives.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/cpp-directives.parseA.txt rename to semantic/test/fixtures/haskell/corpus/cpp-directives.parseA.txt diff --git a/test/fixtures/haskell/corpus/cpp-directives.parseB.txt b/semantic/test/fixtures/haskell/corpus/cpp-directives.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/cpp-directives.parseB.txt rename to semantic/test/fixtures/haskell/corpus/cpp-directives.parseB.txt diff --git a/test/fixtures/haskell/corpus/default-declaration.A.hs b/semantic/test/fixtures/haskell/corpus/default-declaration.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/default-declaration.A.hs rename to semantic/test/fixtures/haskell/corpus/default-declaration.A.hs diff --git a/test/fixtures/haskell/corpus/default-declaration.B.hs b/semantic/test/fixtures/haskell/corpus/default-declaration.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/default-declaration.B.hs rename to semantic/test/fixtures/haskell/corpus/default-declaration.B.hs diff --git a/test/fixtures/haskell/corpus/default-declaration.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/default-declaration.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/default-declaration.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/default-declaration.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/default-declaration.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/default-declaration.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/default-declaration.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/default-declaration.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/default-declaration.parseA.txt b/semantic/test/fixtures/haskell/corpus/default-declaration.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/default-declaration.parseA.txt rename to semantic/test/fixtures/haskell/corpus/default-declaration.parseA.txt diff --git a/test/fixtures/haskell/corpus/default-declaration.parseB.txt b/semantic/test/fixtures/haskell/corpus/default-declaration.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/default-declaration.parseB.txt rename to semantic/test/fixtures/haskell/corpus/default-declaration.parseB.txt diff --git a/test/fixtures/haskell/corpus/expressions.A.hs b/semantic/test/fixtures/haskell/corpus/expressions.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/expressions.A.hs rename to semantic/test/fixtures/haskell/corpus/expressions.A.hs diff --git a/test/fixtures/haskell/corpus/expressions.B.hs b/semantic/test/fixtures/haskell/corpus/expressions.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/expressions.B.hs rename to semantic/test/fixtures/haskell/corpus/expressions.B.hs diff --git a/test/fixtures/haskell/corpus/expressions.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/expressions.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/expressions.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/expressions.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/expressions.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/expressions.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/expressions.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/expressions.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/expressions.parseA.txt b/semantic/test/fixtures/haskell/corpus/expressions.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/expressions.parseA.txt rename to semantic/test/fixtures/haskell/corpus/expressions.parseA.txt diff --git a/test/fixtures/haskell/corpus/expressions.parseB.txt b/semantic/test/fixtures/haskell/corpus/expressions.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/expressions.parseB.txt rename to semantic/test/fixtures/haskell/corpus/expressions.parseB.txt diff --git a/test/fixtures/haskell/corpus/function-declarations.A.hs b/semantic/test/fixtures/haskell/corpus/function-declarations.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/function-declarations.A.hs rename to semantic/test/fixtures/haskell/corpus/function-declarations.A.hs diff --git a/test/fixtures/haskell/corpus/function-declarations.B.hs b/semantic/test/fixtures/haskell/corpus/function-declarations.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/function-declarations.B.hs rename to semantic/test/fixtures/haskell/corpus/function-declarations.B.hs diff --git a/test/fixtures/haskell/corpus/function-declarations.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/function-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/function-declarations.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/function-declarations.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/function-declarations.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/function-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/function-declarations.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/function-declarations.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/function-declarations.parseA.txt b/semantic/test/fixtures/haskell/corpus/function-declarations.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/function-declarations.parseA.txt rename to semantic/test/fixtures/haskell/corpus/function-declarations.parseA.txt diff --git a/test/fixtures/haskell/corpus/function-declarations.parseB.txt b/semantic/test/fixtures/haskell/corpus/function-declarations.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/function-declarations.parseB.txt rename to semantic/test/fixtures/haskell/corpus/function-declarations.parseB.txt diff --git a/test/fixtures/haskell/corpus/gadt-declarations.A.hs b/semantic/test/fixtures/haskell/corpus/gadt-declarations.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/gadt-declarations.A.hs rename to semantic/test/fixtures/haskell/corpus/gadt-declarations.A.hs diff --git a/test/fixtures/haskell/corpus/gadt-declarations.B.hs b/semantic/test/fixtures/haskell/corpus/gadt-declarations.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/gadt-declarations.B.hs rename to semantic/test/fixtures/haskell/corpus/gadt-declarations.B.hs diff --git a/test/fixtures/haskell/corpus/gadt-declarations.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/gadt-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/gadt-declarations.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/gadt-declarations.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/gadt-declarations.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/gadt-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/gadt-declarations.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/gadt-declarations.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/gadt-declarations.parseA.txt b/semantic/test/fixtures/haskell/corpus/gadt-declarations.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/gadt-declarations.parseA.txt rename to semantic/test/fixtures/haskell/corpus/gadt-declarations.parseA.txt diff --git a/test/fixtures/haskell/corpus/gadt-declarations.parseB.txt b/semantic/test/fixtures/haskell/corpus/gadt-declarations.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/gadt-declarations.parseB.txt rename to semantic/test/fixtures/haskell/corpus/gadt-declarations.parseB.txt diff --git a/test/fixtures/haskell/corpus/import-declaration.A.hs b/semantic/test/fixtures/haskell/corpus/import-declaration.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/import-declaration.A.hs rename to semantic/test/fixtures/haskell/corpus/import-declaration.A.hs diff --git a/test/fixtures/haskell/corpus/import-declaration.B.hs b/semantic/test/fixtures/haskell/corpus/import-declaration.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/import-declaration.B.hs rename to semantic/test/fixtures/haskell/corpus/import-declaration.B.hs diff --git a/test/fixtures/haskell/corpus/import-declaration.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/import-declaration.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/import-declaration.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/import-declaration.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/import-declaration.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/import-declaration.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/import-declaration.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/import-declaration.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/import-declaration.parseA.txt b/semantic/test/fixtures/haskell/corpus/import-declaration.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/import-declaration.parseA.txt rename to semantic/test/fixtures/haskell/corpus/import-declaration.parseA.txt diff --git a/test/fixtures/haskell/corpus/import-declaration.parseB.txt b/semantic/test/fixtures/haskell/corpus/import-declaration.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/import-declaration.parseB.txt rename to semantic/test/fixtures/haskell/corpus/import-declaration.parseB.txt diff --git a/test/fixtures/haskell/corpus/layout.A.hs b/semantic/test/fixtures/haskell/corpus/layout.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/layout.A.hs rename to semantic/test/fixtures/haskell/corpus/layout.A.hs diff --git a/test/fixtures/haskell/corpus/layout.B.hs b/semantic/test/fixtures/haskell/corpus/layout.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/layout.B.hs rename to semantic/test/fixtures/haskell/corpus/layout.B.hs diff --git a/test/fixtures/haskell/corpus/layout.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/layout.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/layout.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/layout.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/layout.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/layout.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/layout.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/layout.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/layout.parseA.txt b/semantic/test/fixtures/haskell/corpus/layout.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/layout.parseA.txt rename to semantic/test/fixtures/haskell/corpus/layout.parseA.txt diff --git a/test/fixtures/haskell/corpus/layout.parseB.txt b/semantic/test/fixtures/haskell/corpus/layout.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/layout.parseB.txt rename to semantic/test/fixtures/haskell/corpus/layout.parseB.txt diff --git a/test/fixtures/haskell/corpus/literals.A.hs b/semantic/test/fixtures/haskell/corpus/literals.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/literals.A.hs rename to semantic/test/fixtures/haskell/corpus/literals.A.hs diff --git a/test/fixtures/haskell/corpus/literals.B.hs b/semantic/test/fixtures/haskell/corpus/literals.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/literals.B.hs rename to semantic/test/fixtures/haskell/corpus/literals.B.hs diff --git a/test/fixtures/haskell/corpus/literals.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/literals.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/literals.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/literals.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/literals.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/literals.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/literals.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/literals.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/literals.parseA.txt b/semantic/test/fixtures/haskell/corpus/literals.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/literals.parseA.txt rename to semantic/test/fixtures/haskell/corpus/literals.parseA.txt diff --git a/test/fixtures/haskell/corpus/literals.parseB.txt b/semantic/test/fixtures/haskell/corpus/literals.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/literals.parseB.txt rename to semantic/test/fixtures/haskell/corpus/literals.parseB.txt diff --git a/test/fixtures/haskell/corpus/module-declaration1.A.hs b/semantic/test/fixtures/haskell/corpus/module-declaration1.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration1.A.hs rename to semantic/test/fixtures/haskell/corpus/module-declaration1.A.hs diff --git a/test/fixtures/haskell/corpus/module-declaration1.B.hs b/semantic/test/fixtures/haskell/corpus/module-declaration1.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration1.B.hs rename to semantic/test/fixtures/haskell/corpus/module-declaration1.B.hs diff --git a/test/fixtures/haskell/corpus/module-declaration1.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/module-declaration1.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration1.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration1.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/module-declaration1.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/module-declaration1.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration1.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration1.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/module-declaration1.parseA.txt b/semantic/test/fixtures/haskell/corpus/module-declaration1.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration1.parseA.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration1.parseA.txt diff --git a/test/fixtures/haskell/corpus/module-declaration1.parseB.txt b/semantic/test/fixtures/haskell/corpus/module-declaration1.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration1.parseB.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration1.parseB.txt diff --git a/test/fixtures/haskell/corpus/module-declaration2.A.hs b/semantic/test/fixtures/haskell/corpus/module-declaration2.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration2.A.hs rename to semantic/test/fixtures/haskell/corpus/module-declaration2.A.hs diff --git a/test/fixtures/haskell/corpus/module-declaration2.B.hs b/semantic/test/fixtures/haskell/corpus/module-declaration2.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration2.B.hs rename to semantic/test/fixtures/haskell/corpus/module-declaration2.B.hs diff --git a/test/fixtures/haskell/corpus/module-declaration2.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/module-declaration2.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration2.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration2.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/module-declaration2.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/module-declaration2.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration2.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration2.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/module-declaration2.parseA.txt b/semantic/test/fixtures/haskell/corpus/module-declaration2.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration2.parseA.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration2.parseA.txt diff --git a/test/fixtures/haskell/corpus/module-declaration2.parseB.txt b/semantic/test/fixtures/haskell/corpus/module-declaration2.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration2.parseB.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration2.parseB.txt diff --git a/test/fixtures/haskell/corpus/module-declaration3.A.hs b/semantic/test/fixtures/haskell/corpus/module-declaration3.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration3.A.hs rename to semantic/test/fixtures/haskell/corpus/module-declaration3.A.hs diff --git a/test/fixtures/haskell/corpus/module-declaration3.B.hs b/semantic/test/fixtures/haskell/corpus/module-declaration3.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration3.B.hs rename to semantic/test/fixtures/haskell/corpus/module-declaration3.B.hs diff --git a/test/fixtures/haskell/corpus/module-declaration3.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/module-declaration3.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration3.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration3.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/module-declaration3.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/module-declaration3.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration3.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration3.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/module-declaration3.parseA.txt b/semantic/test/fixtures/haskell/corpus/module-declaration3.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration3.parseA.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration3.parseA.txt diff --git a/test/fixtures/haskell/corpus/module-declaration3.parseB.txt b/semantic/test/fixtures/haskell/corpus/module-declaration3.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration3.parseB.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration3.parseB.txt diff --git a/test/fixtures/haskell/corpus/module-declaration4.A.hs b/semantic/test/fixtures/haskell/corpus/module-declaration4.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration4.A.hs rename to semantic/test/fixtures/haskell/corpus/module-declaration4.A.hs diff --git a/test/fixtures/haskell/corpus/module-declaration4.B.hs b/semantic/test/fixtures/haskell/corpus/module-declaration4.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration4.B.hs rename to semantic/test/fixtures/haskell/corpus/module-declaration4.B.hs diff --git a/test/fixtures/haskell/corpus/module-declaration4.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/module-declaration4.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration4.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration4.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/module-declaration4.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/module-declaration4.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration4.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration4.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/module-declaration4.parseA.txt b/semantic/test/fixtures/haskell/corpus/module-declaration4.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration4.parseA.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration4.parseA.txt diff --git a/test/fixtures/haskell/corpus/module-declaration4.parseB.txt b/semantic/test/fixtures/haskell/corpus/module-declaration4.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration4.parseB.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration4.parseB.txt diff --git a/test/fixtures/haskell/corpus/module-declaration5.A.hs b/semantic/test/fixtures/haskell/corpus/module-declaration5.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration5.A.hs rename to semantic/test/fixtures/haskell/corpus/module-declaration5.A.hs diff --git a/test/fixtures/haskell/corpus/module-declaration5.B.hs b/semantic/test/fixtures/haskell/corpus/module-declaration5.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration5.B.hs rename to semantic/test/fixtures/haskell/corpus/module-declaration5.B.hs diff --git a/test/fixtures/haskell/corpus/module-declaration5.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/module-declaration5.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration5.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration5.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/module-declaration5.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/module-declaration5.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration5.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration5.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/module-declaration5.parseA.txt b/semantic/test/fixtures/haskell/corpus/module-declaration5.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration5.parseA.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration5.parseA.txt diff --git a/test/fixtures/haskell/corpus/module-declaration5.parseB.txt b/semantic/test/fixtures/haskell/corpus/module-declaration5.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/module-declaration5.parseB.txt rename to semantic/test/fixtures/haskell/corpus/module-declaration5.parseB.txt diff --git a/test/fixtures/haskell/corpus/newtype-declaration.A.hs b/semantic/test/fixtures/haskell/corpus/newtype-declaration.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/newtype-declaration.A.hs rename to semantic/test/fixtures/haskell/corpus/newtype-declaration.A.hs diff --git a/test/fixtures/haskell/corpus/newtype-declaration.B.hs b/semantic/test/fixtures/haskell/corpus/newtype-declaration.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/newtype-declaration.B.hs rename to semantic/test/fixtures/haskell/corpus/newtype-declaration.B.hs diff --git a/test/fixtures/haskell/corpus/newtype-declaration.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/newtype-declaration.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/newtype-declaration.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/newtype-declaration.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/newtype-declaration.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/newtype-declaration.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/newtype-declaration.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/newtype-declaration.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/newtype-declaration.parseA.txt b/semantic/test/fixtures/haskell/corpus/newtype-declaration.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/newtype-declaration.parseA.txt rename to semantic/test/fixtures/haskell/corpus/newtype-declaration.parseA.txt diff --git a/test/fixtures/haskell/corpus/newtype-declaration.parseB.txt b/semantic/test/fixtures/haskell/corpus/newtype-declaration.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/newtype-declaration.parseB.txt rename to semantic/test/fixtures/haskell/corpus/newtype-declaration.parseB.txt diff --git a/test/fixtures/haskell/corpus/standalone-deriving-declaration.A.hs b/semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/standalone-deriving-declaration.A.hs rename to semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.A.hs diff --git a/test/fixtures/haskell/corpus/standalone-deriving-declaration.B.hs b/semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/standalone-deriving-declaration.B.hs rename to semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.B.hs diff --git a/test/fixtures/haskell/corpus/standalone-deriving-declaration.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/standalone-deriving-declaration.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/standalone-deriving-declaration.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/standalone-deriving-declaration.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/standalone-deriving-declaration.parseA.txt b/semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/standalone-deriving-declaration.parseA.txt rename to semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.parseA.txt diff --git a/test/fixtures/haskell/corpus/standalone-deriving-declaration.parseB.txt b/semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/standalone-deriving-declaration.parseB.txt rename to semantic/test/fixtures/haskell/corpus/standalone-deriving-declaration.parseB.txt diff --git a/test/fixtures/haskell/corpus/statements.A.hs b/semantic/test/fixtures/haskell/corpus/statements.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/statements.A.hs rename to semantic/test/fixtures/haskell/corpus/statements.A.hs diff --git a/test/fixtures/haskell/corpus/statements.B.hs b/semantic/test/fixtures/haskell/corpus/statements.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/statements.B.hs rename to semantic/test/fixtures/haskell/corpus/statements.B.hs diff --git a/test/fixtures/haskell/corpus/statements.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/statements.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/statements.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/statements.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/statements.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/statements.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/statements.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/statements.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/statements.parseA.txt b/semantic/test/fixtures/haskell/corpus/statements.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/statements.parseA.txt rename to semantic/test/fixtures/haskell/corpus/statements.parseA.txt diff --git a/test/fixtures/haskell/corpus/statements.parseB.txt b/semantic/test/fixtures/haskell/corpus/statements.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/statements.parseB.txt rename to semantic/test/fixtures/haskell/corpus/statements.parseB.txt diff --git a/test/fixtures/haskell/corpus/tempate-haskell.A.hs b/semantic/test/fixtures/haskell/corpus/tempate-haskell.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/tempate-haskell.A.hs rename to semantic/test/fixtures/haskell/corpus/tempate-haskell.A.hs diff --git a/test/fixtures/haskell/corpus/tempate-haskell.parseA.txt b/semantic/test/fixtures/haskell/corpus/tempate-haskell.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/tempate-haskell.parseA.txt rename to semantic/test/fixtures/haskell/corpus/tempate-haskell.parseA.txt diff --git a/test/fixtures/haskell/corpus/template-haskell.B.hs b/semantic/test/fixtures/haskell/corpus/template-haskell.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/template-haskell.B.hs rename to semantic/test/fixtures/haskell/corpus/template-haskell.B.hs diff --git a/test/fixtures/haskell/corpus/type-class-declarations.A.hs b/semantic/test/fixtures/haskell/corpus/type-class-declarations.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/type-class-declarations.A.hs rename to semantic/test/fixtures/haskell/corpus/type-class-declarations.A.hs diff --git a/test/fixtures/haskell/corpus/type-class-declarations.B.hs b/semantic/test/fixtures/haskell/corpus/type-class-declarations.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/type-class-declarations.B.hs rename to semantic/test/fixtures/haskell/corpus/type-class-declarations.B.hs diff --git a/test/fixtures/haskell/corpus/type-class-declarations.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/type-class-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-class-declarations.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/type-class-declarations.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/type-class-declarations.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/type-class-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-class-declarations.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/type-class-declarations.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/type-class-declarations.parseA.txt b/semantic/test/fixtures/haskell/corpus/type-class-declarations.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-class-declarations.parseA.txt rename to semantic/test/fixtures/haskell/corpus/type-class-declarations.parseA.txt diff --git a/test/fixtures/haskell/corpus/type-class-declarations.parseB.txt b/semantic/test/fixtures/haskell/corpus/type-class-declarations.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-class-declarations.parseB.txt rename to semantic/test/fixtures/haskell/corpus/type-class-declarations.parseB.txt diff --git a/test/fixtures/haskell/corpus/type-class-instance-declarations.A.hs b/semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/type-class-instance-declarations.A.hs rename to semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.A.hs diff --git a/test/fixtures/haskell/corpus/type-class-instance-declarations.B.hs b/semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/type-class-instance-declarations.B.hs rename to semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.B.hs diff --git a/test/fixtures/haskell/corpus/type-class-instance-declarations.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-class-instance-declarations.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/type-class-instance-declarations.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-class-instance-declarations.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/type-class-instance-declarations.parseA.txt b/semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-class-instance-declarations.parseA.txt rename to semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.parseA.txt diff --git a/test/fixtures/haskell/corpus/type-class-instance-declarations.parseB.txt b/semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-class-instance-declarations.parseB.txt rename to semantic/test/fixtures/haskell/corpus/type-class-instance-declarations.parseB.txt diff --git a/test/fixtures/haskell/corpus/type-family-declarations.A.hs b/semantic/test/fixtures/haskell/corpus/type-family-declarations.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/type-family-declarations.A.hs rename to semantic/test/fixtures/haskell/corpus/type-family-declarations.A.hs diff --git a/test/fixtures/haskell/corpus/type-family-declarations.B.hs b/semantic/test/fixtures/haskell/corpus/type-family-declarations.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/type-family-declarations.B.hs rename to semantic/test/fixtures/haskell/corpus/type-family-declarations.B.hs diff --git a/test/fixtures/haskell/corpus/type-family-declarations.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/type-family-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-family-declarations.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/type-family-declarations.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/type-family-declarations.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/type-family-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-family-declarations.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/type-family-declarations.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/type-family-declarations.parseA.txt b/semantic/test/fixtures/haskell/corpus/type-family-declarations.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-family-declarations.parseA.txt rename to semantic/test/fixtures/haskell/corpus/type-family-declarations.parseA.txt diff --git a/test/fixtures/haskell/corpus/type-family-declarations.parseB.txt b/semantic/test/fixtures/haskell/corpus/type-family-declarations.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-family-declarations.parseB.txt rename to semantic/test/fixtures/haskell/corpus/type-family-declarations.parseB.txt diff --git a/test/fixtures/haskell/corpus/type-signatures.A.hs b/semantic/test/fixtures/haskell/corpus/type-signatures.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/type-signatures.A.hs rename to semantic/test/fixtures/haskell/corpus/type-signatures.A.hs diff --git a/test/fixtures/haskell/corpus/type-signatures.B.hs b/semantic/test/fixtures/haskell/corpus/type-signatures.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/type-signatures.B.hs rename to semantic/test/fixtures/haskell/corpus/type-signatures.B.hs diff --git a/test/fixtures/haskell/corpus/type-signatures.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/type-signatures.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-signatures.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/type-signatures.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/type-signatures.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/type-signatures.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-signatures.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/type-signatures.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/type-signatures.parseA.txt b/semantic/test/fixtures/haskell/corpus/type-signatures.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-signatures.parseA.txt rename to semantic/test/fixtures/haskell/corpus/type-signatures.parseA.txt diff --git a/test/fixtures/haskell/corpus/type-signatures.parseB.txt b/semantic/test/fixtures/haskell/corpus/type-signatures.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-signatures.parseB.txt rename to semantic/test/fixtures/haskell/corpus/type-signatures.parseB.txt diff --git a/test/fixtures/haskell/corpus/type-synonyms.A.hs b/semantic/test/fixtures/haskell/corpus/type-synonyms.A.hs similarity index 100% rename from test/fixtures/haskell/corpus/type-synonyms.A.hs rename to semantic/test/fixtures/haskell/corpus/type-synonyms.A.hs diff --git a/test/fixtures/haskell/corpus/type-synonyms.B.hs b/semantic/test/fixtures/haskell/corpus/type-synonyms.B.hs similarity index 100% rename from test/fixtures/haskell/corpus/type-synonyms.B.hs rename to semantic/test/fixtures/haskell/corpus/type-synonyms.B.hs diff --git a/test/fixtures/haskell/corpus/type-synonyms.diffA-B.txt b/semantic/test/fixtures/haskell/corpus/type-synonyms.diffA-B.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-synonyms.diffA-B.txt rename to semantic/test/fixtures/haskell/corpus/type-synonyms.diffA-B.txt diff --git a/test/fixtures/haskell/corpus/type-synonyms.diffB-A.txt b/semantic/test/fixtures/haskell/corpus/type-synonyms.diffB-A.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-synonyms.diffB-A.txt rename to semantic/test/fixtures/haskell/corpus/type-synonyms.diffB-A.txt diff --git a/test/fixtures/haskell/corpus/type-synonyms.parseA.txt b/semantic/test/fixtures/haskell/corpus/type-synonyms.parseA.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-synonyms.parseA.txt rename to semantic/test/fixtures/haskell/corpus/type-synonyms.parseA.txt diff --git a/test/fixtures/haskell/corpus/type-synonyms.parseB.txt b/semantic/test/fixtures/haskell/corpus/type-synonyms.parseB.txt similarity index 100% rename from test/fixtures/haskell/corpus/type-synonyms.parseB.txt rename to semantic/test/fixtures/haskell/corpus/type-synonyms.parseB.txt diff --git a/test/fixtures/java/corpus/ArrayAccess.A.java b/semantic/test/fixtures/java/corpus/ArrayAccess.A.java similarity index 100% rename from test/fixtures/java/corpus/ArrayAccess.A.java rename to semantic/test/fixtures/java/corpus/ArrayAccess.A.java diff --git a/test/fixtures/java/corpus/ArrayAccess.B.java b/semantic/test/fixtures/java/corpus/ArrayAccess.B.java similarity index 100% rename from test/fixtures/java/corpus/ArrayAccess.B.java rename to semantic/test/fixtures/java/corpus/ArrayAccess.B.java diff --git a/test/fixtures/java/corpus/ArrayAccess.diffA-B.txt b/semantic/test/fixtures/java/corpus/ArrayAccess.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/ArrayAccess.diffA-B.txt rename to semantic/test/fixtures/java/corpus/ArrayAccess.diffA-B.txt diff --git a/test/fixtures/java/corpus/ArrayAccess.diffB-A.txt b/semantic/test/fixtures/java/corpus/ArrayAccess.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/ArrayAccess.diffB-A.txt rename to semantic/test/fixtures/java/corpus/ArrayAccess.diffB-A.txt diff --git a/test/fixtures/java/corpus/ArrayAccess.parseA.txt b/semantic/test/fixtures/java/corpus/ArrayAccess.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/ArrayAccess.parseA.txt rename to semantic/test/fixtures/java/corpus/ArrayAccess.parseA.txt diff --git a/test/fixtures/java/corpus/ArrayAccess.parseB.txt b/semantic/test/fixtures/java/corpus/ArrayAccess.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/ArrayAccess.parseB.txt rename to semantic/test/fixtures/java/corpus/ArrayAccess.parseB.txt diff --git a/test/fixtures/java/corpus/AssertStatement.A.java b/semantic/test/fixtures/java/corpus/AssertStatement.A.java similarity index 100% rename from test/fixtures/java/corpus/AssertStatement.A.java rename to semantic/test/fixtures/java/corpus/AssertStatement.A.java diff --git a/test/fixtures/java/corpus/AssertStatement.B.java b/semantic/test/fixtures/java/corpus/AssertStatement.B.java similarity index 100% rename from test/fixtures/java/corpus/AssertStatement.B.java rename to semantic/test/fixtures/java/corpus/AssertStatement.B.java diff --git a/test/fixtures/java/corpus/AssertStatement.diffA-B.txt b/semantic/test/fixtures/java/corpus/AssertStatement.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/AssertStatement.diffA-B.txt rename to semantic/test/fixtures/java/corpus/AssertStatement.diffA-B.txt diff --git a/test/fixtures/java/corpus/AssertStatement.diffB-A.txt b/semantic/test/fixtures/java/corpus/AssertStatement.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/AssertStatement.diffB-A.txt rename to semantic/test/fixtures/java/corpus/AssertStatement.diffB-A.txt diff --git a/test/fixtures/java/corpus/AssertStatement.parseA.txt b/semantic/test/fixtures/java/corpus/AssertStatement.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/AssertStatement.parseA.txt rename to semantic/test/fixtures/java/corpus/AssertStatement.parseA.txt diff --git a/test/fixtures/java/corpus/AssertStatement.parseB.txt b/semantic/test/fixtures/java/corpus/AssertStatement.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/AssertStatement.parseB.txt rename to semantic/test/fixtures/java/corpus/AssertStatement.parseB.txt diff --git a/test/fixtures/java/corpus/Binary.A.java b/semantic/test/fixtures/java/corpus/Binary.A.java similarity index 100% rename from test/fixtures/java/corpus/Binary.A.java rename to semantic/test/fixtures/java/corpus/Binary.A.java diff --git a/test/fixtures/java/corpus/Binary.B.java b/semantic/test/fixtures/java/corpus/Binary.B.java similarity index 100% rename from test/fixtures/java/corpus/Binary.B.java rename to semantic/test/fixtures/java/corpus/Binary.B.java diff --git a/test/fixtures/java/corpus/Binary.diffA-B.txt b/semantic/test/fixtures/java/corpus/Binary.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Binary.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Binary.diffA-B.txt diff --git a/test/fixtures/java/corpus/Binary.diffB-A.txt b/semantic/test/fixtures/java/corpus/Binary.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Binary.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Binary.diffB-A.txt diff --git a/test/fixtures/java/corpus/Binary.parseA.txt b/semantic/test/fixtures/java/corpus/Binary.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Binary.parseA.txt rename to semantic/test/fixtures/java/corpus/Binary.parseA.txt diff --git a/test/fixtures/java/corpus/Binary.parseB.txt b/semantic/test/fixtures/java/corpus/Binary.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Binary.parseB.txt rename to semantic/test/fixtures/java/corpus/Binary.parseB.txt diff --git a/test/fixtures/java/corpus/Boolean.A.java b/semantic/test/fixtures/java/corpus/Boolean.A.java similarity index 100% rename from test/fixtures/java/corpus/Boolean.A.java rename to semantic/test/fixtures/java/corpus/Boolean.A.java diff --git a/test/fixtures/java/corpus/Boolean.B.java b/semantic/test/fixtures/java/corpus/Boolean.B.java similarity index 100% rename from test/fixtures/java/corpus/Boolean.B.java rename to semantic/test/fixtures/java/corpus/Boolean.B.java diff --git a/test/fixtures/java/corpus/Boolean.diffA-B.txt b/semantic/test/fixtures/java/corpus/Boolean.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Boolean.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Boolean.diffA-B.txt diff --git a/test/fixtures/java/corpus/Boolean.diffB-A.txt b/semantic/test/fixtures/java/corpus/Boolean.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Boolean.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Boolean.diffB-A.txt diff --git a/test/fixtures/java/corpus/Boolean.parseA.txt b/semantic/test/fixtures/java/corpus/Boolean.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Boolean.parseA.txt rename to semantic/test/fixtures/java/corpus/Boolean.parseA.txt diff --git a/test/fixtures/java/corpus/Boolean.parseB.txt b/semantic/test/fixtures/java/corpus/Boolean.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Boolean.parseB.txt rename to semantic/test/fixtures/java/corpus/Boolean.parseB.txt diff --git a/test/fixtures/java/corpus/Char.A.java b/semantic/test/fixtures/java/corpus/Char.A.java similarity index 100% rename from test/fixtures/java/corpus/Char.A.java rename to semantic/test/fixtures/java/corpus/Char.A.java diff --git a/test/fixtures/java/corpus/Char.B.java b/semantic/test/fixtures/java/corpus/Char.B.java similarity index 100% rename from test/fixtures/java/corpus/Char.B.java rename to semantic/test/fixtures/java/corpus/Char.B.java diff --git a/test/fixtures/java/corpus/Char.diffA-B.txt b/semantic/test/fixtures/java/corpus/Char.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Char.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Char.diffA-B.txt diff --git a/test/fixtures/java/corpus/Char.diffB-A.txt b/semantic/test/fixtures/java/corpus/Char.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Char.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Char.diffB-A.txt diff --git a/test/fixtures/java/corpus/Char.parseA.txt b/semantic/test/fixtures/java/corpus/Char.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Char.parseA.txt rename to semantic/test/fixtures/java/corpus/Char.parseA.txt diff --git a/test/fixtures/java/corpus/Char.parseB.txt b/semantic/test/fixtures/java/corpus/Char.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Char.parseB.txt rename to semantic/test/fixtures/java/corpus/Char.parseB.txt diff --git a/test/fixtures/java/corpus/ClassBody.A.java b/semantic/test/fixtures/java/corpus/ClassBody.A.java similarity index 100% rename from test/fixtures/java/corpus/ClassBody.A.java rename to semantic/test/fixtures/java/corpus/ClassBody.A.java diff --git a/test/fixtures/java/corpus/ClassBody.B.java b/semantic/test/fixtures/java/corpus/ClassBody.B.java similarity index 100% rename from test/fixtures/java/corpus/ClassBody.B.java rename to semantic/test/fixtures/java/corpus/ClassBody.B.java diff --git a/test/fixtures/java/corpus/ClassBody.diffA-B.txt b/semantic/test/fixtures/java/corpus/ClassBody.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/ClassBody.diffA-B.txt rename to semantic/test/fixtures/java/corpus/ClassBody.diffA-B.txt diff --git a/test/fixtures/java/corpus/ClassBody.diffB-A.txt b/semantic/test/fixtures/java/corpus/ClassBody.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/ClassBody.diffB-A.txt rename to semantic/test/fixtures/java/corpus/ClassBody.diffB-A.txt diff --git a/test/fixtures/java/corpus/ClassBody.parseA.txt b/semantic/test/fixtures/java/corpus/ClassBody.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/ClassBody.parseA.txt rename to semantic/test/fixtures/java/corpus/ClassBody.parseA.txt diff --git a/test/fixtures/java/corpus/ClassBody.parseB.txt b/semantic/test/fixtures/java/corpus/ClassBody.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/ClassBody.parseB.txt rename to semantic/test/fixtures/java/corpus/ClassBody.parseB.txt diff --git a/test/fixtures/java/corpus/ClassLiteral.A.java b/semantic/test/fixtures/java/corpus/ClassLiteral.A.java similarity index 100% rename from test/fixtures/java/corpus/ClassLiteral.A.java rename to semantic/test/fixtures/java/corpus/ClassLiteral.A.java diff --git a/test/fixtures/java/corpus/ClassLiteral.B.java b/semantic/test/fixtures/java/corpus/ClassLiteral.B.java similarity index 100% rename from test/fixtures/java/corpus/ClassLiteral.B.java rename to semantic/test/fixtures/java/corpus/ClassLiteral.B.java diff --git a/test/fixtures/java/corpus/ClassLiteral.diffA-B.txt b/semantic/test/fixtures/java/corpus/ClassLiteral.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/ClassLiteral.diffA-B.txt rename to semantic/test/fixtures/java/corpus/ClassLiteral.diffA-B.txt diff --git a/test/fixtures/java/corpus/ClassLiteral.diffB-A.txt b/semantic/test/fixtures/java/corpus/ClassLiteral.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/ClassLiteral.diffB-A.txt rename to semantic/test/fixtures/java/corpus/ClassLiteral.diffB-A.txt diff --git a/test/fixtures/java/corpus/ClassLiteral.parseA.txt b/semantic/test/fixtures/java/corpus/ClassLiteral.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/ClassLiteral.parseA.txt rename to semantic/test/fixtures/java/corpus/ClassLiteral.parseA.txt diff --git a/test/fixtures/java/corpus/ClassLiteral.parseB.txt b/semantic/test/fixtures/java/corpus/ClassLiteral.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/ClassLiteral.parseB.txt rename to semantic/test/fixtures/java/corpus/ClassLiteral.parseB.txt diff --git a/test/fixtures/java/corpus/Comment.A.java b/semantic/test/fixtures/java/corpus/Comment.A.java similarity index 100% rename from test/fixtures/java/corpus/Comment.A.java rename to semantic/test/fixtures/java/corpus/Comment.A.java diff --git a/test/fixtures/java/corpus/Comment.B.java b/semantic/test/fixtures/java/corpus/Comment.B.java similarity index 100% rename from test/fixtures/java/corpus/Comment.B.java rename to semantic/test/fixtures/java/corpus/Comment.B.java diff --git a/test/fixtures/java/corpus/Comment.diffA-B.txt b/semantic/test/fixtures/java/corpus/Comment.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Comment.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Comment.diffA-B.txt diff --git a/test/fixtures/java/corpus/Comment.diffB-A.txt b/semantic/test/fixtures/java/corpus/Comment.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Comment.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Comment.diffB-A.txt diff --git a/test/fixtures/java/corpus/Comment.parseA.txt b/semantic/test/fixtures/java/corpus/Comment.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Comment.parseA.txt rename to semantic/test/fixtures/java/corpus/Comment.parseA.txt diff --git a/test/fixtures/java/corpus/Comment.parseB.txt b/semantic/test/fixtures/java/corpus/Comment.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Comment.parseB.txt rename to semantic/test/fixtures/java/corpus/Comment.parseB.txt diff --git a/test/fixtures/java/corpus/Continue.A.java b/semantic/test/fixtures/java/corpus/Continue.A.java similarity index 100% rename from test/fixtures/java/corpus/Continue.A.java rename to semantic/test/fixtures/java/corpus/Continue.A.java diff --git a/test/fixtures/java/corpus/Continue.B.java b/semantic/test/fixtures/java/corpus/Continue.B.java similarity index 100% rename from test/fixtures/java/corpus/Continue.B.java rename to semantic/test/fixtures/java/corpus/Continue.B.java diff --git a/test/fixtures/java/corpus/Continue.diffA-B.txt b/semantic/test/fixtures/java/corpus/Continue.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Continue.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Continue.diffA-B.txt diff --git a/test/fixtures/java/corpus/Continue.diffB-A.txt b/semantic/test/fixtures/java/corpus/Continue.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Continue.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Continue.diffB-A.txt diff --git a/test/fixtures/java/corpus/Continue.parseA.txt b/semantic/test/fixtures/java/corpus/Continue.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Continue.parseA.txt rename to semantic/test/fixtures/java/corpus/Continue.parseA.txt diff --git a/test/fixtures/java/corpus/Continue.parseB.txt b/semantic/test/fixtures/java/corpus/Continue.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Continue.parseB.txt rename to semantic/test/fixtures/java/corpus/Continue.parseB.txt diff --git a/test/fixtures/java/corpus/Continue0.A.java b/semantic/test/fixtures/java/corpus/Continue0.A.java similarity index 100% rename from test/fixtures/java/corpus/Continue0.A.java rename to semantic/test/fixtures/java/corpus/Continue0.A.java diff --git a/test/fixtures/java/corpus/Continue1.A.java b/semantic/test/fixtures/java/corpus/Continue1.A.java similarity index 100% rename from test/fixtures/java/corpus/Continue1.A.java rename to semantic/test/fixtures/java/corpus/Continue1.A.java diff --git a/test/fixtures/java/corpus/Dims.A.java b/semantic/test/fixtures/java/corpus/Dims.A.java similarity index 100% rename from test/fixtures/java/corpus/Dims.A.java rename to semantic/test/fixtures/java/corpus/Dims.A.java diff --git a/test/fixtures/java/corpus/Dims.B.java b/semantic/test/fixtures/java/corpus/Dims.B.java similarity index 100% rename from test/fixtures/java/corpus/Dims.B.java rename to semantic/test/fixtures/java/corpus/Dims.B.java diff --git a/test/fixtures/java/corpus/Dims.diffA-B.txt b/semantic/test/fixtures/java/corpus/Dims.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Dims.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Dims.diffA-B.txt diff --git a/test/fixtures/java/corpus/Dims.diffB-A.txt b/semantic/test/fixtures/java/corpus/Dims.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Dims.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Dims.diffB-A.txt diff --git a/test/fixtures/java/corpus/Dims.parseA.txt b/semantic/test/fixtures/java/corpus/Dims.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Dims.parseA.txt rename to semantic/test/fixtures/java/corpus/Dims.parseA.txt diff --git a/test/fixtures/java/corpus/Dims.parseB.txt b/semantic/test/fixtures/java/corpus/Dims.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Dims.parseB.txt rename to semantic/test/fixtures/java/corpus/Dims.parseB.txt diff --git a/test/fixtures/java/corpus/DoWhile.A.java b/semantic/test/fixtures/java/corpus/DoWhile.A.java similarity index 100% rename from test/fixtures/java/corpus/DoWhile.A.java rename to semantic/test/fixtures/java/corpus/DoWhile.A.java diff --git a/test/fixtures/java/corpus/DoWhile.B.java b/semantic/test/fixtures/java/corpus/DoWhile.B.java similarity index 100% rename from test/fixtures/java/corpus/DoWhile.B.java rename to semantic/test/fixtures/java/corpus/DoWhile.B.java diff --git a/test/fixtures/java/corpus/DoWhile.diffA-B.txt b/semantic/test/fixtures/java/corpus/DoWhile.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/DoWhile.diffA-B.txt rename to semantic/test/fixtures/java/corpus/DoWhile.diffA-B.txt diff --git a/test/fixtures/java/corpus/DoWhile.diffB-A.txt b/semantic/test/fixtures/java/corpus/DoWhile.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/DoWhile.diffB-A.txt rename to semantic/test/fixtures/java/corpus/DoWhile.diffB-A.txt diff --git a/test/fixtures/java/corpus/DoWhile.parseA.txt b/semantic/test/fixtures/java/corpus/DoWhile.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/DoWhile.parseA.txt rename to semantic/test/fixtures/java/corpus/DoWhile.parseA.txt diff --git a/test/fixtures/java/corpus/DoWhile.parseB.txt b/semantic/test/fixtures/java/corpus/DoWhile.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/DoWhile.parseB.txt rename to semantic/test/fixtures/java/corpus/DoWhile.parseB.txt diff --git a/test/fixtures/java/corpus/EnumDeclaration.A.java b/semantic/test/fixtures/java/corpus/EnumDeclaration.A.java similarity index 100% rename from test/fixtures/java/corpus/EnumDeclaration.A.java rename to semantic/test/fixtures/java/corpus/EnumDeclaration.A.java diff --git a/test/fixtures/java/corpus/EnumDeclaration.B.java b/semantic/test/fixtures/java/corpus/EnumDeclaration.B.java similarity index 100% rename from test/fixtures/java/corpus/EnumDeclaration.B.java rename to semantic/test/fixtures/java/corpus/EnumDeclaration.B.java diff --git a/test/fixtures/java/corpus/EnumDeclaration.diffA-B.txt b/semantic/test/fixtures/java/corpus/EnumDeclaration.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/EnumDeclaration.diffA-B.txt rename to semantic/test/fixtures/java/corpus/EnumDeclaration.diffA-B.txt diff --git a/test/fixtures/java/corpus/EnumDeclaration.diffB-A.txt b/semantic/test/fixtures/java/corpus/EnumDeclaration.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/EnumDeclaration.diffB-A.txt rename to semantic/test/fixtures/java/corpus/EnumDeclaration.diffB-A.txt diff --git a/test/fixtures/java/corpus/EnumDeclaration.parseA.txt b/semantic/test/fixtures/java/corpus/EnumDeclaration.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/EnumDeclaration.parseA.txt rename to semantic/test/fixtures/java/corpus/EnumDeclaration.parseA.txt diff --git a/test/fixtures/java/corpus/EnumDeclaration.parseB.txt b/semantic/test/fixtures/java/corpus/EnumDeclaration.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/EnumDeclaration.parseB.txt rename to semantic/test/fixtures/java/corpus/EnumDeclaration.parseB.txt diff --git a/test/fixtures/java/corpus/FieldAccess.A.java b/semantic/test/fixtures/java/corpus/FieldAccess.A.java similarity index 100% rename from test/fixtures/java/corpus/FieldAccess.A.java rename to semantic/test/fixtures/java/corpus/FieldAccess.A.java diff --git a/test/fixtures/java/corpus/FieldAccess.B.java b/semantic/test/fixtures/java/corpus/FieldAccess.B.java similarity index 100% rename from test/fixtures/java/corpus/FieldAccess.B.java rename to semantic/test/fixtures/java/corpus/FieldAccess.B.java diff --git a/test/fixtures/java/corpus/FieldAccess.diffA-B.txt b/semantic/test/fixtures/java/corpus/FieldAccess.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/FieldAccess.diffA-B.txt rename to semantic/test/fixtures/java/corpus/FieldAccess.diffA-B.txt diff --git a/test/fixtures/java/corpus/FieldAccess.diffB-A.txt b/semantic/test/fixtures/java/corpus/FieldAccess.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/FieldAccess.diffB-A.txt rename to semantic/test/fixtures/java/corpus/FieldAccess.diffB-A.txt diff --git a/test/fixtures/java/corpus/FieldAccess.parseA.txt b/semantic/test/fixtures/java/corpus/FieldAccess.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/FieldAccess.parseA.txt rename to semantic/test/fixtures/java/corpus/FieldAccess.parseA.txt diff --git a/test/fixtures/java/corpus/FieldAccess.parseB.txt b/semantic/test/fixtures/java/corpus/FieldAccess.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/FieldAccess.parseB.txt rename to semantic/test/fixtures/java/corpus/FieldAccess.parseB.txt diff --git a/test/fixtures/java/corpus/Float.A.java b/semantic/test/fixtures/java/corpus/Float.A.java similarity index 100% rename from test/fixtures/java/corpus/Float.A.java rename to semantic/test/fixtures/java/corpus/Float.A.java diff --git a/test/fixtures/java/corpus/Float.B.java b/semantic/test/fixtures/java/corpus/Float.B.java similarity index 100% rename from test/fixtures/java/corpus/Float.B.java rename to semantic/test/fixtures/java/corpus/Float.B.java diff --git a/test/fixtures/java/corpus/Float.diffA-B.txt b/semantic/test/fixtures/java/corpus/Float.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Float.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Float.diffA-B.txt diff --git a/test/fixtures/java/corpus/Float.diffB-A.txt b/semantic/test/fixtures/java/corpus/Float.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Float.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Float.diffB-A.txt diff --git a/test/fixtures/java/corpus/Float.parseA.txt b/semantic/test/fixtures/java/corpus/Float.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Float.parseA.txt rename to semantic/test/fixtures/java/corpus/Float.parseA.txt diff --git a/test/fixtures/java/corpus/Float.parseB.txt b/semantic/test/fixtures/java/corpus/Float.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Float.parseB.txt rename to semantic/test/fixtures/java/corpus/Float.parseB.txt diff --git a/test/fixtures/java/corpus/For.A.java b/semantic/test/fixtures/java/corpus/For.A.java similarity index 100% rename from test/fixtures/java/corpus/For.A.java rename to semantic/test/fixtures/java/corpus/For.A.java diff --git a/test/fixtures/java/corpus/For.B.java b/semantic/test/fixtures/java/corpus/For.B.java similarity index 100% rename from test/fixtures/java/corpus/For.B.java rename to semantic/test/fixtures/java/corpus/For.B.java diff --git a/test/fixtures/java/corpus/For.diffA-B.txt b/semantic/test/fixtures/java/corpus/For.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/For.diffA-B.txt rename to semantic/test/fixtures/java/corpus/For.diffA-B.txt diff --git a/test/fixtures/java/corpus/For.diffB-A.txt b/semantic/test/fixtures/java/corpus/For.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/For.diffB-A.txt rename to semantic/test/fixtures/java/corpus/For.diffB-A.txt diff --git a/test/fixtures/java/corpus/For.parseA.txt b/semantic/test/fixtures/java/corpus/For.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/For.parseA.txt rename to semantic/test/fixtures/java/corpus/For.parseA.txt diff --git a/test/fixtures/java/corpus/For.parseB.txt b/semantic/test/fixtures/java/corpus/For.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/For.parseB.txt rename to semantic/test/fixtures/java/corpus/For.parseB.txt diff --git a/test/fixtures/java/corpus/If.A.java b/semantic/test/fixtures/java/corpus/If.A.java similarity index 100% rename from test/fixtures/java/corpus/If.A.java rename to semantic/test/fixtures/java/corpus/If.A.java diff --git a/test/fixtures/java/corpus/If.B.java b/semantic/test/fixtures/java/corpus/If.B.java similarity index 100% rename from test/fixtures/java/corpus/If.B.java rename to semantic/test/fixtures/java/corpus/If.B.java diff --git a/test/fixtures/java/corpus/If.diffA-B.txt b/semantic/test/fixtures/java/corpus/If.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/If.diffA-B.txt rename to semantic/test/fixtures/java/corpus/If.diffA-B.txt diff --git a/test/fixtures/java/corpus/If.diffB-A.txt b/semantic/test/fixtures/java/corpus/If.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/If.diffB-A.txt rename to semantic/test/fixtures/java/corpus/If.diffB-A.txt diff --git a/test/fixtures/java/corpus/If.parseA.txt b/semantic/test/fixtures/java/corpus/If.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/If.parseA.txt rename to semantic/test/fixtures/java/corpus/If.parseA.txt diff --git a/test/fixtures/java/corpus/If.parseB.txt b/semantic/test/fixtures/java/corpus/If.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/If.parseB.txt rename to semantic/test/fixtures/java/corpus/If.parseB.txt diff --git a/test/fixtures/java/corpus/Import.A.java b/semantic/test/fixtures/java/corpus/Import.A.java similarity index 100% rename from test/fixtures/java/corpus/Import.A.java rename to semantic/test/fixtures/java/corpus/Import.A.java diff --git a/test/fixtures/java/corpus/Import.B.java b/semantic/test/fixtures/java/corpus/Import.B.java similarity index 100% rename from test/fixtures/java/corpus/Import.B.java rename to semantic/test/fixtures/java/corpus/Import.B.java diff --git a/test/fixtures/java/corpus/Import.diffA-B.txt b/semantic/test/fixtures/java/corpus/Import.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Import.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Import.diffA-B.txt diff --git a/test/fixtures/java/corpus/Import.diffB-A.txt b/semantic/test/fixtures/java/corpus/Import.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Import.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Import.diffB-A.txt diff --git a/test/fixtures/java/corpus/Import.parseA.txt b/semantic/test/fixtures/java/corpus/Import.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Import.parseA.txt rename to semantic/test/fixtures/java/corpus/Import.parseA.txt diff --git a/test/fixtures/java/corpus/Import.parseB.txt b/semantic/test/fixtures/java/corpus/Import.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Import.parseB.txt rename to semantic/test/fixtures/java/corpus/Import.parseB.txt diff --git a/test/fixtures/java/corpus/Int.A.java b/semantic/test/fixtures/java/corpus/Int.A.java similarity index 100% rename from test/fixtures/java/corpus/Int.A.java rename to semantic/test/fixtures/java/corpus/Int.A.java diff --git a/test/fixtures/java/corpus/Int.B.java b/semantic/test/fixtures/java/corpus/Int.B.java similarity index 100% rename from test/fixtures/java/corpus/Int.B.java rename to semantic/test/fixtures/java/corpus/Int.B.java diff --git a/test/fixtures/java/corpus/Int.diffA-B.txt b/semantic/test/fixtures/java/corpus/Int.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Int.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Int.diffA-B.txt diff --git a/test/fixtures/java/corpus/Int.diffB-A.txt b/semantic/test/fixtures/java/corpus/Int.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Int.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Int.diffB-A.txt diff --git a/test/fixtures/java/corpus/Int.parseA.txt b/semantic/test/fixtures/java/corpus/Int.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Int.parseA.txt rename to semantic/test/fixtures/java/corpus/Int.parseA.txt diff --git a/test/fixtures/java/corpus/Int.parseB.txt b/semantic/test/fixtures/java/corpus/Int.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Int.parseB.txt rename to semantic/test/fixtures/java/corpus/Int.parseB.txt diff --git a/test/fixtures/java/corpus/Interface.A.java b/semantic/test/fixtures/java/corpus/Interface.A.java similarity index 100% rename from test/fixtures/java/corpus/Interface.A.java rename to semantic/test/fixtures/java/corpus/Interface.A.java diff --git a/test/fixtures/java/corpus/Interface.B.java b/semantic/test/fixtures/java/corpus/Interface.B.java similarity index 100% rename from test/fixtures/java/corpus/Interface.B.java rename to semantic/test/fixtures/java/corpus/Interface.B.java diff --git a/test/fixtures/java/corpus/Interface.diffA-B.txt b/semantic/test/fixtures/java/corpus/Interface.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Interface.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Interface.diffA-B.txt diff --git a/test/fixtures/java/corpus/Interface.diffB-A.txt b/semantic/test/fixtures/java/corpus/Interface.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Interface.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Interface.diffB-A.txt diff --git a/test/fixtures/java/corpus/Interface.parseA.txt b/semantic/test/fixtures/java/corpus/Interface.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Interface.parseA.txt rename to semantic/test/fixtures/java/corpus/Interface.parseA.txt diff --git a/test/fixtures/java/corpus/Interface.parseB.txt b/semantic/test/fixtures/java/corpus/Interface.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Interface.parseB.txt rename to semantic/test/fixtures/java/corpus/Interface.parseB.txt diff --git a/test/fixtures/java/corpus/Lambda.A.java b/semantic/test/fixtures/java/corpus/Lambda.A.java similarity index 100% rename from test/fixtures/java/corpus/Lambda.A.java rename to semantic/test/fixtures/java/corpus/Lambda.A.java diff --git a/test/fixtures/java/corpus/Lambda.B.java b/semantic/test/fixtures/java/corpus/Lambda.B.java similarity index 100% rename from test/fixtures/java/corpus/Lambda.B.java rename to semantic/test/fixtures/java/corpus/Lambda.B.java diff --git a/test/fixtures/java/corpus/Lambda.diffA-B.txt b/semantic/test/fixtures/java/corpus/Lambda.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Lambda.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Lambda.diffA-B.txt diff --git a/test/fixtures/java/corpus/Lambda.diffB-A.txt b/semantic/test/fixtures/java/corpus/Lambda.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Lambda.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Lambda.diffB-A.txt diff --git a/test/fixtures/java/corpus/Lambda.parseA.txt b/semantic/test/fixtures/java/corpus/Lambda.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Lambda.parseA.txt rename to semantic/test/fixtures/java/corpus/Lambda.parseA.txt diff --git a/test/fixtures/java/corpus/Lambda.parseB.txt b/semantic/test/fixtures/java/corpus/Lambda.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Lambda.parseB.txt rename to semantic/test/fixtures/java/corpus/Lambda.parseB.txt diff --git a/test/fixtures/java/corpus/ScopedIdentifier.A.java b/semantic/test/fixtures/java/corpus/ScopedIdentifier.A.java similarity index 100% rename from test/fixtures/java/corpus/ScopedIdentifier.A.java rename to semantic/test/fixtures/java/corpus/ScopedIdentifier.A.java diff --git a/test/fixtures/java/corpus/ScopedIdentifier.B.java b/semantic/test/fixtures/java/corpus/ScopedIdentifier.B.java similarity index 100% rename from test/fixtures/java/corpus/ScopedIdentifier.B.java rename to semantic/test/fixtures/java/corpus/ScopedIdentifier.B.java diff --git a/test/fixtures/java/corpus/ScopedIdentifier.diffA-B.txt b/semantic/test/fixtures/java/corpus/ScopedIdentifier.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/ScopedIdentifier.diffA-B.txt rename to semantic/test/fixtures/java/corpus/ScopedIdentifier.diffA-B.txt diff --git a/test/fixtures/java/corpus/ScopedIdentifier.diffB-A.txt b/semantic/test/fixtures/java/corpus/ScopedIdentifier.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/ScopedIdentifier.diffB-A.txt rename to semantic/test/fixtures/java/corpus/ScopedIdentifier.diffB-A.txt diff --git a/test/fixtures/java/corpus/ScopedIdentifier.parseA.txt b/semantic/test/fixtures/java/corpus/ScopedIdentifier.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/ScopedIdentifier.parseA.txt rename to semantic/test/fixtures/java/corpus/ScopedIdentifier.parseA.txt diff --git a/test/fixtures/java/corpus/ScopedIdentifier.parseB.txt b/semantic/test/fixtures/java/corpus/ScopedIdentifier.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/ScopedIdentifier.parseB.txt rename to semantic/test/fixtures/java/corpus/ScopedIdentifier.parseB.txt diff --git a/test/fixtures/java/corpus/SpreadParameter.A.java b/semantic/test/fixtures/java/corpus/SpreadParameter.A.java similarity index 100% rename from test/fixtures/java/corpus/SpreadParameter.A.java rename to semantic/test/fixtures/java/corpus/SpreadParameter.A.java diff --git a/test/fixtures/java/corpus/SpreadParameter.B.java b/semantic/test/fixtures/java/corpus/SpreadParameter.B.java similarity index 100% rename from test/fixtures/java/corpus/SpreadParameter.B.java rename to semantic/test/fixtures/java/corpus/SpreadParameter.B.java diff --git a/test/fixtures/java/corpus/SpreadParameter.diffA-B.txt b/semantic/test/fixtures/java/corpus/SpreadParameter.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/SpreadParameter.diffA-B.txt rename to semantic/test/fixtures/java/corpus/SpreadParameter.diffA-B.txt diff --git a/test/fixtures/java/corpus/SpreadParameter.diffB-A.txt b/semantic/test/fixtures/java/corpus/SpreadParameter.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/SpreadParameter.diffB-A.txt rename to semantic/test/fixtures/java/corpus/SpreadParameter.diffB-A.txt diff --git a/test/fixtures/java/corpus/SpreadParameter.parseA.txt b/semantic/test/fixtures/java/corpus/SpreadParameter.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/SpreadParameter.parseA.txt rename to semantic/test/fixtures/java/corpus/SpreadParameter.parseA.txt diff --git a/test/fixtures/java/corpus/SpreadParameter.parseB.txt b/semantic/test/fixtures/java/corpus/SpreadParameter.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/SpreadParameter.parseB.txt rename to semantic/test/fixtures/java/corpus/SpreadParameter.parseB.txt diff --git a/test/fixtures/java/corpus/String.A.java b/semantic/test/fixtures/java/corpus/String.A.java similarity index 100% rename from test/fixtures/java/corpus/String.A.java rename to semantic/test/fixtures/java/corpus/String.A.java diff --git a/test/fixtures/java/corpus/String.B.java b/semantic/test/fixtures/java/corpus/String.B.java similarity index 100% rename from test/fixtures/java/corpus/String.B.java rename to semantic/test/fixtures/java/corpus/String.B.java diff --git a/test/fixtures/java/corpus/String.diffA-B.txt b/semantic/test/fixtures/java/corpus/String.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/String.diffA-B.txt rename to semantic/test/fixtures/java/corpus/String.diffA-B.txt diff --git a/test/fixtures/java/corpus/String.diffB-A.txt b/semantic/test/fixtures/java/corpus/String.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/String.diffB-A.txt rename to semantic/test/fixtures/java/corpus/String.diffB-A.txt diff --git a/test/fixtures/java/corpus/String.parseA.txt b/semantic/test/fixtures/java/corpus/String.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/String.parseA.txt rename to semantic/test/fixtures/java/corpus/String.parseA.txt diff --git a/test/fixtures/java/corpus/String.parseB.txt b/semantic/test/fixtures/java/corpus/String.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/String.parseB.txt rename to semantic/test/fixtures/java/corpus/String.parseB.txt diff --git a/test/fixtures/java/corpus/Switch.A.java b/semantic/test/fixtures/java/corpus/Switch.A.java similarity index 100% rename from test/fixtures/java/corpus/Switch.A.java rename to semantic/test/fixtures/java/corpus/Switch.A.java diff --git a/test/fixtures/java/corpus/Switch.B.java b/semantic/test/fixtures/java/corpus/Switch.B.java similarity index 100% rename from test/fixtures/java/corpus/Switch.B.java rename to semantic/test/fixtures/java/corpus/Switch.B.java diff --git a/test/fixtures/java/corpus/Switch.diffA-B.txt b/semantic/test/fixtures/java/corpus/Switch.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Switch.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Switch.diffA-B.txt diff --git a/test/fixtures/java/corpus/Switch.diffB-A.txt b/semantic/test/fixtures/java/corpus/Switch.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Switch.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Switch.diffB-A.txt diff --git a/test/fixtures/java/corpus/Switch.parseA.txt b/semantic/test/fixtures/java/corpus/Switch.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Switch.parseA.txt rename to semantic/test/fixtures/java/corpus/Switch.parseA.txt diff --git a/test/fixtures/java/corpus/Switch.parseB.txt b/semantic/test/fixtures/java/corpus/Switch.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Switch.parseB.txt rename to semantic/test/fixtures/java/corpus/Switch.parseB.txt diff --git a/test/fixtures/java/corpus/Throws.A.java b/semantic/test/fixtures/java/corpus/Throws.A.java similarity index 100% rename from test/fixtures/java/corpus/Throws.A.java rename to semantic/test/fixtures/java/corpus/Throws.A.java diff --git a/test/fixtures/java/corpus/Throws.B.java b/semantic/test/fixtures/java/corpus/Throws.B.java similarity index 100% rename from test/fixtures/java/corpus/Throws.B.java rename to semantic/test/fixtures/java/corpus/Throws.B.java diff --git a/test/fixtures/java/corpus/TryCatches.A.java b/semantic/test/fixtures/java/corpus/TryCatches.A.java similarity index 100% rename from test/fixtures/java/corpus/TryCatches.A.java rename to semantic/test/fixtures/java/corpus/TryCatches.A.java diff --git a/test/fixtures/java/corpus/TryCatches.B.java b/semantic/test/fixtures/java/corpus/TryCatches.B.java similarity index 100% rename from test/fixtures/java/corpus/TryCatches.B.java rename to semantic/test/fixtures/java/corpus/TryCatches.B.java diff --git a/test/fixtures/java/corpus/TryWithResourcesStatement.A.java b/semantic/test/fixtures/java/corpus/TryWithResourcesStatement.A.java similarity index 100% rename from test/fixtures/java/corpus/TryWithResourcesStatement.A.java rename to semantic/test/fixtures/java/corpus/TryWithResourcesStatement.A.java diff --git a/test/fixtures/java/corpus/TryWithResourcesStatement.B.java b/semantic/test/fixtures/java/corpus/TryWithResourcesStatement.B.java similarity index 100% rename from test/fixtures/java/corpus/TryWithResourcesStatement.B.java rename to semantic/test/fixtures/java/corpus/TryWithResourcesStatement.B.java diff --git a/test/fixtures/java/corpus/TryWithResourcesStatement.diffA-B.txt b/semantic/test/fixtures/java/corpus/TryWithResourcesStatement.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/TryWithResourcesStatement.diffA-B.txt rename to semantic/test/fixtures/java/corpus/TryWithResourcesStatement.diffA-B.txt diff --git a/test/fixtures/java/corpus/TryWithResourcesStatement.diffB-A.txt b/semantic/test/fixtures/java/corpus/TryWithResourcesStatement.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/TryWithResourcesStatement.diffB-A.txt rename to semantic/test/fixtures/java/corpus/TryWithResourcesStatement.diffB-A.txt diff --git a/test/fixtures/java/corpus/TryWithResourcesStatement.parseA.txt b/semantic/test/fixtures/java/corpus/TryWithResourcesStatement.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/TryWithResourcesStatement.parseA.txt rename to semantic/test/fixtures/java/corpus/TryWithResourcesStatement.parseA.txt diff --git a/test/fixtures/java/corpus/TryWithResourcesStatement.parseB.txt b/semantic/test/fixtures/java/corpus/TryWithResourcesStatement.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/TryWithResourcesStatement.parseB.txt rename to semantic/test/fixtures/java/corpus/TryWithResourcesStatement.parseB.txt diff --git a/test/fixtures/java/corpus/TypeArgument.A.java b/semantic/test/fixtures/java/corpus/TypeArgument.A.java similarity index 100% rename from test/fixtures/java/corpus/TypeArgument.A.java rename to semantic/test/fixtures/java/corpus/TypeArgument.A.java diff --git a/test/fixtures/java/corpus/TypeArgument.B.java b/semantic/test/fixtures/java/corpus/TypeArgument.B.java similarity index 100% rename from test/fixtures/java/corpus/TypeArgument.B.java rename to semantic/test/fixtures/java/corpus/TypeArgument.B.java diff --git a/test/fixtures/java/corpus/TypeArgument.diffA-B.txt b/semantic/test/fixtures/java/corpus/TypeArgument.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/TypeArgument.diffA-B.txt rename to semantic/test/fixtures/java/corpus/TypeArgument.diffA-B.txt diff --git a/test/fixtures/java/corpus/TypeArgument.diffB-A.txt b/semantic/test/fixtures/java/corpus/TypeArgument.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/TypeArgument.diffB-A.txt rename to semantic/test/fixtures/java/corpus/TypeArgument.diffB-A.txt diff --git a/test/fixtures/java/corpus/TypeArgument.parseA.txt b/semantic/test/fixtures/java/corpus/TypeArgument.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/TypeArgument.parseA.txt rename to semantic/test/fixtures/java/corpus/TypeArgument.parseA.txt diff --git a/test/fixtures/java/corpus/TypeArgument.parseB.txt b/semantic/test/fixtures/java/corpus/TypeArgument.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/TypeArgument.parseB.txt rename to semantic/test/fixtures/java/corpus/TypeArgument.parseB.txt diff --git a/test/fixtures/java/corpus/Update.A.java b/semantic/test/fixtures/java/corpus/Update.A.java similarity index 100% rename from test/fixtures/java/corpus/Update.A.java rename to semantic/test/fixtures/java/corpus/Update.A.java diff --git a/test/fixtures/java/corpus/Update.B.java b/semantic/test/fixtures/java/corpus/Update.B.java similarity index 100% rename from test/fixtures/java/corpus/Update.B.java rename to semantic/test/fixtures/java/corpus/Update.B.java diff --git a/test/fixtures/java/corpus/Update.diffA-B.txt b/semantic/test/fixtures/java/corpus/Update.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Update.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Update.diffA-B.txt diff --git a/test/fixtures/java/corpus/Update.diffB-A.txt b/semantic/test/fixtures/java/corpus/Update.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Update.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Update.diffB-A.txt diff --git a/test/fixtures/java/corpus/Update.parseA.txt b/semantic/test/fixtures/java/corpus/Update.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Update.parseA.txt rename to semantic/test/fixtures/java/corpus/Update.parseA.txt diff --git a/test/fixtures/java/corpus/Update.parseB.txt b/semantic/test/fixtures/java/corpus/Update.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Update.parseB.txt rename to semantic/test/fixtures/java/corpus/Update.parseB.txt diff --git a/test/fixtures/java/corpus/VariableDeclaration.A.java b/semantic/test/fixtures/java/corpus/VariableDeclaration.A.java similarity index 100% rename from test/fixtures/java/corpus/VariableDeclaration.A.java rename to semantic/test/fixtures/java/corpus/VariableDeclaration.A.java diff --git a/test/fixtures/java/corpus/VariableDeclaration.B.java b/semantic/test/fixtures/java/corpus/VariableDeclaration.B.java similarity index 100% rename from test/fixtures/java/corpus/VariableDeclaration.B.java rename to semantic/test/fixtures/java/corpus/VariableDeclaration.B.java diff --git a/test/fixtures/java/corpus/VariableDeclaration.diffA-B.txt b/semantic/test/fixtures/java/corpus/VariableDeclaration.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/VariableDeclaration.diffA-B.txt rename to semantic/test/fixtures/java/corpus/VariableDeclaration.diffA-B.txt diff --git a/test/fixtures/java/corpus/VariableDeclaration.diffB-A.txt b/semantic/test/fixtures/java/corpus/VariableDeclaration.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/VariableDeclaration.diffB-A.txt rename to semantic/test/fixtures/java/corpus/VariableDeclaration.diffB-A.txt diff --git a/test/fixtures/java/corpus/VariableDeclaration.parseA.txt b/semantic/test/fixtures/java/corpus/VariableDeclaration.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/VariableDeclaration.parseA.txt rename to semantic/test/fixtures/java/corpus/VariableDeclaration.parseA.txt diff --git a/test/fixtures/java/corpus/VariableDeclaration.parseB.txt b/semantic/test/fixtures/java/corpus/VariableDeclaration.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/VariableDeclaration.parseB.txt rename to semantic/test/fixtures/java/corpus/VariableDeclaration.parseB.txt diff --git a/test/fixtures/java/corpus/While.A.java b/semantic/test/fixtures/java/corpus/While.A.java similarity index 100% rename from test/fixtures/java/corpus/While.A.java rename to semantic/test/fixtures/java/corpus/While.A.java diff --git a/test/fixtures/java/corpus/While.B.java b/semantic/test/fixtures/java/corpus/While.B.java similarity index 100% rename from test/fixtures/java/corpus/While.B.java rename to semantic/test/fixtures/java/corpus/While.B.java diff --git a/test/fixtures/java/corpus/While.diffA-B.txt b/semantic/test/fixtures/java/corpus/While.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/While.diffA-B.txt rename to semantic/test/fixtures/java/corpus/While.diffA-B.txt diff --git a/test/fixtures/java/corpus/While.diffB-A.txt b/semantic/test/fixtures/java/corpus/While.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/While.diffB-A.txt rename to semantic/test/fixtures/java/corpus/While.diffB-A.txt diff --git a/test/fixtures/java/corpus/While.parseA.txt b/semantic/test/fixtures/java/corpus/While.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/While.parseA.txt rename to semantic/test/fixtures/java/corpus/While.parseA.txt diff --git a/test/fixtures/java/corpus/While.parseB.txt b/semantic/test/fixtures/java/corpus/While.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/While.parseB.txt rename to semantic/test/fixtures/java/corpus/While.parseB.txt diff --git a/test/fixtures/java/corpus/Wildcard.A.java b/semantic/test/fixtures/java/corpus/Wildcard.A.java similarity index 100% rename from test/fixtures/java/corpus/Wildcard.A.java rename to semantic/test/fixtures/java/corpus/Wildcard.A.java diff --git a/test/fixtures/java/corpus/Wildcard.B.java b/semantic/test/fixtures/java/corpus/Wildcard.B.java similarity index 100% rename from test/fixtures/java/corpus/Wildcard.B.java rename to semantic/test/fixtures/java/corpus/Wildcard.B.java diff --git a/test/fixtures/java/corpus/Wildcard.diffA-B.txt b/semantic/test/fixtures/java/corpus/Wildcard.diffA-B.txt similarity index 100% rename from test/fixtures/java/corpus/Wildcard.diffA-B.txt rename to semantic/test/fixtures/java/corpus/Wildcard.diffA-B.txt diff --git a/test/fixtures/java/corpus/Wildcard.diffB-A.txt b/semantic/test/fixtures/java/corpus/Wildcard.diffB-A.txt similarity index 100% rename from test/fixtures/java/corpus/Wildcard.diffB-A.txt rename to semantic/test/fixtures/java/corpus/Wildcard.diffB-A.txt diff --git a/test/fixtures/java/corpus/Wildcard.parseA.txt b/semantic/test/fixtures/java/corpus/Wildcard.parseA.txt similarity index 100% rename from test/fixtures/java/corpus/Wildcard.parseA.txt rename to semantic/test/fixtures/java/corpus/Wildcard.parseA.txt diff --git a/test/fixtures/java/corpus/Wildcard.parseB.txt b/semantic/test/fixtures/java/corpus/Wildcard.parseB.txt similarity index 100% rename from test/fixtures/java/corpus/Wildcard.parseB.txt rename to semantic/test/fixtures/java/corpus/Wildcard.parseB.txt diff --git a/test/fixtures/java/corpus/array-access.java b/semantic/test/fixtures/java/corpus/array-access.java similarity index 100% rename from test/fixtures/java/corpus/array-access.java rename to semantic/test/fixtures/java/corpus/array-access.java diff --git a/test/fixtures/java/corpus/assertStatement.java b/semantic/test/fixtures/java/corpus/assertStatement.java similarity index 100% rename from test/fixtures/java/corpus/assertStatement.java rename to semantic/test/fixtures/java/corpus/assertStatement.java diff --git a/test/fixtures/java/corpus/assertStringLiteral.java b/semantic/test/fixtures/java/corpus/assertStringLiteral.java similarity index 100% rename from test/fixtures/java/corpus/assertStringLiteral.java rename to semantic/test/fixtures/java/corpus/assertStringLiteral.java diff --git a/test/fixtures/java/corpus/enum.java b/semantic/test/fixtures/java/corpus/enum.java similarity index 100% rename from test/fixtures/java/corpus/enum.java rename to semantic/test/fixtures/java/corpus/enum.java diff --git a/test/fixtures/java/corpus/methodReference.java b/semantic/test/fixtures/java/corpus/methodReference.java similarity index 100% rename from test/fixtures/java/corpus/methodReference.java rename to semantic/test/fixtures/java/corpus/methodReference.java diff --git a/test/fixtures/java/corpus/modifier-abstract.java b/semantic/test/fixtures/java/corpus/modifier-abstract.java similarity index 100% rename from test/fixtures/java/corpus/modifier-abstract.java rename to semantic/test/fixtures/java/corpus/modifier-abstract.java diff --git a/test/fixtures/java/corpus/modifier-private.java b/semantic/test/fixtures/java/corpus/modifier-private.java similarity index 100% rename from test/fixtures/java/corpus/modifier-private.java rename to semantic/test/fixtures/java/corpus/modifier-private.java diff --git a/test/fixtures/java/corpus/modifier-protected.java b/semantic/test/fixtures/java/corpus/modifier-protected.java similarity index 100% rename from test/fixtures/java/corpus/modifier-protected.java rename to semantic/test/fixtures/java/corpus/modifier-protected.java diff --git a/test/fixtures/java/corpus/modifier-public.java b/semantic/test/fixtures/java/corpus/modifier-public.java similarity index 100% rename from test/fixtures/java/corpus/modifier-public.java rename to semantic/test/fixtures/java/corpus/modifier-public.java diff --git a/test/fixtures/java/corpus/modifier-static.java b/semantic/test/fixtures/java/corpus/modifier-static.java similarity index 100% rename from test/fixtures/java/corpus/modifier-static.java rename to semantic/test/fixtures/java/corpus/modifier-static.java diff --git a/test/fixtures/java/corpus/null.java b/semantic/test/fixtures/java/corpus/null.java similarity index 100% rename from test/fixtures/java/corpus/null.java rename to semantic/test/fixtures/java/corpus/null.java diff --git a/test/fixtures/java/corpus/package.java b/semantic/test/fixtures/java/corpus/package.java similarity index 100% rename from test/fixtures/java/corpus/package.java rename to semantic/test/fixtures/java/corpus/package.java diff --git a/test/fixtures/java/corpus/return.java b/semantic/test/fixtures/java/corpus/return.java similarity index 100% rename from test/fixtures/java/corpus/return.java rename to semantic/test/fixtures/java/corpus/return.java diff --git a/semantic/test/fixtures/java/corpus/try.java b/semantic/test/fixtures/java/corpus/try.java new file mode 100644 index 0000000000..b3eea2991a --- /dev/null +++ b/semantic/test/fixtures/java/corpus/try.java @@ -0,0 +1,9 @@ +public class Bar { + public void foo() { + try { + System.out.println(1/0); + } catch (Exception e) { + e.printStackTrace(System.out); + } + } +} diff --git a/semantic/test/fixtures/java/corpus/try_with_resources.java b/semantic/test/fixtures/java/corpus/try_with_resources.java new file mode 100644 index 0000000000..8d7536b9ef --- /dev/null +++ b/semantic/test/fixtures/java/corpus/try_with_resources.java @@ -0,0 +1,9 @@ +public class Bar { + public void foo() { + try (BufferedReader br = new BufferedReader()) { + System.out.println(1/0); + } catch (Exception e) { + e.printStackTrace(System.out); + } + } +} diff --git a/test/fixtures/javascript/analysis/exports/lib.js b/semantic/test/fixtures/javascript/analysis/exports/lib.js similarity index 100% rename from test/fixtures/javascript/analysis/exports/lib.js rename to semantic/test/fixtures/javascript/analysis/exports/lib.js diff --git a/test/fixtures/javascript/analysis/exports/main.js b/semantic/test/fixtures/javascript/analysis/exports/main.js similarity index 100% rename from test/fixtures/javascript/analysis/exports/main.js rename to semantic/test/fixtures/javascript/analysis/exports/main.js diff --git a/test/fixtures/javascript/analysis/foo.js b/semantic/test/fixtures/javascript/analysis/foo.js similarity index 100% rename from test/fixtures/javascript/analysis/foo.js rename to semantic/test/fixtures/javascript/analysis/foo.js diff --git a/test/fixtures/javascript/analysis/main.js b/semantic/test/fixtures/javascript/analysis/main.js similarity index 100% rename from test/fixtures/javascript/analysis/main.js rename to semantic/test/fixtures/javascript/analysis/main.js diff --git a/test/fixtures/javascript/analysis/main2.js b/semantic/test/fixtures/javascript/analysis/main2.js similarity index 100% rename from test/fixtures/javascript/analysis/main2.js rename to semantic/test/fixtures/javascript/analysis/main2.js diff --git a/test/fixtures/javascript/analysis/node_modules/bar.js b/semantic/test/fixtures/javascript/analysis/node_modules/bar.js similarity index 100% rename from test/fixtures/javascript/analysis/node_modules/bar.js rename to semantic/test/fixtures/javascript/analysis/node_modules/bar.js diff --git a/test/fixtures/javascript/analysis/node_modules/tos/index.js b/semantic/test/fixtures/javascript/analysis/node_modules/tos/index.js similarity index 100% rename from test/fixtures/javascript/analysis/node_modules/tos/index.js rename to semantic/test/fixtures/javascript/analysis/node_modules/tos/index.js diff --git a/test/fixtures/javascript/analysis/node_modules/wap/package.json b/semantic/test/fixtures/javascript/analysis/node_modules/wap/package.json similarity index 100% rename from test/fixtures/javascript/analysis/node_modules/wap/package.json rename to semantic/test/fixtures/javascript/analysis/node_modules/wap/package.json diff --git a/test/fixtures/javascript/analysis/node_modules/wap/start.js b/semantic/test/fixtures/javascript/analysis/node_modules/wap/start.js similarity index 100% rename from test/fixtures/javascript/analysis/node_modules/wap/start.js rename to semantic/test/fixtures/javascript/analysis/node_modules/wap/start.js diff --git a/test/fixtures/javascript/corpus/anonymous-function.A.js b/semantic/test/fixtures/javascript/corpus/anonymous-function.A.js similarity index 100% rename from test/fixtures/javascript/corpus/anonymous-function.A.js rename to semantic/test/fixtures/javascript/corpus/anonymous-function.A.js diff --git a/test/fixtures/javascript/corpus/anonymous-function.B.js b/semantic/test/fixtures/javascript/corpus/anonymous-function.B.js similarity index 100% rename from test/fixtures/javascript/corpus/anonymous-function.B.js rename to semantic/test/fixtures/javascript/corpus/anonymous-function.B.js diff --git a/test/fixtures/javascript/corpus/anonymous-function.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/anonymous-function.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/anonymous-function.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/anonymous-function.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/anonymous-function.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/anonymous-function.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/anonymous-function.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/anonymous-function.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/anonymous-function.parseA.txt b/semantic/test/fixtures/javascript/corpus/anonymous-function.parseA.txt new file mode 100644 index 0000000000..69d7b866ed --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/anonymous-function.parseA.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "a")) + (Expression + (Identifier "b"))))))) + (FormalParameters + (RequiredParameter + (Identifier "a")) + (RequiredParameter + (Identifier "b")))))))) diff --git a/semantic/test/fixtures/javascript/corpus/anonymous-function.parseB.txt b/semantic/test/fixtures/javascript/corpus/anonymous-function.parseB.txt new file mode 100644 index 0000000000..f5356effb4 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/anonymous-function.parseB.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "b")) + (Expression + (Identifier "c"))))))) + (FormalParameters + (RequiredParameter + (Identifier "b")) + (RequiredParameter + (Identifier "c")))))))) diff --git a/test/fixtures/javascript/corpus/anonymous-parameterless-function.A.js b/semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.A.js similarity index 100% rename from test/fixtures/javascript/corpus/anonymous-parameterless-function.A.js rename to semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.A.js diff --git a/test/fixtures/javascript/corpus/anonymous-parameterless-function.B.js b/semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.B.js similarity index 100% rename from test/fixtures/javascript/corpus/anonymous-parameterless-function.B.js rename to semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.B.js diff --git a/test/fixtures/javascript/corpus/anonymous-parameterless-function.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/anonymous-parameterless-function.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/anonymous-parameterless-function.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/anonymous-parameterless-function.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseA.txt b/semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseA.txt new file mode 100644 index 0000000000..c0b50535f5 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseA.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (String))))) + (FormalParameters)))))) diff --git a/semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseB.txt b/semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseB.txt new file mode 100644 index 0000000000..c0b50535f5 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseB.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (String))))) + (FormalParameters)))))) diff --git a/test/fixtures/javascript/corpus/array.A.js b/semantic/test/fixtures/javascript/corpus/array.A.js similarity index 100% rename from test/fixtures/javascript/corpus/array.A.js rename to semantic/test/fixtures/javascript/corpus/array.A.js diff --git a/test/fixtures/javascript/corpus/array.B.js b/semantic/test/fixtures/javascript/corpus/array.B.js similarity index 100% rename from test/fixtures/javascript/corpus/array.B.js rename to semantic/test/fixtures/javascript/corpus/array.B.js diff --git a/test/fixtures/javascript/corpus/array.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/array.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/array.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/array.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/array.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/array.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/array.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/array.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/array.parseA.txt b/semantic/test/fixtures/javascript/corpus/array.parseA.txt new file mode 100644 index 0000000000..51199093a4 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/array.parseA.txt @@ -0,0 +1,7 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Array + (Expression + (String))))))) diff --git a/semantic/test/fixtures/javascript/corpus/array.parseB.txt b/semantic/test/fixtures/javascript/corpus/array.parseB.txt new file mode 100644 index 0000000000..985c789dda --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/array.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Array + (Expression + (String)) + (Expression + (String))))))) diff --git a/test/fixtures/javascript/corpus/arrow-function.A.js b/semantic/test/fixtures/javascript/corpus/arrow-function.A.js similarity index 100% rename from test/fixtures/javascript/corpus/arrow-function.A.js rename to semantic/test/fixtures/javascript/corpus/arrow-function.A.js diff --git a/test/fixtures/javascript/corpus/arrow-function.B.js b/semantic/test/fixtures/javascript/corpus/arrow-function.B.js similarity index 100% rename from test/fixtures/javascript/corpus/arrow-function.B.js rename to semantic/test/fixtures/javascript/corpus/arrow-function.B.js diff --git a/test/fixtures/javascript/corpus/arrow-function.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/arrow-function.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/arrow-function.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/arrow-function.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/arrow-function.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/arrow-function.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/arrow-function.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/arrow-function.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/arrow-function.parseA.txt b/semantic/test/fixtures/javascript/corpus/arrow-function.parseA.txt new file mode 100644 index 0000000000..ed34ac268d --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/arrow-function.parseA.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (ArrowFunction + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "h"))))) + (FormalParameters + (RequiredParameter + (Identifier "f")) + (RequiredParameter + (Identifier "g")))))))) diff --git a/semantic/test/fixtures/javascript/corpus/arrow-function.parseB.txt b/semantic/test/fixtures/javascript/corpus/arrow-function.parseB.txt new file mode 100644 index 0000000000..67efe73fd9 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/arrow-function.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (ArrowFunction + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "g"))))) + (FormalParameters + (RequiredParameter + (Identifier "f")) + (RequiredParameter + (Identifier "g")))))))) diff --git a/test/fixtures/javascript/corpus/assignment-pattern.A.js b/semantic/test/fixtures/javascript/corpus/assignment-pattern.A.js similarity index 100% rename from test/fixtures/javascript/corpus/assignment-pattern.A.js rename to semantic/test/fixtures/javascript/corpus/assignment-pattern.A.js diff --git a/test/fixtures/javascript/corpus/assignment-pattern.B.js b/semantic/test/fixtures/javascript/corpus/assignment-pattern.B.js similarity index 100% rename from test/fixtures/javascript/corpus/assignment-pattern.B.js rename to semantic/test/fixtures/javascript/corpus/assignment-pattern.B.js diff --git a/test/fixtures/javascript/corpus/assignment-pattern.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/assignment-pattern.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/assignment-pattern.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/assignment-pattern.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/assignment-pattern.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/assignment-pattern.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/assignment-pattern.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/assignment-pattern.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/assignment-pattern.parseA.txt b/semantic/test/fixtures/javascript/corpus/assignment-pattern.parseA.txt new file mode 100644 index 0000000000..d31efb2e71 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/assignment-pattern.parseA.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (Identifier "foo")) + (DestructuringPattern + (ObjectPattern + (AssignmentPattern + (ShorthandPropertyIdentifier "x") + (Expression + (Number "0")))))))))) diff --git a/semantic/test/fixtures/javascript/corpus/assignment-pattern.parseB.txt b/semantic/test/fixtures/javascript/corpus/assignment-pattern.parseB.txt new file mode 100644 index 0000000000..1fc7003545 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/assignment-pattern.parseB.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (Identifier "foo")) + (DestructuringPattern + (ObjectPattern + (AssignmentPattern + (ShorthandPropertyIdentifier "y") + (Expression + (Number "1")))))))))) diff --git a/test/fixtures/javascript/corpus/assignment.A.js b/semantic/test/fixtures/javascript/corpus/assignment.A.js similarity index 100% rename from test/fixtures/javascript/corpus/assignment.A.js rename to semantic/test/fixtures/javascript/corpus/assignment.A.js diff --git a/test/fixtures/javascript/corpus/assignment.B.js b/semantic/test/fixtures/javascript/corpus/assignment.B.js similarity index 100% rename from test/fixtures/javascript/corpus/assignment.B.js rename to semantic/test/fixtures/javascript/corpus/assignment.B.js diff --git a/test/fixtures/javascript/corpus/assignment.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/assignment.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/assignment.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/assignment.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/assignment.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/assignment.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/assignment.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/assignment.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/assignment.parseA.txt b/semantic/test/fixtures/javascript/corpus/assignment.parseA.txt new file mode 100644 index 0000000000..a076e47c31 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/assignment.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "x") + (Expression + (Number "0"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/assignment.parseB.txt b/semantic/test/fixtures/javascript/corpus/assignment.parseB.txt new file mode 100644 index 0000000000..5b6c6262c7 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/assignment.parseB.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "x") + (Expression + (Number "1"))))))) diff --git a/test/fixtures/javascript/corpus/bitwise-operator.A.js b/semantic/test/fixtures/javascript/corpus/bitwise-operator.A.js similarity index 100% rename from test/fixtures/javascript/corpus/bitwise-operator.A.js rename to semantic/test/fixtures/javascript/corpus/bitwise-operator.A.js diff --git a/test/fixtures/javascript/corpus/bitwise-operator.B.js b/semantic/test/fixtures/javascript/corpus/bitwise-operator.B.js similarity index 100% rename from test/fixtures/javascript/corpus/bitwise-operator.B.js rename to semantic/test/fixtures/javascript/corpus/bitwise-operator.B.js diff --git a/test/fixtures/javascript/corpus/bitwise-operator.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/bitwise-operator.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/bitwise-operator.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/bitwise-operator.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/bitwise-operator.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/bitwise-operator.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/bitwise-operator.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/bitwise-operator.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/bitwise-operator.parseA.txt b/semantic/test/fixtures/javascript/corpus/bitwise-operator.parseA.txt new file mode 100644 index 0000000000..6a1cc6460d --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/bitwise-operator.parseA.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "j"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/bitwise-operator.parseB.txt b/semantic/test/fixtures/javascript/corpus/bitwise-operator.parseB.txt new file mode 100644 index 0000000000..032d59b53b --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/bitwise-operator.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "k"))))))) diff --git a/test/fixtures/javascript/corpus/boolean-operator.A.js b/semantic/test/fixtures/javascript/corpus/boolean-operator.A.js similarity index 100% rename from test/fixtures/javascript/corpus/boolean-operator.A.js rename to semantic/test/fixtures/javascript/corpus/boolean-operator.A.js diff --git a/test/fixtures/javascript/corpus/boolean-operator.B.js b/semantic/test/fixtures/javascript/corpus/boolean-operator.B.js similarity index 100% rename from test/fixtures/javascript/corpus/boolean-operator.B.js rename to semantic/test/fixtures/javascript/corpus/boolean-operator.B.js diff --git a/test/fixtures/javascript/corpus/boolean-operator.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/boolean-operator.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/boolean-operator.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/boolean-operator.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/boolean-operator.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/boolean-operator.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/boolean-operator.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/boolean-operator.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/boolean-operator.parseA.txt b/semantic/test/fixtures/javascript/corpus/boolean-operator.parseA.txt new file mode 100644 index 0000000000..6a1cc6460d --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/boolean-operator.parseA.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "j"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/boolean-operator.parseB.txt b/semantic/test/fixtures/javascript/corpus/boolean-operator.parseB.txt new file mode 100644 index 0000000000..6a1cc6460d --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/boolean-operator.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "j"))))))) diff --git a/test/fixtures/javascript/corpus/break.A.js b/semantic/test/fixtures/javascript/corpus/break.A.js similarity index 100% rename from test/fixtures/javascript/corpus/break.A.js rename to semantic/test/fixtures/javascript/corpus/break.A.js diff --git a/test/fixtures/javascript/corpus/break.B.js b/semantic/test/fixtures/javascript/corpus/break.B.js similarity index 100% rename from test/fixtures/javascript/corpus/break.B.js rename to semantic/test/fixtures/javascript/corpus/break.B.js diff --git a/test/fixtures/javascript/corpus/break.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/break.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/break.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/break.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/break.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/break.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/break.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/break.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/break.parseA.txt b/semantic/test/fixtures/javascript/corpus/break.parseA.txt new file mode 100644 index 0000000000..3be6cbb928 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/break.parseA.txt @@ -0,0 +1,44 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (BreakStatement)))) + (ParenthesizedExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "4"))))))) + (Statement + (EmptyStatement ";")) + (Statement + (ExpressionStatement + (Expression + (Identifier "i")))))) + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "10"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/break.parseB.txt b/semantic/test/fixtures/javascript/corpus/break.parseB.txt new file mode 100644 index 0000000000..a835ae53a8 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/break.parseB.txt @@ -0,0 +1,44 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (ContinueStatement)))) + (ParenthesizedExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "4"))))))) + (Statement + (EmptyStatement ";")) + (Statement + (ExpressionStatement + (Expression + (Identifier "i")))))) + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "10"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/test/fixtures/javascript/corpus/chained-callbacks.A.js b/semantic/test/fixtures/javascript/corpus/chained-callbacks.A.js similarity index 100% rename from test/fixtures/javascript/corpus/chained-callbacks.A.js rename to semantic/test/fixtures/javascript/corpus/chained-callbacks.A.js diff --git a/test/fixtures/javascript/corpus/chained-callbacks.B.js b/semantic/test/fixtures/javascript/corpus/chained-callbacks.B.js similarity index 100% rename from test/fixtures/javascript/corpus/chained-callbacks.B.js rename to semantic/test/fixtures/javascript/corpus/chained-callbacks.B.js diff --git a/test/fixtures/javascript/corpus/chained-callbacks.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/chained-callbacks.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/chained-callbacks.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/chained-callbacks.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/chained-callbacks.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/chained-callbacks.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/chained-callbacks.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/chained-callbacks.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/chained-callbacks.parseA.txt b/semantic/test/fixtures/javascript/corpus/chained-callbacks.parseA.txt new file mode 100644 index 0000000000..5ff0a3f710 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/chained-callbacks.parseA.txt @@ -0,0 +1,24 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "map") + (Expression + (This "this")))) + (Arguments + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (MemberExpression + (PropertyIdentifier "b") + (Expression + (Identifier "a"))))))) + (FormalParameters + (RequiredParameter + (Identifier "a"))))))))))) diff --git a/semantic/test/fixtures/javascript/corpus/chained-callbacks.parseB.txt b/semantic/test/fixtures/javascript/corpus/chained-callbacks.parseB.txt new file mode 100644 index 0000000000..66b9e870e9 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/chained-callbacks.parseB.txt @@ -0,0 +1,24 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "reduce") + (Expression + (This "this")))) + (Arguments + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (MemberExpression + (PropertyIdentifier "a") + (Expression + (Identifier "b"))))))) + (FormalParameters + (RequiredParameter + (Identifier "a"))))))))))) diff --git a/test/fixtures/javascript/corpus/chained-property-access.A.js b/semantic/test/fixtures/javascript/corpus/chained-property-access.A.js similarity index 100% rename from test/fixtures/javascript/corpus/chained-property-access.A.js rename to semantic/test/fixtures/javascript/corpus/chained-property-access.A.js diff --git a/test/fixtures/javascript/corpus/chained-property-access.B.js b/semantic/test/fixtures/javascript/corpus/chained-property-access.B.js similarity index 100% rename from test/fixtures/javascript/corpus/chained-property-access.B.js rename to semantic/test/fixtures/javascript/corpus/chained-property-access.B.js diff --git a/test/fixtures/javascript/corpus/chained-property-access.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/chained-property-access.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/chained-property-access.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/chained-property-access.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/chained-property-access.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/chained-property-access.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/chained-property-access.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/chained-property-access.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/chained-property-access.parseA.txt b/semantic/test/fixtures/javascript/corpus/chained-property-access.parseA.txt new file mode 100644 index 0000000000..99a5346ed7 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/chained-property-access.parseA.txt @@ -0,0 +1,33 @@ +(Program + (Statement + (ReturnStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "fail") + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "done") + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "promise") + (Expression + (Identifier "returned")))) + (Arguments))))) + (Arguments + (Expression + (MemberExpression + (PropertyIdentifier "resolve") + (Expression + (Identifier "newDefer"))))))))) + (Arguments + (Expression + (MemberExpression + (PropertyIdentifier "reject") + (Expression + (Identifier "newDefer")))))))))) diff --git a/semantic/test/fixtures/javascript/corpus/chained-property-access.parseB.txt b/semantic/test/fixtures/javascript/corpus/chained-property-access.parseB.txt new file mode 100644 index 0000000000..43bca65393 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/chained-property-access.parseB.txt @@ -0,0 +1,33 @@ +(Program + (Statement + (ReturnStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "fail") + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "done") + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "promise") + (Expression + (Identifier "returned")))) + (Arguments))))) + (Arguments + (Expression + (MemberExpression + (PropertyIdentifier "resolve") + (Expression + (Identifier "otherDefer"))))))))) + (Arguments + (Expression + (MemberExpression + (PropertyIdentifier "reject") + (Expression + (Identifier "otherDefer")))))))))) diff --git a/test/fixtures/javascript/corpus/class.A.js b/semantic/test/fixtures/javascript/corpus/class.A.js similarity index 100% rename from test/fixtures/javascript/corpus/class.A.js rename to semantic/test/fixtures/javascript/corpus/class.A.js diff --git a/test/fixtures/javascript/corpus/class.B.js b/semantic/test/fixtures/javascript/corpus/class.B.js similarity index 100% rename from test/fixtures/javascript/corpus/class.B.js rename to semantic/test/fixtures/javascript/corpus/class.B.js diff --git a/test/fixtures/javascript/corpus/class.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/class.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/class.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/class.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/class.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/class.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/class.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/class.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/class.parseA.txt b/semantic/test/fixtures/javascript/corpus/class.parseA.txt new file mode 100644 index 0000000000..b82b6a11d3 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/class.parseA.txt @@ -0,0 +1,40 @@ +(Program + (Statement + (Declaration + (ClassDeclaration + (ClassBody + (PublicFieldDefinition + (Expression + (Number "5")) + (PropertyIdentifier "bar")) + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "a"))))) + (PropertyIdentifier "one") + (FormalParameters + (RequiredParameter + (Identifier "a")))) + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "b"))))) + (PropertyIdentifier "two") + (FormalParameters + (RequiredParameter + (Identifier "b")))) + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "c"))))) + (PropertyIdentifier "three") + (FormalParameters + (RequiredParameter + (Identifier "c"))))) + (TypeIdentifier "Foo"))))) diff --git a/semantic/test/fixtures/javascript/corpus/class.parseB.txt b/semantic/test/fixtures/javascript/corpus/class.parseB.txt new file mode 100644 index 0000000000..38351e28da --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/class.parseB.txt @@ -0,0 +1,36 @@ +(Program + (Statement + (Declaration + (ClassDeclaration + (ClassBody + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "a"))))) + (PropertyIdentifier "foo") + (FormalParameters + (RequiredParameter + (Identifier "a")))) + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "b"))))) + (PropertyIdentifier "bar") + (FormalParameters + (RequiredParameter + (Identifier "b")))) + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "c"))))) + (PropertyIdentifier "baz") + (FormalParameters + (RequiredParameter + (Identifier "c"))))) + (TypeIdentifier "Foo"))))) diff --git a/test/fixtures/javascript/corpus/comma-operator.A.js b/semantic/test/fixtures/javascript/corpus/comma-operator.A.js similarity index 100% rename from test/fixtures/javascript/corpus/comma-operator.A.js rename to semantic/test/fixtures/javascript/corpus/comma-operator.A.js diff --git a/test/fixtures/javascript/corpus/comma-operator.B.js b/semantic/test/fixtures/javascript/corpus/comma-operator.B.js similarity index 100% rename from test/fixtures/javascript/corpus/comma-operator.B.js rename to semantic/test/fixtures/javascript/corpus/comma-operator.B.js diff --git a/test/fixtures/javascript/corpus/comma-operator.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/comma-operator.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/comma-operator.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/comma-operator.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/comma-operator.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/comma-operator.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/comma-operator.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/comma-operator.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/comma-operator.parseA.txt b/semantic/test/fixtures/javascript/corpus/comma-operator.parseA.txt new file mode 100644 index 0000000000..960b93c671 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/comma-operator.parseA.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (ExpressionStatement + (SequenceExpression + (Expression + (AssignmentExpression + (Identifier "a") + (Expression + (Number "1")))) + (Expression + (AssignmentExpression + (Identifier "b") + (Expression + (Number "2")))))))) diff --git a/semantic/test/fixtures/javascript/corpus/comma-operator.parseB.txt b/semantic/test/fixtures/javascript/corpus/comma-operator.parseB.txt new file mode 100644 index 0000000000..e1ead07707 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/comma-operator.parseB.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "c") + (Expression + (Object + (Pair + (Expression + (ParenthesizedExpression + (SequenceExpression + (Expression + (Number "3")) + (SequenceExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Number "4")) + (Expression + (Number "5")))) + (Expression + (Number "6")))))) + (PropertyIdentifier "d"))))))))) diff --git a/test/fixtures/javascript/corpus/comment.A.js b/semantic/test/fixtures/javascript/corpus/comment.A.js similarity index 100% rename from test/fixtures/javascript/corpus/comment.A.js rename to semantic/test/fixtures/javascript/corpus/comment.A.js diff --git a/test/fixtures/javascript/corpus/comment.B.js b/semantic/test/fixtures/javascript/corpus/comment.B.js similarity index 100% rename from test/fixtures/javascript/corpus/comment.B.js rename to semantic/test/fixtures/javascript/corpus/comment.B.js diff --git a/test/fixtures/javascript/corpus/comment.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/comment.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/comment.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/comment.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/comment.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/comment.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/comment.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/comment.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/comment.parseA.txt b/semantic/test/fixtures/javascript/corpus/comment.parseA.txt new file mode 100644 index 0000000000..0b05546cdb --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/comment.parseA.txt @@ -0,0 +1 @@ +(Program) diff --git a/semantic/test/fixtures/javascript/corpus/comment.parseB.txt b/semantic/test/fixtures/javascript/corpus/comment.parseB.txt new file mode 100644 index 0000000000..0b05546cdb --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/comment.parseB.txt @@ -0,0 +1 @@ +(Program) diff --git a/test/fixtures/javascript/corpus/constructor-call.A.js b/semantic/test/fixtures/javascript/corpus/constructor-call.A.js similarity index 100% rename from test/fixtures/javascript/corpus/constructor-call.A.js rename to semantic/test/fixtures/javascript/corpus/constructor-call.A.js diff --git a/test/fixtures/javascript/corpus/constructor-call.B.js b/semantic/test/fixtures/javascript/corpus/constructor-call.B.js similarity index 100% rename from test/fixtures/javascript/corpus/constructor-call.B.js rename to semantic/test/fixtures/javascript/corpus/constructor-call.B.js diff --git a/test/fixtures/javascript/corpus/constructor-call.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/constructor-call.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/constructor-call.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/constructor-call.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/constructor-call.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/constructor-call.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/constructor-call.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/constructor-call.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/constructor-call.parseA.txt b/semantic/test/fixtures/javascript/corpus/constructor-call.parseA.txt new file mode 100644 index 0000000000..3f61ff455c --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/constructor-call.parseA.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (NewExpression + (Arguments + (Expression + (Number "1")) + (Expression + (String))) + (MemberExpression + (PropertyIdentifier "Klass") + (Expression + (Identifier "module")))))))) diff --git a/semantic/test/fixtures/javascript/corpus/constructor-call.parseB.txt b/semantic/test/fixtures/javascript/corpus/constructor-call.parseB.txt new file mode 100644 index 0000000000..3f61ff455c --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/constructor-call.parseB.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (NewExpression + (Arguments + (Expression + (Number "1")) + (Expression + (String))) + (MemberExpression + (PropertyIdentifier "Klass") + (Expression + (Identifier "module")))))))) diff --git a/test/fixtures/javascript/corpus/continue.A.js b/semantic/test/fixtures/javascript/corpus/continue.A.js similarity index 100% rename from test/fixtures/javascript/corpus/continue.A.js rename to semantic/test/fixtures/javascript/corpus/continue.A.js diff --git a/test/fixtures/javascript/corpus/continue.B.js b/semantic/test/fixtures/javascript/corpus/continue.B.js similarity index 100% rename from test/fixtures/javascript/corpus/continue.B.js rename to semantic/test/fixtures/javascript/corpus/continue.B.js diff --git a/test/fixtures/javascript/corpus/continue.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/continue.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/continue.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/continue.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/continue.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/continue.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/continue.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/continue.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/continue.parseA.txt b/semantic/test/fixtures/javascript/corpus/continue.parseA.txt new file mode 100644 index 0000000000..a835ae53a8 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/continue.parseA.txt @@ -0,0 +1,44 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (ContinueStatement)))) + (ParenthesizedExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "4"))))))) + (Statement + (EmptyStatement ";")) + (Statement + (ExpressionStatement + (Expression + (Identifier "i")))))) + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "10"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/continue.parseB.txt b/semantic/test/fixtures/javascript/corpus/continue.parseB.txt new file mode 100644 index 0000000000..3be6cbb928 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/continue.parseB.txt @@ -0,0 +1,44 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (BreakStatement)))) + (ParenthesizedExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "4"))))))) + (Statement + (EmptyStatement ";")) + (Statement + (ExpressionStatement + (Expression + (Identifier "i")))))) + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "10"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/test/fixtures/javascript/corpus/delete-operator.A.js b/semantic/test/fixtures/javascript/corpus/delete-operator.A.js similarity index 100% rename from test/fixtures/javascript/corpus/delete-operator.A.js rename to semantic/test/fixtures/javascript/corpus/delete-operator.A.js diff --git a/test/fixtures/javascript/corpus/delete-operator.B.js b/semantic/test/fixtures/javascript/corpus/delete-operator.B.js similarity index 100% rename from test/fixtures/javascript/corpus/delete-operator.B.js rename to semantic/test/fixtures/javascript/corpus/delete-operator.B.js diff --git a/test/fixtures/javascript/corpus/delete-operator.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/delete-operator.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/delete-operator.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/delete-operator.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/delete-operator.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/delete-operator.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/delete-operator.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/delete-operator.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/delete-operator.parseA.txt b/semantic/test/fixtures/javascript/corpus/delete-operator.parseA.txt new file mode 100644 index 0000000000..688cf8e684 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/delete-operator.parseA.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (UnaryExpression + (Token) + (Expression + (SubscriptExpression + (Expression + (Identifier "thing")) + (Expression + (String))))))))) diff --git a/semantic/test/fixtures/javascript/corpus/delete-operator.parseB.txt b/semantic/test/fixtures/javascript/corpus/delete-operator.parseB.txt new file mode 100644 index 0000000000..88ee6a2c30 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/delete-operator.parseB.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (UnaryExpression + (Token) + (Expression + (MemberExpression + (PropertyIdentifier "prop") + (Expression + (Identifier "thing"))))))))) diff --git a/test/fixtures/javascript/corpus/do-while-statement.A.js b/semantic/test/fixtures/javascript/corpus/do-while-statement.A.js similarity index 100% rename from test/fixtures/javascript/corpus/do-while-statement.A.js rename to semantic/test/fixtures/javascript/corpus/do-while-statement.A.js diff --git a/test/fixtures/javascript/corpus/do-while-statement.B.js b/semantic/test/fixtures/javascript/corpus/do-while-statement.B.js similarity index 100% rename from test/fixtures/javascript/corpus/do-while-statement.B.js rename to semantic/test/fixtures/javascript/corpus/do-while-statement.B.js diff --git a/test/fixtures/javascript/corpus/do-while-statement.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/do-while-statement.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/do-while-statement.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/do-while-statement.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/do-while-statement.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/do-while-statement.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/do-while-statement.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/do-while-statement.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/do-while-statement.parseA.txt b/semantic/test/fixtures/javascript/corpus/do-while-statement.parseA.txt new file mode 100644 index 0000000000..7923b18cb6 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/do-while-statement.parseA.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (DoStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "insert"))))))))) + (ParenthesizedExpression + (Expression + (True "true")))))) diff --git a/semantic/test/fixtures/javascript/corpus/do-while-statement.parseB.txt b/semantic/test/fixtures/javascript/corpus/do-while-statement.parseB.txt new file mode 100644 index 0000000000..22e1834e74 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/do-while-statement.parseB.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (DoStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "replacement"))))))))) + (ParenthesizedExpression + (Expression + (False "false")))))) diff --git a/test/fixtures/javascript/corpus/export.A.js b/semantic/test/fixtures/javascript/corpus/export.A.js similarity index 100% rename from test/fixtures/javascript/corpus/export.A.js rename to semantic/test/fixtures/javascript/corpus/export.A.js diff --git a/test/fixtures/javascript/corpus/export.B.js b/semantic/test/fixtures/javascript/corpus/export.B.js similarity index 100% rename from test/fixtures/javascript/corpus/export.B.js rename to semantic/test/fixtures/javascript/corpus/export.B.js diff --git a/semantic/test/fixtures/javascript/corpus/export.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/export.diffA-B.txt new file mode 100644 index 0000000000..3af549f561 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/export.diffA-B.txt @@ -0,0 +1,77 @@ +(Statements +{ (QualifiedExport) +->(QualifiedExport) } +{ (QualifiedExport) +->(QualifiedExport) } + (DefaultExport + (VariableDeclaration + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)))) + (DefaultExport + (VariableDeclaration + {-(Assignment + {-(Empty)-} + {-(Identifier)-} + {-(Identifier)-})-} + (Assignment + (Empty) + (Identifier) + (Identifier)) + (Assignment + (Empty) + (Identifier) + { (Empty) + ->(Identifier) }) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + {+(Assignment + {+(Empty)+} + {+(Identifier)+} + {+(Empty)+})+})) + (DefaultExport + { (Identifier) + ->(Identifier) }) +{+(DefaultExport + {+(Function + {+(Empty)+} + {+(Empty)+} + {+(Identifier)+} + {+(StatementBlock)+})+})+} + (DefaultExport + (Function + (Empty) + (Empty) + (Empty) + (StatementBlock))) +{+(QualifiedExport)+} +{+(DefaultExport + {+(TextElement)+})+} +{+(QualifiedExportFrom)+} +{+(QualifiedExportFrom)+} +{-(DefaultExport + {-(Function + {-(Empty)-} + {-(Empty)-} + {-(Identifier)-} + {-(StatementBlock)-})-})-} +{-(QualifiedExport)-} +{-(DefaultExport + {-(TextElement)-})-} +{-(QualifiedExportFrom)-} +{-(QualifiedExportFrom)-}) diff --git a/semantic/test/fixtures/javascript/corpus/export.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/export.diffB-A.txt new file mode 100644 index 0000000000..4a0ec2fa57 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/export.diffB-A.txt @@ -0,0 +1,76 @@ +(Statements +{ (QualifiedExport) +->(QualifiedExport) } +{ (QualifiedExport) +->(QualifiedExport) } + (DefaultExport + (VariableDeclaration + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)))) + (DefaultExport + (VariableDeclaration + {+(Assignment + {+(Empty)+} + {+(Identifier)+} + {+(Identifier)+})+} + (Assignment + (Empty) + (Identifier) + (Identifier)) + (Assignment + (Empty) + (Identifier) + { (Identifier) + ->(Empty) }) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + {-(Assignment + {-(Empty)-} + {-(Identifier)-} + {-(Empty)-})-})) + (DefaultExport + { (Identifier) + ->(Identifier) }) +{-(DefaultExport + {-(Function + {-(Empty)-} + {-(Empty)-} + {-(Identifier)-} + {-(StatementBlock)-})-})-} + (DefaultExport + (Function + (Empty) + (Empty) + (Empty) + (StatementBlock))) +{+(DefaultExport + {+(Function + {+(Empty)+} + {+(Empty)+} + {+(Identifier)+} + {+(StatementBlock)+})+})+} +{ (QualifiedExport) +->(QualifiedExport) } + (DefaultExport + { (TextElement) + ->(TextElement) }) +{ (QualifiedExportFrom) +->(QualifiedExportFrom) } +{ (QualifiedExportFrom) +->(QualifiedExportFrom) }) diff --git a/semantic/test/fixtures/javascript/corpus/export.parseA.txt b/semantic/test/fixtures/javascript/corpus/export.parseA.txt new file mode 100644 index 0000000000..a1e5b0619d --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/export.parseA.txt @@ -0,0 +1,97 @@ +(Program + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "name1")) + (ExportSpecifier + (Identifier "name2")) + (ExportSpecifier + (Identifier "name3")) + (ExportSpecifier + (Identifier "nameN"))))) + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "name1") + (Identifier "variable1")) + (ExportSpecifier + (Identifier "name2") + (Identifier "variable2")) + (ExportSpecifier + (Identifier "nameN"))))) + (Statement + (ExportStatement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "name1")) + (VariableDeclarator + (Identifier "name2")) + (VariableDeclarator + (Identifier "nameN")))))) + (Statement + (ExportStatement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Expression + (Identifier "value1")) + (Identifier "name1")) + (VariableDeclarator + (Expression + (Identifier "value2")) + (Identifier "name2")) + (VariableDeclarator + (Identifier "name3")) + (VariableDeclarator + (Identifier "nameN")))))) + (Statement + (ExportStatement + (Expression + (Identifier "namedFunction")))) + (Statement + (ExportStatement + (Expression + (Function + (StatementBlock) + (FormalParameters))))) + (Statement + (ExportStatement + (Expression + (Function + (StatementBlock) + (Identifier "name1") + (FormalParameters))))) + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "default") + (Identifier "name1"))))) + (Statement + (ExportStatement + (String))) + (Statement + (ExportStatement + (String) + (ExportClause + (ExportSpecifier + (Identifier "name1")) + (ExportSpecifier + (Identifier "name2")) + (ExportSpecifier + (Identifier "nameN"))))) + (Statement + (ExportStatement + (String) + (ExportClause + (ExportSpecifier + (Identifier "name1") + (Identifier "import1")) + (ExportSpecifier + (Identifier "name2") + (Identifier "import2")) + (ExportSpecifier + (Identifier "nameN")))))) diff --git a/semantic/test/fixtures/javascript/corpus/export.parseB.txt b/semantic/test/fixtures/javascript/corpus/export.parseB.txt new file mode 100644 index 0000000000..56e369e27a --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/export.parseB.txt @@ -0,0 +1,97 @@ +(Program + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "name4")) + (ExportSpecifier + (Identifier "name5")) + (ExportSpecifier + (Identifier "name6")) + (ExportSpecifier + (Identifier "nameZ"))))) + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "name2") + (Identifier "variable2")) + (ExportSpecifier + (Identifier "name3") + (Identifier "variable3")) + (ExportSpecifier + (Identifier "nameY"))))) + (Statement + (ExportStatement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "name3")) + (VariableDeclarator + (Identifier "name4")) + (VariableDeclarator + (Identifier "nameT")))))) + (Statement + (ExportStatement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Expression + (Identifier "value2")) + (Identifier "name2")) + (VariableDeclarator + (Expression + (Identifier "value3")) + (Identifier "name3")) + (VariableDeclarator + (Identifier "name4")) + (VariableDeclarator + (Identifier "nameO")))))) + (Statement + (ExportStatement + (Expression + (Identifier "otherNamedFunction")))) + (Statement + (ExportStatement + (Expression + (Function + (StatementBlock) + (Identifier "newName1") + (FormalParameters))))) + (Statement + (ExportStatement + (Expression + (Function + (StatementBlock) + (FormalParameters))))) + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "statement") + (Identifier "name2"))))) + (Statement + (ExportStatement + (String))) + (Statement + (ExportStatement + (String) + (ExportClause + (ExportSpecifier + (Identifier "name7")) + (ExportSpecifier + (Identifier "name8")) + (ExportSpecifier + (Identifier "nameP"))))) + (Statement + (ExportStatement + (String) + (ExportClause + (ExportSpecifier + (Identifier "name6") + (Identifier "import6")) + (ExportSpecifier + (Identifier "name7") + (Identifier "import7")) + (ExportSpecifier + (Identifier "nameB")))))) diff --git a/test/fixtures/javascript/corpus/false.A.js b/semantic/test/fixtures/javascript/corpus/false.A.js similarity index 100% rename from test/fixtures/javascript/corpus/false.A.js rename to semantic/test/fixtures/javascript/corpus/false.A.js diff --git a/test/fixtures/javascript/corpus/false.B.js b/semantic/test/fixtures/javascript/corpus/false.B.js similarity index 100% rename from test/fixtures/javascript/corpus/false.B.js rename to semantic/test/fixtures/javascript/corpus/false.B.js diff --git a/test/fixtures/javascript/corpus/false.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/false.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/false.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/false.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/false.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/false.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/false.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/false.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/false.parseA.txt b/semantic/test/fixtures/javascript/corpus/false.parseA.txt new file mode 100644 index 0000000000..3be6991ba9 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/false.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (False "false"))))) diff --git a/semantic/test/fixtures/javascript/corpus/false.parseB.txt b/semantic/test/fixtures/javascript/corpus/false.parseB.txt new file mode 100644 index 0000000000..1123c876f6 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/false.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (False "false"))))) diff --git a/test/fixtures/javascript/corpus/for-in-statement.A.js b/semantic/test/fixtures/javascript/corpus/for-in-statement.A.js similarity index 100% rename from test/fixtures/javascript/corpus/for-in-statement.A.js rename to semantic/test/fixtures/javascript/corpus/for-in-statement.A.js diff --git a/test/fixtures/javascript/corpus/for-in-statement.B.js b/semantic/test/fixtures/javascript/corpus/for-in-statement.B.js similarity index 100% rename from test/fixtures/javascript/corpus/for-in-statement.B.js rename to semantic/test/fixtures/javascript/corpus/for-in-statement.B.js diff --git a/test/fixtures/javascript/corpus/for-in-statement.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/for-in-statement.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/for-in-statement.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/for-in-statement.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/for-in-statement.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/for-in-statement.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/for-in-statement.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/for-in-statement.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/for-in-statement.parseA.txt b/semantic/test/fixtures/javascript/corpus/for-in-statement.parseA.txt new file mode 100644 index 0000000000..ade0620a48 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/for-in-statement.parseA.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ForInStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "thing")) + (Arguments))))))) + (Identifier "thing") + (Expression + (Identifier "things"))))) diff --git a/semantic/test/fixtures/javascript/corpus/for-in-statement.parseB.txt b/semantic/test/fixtures/javascript/corpus/for-in-statement.parseB.txt new file mode 100644 index 0000000000..879fadc02e --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/for-in-statement.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ForInStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "item")) + (Arguments))))))) + (Identifier "item") + (Expression + (Identifier "items"))))) diff --git a/test/fixtures/javascript/corpus/for-loop-with-in-statement.A.js b/semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.A.js similarity index 100% rename from test/fixtures/javascript/corpus/for-loop-with-in-statement.A.js rename to semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.A.js diff --git a/test/fixtures/javascript/corpus/for-loop-with-in-statement.B.js b/semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.B.js similarity index 100% rename from test/fixtures/javascript/corpus/for-loop-with-in-statement.B.js rename to semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.B.js diff --git a/test/fixtures/javascript/corpus/for-loop-with-in-statement.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/for-loop-with-in-statement.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/for-loop-with-in-statement.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/for-loop-with-in-statement.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseA.txt b/semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseA.txt new file mode 100644 index 0000000000..1832273d2d --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseA.txt @@ -0,0 +1,41 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "doSomething")) + (Arguments))))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "key")) + (Expression + (Identifier "something")))) + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "n"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseB.txt b/semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseB.txt new file mode 100644 index 0000000000..818f9c602a --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseB.txt @@ -0,0 +1,41 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "doOtherSomething")) + (Arguments))))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "otherKey")) + (Expression + (Identifier "something")))) + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "n"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/test/fixtures/javascript/corpus/for-of-statement.A.js b/semantic/test/fixtures/javascript/corpus/for-of-statement.A.js similarity index 100% rename from test/fixtures/javascript/corpus/for-of-statement.A.js rename to semantic/test/fixtures/javascript/corpus/for-of-statement.A.js diff --git a/test/fixtures/javascript/corpus/for-of-statement.B.js b/semantic/test/fixtures/javascript/corpus/for-of-statement.B.js similarity index 100% rename from test/fixtures/javascript/corpus/for-of-statement.B.js rename to semantic/test/fixtures/javascript/corpus/for-of-statement.B.js diff --git a/semantic/test/fixtures/javascript/corpus/for-of-statement.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/for-of-statement.diffA-B.txt new file mode 100644 index 0000000000..ec81af0f91 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/for-of-statement.diffA-B.txt @@ -0,0 +1,13 @@ +(Statements + (ForEach + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + (Statements + (Call + (Identifier) + { (Identifier) + ->(Identifier) } + (Empty)))) + (Empty)) diff --git a/semantic/test/fixtures/javascript/corpus/for-of-statement.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/for-of-statement.diffB-A.txt new file mode 100644 index 0000000000..ec81af0f91 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/for-of-statement.diffB-A.txt @@ -0,0 +1,13 @@ +(Statements + (ForEach + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + (Statements + (Call + (Identifier) + { (Identifier) + ->(Identifier) } + (Empty)))) + (Empty)) diff --git a/semantic/test/fixtures/javascript/corpus/for-of-statement.parseA.txt b/semantic/test/fixtures/javascript/corpus/for-of-statement.parseA.txt new file mode 100644 index 0000000000..b45bbc8519 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/for-of-statement.parseA.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (ForInStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "process")) + (Arguments + (Expression + (Identifier "item"))))))))) + (Identifier "item") + (Expression + (Identifier "items")))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/javascript/corpus/for-of-statement.parseB.txt b/semantic/test/fixtures/javascript/corpus/for-of-statement.parseB.txt new file mode 100644 index 0000000000..9bf63fefa5 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/for-of-statement.parseB.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (ForInStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "process")) + (Arguments + (Expression + (Identifier "thing"))))))))) + (Identifier "thing") + (Expression + (Identifier "things")))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/javascript/corpus/for-statement.A.js b/semantic/test/fixtures/javascript/corpus/for-statement.A.js similarity index 100% rename from test/fixtures/javascript/corpus/for-statement.A.js rename to semantic/test/fixtures/javascript/corpus/for-statement.A.js diff --git a/test/fixtures/javascript/corpus/for-statement.B.js b/semantic/test/fixtures/javascript/corpus/for-statement.B.js similarity index 100% rename from test/fixtures/javascript/corpus/for-statement.B.js rename to semantic/test/fixtures/javascript/corpus/for-statement.B.js diff --git a/test/fixtures/javascript/corpus/for-statement.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/for-statement.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/for-statement.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/for-statement.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/for-statement.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/for-statement.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/for-statement.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/for-statement.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/for-statement.parseA.txt b/semantic/test/fixtures/javascript/corpus/for-statement.parseA.txt new file mode 100644 index 0000000000..241a178f42 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/for-statement.parseA.txt @@ -0,0 +1,39 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "log")) + (Arguments + (Expression + (Identifier "i"))))))))) + (ExpressionStatement + (SequenceExpression + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0")))) + (Expression + (CallExpression + (Expression + (Identifier "init")) + (Arguments))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "10"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/for-statement.parseB.txt b/semantic/test/fixtures/javascript/corpus/for-statement.parseB.txt new file mode 100644 index 0000000000..432defeb15 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/for-statement.parseB.txt @@ -0,0 +1,39 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "log")) + (Arguments + (Expression + (Identifier "i"))))))))) + (ExpressionStatement + (SequenceExpression + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0")))) + (Expression + (CallExpression + (Expression + (Identifier "init")) + (Arguments))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "100"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/test/fixtures/javascript/corpus/function-call-args.A.js b/semantic/test/fixtures/javascript/corpus/function-call-args.A.js similarity index 100% rename from test/fixtures/javascript/corpus/function-call-args.A.js rename to semantic/test/fixtures/javascript/corpus/function-call-args.A.js diff --git a/test/fixtures/javascript/corpus/function-call-args.B.js b/semantic/test/fixtures/javascript/corpus/function-call-args.B.js similarity index 100% rename from test/fixtures/javascript/corpus/function-call-args.B.js rename to semantic/test/fixtures/javascript/corpus/function-call-args.B.js diff --git a/test/fixtures/javascript/corpus/function-call-args.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/function-call-args.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/function-call-args.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/function-call-args.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/function-call-args.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/function-call-args.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/function-call-args.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/function-call-args.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/function-call-args.parseA.txt b/semantic/test/fixtures/javascript/corpus/function-call-args.parseA.txt new file mode 100644 index 0000000000..6bd83a38ce --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/function-call-args.parseA.txt @@ -0,0 +1,38 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "someFunction")) + (Arguments + (Expression + (Number "1")) + (Expression + (String)) + (Expression + (Function + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "a"))))))) + (Statement + (ReturnStatement + (Expression + (Identifier "b"))))) + (FormalParameters + (RequiredParameter + (Identifier "a")) + (RequiredParameter + (Identifier "b"))))) + (Expression + (True "true")))))))) diff --git a/semantic/test/fixtures/javascript/corpus/function-call-args.parseB.txt b/semantic/test/fixtures/javascript/corpus/function-call-args.parseB.txt new file mode 100644 index 0000000000..19c869209b --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/function-call-args.parseB.txt @@ -0,0 +1,38 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "someFunction")) + (Arguments + (Expression + (Number "1")) + (Expression + (String)) + (Expression + (Function + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "b"))))))) + (Statement + (ReturnStatement + (Expression + (Identifier "c"))))) + (FormalParameters + (RequiredParameter + (Identifier "b")) + (RequiredParameter + (Identifier "c"))))) + (Expression + (False "false")))))))) diff --git a/test/fixtures/javascript/corpus/function-call.A.js b/semantic/test/fixtures/javascript/corpus/function-call.A.js similarity index 100% rename from test/fixtures/javascript/corpus/function-call.A.js rename to semantic/test/fixtures/javascript/corpus/function-call.A.js diff --git a/test/fixtures/javascript/corpus/function-call.B.js b/semantic/test/fixtures/javascript/corpus/function-call.B.js similarity index 100% rename from test/fixtures/javascript/corpus/function-call.B.js rename to semantic/test/fixtures/javascript/corpus/function-call.B.js diff --git a/test/fixtures/javascript/corpus/function-call.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/function-call.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/function-call.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/function-call.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/function-call.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/function-call.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/function-call.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/function-call.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/function-call.parseA.txt b/semantic/test/fixtures/javascript/corpus/function-call.parseA.txt new file mode 100644 index 0000000000..b8015e0588 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/function-call.parseA.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "someFunction")) + (Arguments + (Expression + (Identifier "arg1")) + (Expression + (String)))))))) diff --git a/semantic/test/fixtures/javascript/corpus/function-call.parseB.txt b/semantic/test/fixtures/javascript/corpus/function-call.parseB.txt new file mode 100644 index 0000000000..b8015e0588 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/function-call.parseB.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "someFunction")) + (Arguments + (Expression + (Identifier "arg1")) + (Expression + (String)))))))) diff --git a/test/fixtures/javascript/corpus/function.A.js b/semantic/test/fixtures/javascript/corpus/function.A.js similarity index 100% rename from test/fixtures/javascript/corpus/function.A.js rename to semantic/test/fixtures/javascript/corpus/function.A.js diff --git a/test/fixtures/javascript/corpus/function.B.js b/semantic/test/fixtures/javascript/corpus/function.B.js similarity index 100% rename from test/fixtures/javascript/corpus/function.B.js rename to semantic/test/fixtures/javascript/corpus/function.B.js diff --git a/semantic/test/fixtures/javascript/corpus/function.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/function.diffA-B.txt new file mode 100644 index 0000000000..1d0fdbbeec --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/function.diffA-B.txt @@ -0,0 +1,18 @@ +(Statements + (Function + (Empty) + (Empty) + (Empty) + (RequiredParameter + (Empty) + (Empty) + (Identifier) + (Empty)) + (RequiredParameter + (Empty) + (Empty) + (Identifier) + (Empty)) + (StatementBlock + { (Identifier) + ->(Identifier) }))) diff --git a/semantic/test/fixtures/javascript/corpus/function.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/function.diffB-A.txt new file mode 100644 index 0000000000..1d0fdbbeec --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/function.diffB-A.txt @@ -0,0 +1,18 @@ +(Statements + (Function + (Empty) + (Empty) + (Empty) + (RequiredParameter + (Empty) + (Empty) + (Identifier) + (Empty)) + (RequiredParameter + (Empty) + (Empty) + (Identifier) + (Empty)) + (StatementBlock + { (Identifier) + ->(Identifier) }))) diff --git a/semantic/test/fixtures/javascript/corpus/function.parseA.txt b/semantic/test/fixtures/javascript/corpus/function.parseA.txt new file mode 100644 index 0000000000..cf17a0e7af --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/function.parseA.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "arg2"))))) + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2")))))))) diff --git a/semantic/test/fixtures/javascript/corpus/function.parseB.txt b/semantic/test/fixtures/javascript/corpus/function.parseB.txt new file mode 100644 index 0000000000..38ccaf4922 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/function.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "arg1"))))) + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2")))))))) diff --git a/test/fixtures/javascript/corpus/generator-function.A.js b/semantic/test/fixtures/javascript/corpus/generator-function.A.js similarity index 100% rename from test/fixtures/javascript/corpus/generator-function.A.js rename to semantic/test/fixtures/javascript/corpus/generator-function.A.js diff --git a/test/fixtures/javascript/corpus/generator-function.B.js b/semantic/test/fixtures/javascript/corpus/generator-function.B.js similarity index 100% rename from test/fixtures/javascript/corpus/generator-function.B.js rename to semantic/test/fixtures/javascript/corpus/generator-function.B.js diff --git a/test/fixtures/javascript/corpus/generator-function.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/generator-function.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/generator-function.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/generator-function.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/generator-function.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/generator-function.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/generator-function.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/generator-function.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/generator-function.parseA.txt b/semantic/test/fixtures/javascript/corpus/generator-function.parseA.txt new file mode 100644 index 0000000000..141f4ed8b8 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/generator-function.parseA.txt @@ -0,0 +1,23 @@ +(Program + (Statement + (Declaration + (GeneratorFunctionDeclaration + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (YieldExpression)))) + (Statement + (ExpressionStatement + (Expression + (YieldExpression + (Expression + (Identifier "arg2"))))))) + (Identifier "generateStuff") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2")))))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/javascript/corpus/generator-function.parseB.txt b/semantic/test/fixtures/javascript/corpus/generator-function.parseB.txt new file mode 100644 index 0000000000..c69d986e9b --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/generator-function.parseB.txt @@ -0,0 +1,23 @@ +(Program + (Statement + (Declaration + (GeneratorFunctionDeclaration + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (YieldExpression)))) + (Statement + (ExpressionStatement + (Expression + (YieldExpression + (Expression + (Identifier "arg2"))))))) + (Identifier "generateNewStuff") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2")))))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/javascript/corpus/identifier.A.js b/semantic/test/fixtures/javascript/corpus/identifier.A.js similarity index 100% rename from test/fixtures/javascript/corpus/identifier.A.js rename to semantic/test/fixtures/javascript/corpus/identifier.A.js diff --git a/test/fixtures/javascript/corpus/identifier.B.js b/semantic/test/fixtures/javascript/corpus/identifier.B.js similarity index 100% rename from test/fixtures/javascript/corpus/identifier.B.js rename to semantic/test/fixtures/javascript/corpus/identifier.B.js diff --git a/test/fixtures/javascript/corpus/identifier.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/identifier.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/identifier.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/identifier.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/identifier.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/identifier.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/identifier.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/identifier.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/identifier.parseA.txt b/semantic/test/fixtures/javascript/corpus/identifier.parseA.txt new file mode 100644 index 0000000000..ee36557999 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/identifier.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Identifier "theVar"))))) diff --git a/semantic/test/fixtures/javascript/corpus/identifier.parseB.txt b/semantic/test/fixtures/javascript/corpus/identifier.parseB.txt new file mode 100644 index 0000000000..420643ed8a --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/identifier.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Identifier "theVar2"))))) diff --git a/test/fixtures/javascript/corpus/if-else.A.js b/semantic/test/fixtures/javascript/corpus/if-else.A.js similarity index 100% rename from test/fixtures/javascript/corpus/if-else.A.js rename to semantic/test/fixtures/javascript/corpus/if-else.A.js diff --git a/test/fixtures/javascript/corpus/if-else.B.js b/semantic/test/fixtures/javascript/corpus/if-else.B.js similarity index 100% rename from test/fixtures/javascript/corpus/if-else.B.js rename to semantic/test/fixtures/javascript/corpus/if-else.B.js diff --git a/test/fixtures/javascript/corpus/if-else.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/if-else.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/if-else.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/if-else.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/if-else.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/if-else.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/if-else.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/if-else.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/if-else.parseA.txt b/semantic/test/fixtures/javascript/corpus/if-else.parseA.txt new file mode 100644 index 0000000000..d18a55158c --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/if-else.parseA.txt @@ -0,0 +1,41 @@ +(Program + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (ExpressionStatement + (Expression + (Identifier "g")))) + (Statement + (ExpressionStatement + (Expression + (Identifier "f")))) + (ParenthesizedExpression + (Expression + (Identifier "e"))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "d")))) + (ParenthesizedExpression + (Expression + (Identifier "c"))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "b")))) + (ParenthesizedExpression + (Expression + (Identifier "a"))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "y")))) + (ParenthesizedExpression + (Expression + (Identifier "x")))))) diff --git a/semantic/test/fixtures/javascript/corpus/if-else.parseB.txt b/semantic/test/fixtures/javascript/corpus/if-else.parseB.txt new file mode 100644 index 0000000000..181d88a299 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/if-else.parseB.txt @@ -0,0 +1,45 @@ +(Program + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (ExpressionStatement + (Expression + (Identifier "o")))) + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "n")))))) + (ParenthesizedExpression + (Expression + (Identifier "m"))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "l")))) + (ParenthesizedExpression + (Expression + (Identifier "k"))))) + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "j")))))) + (ParenthesizedExpression + (Expression + (Identifier "i"))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "h")))) + (ParenthesizedExpression + (Expression + (Identifier "g")))))) diff --git a/test/fixtures/javascript/corpus/if.A.js b/semantic/test/fixtures/javascript/corpus/if.A.js similarity index 100% rename from test/fixtures/javascript/corpus/if.A.js rename to semantic/test/fixtures/javascript/corpus/if.A.js diff --git a/test/fixtures/javascript/corpus/if.B.js b/semantic/test/fixtures/javascript/corpus/if.B.js similarity index 100% rename from test/fixtures/javascript/corpus/if.B.js rename to semantic/test/fixtures/javascript/corpus/if.B.js diff --git a/test/fixtures/javascript/corpus/if.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/if.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/if.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/if.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/if.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/if.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/if.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/if.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/if.parseA.txt b/semantic/test/fixtures/javascript/corpus/if.parseA.txt new file mode 100644 index 0000000000..335293f9f8 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/if.parseA.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "log")) + (Arguments + (Expression + (Identifier "y"))))))))) + (ParenthesizedExpression + (Expression + (Identifier "x")))))) diff --git a/semantic/test/fixtures/javascript/corpus/if.parseB.txt b/semantic/test/fixtures/javascript/corpus/if.parseB.txt new file mode 100644 index 0000000000..8ad1565604 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/if.parseB.txt @@ -0,0 +1,24 @@ +(Program + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "log")) + (Arguments + (Expression + (Identifier "c"))))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "d")))))) + (ParenthesizedExpression + (Expression + (MemberExpression + (PropertyIdentifier "b") + (Expression + (Identifier "a")))))))) diff --git a/test/fixtures/javascript/corpus/import.A.js b/semantic/test/fixtures/javascript/corpus/import.A.js similarity index 100% rename from test/fixtures/javascript/corpus/import.A.js rename to semantic/test/fixtures/javascript/corpus/import.A.js diff --git a/test/fixtures/javascript/corpus/import.B.js b/semantic/test/fixtures/javascript/corpus/import.B.js similarity index 100% rename from test/fixtures/javascript/corpus/import.B.js rename to semantic/test/fixtures/javascript/corpus/import.B.js diff --git a/semantic/test/fixtures/javascript/corpus/import.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/import.diffA-B.txt new file mode 100644 index 0000000000..dd663bae36 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/import.diffA-B.txt @@ -0,0 +1,29 @@ +(Statements +{+(Import)+} +{+(QualifiedAliasedImport + {+(Identifier)+})+} +{ (Import) +->(Import) } +{+(Import)+} +{+(Import)+} +{+(Statements + {+(Import)+} + {+(Import)+})+} +{+(Statements + {+(Import)+} + {+(QualifiedAliasedImport + {+(Identifier)+})+})+} +{+(SideEffectImport)+} +{-(QualifiedAliasedImport + {-(Identifier)-})-} +{-(Import)-} +{-(Import)-} +{-(Import)-} +{-(Statements + {-(Import)-} + {-(Import)-})-} +{-(Statements + {-(Import)-} + {-(QualifiedAliasedImport + {-(Identifier)-})-})-} +{-(SideEffectImport)-}) diff --git a/semantic/test/fixtures/javascript/corpus/import.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/import.diffB-A.txt new file mode 100644 index 0000000000..dd663bae36 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/import.diffB-A.txt @@ -0,0 +1,29 @@ +(Statements +{+(Import)+} +{+(QualifiedAliasedImport + {+(Identifier)+})+} +{ (Import) +->(Import) } +{+(Import)+} +{+(Import)+} +{+(Statements + {+(Import)+} + {+(Import)+})+} +{+(Statements + {+(Import)+} + {+(QualifiedAliasedImport + {+(Identifier)+})+})+} +{+(SideEffectImport)+} +{-(QualifiedAliasedImport + {-(Identifier)-})-} +{-(Import)-} +{-(Import)-} +{-(Import)-} +{-(Statements + {-(Import)-} + {-(Import)-})-} +{-(Statements + {-(Import)-} + {-(QualifiedAliasedImport + {-(Identifier)-})-})-} +{-(SideEffectImport)-}) diff --git a/semantic/test/fixtures/javascript/corpus/import.parseA.txt b/semantic/test/fixtures/javascript/corpus/import.parseA.txt new file mode 100644 index 0000000000..6a9fb8c0fa --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/import.parseA.txt @@ -0,0 +1,59 @@ +(Program + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember")))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamespaceImport + (Identifier "name"))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "member")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "member1")) + (ImportSpecifier + (Identifier "member2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "member1")) + (ImportSpecifier + (Identifier "alias2") + (Identifier "member2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember") + (NamedImports + (ImportSpecifier + (Identifier "member1")) + (ImportSpecifier + (Identifier "alias2") + (Identifier "member2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember") + (NamespaceImport + (Identifier "name"))))) + (Statement + (ImportStatement + (String)))) diff --git a/semantic/test/fixtures/javascript/corpus/import.parseB.txt b/semantic/test/fixtures/javascript/corpus/import.parseB.txt new file mode 100644 index 0000000000..30fc0c7e39 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/import.parseB.txt @@ -0,0 +1,59 @@ +(Program + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember")))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamespaceImport + (Identifier "otherName"))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "element")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "element1")) + (ImportSpecifier + (Identifier "element2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "element1")) + (ImportSpecifier + (Identifier "elementAlias2") + (Identifier "element2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember") + (NamedImports + (ImportSpecifier + (Identifier "element1")) + (ImportSpecifier + (Identifier "elementAlias2") + (Identifier "element2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember") + (NamespaceImport + (Identifier "element"))))) + (Statement + (ImportStatement + (String)))) diff --git a/semantic/test/fixtures/javascript/corpus/jsx.A.js b/semantic/test/fixtures/javascript/corpus/jsx.A.js new file mode 100644 index 0000000000..5b4c905660 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/jsx.A.js @@ -0,0 +1,5 @@ +function Something() { + return
+ hello +
; +} diff --git a/semantic/test/fixtures/javascript/corpus/jsx.B.js b/semantic/test/fixtures/javascript/corpus/jsx.B.js new file mode 100644 index 0000000000..237faaca55 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/jsx.B.js @@ -0,0 +1,5 @@ +function Something() { + return
+ >goodbye +
; +} diff --git a/semantic/test/fixtures/javascript/corpus/jsx.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/jsx.diffA-B.txt new file mode 100644 index 0000000000..9286a8dc28 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/jsx.diffA-B.txt @@ -0,0 +1,25 @@ +(Statements + (Function + (Empty) + (Empty) + (Identifier) + (StatementBlock + (Return + (JsxElement + (JsxOpeningElement + (Identifier) + (Empty)) + (JsxText) + (JsxElement + (JsxOpeningElement + (Identifier) + { (Empty) + ->(TypeArguments + {+(TypeIdentifier)+}) }) + { (JsxText) + ->(JsxText) } + (JsxClosingElement + (Identifier))) + (JsxText) + (JsxClosingElement + (Identifier))))))) diff --git a/semantic/test/fixtures/javascript/corpus/jsx.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/jsx.diffB-A.txt new file mode 100644 index 0000000000..708286acdb --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/jsx.diffB-A.txt @@ -0,0 +1,25 @@ +(Statements + (Function + (Empty) + (Empty) + (Identifier) + (StatementBlock + (Return + (JsxElement + (JsxOpeningElement + (Identifier) + (Empty)) + (JsxText) + (JsxElement + (JsxOpeningElement + (Identifier) + { (TypeArguments + {-(TypeIdentifier)-}) + ->(Empty) }) + { (JsxText) + ->(JsxText) } + (JsxClosingElement + (Identifier))) + (JsxText) + (JsxClosingElement + (Identifier))))))) diff --git a/semantic/test/fixtures/javascript/corpus/jsx.parseA.txt b/semantic/test/fixtures/javascript/corpus/jsx.parseA.txt new file mode 100644 index 0000000000..fd3b751f0d --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/jsx.parseA.txt @@ -0,0 +1,23 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (ReturnStatement + (Expression + (JsxElement + (JsxClosingElement + (Identifier "div")) + (JsxOpeningElement + (Identifier "div")) + (JsxText "\n ") + (JsxElement + (JsxClosingElement + (Identifier "Foo")) + (JsxOpeningElement + (Identifier "Foo")) + (JsxText "hello")) + (JsxText "\n ")))))) + (Identifier "Something") + (FormalParameters))))) diff --git a/semantic/test/fixtures/javascript/corpus/jsx.parseB.txt b/semantic/test/fixtures/javascript/corpus/jsx.parseB.txt new file mode 100644 index 0000000000..d49bbdab8d --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/jsx.parseB.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (ReturnStatement + (Expression + (JsxElement + (JsxClosingElement + (Identifier "div")) + (JsxOpeningElement + (Identifier "div")) + (JsxText "\n ") + (JsxElement + (JsxClosingElement + (Identifier "Foo")) + (JsxOpeningElement + (Identifier "Foo") + (TypeArguments + (TypeIdentifier "T"))) + (JsxText "goodbye")) + (JsxText "\n ")))))) + (Identifier "Something") + (FormalParameters))))) diff --git a/test/fixtures/javascript/corpus/math-assignment-operator.A.js b/semantic/test/fixtures/javascript/corpus/math-assignment-operator.A.js similarity index 100% rename from test/fixtures/javascript/corpus/math-assignment-operator.A.js rename to semantic/test/fixtures/javascript/corpus/math-assignment-operator.A.js diff --git a/test/fixtures/javascript/corpus/math-assignment-operator.B.js b/semantic/test/fixtures/javascript/corpus/math-assignment-operator.B.js similarity index 100% rename from test/fixtures/javascript/corpus/math-assignment-operator.B.js rename to semantic/test/fixtures/javascript/corpus/math-assignment-operator.B.js diff --git a/semantic/test/fixtures/javascript/corpus/math-assignment-operator.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/math-assignment-operator.diffA-B.txt new file mode 100644 index 0000000000..469533a1fb --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/math-assignment-operator.diffA-B.txt @@ -0,0 +1,6 @@ +(Statements + (AugmentedAssignment + (Plus + (Identifier) + { (Float) + ->(Float) }))) diff --git a/semantic/test/fixtures/javascript/corpus/math-assignment-operator.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/math-assignment-operator.diffB-A.txt new file mode 100644 index 0000000000..469533a1fb --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/math-assignment-operator.diffB-A.txt @@ -0,0 +1,6 @@ +(Statements + (AugmentedAssignment + (Plus + (Identifier) + { (Float) + ->(Float) }))) diff --git a/semantic/test/fixtures/javascript/corpus/math-assignment-operator.parseA.txt b/semantic/test/fixtures/javascript/corpus/math-assignment-operator.parseA.txt new file mode 100644 index 0000000000..af0d3a8633 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/math-assignment-operator.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AugmentedAssignmentExpression + (Identifier "x") + (Expression + (Number "1"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/math-assignment-operator.parseB.txt b/semantic/test/fixtures/javascript/corpus/math-assignment-operator.parseB.txt new file mode 100644 index 0000000000..b4837c6733 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/math-assignment-operator.parseB.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AugmentedAssignmentExpression + (Identifier "x") + (Expression + (Number "2"))))))) diff --git a/test/fixtures/javascript/corpus/math-operator.A.js b/semantic/test/fixtures/javascript/corpus/math-operator.A.js similarity index 100% rename from test/fixtures/javascript/corpus/math-operator.A.js rename to semantic/test/fixtures/javascript/corpus/math-operator.A.js diff --git a/test/fixtures/javascript/corpus/math-operator.B.js b/semantic/test/fixtures/javascript/corpus/math-operator.B.js similarity index 100% rename from test/fixtures/javascript/corpus/math-operator.B.js rename to semantic/test/fixtures/javascript/corpus/math-operator.B.js diff --git a/test/fixtures/javascript/corpus/math-operator.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/math-operator.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/math-operator.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/math-operator.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/math-operator.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/math-operator.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/math-operator.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/math-operator.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/math-operator.parseA.txt b/semantic/test/fixtures/javascript/corpus/math-operator.parseA.txt new file mode 100644 index 0000000000..dd88c3c650 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/math-operator.parseA.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "j")) + (Expression + (Number "3")))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "j")) + (Expression + (Number "5"))))))))) diff --git a/semantic/test/fixtures/javascript/corpus/math-operator.parseB.txt b/semantic/test/fixtures/javascript/corpus/math-operator.parseB.txt new file mode 100644 index 0000000000..62fb2bb752 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/math-operator.parseB.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "j")) + (Expression + (Number "2")))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "j")) + (Expression + (Number "4"))))))))) diff --git a/test/fixtures/javascript/corpus/member-access-assignment.A.js b/semantic/test/fixtures/javascript/corpus/member-access-assignment.A.js similarity index 100% rename from test/fixtures/javascript/corpus/member-access-assignment.A.js rename to semantic/test/fixtures/javascript/corpus/member-access-assignment.A.js diff --git a/test/fixtures/javascript/corpus/member-access-assignment.B.js b/semantic/test/fixtures/javascript/corpus/member-access-assignment.B.js similarity index 100% rename from test/fixtures/javascript/corpus/member-access-assignment.B.js rename to semantic/test/fixtures/javascript/corpus/member-access-assignment.B.js diff --git a/test/fixtures/javascript/corpus/member-access-assignment.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/member-access-assignment.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/member-access-assignment.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/member-access-assignment.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/member-access-assignment.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/member-access-assignment.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/member-access-assignment.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/member-access-assignment.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/member-access-assignment.parseA.txt b/semantic/test/fixtures/javascript/corpus/member-access-assignment.parseA.txt new file mode 100644 index 0000000000..cbd2b32859 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/member-access-assignment.parseA.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (MemberExpression + (PropertyIdentifier "x") + (Expression + (Identifier "y"))) + (Expression + (Number "0"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/member-access-assignment.parseB.txt b/semantic/test/fixtures/javascript/corpus/member-access-assignment.parseB.txt new file mode 100644 index 0000000000..bdc68e3d2e --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/member-access-assignment.parseB.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (MemberExpression + (PropertyIdentifier "x") + (Expression + (Identifier "y"))) + (Expression + (Number "1"))))))) diff --git a/test/fixtures/javascript/corpus/member-access.A.js b/semantic/test/fixtures/javascript/corpus/member-access.A.js similarity index 100% rename from test/fixtures/javascript/corpus/member-access.A.js rename to semantic/test/fixtures/javascript/corpus/member-access.A.js diff --git a/test/fixtures/javascript/corpus/member-access.B.js b/semantic/test/fixtures/javascript/corpus/member-access.B.js similarity index 100% rename from test/fixtures/javascript/corpus/member-access.B.js rename to semantic/test/fixtures/javascript/corpus/member-access.B.js diff --git a/test/fixtures/javascript/corpus/member-access.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/member-access.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/member-access.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/member-access.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/member-access.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/member-access.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/member-access.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/member-access.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/member-access.parseA.txt b/semantic/test/fixtures/javascript/corpus/member-access.parseA.txt new file mode 100644 index 0000000000..4561833d53 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/member-access.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (MemberExpression + (PropertyIdentifier "someProperty") + (Expression + (Identifier "x"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/member-access.parseB.txt b/semantic/test/fixtures/javascript/corpus/member-access.parseB.txt new file mode 100644 index 0000000000..ad76fcda57 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/member-access.parseB.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (MemberExpression + (PropertyIdentifier "someOtherProperty") + (Expression + (Identifier "x"))))))) diff --git a/test/fixtures/javascript/corpus/method-call.A.js b/semantic/test/fixtures/javascript/corpus/method-call.A.js similarity index 100% rename from test/fixtures/javascript/corpus/method-call.A.js rename to semantic/test/fixtures/javascript/corpus/method-call.A.js diff --git a/test/fixtures/javascript/corpus/method-call.B.js b/semantic/test/fixtures/javascript/corpus/method-call.B.js similarity index 100% rename from test/fixtures/javascript/corpus/method-call.B.js rename to semantic/test/fixtures/javascript/corpus/method-call.B.js diff --git a/test/fixtures/javascript/corpus/method-call.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/method-call.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/method-call.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/method-call.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/method-call.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/method-call.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/method-call.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/method-call.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/method-call.parseA.txt b/semantic/test/fixtures/javascript/corpus/method-call.parseA.txt new file mode 100644 index 0000000000..87d432c283 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/method-call.parseA.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "someMethod") + (Expression + (Identifier "object")))) + (Arguments + (Expression + (Identifier "arg1")) + (Expression + (String)))))))) diff --git a/semantic/test/fixtures/javascript/corpus/method-call.parseB.txt b/semantic/test/fixtures/javascript/corpus/method-call.parseB.txt new file mode 100644 index 0000000000..87d432c283 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/method-call.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "someMethod") + (Expression + (Identifier "object")))) + (Arguments + (Expression + (Identifier "arg1")) + (Expression + (String)))))))) diff --git a/test/fixtures/javascript/corpus/named-function.A.js b/semantic/test/fixtures/javascript/corpus/named-function.A.js similarity index 100% rename from test/fixtures/javascript/corpus/named-function.A.js rename to semantic/test/fixtures/javascript/corpus/named-function.A.js diff --git a/test/fixtures/javascript/corpus/named-function.B.js b/semantic/test/fixtures/javascript/corpus/named-function.B.js similarity index 100% rename from test/fixtures/javascript/corpus/named-function.B.js rename to semantic/test/fixtures/javascript/corpus/named-function.B.js diff --git a/test/fixtures/javascript/corpus/named-function.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/named-function.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/named-function.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/named-function.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/named-function.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/named-function.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/named-function.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/named-function.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/named-function.parseA.txt b/semantic/test/fixtures/javascript/corpus/named-function.parseA.txt new file mode 100644 index 0000000000..0cda33e832 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/named-function.parseA.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "arg2"))))) + (Identifier "myFunction") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2")))))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/javascript/corpus/named-function.parseB.txt b/semantic/test/fixtures/javascript/corpus/named-function.parseB.txt new file mode 100644 index 0000000000..d6c28317a9 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/named-function.parseB.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (ReturnStatement + (Expression + (False "false"))))) + (Identifier "anotherFunction") + (FormalParameters)))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/javascript/corpus/nested-do-while-in-function.A.js b/semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.A.js similarity index 100% rename from test/fixtures/javascript/corpus/nested-do-while-in-function.A.js rename to semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.A.js diff --git a/test/fixtures/javascript/corpus/nested-do-while-in-function.B.js b/semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.B.js similarity index 100% rename from test/fixtures/javascript/corpus/nested-do-while-in-function.B.js rename to semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.B.js diff --git a/test/fixtures/javascript/corpus/nested-do-while-in-function.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/nested-do-while-in-function.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/nested-do-while-in-function.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/nested-do-while-in-function.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.parseA.txt b/semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.parseA.txt new file mode 100644 index 0000000000..2f4755aa2d --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.parseA.txt @@ -0,0 +1,27 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (DoStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "something")) + (Arguments + (Expression + (Identifier "arg1"))))))))) + (ParenthesizedExpression + (Expression + (Identifier "arg2")))))) + (Identifier "f") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.parseB.txt b/semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.parseB.txt new file mode 100644 index 0000000000..24ccf3949b --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/nested-do-while-in-function.parseB.txt @@ -0,0 +1,27 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (DoStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "something")) + (Arguments + (Expression + (Identifier "arg2"))))))))) + (ParenthesizedExpression + (Expression + (Identifier "arg1")))))) + (Identifier "f") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2"))))))) diff --git a/test/fixtures/javascript/corpus/nested-functions.A.js b/semantic/test/fixtures/javascript/corpus/nested-functions.A.js similarity index 100% rename from test/fixtures/javascript/corpus/nested-functions.A.js rename to semantic/test/fixtures/javascript/corpus/nested-functions.A.js diff --git a/test/fixtures/javascript/corpus/nested-functions.B.js b/semantic/test/fixtures/javascript/corpus/nested-functions.B.js similarity index 100% rename from test/fixtures/javascript/corpus/nested-functions.B.js rename to semantic/test/fixtures/javascript/corpus/nested-functions.B.js diff --git a/test/fixtures/javascript/corpus/nested-functions.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/nested-functions.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/nested-functions.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/nested-functions.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/nested-functions.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/nested-functions.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/nested-functions.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/nested-functions.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/nested-functions.parseA.txt b/semantic/test/fixtures/javascript/corpus/nested-functions.parseA.txt new file mode 100644 index 0000000000..87a0a98774 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/nested-functions.parseA.txt @@ -0,0 +1,45 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "arg3"))))))) + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "arg4")))))))) + (Identifier "child") + (FormalParameters + (RequiredParameter + (Identifier "arg3")) + (RequiredParameter + (Identifier "arg4"))))))) + (Identifier "parent") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/nested-functions.parseB.txt b/semantic/test/fixtures/javascript/corpus/nested-functions.parseB.txt new file mode 100644 index 0000000000..61537b42ce --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/nested-functions.parseB.txt @@ -0,0 +1,45 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "arg1"))))))) + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "arg2")))))))) + (Identifier "child") + (FormalParameters + (RequiredParameter + (Identifier "arg3")) + (RequiredParameter + (Identifier "arg4"))))))) + (Identifier "parent") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2"))))))) diff --git a/test/fixtures/javascript/corpus/null.A.js b/semantic/test/fixtures/javascript/corpus/null.A.js similarity index 100% rename from test/fixtures/javascript/corpus/null.A.js rename to semantic/test/fixtures/javascript/corpus/null.A.js diff --git a/test/fixtures/javascript/corpus/null.B.js b/semantic/test/fixtures/javascript/corpus/null.B.js similarity index 100% rename from test/fixtures/javascript/corpus/null.B.js rename to semantic/test/fixtures/javascript/corpus/null.B.js diff --git a/test/fixtures/javascript/corpus/null.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/null.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/null.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/null.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/null.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/null.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/null.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/null.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/null.parseA.txt b/semantic/test/fixtures/javascript/corpus/null.parseA.txt new file mode 100644 index 0000000000..48ab292e21 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/null.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Null "null"))))) diff --git a/semantic/test/fixtures/javascript/corpus/null.parseB.txt b/semantic/test/fixtures/javascript/corpus/null.parseB.txt new file mode 100644 index 0000000000..9a5613678e --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/null.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (Null "null"))))) diff --git a/test/fixtures/javascript/corpus/number.A.js b/semantic/test/fixtures/javascript/corpus/number.A.js similarity index 100% rename from test/fixtures/javascript/corpus/number.A.js rename to semantic/test/fixtures/javascript/corpus/number.A.js diff --git a/test/fixtures/javascript/corpus/number.B.js b/semantic/test/fixtures/javascript/corpus/number.B.js similarity index 100% rename from test/fixtures/javascript/corpus/number.B.js rename to semantic/test/fixtures/javascript/corpus/number.B.js diff --git a/test/fixtures/javascript/corpus/number.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/number.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/number.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/number.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/number.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/number.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/number.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/number.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/number.parseA.txt b/semantic/test/fixtures/javascript/corpus/number.parseA.txt new file mode 100644 index 0000000000..e52f85ba19 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/number.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Number "101"))))) diff --git a/semantic/test/fixtures/javascript/corpus/number.parseB.txt b/semantic/test/fixtures/javascript/corpus/number.parseB.txt new file mode 100644 index 0000000000..a9f2df2689 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/number.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Number "102"))))) diff --git a/test/fixtures/javascript/corpus/object.A.js b/semantic/test/fixtures/javascript/corpus/object.A.js similarity index 100% rename from test/fixtures/javascript/corpus/object.A.js rename to semantic/test/fixtures/javascript/corpus/object.A.js diff --git a/test/fixtures/javascript/corpus/object.B.js b/semantic/test/fixtures/javascript/corpus/object.B.js similarity index 100% rename from test/fixtures/javascript/corpus/object.B.js rename to semantic/test/fixtures/javascript/corpus/object.B.js diff --git a/test/fixtures/javascript/corpus/object.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/object.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/object.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/object.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/object.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/object.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/object.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/object.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/object.parseA.txt b/semantic/test/fixtures/javascript/corpus/object.parseA.txt new file mode 100644 index 0000000000..2cd9f24e22 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/object.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Object + (Pair + (Expression + (String)) + (String))))))) diff --git a/semantic/test/fixtures/javascript/corpus/object.parseB.txt b/semantic/test/fixtures/javascript/corpus/object.parseB.txt new file mode 100644 index 0000000000..09376d123c --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/object.parseB.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Object + (Pair + (Expression + (String)) + (String)) + (Pair + (Expression + (String)) + (String)) + (Pair + (Expression + (String)) + (String))))))) diff --git a/test/fixtures/javascript/corpus/objects-with-methods.A.js b/semantic/test/fixtures/javascript/corpus/objects-with-methods.A.js similarity index 100% rename from test/fixtures/javascript/corpus/objects-with-methods.A.js rename to semantic/test/fixtures/javascript/corpus/objects-with-methods.A.js diff --git a/test/fixtures/javascript/corpus/objects-with-methods.B.js b/semantic/test/fixtures/javascript/corpus/objects-with-methods.B.js similarity index 100% rename from test/fixtures/javascript/corpus/objects-with-methods.B.js rename to semantic/test/fixtures/javascript/corpus/objects-with-methods.B.js diff --git a/test/fixtures/javascript/corpus/objects-with-methods.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/objects-with-methods.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/objects-with-methods.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/objects-with-methods.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/objects-with-methods.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/objects-with-methods.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/objects-with-methods.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/objects-with-methods.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/objects-with-methods.parseA.txt b/semantic/test/fixtures/javascript/corpus/objects-with-methods.parseA.txt new file mode 100644 index 0000000000..fa21519dea --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/objects-with-methods.parseA.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Object + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "a")) + (Expression + (Identifier "b"))))))) + (PropertyIdentifier "add") + (FormalParameters + (RequiredParameter + (Identifier "a")) + (RequiredParameter + (Identifier "b"))))))))) diff --git a/semantic/test/fixtures/javascript/corpus/objects-with-methods.parseB.txt b/semantic/test/fixtures/javascript/corpus/objects-with-methods.parseB.txt new file mode 100644 index 0000000000..0c8c433ab1 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/objects-with-methods.parseB.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Object + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "a")) + (Expression + (Identifier "b"))))))) + (PropertyIdentifier "subtract") + (FormalParameters + (RequiredParameter + (Identifier "a")) + (RequiredParameter + (Identifier "b"))))))))) diff --git a/test/fixtures/javascript/corpus/regex.A.js b/semantic/test/fixtures/javascript/corpus/regex.A.js similarity index 100% rename from test/fixtures/javascript/corpus/regex.A.js rename to semantic/test/fixtures/javascript/corpus/regex.A.js diff --git a/test/fixtures/javascript/corpus/regex.B.js b/semantic/test/fixtures/javascript/corpus/regex.B.js similarity index 100% rename from test/fixtures/javascript/corpus/regex.B.js rename to semantic/test/fixtures/javascript/corpus/regex.B.js diff --git a/test/fixtures/javascript/corpus/regex.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/regex.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/regex.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/regex.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/regex.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/regex.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/regex.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/regex.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/regex.parseA.txt b/semantic/test/fixtures/javascript/corpus/regex.parseA.txt new file mode 100644 index 0000000000..89f64913b0 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/regex.parseA.txt @@ -0,0 +1,7 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Regex + (RegexFlags "g") + (RegexPattern "one")))))) diff --git a/semantic/test/fixtures/javascript/corpus/regex.parseB.txt b/semantic/test/fixtures/javascript/corpus/regex.parseB.txt new file mode 100644 index 0000000000..c71a96e155 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/regex.parseB.txt @@ -0,0 +1,7 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Regex + (RegexFlags "gim") + (RegexPattern "on[^/]afe")))))) diff --git a/test/fixtures/javascript/corpus/relational-operator.A.js b/semantic/test/fixtures/javascript/corpus/relational-operator.A.js similarity index 100% rename from test/fixtures/javascript/corpus/relational-operator.A.js rename to semantic/test/fixtures/javascript/corpus/relational-operator.A.js diff --git a/test/fixtures/javascript/corpus/relational-operator.B.js b/semantic/test/fixtures/javascript/corpus/relational-operator.B.js similarity index 100% rename from test/fixtures/javascript/corpus/relational-operator.B.js rename to semantic/test/fixtures/javascript/corpus/relational-operator.B.js diff --git a/test/fixtures/javascript/corpus/relational-operator.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/relational-operator.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/relational-operator.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/relational-operator.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/relational-operator.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/relational-operator.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/relational-operator.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/relational-operator.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/relational-operator.parseA.txt b/semantic/test/fixtures/javascript/corpus/relational-operator.parseA.txt new file mode 100644 index 0000000000..39e1b0511e --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/relational-operator.parseA.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (Identifier "y"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/relational-operator.parseB.txt b/semantic/test/fixtures/javascript/corpus/relational-operator.parseB.txt new file mode 100644 index 0000000000..39e1b0511e --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/relational-operator.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (Identifier "y"))))))) diff --git a/test/fixtures/javascript/corpus/return-statement.A.js b/semantic/test/fixtures/javascript/corpus/return-statement.A.js similarity index 100% rename from test/fixtures/javascript/corpus/return-statement.A.js rename to semantic/test/fixtures/javascript/corpus/return-statement.A.js diff --git a/test/fixtures/javascript/corpus/return-statement.B.js b/semantic/test/fixtures/javascript/corpus/return-statement.B.js similarity index 100% rename from test/fixtures/javascript/corpus/return-statement.B.js rename to semantic/test/fixtures/javascript/corpus/return-statement.B.js diff --git a/test/fixtures/javascript/corpus/return-statement.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/return-statement.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/return-statement.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/return-statement.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/return-statement.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/return-statement.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/return-statement.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/return-statement.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/return-statement.parseA.txt b/semantic/test/fixtures/javascript/corpus/return-statement.parseA.txt new file mode 100644 index 0000000000..d82329d1d1 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/return-statement.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (Number "5"))))) diff --git a/semantic/test/fixtures/javascript/corpus/return-statement.parseB.txt b/semantic/test/fixtures/javascript/corpus/return-statement.parseB.txt new file mode 100644 index 0000000000..034d014adc --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/return-statement.parseB.txt @@ -0,0 +1,3 @@ +(Program + (Statement + (ReturnStatement))) diff --git a/test/fixtures/javascript/corpus/string.A.js b/semantic/test/fixtures/javascript/corpus/string.A.js similarity index 100% rename from test/fixtures/javascript/corpus/string.A.js rename to semantic/test/fixtures/javascript/corpus/string.A.js diff --git a/test/fixtures/javascript/corpus/string.B.js b/semantic/test/fixtures/javascript/corpus/string.B.js similarity index 100% rename from test/fixtures/javascript/corpus/string.B.js rename to semantic/test/fixtures/javascript/corpus/string.B.js diff --git a/test/fixtures/javascript/corpus/string.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/string.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/string.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/string.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/string.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/string.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/string.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/string.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/string.parseA.txt b/semantic/test/fixtures/javascript/corpus/string.parseA.txt new file mode 100644 index 0000000000..1d43efb305 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/string.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (String))))) diff --git a/semantic/test/fixtures/javascript/corpus/string.parseB.txt b/semantic/test/fixtures/javascript/corpus/string.parseB.txt new file mode 100644 index 0000000000..1d43efb305 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/string.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (String))))) diff --git a/test/fixtures/javascript/corpus/subscript-access-assignment.A.js b/semantic/test/fixtures/javascript/corpus/subscript-access-assignment.A.js similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-assignment.A.js rename to semantic/test/fixtures/javascript/corpus/subscript-access-assignment.A.js diff --git a/test/fixtures/javascript/corpus/subscript-access-assignment.B.js b/semantic/test/fixtures/javascript/corpus/subscript-access-assignment.B.js similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-assignment.B.js rename to semantic/test/fixtures/javascript/corpus/subscript-access-assignment.B.js diff --git a/test/fixtures/javascript/corpus/subscript-access-assignment.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-assignment.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-assignment.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/subscript-access-assignment.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/subscript-access-assignment.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-assignment.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-assignment.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/subscript-access-assignment.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/subscript-access-assignment.parseA.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-assignment.parseA.txt new file mode 100644 index 0000000000..54b1595a8b --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/subscript-access-assignment.parseA.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (SubscriptExpression + (Expression + (Identifier "y")) + (Expression + (String))) + (Expression + (Number "0"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/subscript-access-assignment.parseB.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-assignment.parseB.txt new file mode 100644 index 0000000000..3303da8dde --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/subscript-access-assignment.parseB.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (SubscriptExpression + (Expression + (Identifier "y")) + (Expression + (String))) + (Expression + (Number "1"))))))) diff --git a/test/fixtures/javascript/corpus/subscript-access-string.A.js b/semantic/test/fixtures/javascript/corpus/subscript-access-string.A.js similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-string.A.js rename to semantic/test/fixtures/javascript/corpus/subscript-access-string.A.js diff --git a/test/fixtures/javascript/corpus/subscript-access-string.B.js b/semantic/test/fixtures/javascript/corpus/subscript-access-string.B.js similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-string.B.js rename to semantic/test/fixtures/javascript/corpus/subscript-access-string.B.js diff --git a/test/fixtures/javascript/corpus/subscript-access-string.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-string.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-string.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/subscript-access-string.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/subscript-access-string.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-string.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-string.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/subscript-access-string.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/subscript-access-string.parseA.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-string.parseA.txt new file mode 100644 index 0000000000..329f8704b1 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/subscript-access-string.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (SubscriptExpression + (Expression + (Identifier "x")) + (Expression + (String))))))) diff --git a/semantic/test/fixtures/javascript/corpus/subscript-access-string.parseB.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-string.parseB.txt new file mode 100644 index 0000000000..329f8704b1 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/subscript-access-string.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (SubscriptExpression + (Expression + (Identifier "x")) + (Expression + (String))))))) diff --git a/test/fixtures/javascript/corpus/subscript-access-variable.A.js b/semantic/test/fixtures/javascript/corpus/subscript-access-variable.A.js similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-variable.A.js rename to semantic/test/fixtures/javascript/corpus/subscript-access-variable.A.js diff --git a/test/fixtures/javascript/corpus/subscript-access-variable.B.js b/semantic/test/fixtures/javascript/corpus/subscript-access-variable.B.js similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-variable.B.js rename to semantic/test/fixtures/javascript/corpus/subscript-access-variable.B.js diff --git a/test/fixtures/javascript/corpus/subscript-access-variable.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-variable.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-variable.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/subscript-access-variable.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/subscript-access-variable.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-variable.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/subscript-access-variable.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/subscript-access-variable.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/subscript-access-variable.parseA.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-variable.parseA.txt new file mode 100644 index 0000000000..649b3f104f --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/subscript-access-variable.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (SubscriptExpression + (Expression + (Identifier "x")) + (Expression + (Identifier "someVariable"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/subscript-access-variable.parseB.txt b/semantic/test/fixtures/javascript/corpus/subscript-access-variable.parseB.txt new file mode 100644 index 0000000000..ef75413806 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/subscript-access-variable.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (SubscriptExpression + (Expression + (Identifier "x")) + (Expression + (Identifier "someOtherVariable"))))))) diff --git a/test/fixtures/javascript/corpus/switch-statement.A.js b/semantic/test/fixtures/javascript/corpus/switch-statement.A.js similarity index 100% rename from test/fixtures/javascript/corpus/switch-statement.A.js rename to semantic/test/fixtures/javascript/corpus/switch-statement.A.js diff --git a/test/fixtures/javascript/corpus/switch-statement.B.js b/semantic/test/fixtures/javascript/corpus/switch-statement.B.js similarity index 100% rename from test/fixtures/javascript/corpus/switch-statement.B.js rename to semantic/test/fixtures/javascript/corpus/switch-statement.B.js diff --git a/test/fixtures/javascript/corpus/switch-statement.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/switch-statement.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/switch-statement.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/switch-statement.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/switch-statement.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/switch-statement.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/switch-statement.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/switch-statement.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/switch-statement.parseA.txt b/semantic/test/fixtures/javascript/corpus/switch-statement.parseA.txt new file mode 100644 index 0000000000..e0a1277bef --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/switch-statement.parseA.txt @@ -0,0 +1,30 @@ +(Program + (Statement + (SwitchStatement + (SwitchBody + (SwitchCase + (Expression + (Number "1")) + (Statement + (ExpressionStatement + (Expression + (Number "1"))))) + (SwitchCase + (Expression + (Number "2")) + (Statement + (ExpressionStatement + (Expression + (Number "1"))))) + (SwitchCase + (Expression + (Number "3")) + (Statement + (ExpressionStatement + (Expression + (Number "3")))))) + (ParenthesizedExpression + (Expression + (Number "1"))))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/javascript/corpus/switch-statement.parseB.txt b/semantic/test/fixtures/javascript/corpus/switch-statement.parseB.txt new file mode 100644 index 0000000000..87786f3f52 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/switch-statement.parseB.txt @@ -0,0 +1,30 @@ +(Program + (Statement + (SwitchStatement + (SwitchBody + (SwitchCase + (Expression + (Number "1")) + (Statement + (ExpressionStatement + (Expression + (Number "1"))))) + (SwitchCase + (Expression + (Number "2")) + (Statement + (ExpressionStatement + (Expression + (Number "2"))))) + (SwitchCase + (Expression + (Number "3")) + (Statement + (ExpressionStatement + (Expression + (Number "3")))))) + (ParenthesizedExpression + (Expression + (Number "2"))))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/javascript/corpus/template-string.A.js b/semantic/test/fixtures/javascript/corpus/template-string.A.js similarity index 100% rename from test/fixtures/javascript/corpus/template-string.A.js rename to semantic/test/fixtures/javascript/corpus/template-string.A.js diff --git a/test/fixtures/javascript/corpus/template-string.B.js b/semantic/test/fixtures/javascript/corpus/template-string.B.js similarity index 100% rename from test/fixtures/javascript/corpus/template-string.B.js rename to semantic/test/fixtures/javascript/corpus/template-string.B.js diff --git a/test/fixtures/javascript/corpus/template-string.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/template-string.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/template-string.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/template-string.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/template-string.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/template-string.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/template-string.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/template-string.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/template-string.parseA.txt b/semantic/test/fixtures/javascript/corpus/template-string.parseA.txt new file mode 100644 index 0000000000..75bebd8e92 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/template-string.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (TemplateString))))) diff --git a/semantic/test/fixtures/javascript/corpus/template-string.parseB.txt b/semantic/test/fixtures/javascript/corpus/template-string.parseB.txt new file mode 100644 index 0000000000..75bebd8e92 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/template-string.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (TemplateString))))) diff --git a/test/fixtures/javascript/corpus/ternary.A.js b/semantic/test/fixtures/javascript/corpus/ternary.A.js similarity index 100% rename from test/fixtures/javascript/corpus/ternary.A.js rename to semantic/test/fixtures/javascript/corpus/ternary.A.js diff --git a/test/fixtures/javascript/corpus/ternary.B.js b/semantic/test/fixtures/javascript/corpus/ternary.B.js similarity index 100% rename from test/fixtures/javascript/corpus/ternary.B.js rename to semantic/test/fixtures/javascript/corpus/ternary.B.js diff --git a/test/fixtures/javascript/corpus/ternary.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/ternary.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/ternary.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/ternary.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/ternary.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/ternary.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/ternary.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/ternary.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/ternary.parseA.txt b/semantic/test/fixtures/javascript/corpus/ternary.parseA.txt new file mode 100644 index 0000000000..7486c9466a --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/ternary.parseA.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (TernaryExpression + (Expression + (Identifier "case2")) + (Expression + (Identifier "case1")) + (Expression + (Identifier "condition"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/ternary.parseB.txt b/semantic/test/fixtures/javascript/corpus/ternary.parseB.txt new file mode 100644 index 0000000000..24f03ad5aa --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/ternary.parseB.txt @@ -0,0 +1,29 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (MemberExpression + (PropertyIdentifier "y") + (Expression + (Identifier "x"))) + (Expression + (TernaryExpression + (Expression + (MemberExpression + (PropertyIdentifier "case") + (Expression + (MemberExpression + (PropertyIdentifier "other") + (Expression + (Identifier "some")))))) + (Expression + (MemberExpression + (PropertyIdentifier "case") + (Expression + (Identifier "some")))) + (Expression + (MemberExpression + (PropertyIdentifier "condition") + (Expression + (Identifier "some"))))))))))) diff --git a/test/fixtures/javascript/corpus/this-expression.A.js b/semantic/test/fixtures/javascript/corpus/this-expression.A.js similarity index 100% rename from test/fixtures/javascript/corpus/this-expression.A.js rename to semantic/test/fixtures/javascript/corpus/this-expression.A.js diff --git a/test/fixtures/javascript/corpus/this-expression.B.js b/semantic/test/fixtures/javascript/corpus/this-expression.B.js similarity index 100% rename from test/fixtures/javascript/corpus/this-expression.B.js rename to semantic/test/fixtures/javascript/corpus/this-expression.B.js diff --git a/test/fixtures/javascript/corpus/this-expression.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/this-expression.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/this-expression.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/this-expression.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/this-expression.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/this-expression.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/this-expression.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/this-expression.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/this-expression.parseA.txt b/semantic/test/fixtures/javascript/corpus/this-expression.parseA.txt new file mode 100644 index 0000000000..7a21a87443 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/this-expression.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (This "this"))))) diff --git a/semantic/test/fixtures/javascript/corpus/this-expression.parseB.txt b/semantic/test/fixtures/javascript/corpus/this-expression.parseB.txt new file mode 100644 index 0000000000..28e054b881 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/this-expression.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (This "this"))))) diff --git a/test/fixtures/javascript/corpus/throw-statement.A.js b/semantic/test/fixtures/javascript/corpus/throw-statement.A.js similarity index 100% rename from test/fixtures/javascript/corpus/throw-statement.A.js rename to semantic/test/fixtures/javascript/corpus/throw-statement.A.js diff --git a/test/fixtures/javascript/corpus/throw-statement.B.js b/semantic/test/fixtures/javascript/corpus/throw-statement.B.js similarity index 100% rename from test/fixtures/javascript/corpus/throw-statement.B.js rename to semantic/test/fixtures/javascript/corpus/throw-statement.B.js diff --git a/test/fixtures/javascript/corpus/throw-statement.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/throw-statement.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/throw-statement.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/throw-statement.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/throw-statement.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/throw-statement.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/throw-statement.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/throw-statement.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/throw-statement.parseA.txt b/semantic/test/fixtures/javascript/corpus/throw-statement.parseA.txt new file mode 100644 index 0000000000..f73f01a1a3 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/throw-statement.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ThrowStatement + (Expression + (NewExpression + (Arguments + (Expression + (String))) + (Identifier "Error")))))) diff --git a/semantic/test/fixtures/javascript/corpus/throw-statement.parseB.txt b/semantic/test/fixtures/javascript/corpus/throw-statement.parseB.txt new file mode 100644 index 0000000000..f73f01a1a3 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/throw-statement.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ThrowStatement + (Expression + (NewExpression + (Arguments + (Expression + (String))) + (Identifier "Error")))))) diff --git a/test/fixtures/javascript/corpus/true.A.js b/semantic/test/fixtures/javascript/corpus/true.A.js similarity index 100% rename from test/fixtures/javascript/corpus/true.A.js rename to semantic/test/fixtures/javascript/corpus/true.A.js diff --git a/test/fixtures/javascript/corpus/true.B.js b/semantic/test/fixtures/javascript/corpus/true.B.js similarity index 100% rename from test/fixtures/javascript/corpus/true.B.js rename to semantic/test/fixtures/javascript/corpus/true.B.js diff --git a/test/fixtures/javascript/corpus/true.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/true.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/true.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/true.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/true.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/true.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/true.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/true.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/true.parseA.txt b/semantic/test/fixtures/javascript/corpus/true.parseA.txt new file mode 100644 index 0000000000..aa0ec6291a --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/true.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (True "true"))))) diff --git a/semantic/test/fixtures/javascript/corpus/true.parseB.txt b/semantic/test/fixtures/javascript/corpus/true.parseB.txt new file mode 100644 index 0000000000..a5273bbdea --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/true.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (True "true"))))) diff --git a/test/fixtures/javascript/corpus/try-statement.A.js b/semantic/test/fixtures/javascript/corpus/try-statement.A.js similarity index 100% rename from test/fixtures/javascript/corpus/try-statement.A.js rename to semantic/test/fixtures/javascript/corpus/try-statement.A.js diff --git a/test/fixtures/javascript/corpus/try-statement.B.js b/semantic/test/fixtures/javascript/corpus/try-statement.B.js similarity index 100% rename from test/fixtures/javascript/corpus/try-statement.B.js rename to semantic/test/fixtures/javascript/corpus/try-statement.B.js diff --git a/test/fixtures/javascript/corpus/try-statement.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/try-statement.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/try-statement.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/try-statement.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/try-statement.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/try-statement.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/try-statement.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/try-statement.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/try-statement.parseA.txt b/semantic/test/fixtures/javascript/corpus/try-statement.parseA.txt new file mode 100644 index 0000000000..49738edd6f --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/try-statement.parseA.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (TryStatement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "f"))))) + (CatchClause + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "g")))))) + (FinallyClause + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "h")))))))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/javascript/corpus/try-statement.parseB.txt b/semantic/test/fixtures/javascript/corpus/try-statement.parseB.txt new file mode 100644 index 0000000000..5728f6c703 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/try-statement.parseB.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (TryStatement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "f"))))) + (CatchClause + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "h")))))) + (FinallyClause + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "g")))))))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/javascript/corpus/type-operator.A.js b/semantic/test/fixtures/javascript/corpus/type-operator.A.js similarity index 100% rename from test/fixtures/javascript/corpus/type-operator.A.js rename to semantic/test/fixtures/javascript/corpus/type-operator.A.js diff --git a/test/fixtures/javascript/corpus/type-operator.B.js b/semantic/test/fixtures/javascript/corpus/type-operator.B.js similarity index 100% rename from test/fixtures/javascript/corpus/type-operator.B.js rename to semantic/test/fixtures/javascript/corpus/type-operator.B.js diff --git a/test/fixtures/javascript/corpus/type-operator.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/type-operator.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/type-operator.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/type-operator.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/type-operator.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/type-operator.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/type-operator.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/type-operator.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/type-operator.parseA.txt b/semantic/test/fixtures/javascript/corpus/type-operator.parseA.txt new file mode 100644 index 0000000000..06e961690d --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/type-operator.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "x"))))))) diff --git a/semantic/test/fixtures/javascript/corpus/type-operator.parseB.txt b/semantic/test/fixtures/javascript/corpus/type-operator.parseB.txt new file mode 100644 index 0000000000..e4d8f4cebe --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/type-operator.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (Identifier "String"))))))) diff --git a/test/fixtures/javascript/corpus/undefined.A.js b/semantic/test/fixtures/javascript/corpus/undefined.A.js similarity index 100% rename from test/fixtures/javascript/corpus/undefined.A.js rename to semantic/test/fixtures/javascript/corpus/undefined.A.js diff --git a/test/fixtures/javascript/corpus/undefined.B.js b/semantic/test/fixtures/javascript/corpus/undefined.B.js similarity index 100% rename from test/fixtures/javascript/corpus/undefined.B.js rename to semantic/test/fixtures/javascript/corpus/undefined.B.js diff --git a/test/fixtures/javascript/corpus/undefined.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/undefined.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/undefined.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/undefined.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/undefined.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/undefined.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/undefined.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/undefined.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/undefined.parseA.txt b/semantic/test/fixtures/javascript/corpus/undefined.parseA.txt new file mode 100644 index 0000000000..26370fbb4b --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/undefined.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Undefined "undefined"))))) diff --git a/semantic/test/fixtures/javascript/corpus/undefined.parseB.txt b/semantic/test/fixtures/javascript/corpus/undefined.parseB.txt new file mode 100644 index 0000000000..d7ad4f1c7a --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/undefined.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (Undefined "undefined"))))) diff --git a/test/fixtures/javascript/corpus/var-declaration.A.js b/semantic/test/fixtures/javascript/corpus/var-declaration.A.js similarity index 100% rename from test/fixtures/javascript/corpus/var-declaration.A.js rename to semantic/test/fixtures/javascript/corpus/var-declaration.A.js diff --git a/test/fixtures/javascript/corpus/var-declaration.B.js b/semantic/test/fixtures/javascript/corpus/var-declaration.B.js similarity index 100% rename from test/fixtures/javascript/corpus/var-declaration.B.js rename to semantic/test/fixtures/javascript/corpus/var-declaration.B.js diff --git a/test/fixtures/javascript/corpus/var-declaration.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/var-declaration.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/var-declaration.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/var-declaration.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/var-declaration.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/var-declaration.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/var-declaration.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/var-declaration.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/var-declaration.parseA.txt b/semantic/test/fixtures/javascript/corpus/var-declaration.parseA.txt new file mode 100644 index 0000000000..7add3ac35e --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/var-declaration.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (Number "1")) + (Identifier "x")))))) diff --git a/semantic/test/fixtures/javascript/corpus/var-declaration.parseB.txt b/semantic/test/fixtures/javascript/corpus/var-declaration.parseB.txt new file mode 100644 index 0000000000..b6166d8f82 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/var-declaration.parseB.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Identifier "x")) + (VariableDeclarator + (Expression + (Object)) + (Identifier "y")) + (VariableDeclarator + (Identifier "z")))))) diff --git a/test/fixtures/javascript/corpus/variable.A.js b/semantic/test/fixtures/javascript/corpus/variable.A.js similarity index 100% rename from test/fixtures/javascript/corpus/variable.A.js rename to semantic/test/fixtures/javascript/corpus/variable.A.js diff --git a/test/fixtures/javascript/corpus/variable.B.js b/semantic/test/fixtures/javascript/corpus/variable.B.js similarity index 100% rename from test/fixtures/javascript/corpus/variable.B.js rename to semantic/test/fixtures/javascript/corpus/variable.B.js diff --git a/test/fixtures/javascript/corpus/variable.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/variable.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/variable.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/variable.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/variable.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/variable.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/variable.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/variable.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/variable.parseA.txt b/semantic/test/fixtures/javascript/corpus/variable.parseA.txt new file mode 100644 index 0000000000..ee36557999 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/variable.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Identifier "theVar"))))) diff --git a/semantic/test/fixtures/javascript/corpus/variable.parseB.txt b/semantic/test/fixtures/javascript/corpus/variable.parseB.txt new file mode 100644 index 0000000000..420643ed8a --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/variable.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Identifier "theVar2"))))) diff --git a/test/fixtures/python/analysis/b/__init__.py b/semantic/test/fixtures/javascript/corpus/variadic-function-declarations.parseA.txt similarity index 100% rename from test/fixtures/python/analysis/b/__init__.py rename to semantic/test/fixtures/javascript/corpus/variadic-function-declarations.parseA.txt diff --git a/test/fixtures/javascript/corpus/void-operator.A.js b/semantic/test/fixtures/javascript/corpus/void-operator.A.js similarity index 100% rename from test/fixtures/javascript/corpus/void-operator.A.js rename to semantic/test/fixtures/javascript/corpus/void-operator.A.js diff --git a/test/fixtures/javascript/corpus/void-operator.B.js b/semantic/test/fixtures/javascript/corpus/void-operator.B.js similarity index 100% rename from test/fixtures/javascript/corpus/void-operator.B.js rename to semantic/test/fixtures/javascript/corpus/void-operator.B.js diff --git a/test/fixtures/javascript/corpus/void-operator.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/void-operator.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/void-operator.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/void-operator.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/void-operator.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/void-operator.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/void-operator.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/void-operator.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/void-operator.parseA.txt b/semantic/test/fixtures/javascript/corpus/void-operator.parseA.txt new file mode 100644 index 0000000000..c5d371aa5e --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/void-operator.parseA.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (UnaryExpression + (Token) + (Expression + (CallExpression + (Expression + (Identifier "b")) + (Arguments)))))))) diff --git a/semantic/test/fixtures/javascript/corpus/void-operator.parseB.txt b/semantic/test/fixtures/javascript/corpus/void-operator.parseB.txt new file mode 100644 index 0000000000..486e852f3a --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/void-operator.parseB.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (UnaryExpression + (Token) + (Expression + (CallExpression + (Expression + (Identifier "c")) + (Arguments)))))))) diff --git a/test/fixtures/javascript/corpus/while-statement.A.js b/semantic/test/fixtures/javascript/corpus/while-statement.A.js similarity index 100% rename from test/fixtures/javascript/corpus/while-statement.A.js rename to semantic/test/fixtures/javascript/corpus/while-statement.A.js diff --git a/test/fixtures/javascript/corpus/while-statement.B.js b/semantic/test/fixtures/javascript/corpus/while-statement.B.js similarity index 100% rename from test/fixtures/javascript/corpus/while-statement.B.js rename to semantic/test/fixtures/javascript/corpus/while-statement.B.js diff --git a/test/fixtures/javascript/corpus/while-statement.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/while-statement.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/while-statement.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/while-statement.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/while-statement.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/while-statement.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/while-statement.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/while-statement.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/while-statement.parseA.txt b/semantic/test/fixtures/javascript/corpus/while-statement.parseA.txt new file mode 100644 index 0000000000..edb9d27fb9 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/while-statement.parseA.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (WhileStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (Arguments))))))) + (ParenthesizedExpression + (Expression + (Identifier "a"))))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/javascript/corpus/while-statement.parseB.txt b/semantic/test/fixtures/javascript/corpus/while-statement.parseB.txt new file mode 100644 index 0000000000..d9c98394de --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/while-statement.parseB.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (WhileStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (Arguments))))))) + (ParenthesizedExpression + (Expression + (Identifier "b"))))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/javascript/corpus/yield.A.js b/semantic/test/fixtures/javascript/corpus/yield.A.js similarity index 100% rename from test/fixtures/javascript/corpus/yield.A.js rename to semantic/test/fixtures/javascript/corpus/yield.A.js diff --git a/test/fixtures/javascript/corpus/yield.B.js b/semantic/test/fixtures/javascript/corpus/yield.B.js similarity index 100% rename from test/fixtures/javascript/corpus/yield.B.js rename to semantic/test/fixtures/javascript/corpus/yield.B.js diff --git a/test/fixtures/javascript/corpus/yield.diffA-B.txt b/semantic/test/fixtures/javascript/corpus/yield.diffA-B.txt similarity index 100% rename from test/fixtures/javascript/corpus/yield.diffA-B.txt rename to semantic/test/fixtures/javascript/corpus/yield.diffA-B.txt diff --git a/test/fixtures/javascript/corpus/yield.diffB-A.txt b/semantic/test/fixtures/javascript/corpus/yield.diffB-A.txt similarity index 100% rename from test/fixtures/javascript/corpus/yield.diffB-A.txt rename to semantic/test/fixtures/javascript/corpus/yield.diffB-A.txt diff --git a/semantic/test/fixtures/javascript/corpus/yield.parseA.txt b/semantic/test/fixtures/javascript/corpus/yield.parseA.txt new file mode 100644 index 0000000000..5b2b9a2543 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/yield.parseA.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (Declaration + (GeneratorFunctionDeclaration + (StatementBlock + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (Number "0")) + (Identifier "index"))))) + (Statement + (ExpressionStatement + (Expression + (YieldExpression + (Expression + (Identifier "i"))))))) + (Identifier "foo") + (FormalParameters))))) diff --git a/semantic/test/fixtures/javascript/corpus/yield.parseB.txt b/semantic/test/fixtures/javascript/corpus/yield.parseB.txt new file mode 100644 index 0000000000..492c1ced74 --- /dev/null +++ b/semantic/test/fixtures/javascript/corpus/yield.parseB.txt @@ -0,0 +1,23 @@ +(Program + (Statement + (Declaration + (GeneratorFunctionDeclaration + (StatementBlock + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (Number "0")) + (Identifier "index"))))) + (Statement + (ExpressionStatement + (Expression + (YieldExpression + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))))) + (Identifier "foo") + (FormalParameters))))) diff --git a/test/fixtures/javascript/reprinting/map.json b/semantic/test/fixtures/javascript/reprinting/map.json similarity index 100% rename from test/fixtures/javascript/reprinting/map.json rename to semantic/test/fixtures/javascript/reprinting/map.json diff --git a/test/fixtures/javascript/tags/simple_function_with_docs.js b/semantic/test/fixtures/javascript/tags/simple_function_with_docs.js similarity index 100% rename from test/fixtures/javascript/tags/simple_function_with_docs.js rename to semantic/test/fixtures/javascript/tags/simple_function_with_docs.js diff --git a/test/fixtures/javascript/toc/duplicate-parent.A.js b/semantic/test/fixtures/javascript/toc/duplicate-parent.A.js similarity index 100% rename from test/fixtures/javascript/toc/duplicate-parent.A.js rename to semantic/test/fixtures/javascript/toc/duplicate-parent.A.js diff --git a/test/fixtures/javascript/toc/duplicate-parent.B.js b/semantic/test/fixtures/javascript/toc/duplicate-parent.B.js similarity index 100% rename from test/fixtures/javascript/toc/duplicate-parent.B.js rename to semantic/test/fixtures/javascript/toc/duplicate-parent.B.js diff --git a/test/fixtures/javascript/toc/erroneous-duplicate-method.A.js b/semantic/test/fixtures/javascript/toc/erroneous-duplicate-method.A.js similarity index 100% rename from test/fixtures/javascript/toc/erroneous-duplicate-method.A.js rename to semantic/test/fixtures/javascript/toc/erroneous-duplicate-method.A.js diff --git a/test/fixtures/javascript/toc/erroneous-duplicate-method.B.js b/semantic/test/fixtures/javascript/toc/erroneous-duplicate-method.B.js similarity index 100% rename from test/fixtures/javascript/toc/erroneous-duplicate-method.B.js rename to semantic/test/fixtures/javascript/toc/erroneous-duplicate-method.B.js diff --git a/test/fixtures/javascript/toc/starts-with-newline.js b/semantic/test/fixtures/javascript/toc/starts-with-newline.js similarity index 100% rename from test/fixtures/javascript/toc/starts-with-newline.js rename to semantic/test/fixtures/javascript/toc/starts-with-newline.js diff --git a/semantic/test/fixtures/jquery-3.5.1.min.js b/semantic/test/fixtures/jquery-3.5.1.min.js new file mode 100644 index 0000000000..b0614034ad --- /dev/null +++ b/semantic/test/fixtures/jquery-3.5.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0(Identifier) } + (Integer)) + (Assignment + { (Statements + {-(Identifier)-} + {-(Identifier)-}) + ->(Identifier) } + (Statements + (Integer) + (Integer))) +{-(Assignment + {-(Identifier)-} + {-(Statements + {-(Integer)-} + {-(Integer)-})-})-}) diff --git a/test/fixtures/python/corpus/assignment.diffB-A.txt b/semantic/test/fixtures/python/corpus/assignment.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/assignment.diffB-A.txt rename to semantic/test/fixtures/python/corpus/assignment.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/assignment.parseA.txt b/semantic/test/fixtures/python/corpus/assignment.parseA.txt new file mode 100644 index 0000000000..78d1775c2e --- /dev/null +++ b/semantic/test/fixtures/python/corpus/assignment.parseA.txt @@ -0,0 +1,43 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "a")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "1"))))))) + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "a"))) + (Expression + (PrimaryExpression + (Identifier "b")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "2"))))))) + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "a")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "2")))))))) diff --git a/semantic/test/fixtures/python/corpus/assignment.parseB.txt b/semantic/test/fixtures/python/corpus/assignment.parseB.txt new file mode 100644 index 0000000000..e335239962 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/assignment.parseB.txt @@ -0,0 +1,43 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "a"))) + (Expression + (PrimaryExpression + (Identifier "b")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "2"))) + (Expression + (PrimaryExpression + (Integer "1"))))))) + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "c")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "1"))))))) + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "b")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "2")))))))) diff --git a/test/fixtures/python/corpus/async-function-definition.A.py b/semantic/test/fixtures/python/corpus/async-function-definition.A.py similarity index 100% rename from test/fixtures/python/corpus/async-function-definition.A.py rename to semantic/test/fixtures/python/corpus/async-function-definition.A.py diff --git a/test/fixtures/python/corpus/async-function-definition.B.py b/semantic/test/fixtures/python/corpus/async-function-definition.B.py similarity index 100% rename from test/fixtures/python/corpus/async-function-definition.B.py rename to semantic/test/fixtures/python/corpus/async-function-definition.B.py diff --git a/test/fixtures/python/corpus/async-function-definition.diffA-B.txt b/semantic/test/fixtures/python/corpus/async-function-definition.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/async-function-definition.diffA-B.txt rename to semantic/test/fixtures/python/corpus/async-function-definition.diffA-B.txt diff --git a/test/fixtures/python/corpus/async-function-definition.diffB-A.txt b/semantic/test/fixtures/python/corpus/async-function-definition.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/async-function-definition.diffB-A.txt rename to semantic/test/fixtures/python/corpus/async-function-definition.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/async-function-definition.parseA.txt b/semantic/test/fixtures/python/corpus/async-function-definition.parseA.txt new file mode 100644 index 0000000000..e077bfcf08 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/async-function-definition.parseA.txt @@ -0,0 +1,37 @@ +(Module + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b")))))) + (Identifier "a") + (Parameters))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "i")))))) + (Identifier "b") + (Parameters + (Parameter + (Identifier "h")) + (Parameter + (Identifier "i"))))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "d")))))) + (Identifier "c") + (Parameters + (Parameter + (Identifier "d")))))) diff --git a/semantic/test/fixtures/python/corpus/async-function-definition.parseB.txt b/semantic/test/fixtures/python/corpus/async-function-definition.parseB.txt new file mode 100644 index 0000000000..aaee704024 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/async-function-definition.parseB.txt @@ -0,0 +1,37 @@ +(Module + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "j")))))) + (Identifier "g") + (Parameters + (Parameter + (Identifier "i")) + (Parameter + (Identifier "j"))))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "c")))))) + (Identifier "a") + (Parameters))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "e")))))) + (Identifier "d") + (Parameters + (Parameter + (Identifier "c")))))) diff --git a/test/fixtures/python/corpus/attribute.A.py b/semantic/test/fixtures/python/corpus/attribute.A.py similarity index 100% rename from test/fixtures/python/corpus/attribute.A.py rename to semantic/test/fixtures/python/corpus/attribute.A.py diff --git a/test/fixtures/python/corpus/attribute.B.py b/semantic/test/fixtures/python/corpus/attribute.B.py similarity index 100% rename from test/fixtures/python/corpus/attribute.B.py rename to semantic/test/fixtures/python/corpus/attribute.B.py diff --git a/test/fixtures/python/corpus/attribute.diffA-B.txt b/semantic/test/fixtures/python/corpus/attribute.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/attribute.diffA-B.txt rename to semantic/test/fixtures/python/corpus/attribute.diffA-B.txt diff --git a/test/fixtures/python/corpus/attribute.diffB-A.txt b/semantic/test/fixtures/python/corpus/attribute.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/attribute.diffB-A.txt rename to semantic/test/fixtures/python/corpus/attribute.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/attribute.parseA.txt b/semantic/test/fixtures/python/corpus/attribute.parseA.txt new file mode 100644 index 0000000000..34b580e342 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/attribute.parseA.txt @@ -0,0 +1,9 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Attribute + (Identifier "b") + (PrimaryExpression + (Identifier "a")))))))) diff --git a/semantic/test/fixtures/python/corpus/attribute.parseB.txt b/semantic/test/fixtures/python/corpus/attribute.parseB.txt new file mode 100644 index 0000000000..6a9ac07138 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/attribute.parseB.txt @@ -0,0 +1,12 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Attribute + (Identifier "c") + (PrimaryExpression + (Attribute + (Identifier "b") + (PrimaryExpression + (Identifier "a")))))))))) diff --git a/test/fixtures/python/corpus/augmented-assignment.A.py b/semantic/test/fixtures/python/corpus/augmented-assignment.A.py similarity index 100% rename from test/fixtures/python/corpus/augmented-assignment.A.py rename to semantic/test/fixtures/python/corpus/augmented-assignment.A.py diff --git a/test/fixtures/python/corpus/augmented-assignment.B.py b/semantic/test/fixtures/python/corpus/augmented-assignment.B.py similarity index 100% rename from test/fixtures/python/corpus/augmented-assignment.B.py rename to semantic/test/fixtures/python/corpus/augmented-assignment.B.py diff --git a/semantic/test/fixtures/python/corpus/augmented-assignment.diffA-B.txt b/semantic/test/fixtures/python/corpus/augmented-assignment.diffA-B.txt new file mode 100644 index 0000000000..0a05a90a71 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/augmented-assignment.diffA-B.txt @@ -0,0 +1,23 @@ +(Statements + (AugmentedAssignment + { (Plus + {-(Identifier)-} + {-(Integer)-}) + ->(RShift + {+(Identifier)+} + {+(Integer)+}) }) +{+(AugmentedAssignment + {+(DividedBy + {+(Identifier)+} + {+(Integer)+})+})+} + (AugmentedAssignment + { (RShift + {-(Identifier)-} + {-(Integer)-}) + ->(Plus + {+(Identifier)+} + {+(Integer)+}) }) +{-(AugmentedAssignment + {-(DividedBy + {-(Identifier)-} + {-(Integer)-})-})-}) diff --git a/semantic/test/fixtures/python/corpus/augmented-assignment.diffB-A.txt b/semantic/test/fixtures/python/corpus/augmented-assignment.diffB-A.txt new file mode 100644 index 0000000000..08fe6e85ae --- /dev/null +++ b/semantic/test/fixtures/python/corpus/augmented-assignment.diffB-A.txt @@ -0,0 +1,24 @@ +(Statements + (AugmentedAssignment + { (RShift + {-(Identifier)-} + {-(Integer)-}) + ->(Plus + {+(Identifier)+} + {+(Integer)+}) }) +{+(AugmentedAssignment + {+(RShift + {+(Identifier)+} + {+(Integer)+})+})+} +{+(AugmentedAssignment + {+(DividedBy + {+(Identifier)+} + {+(Integer)+})+})+} +{-(AugmentedAssignment + {-(DividedBy + {-(Identifier)-} + {-(Integer)-})-})-} +{-(AugmentedAssignment + {-(Plus + {-(Identifier)-} + {-(Integer)-})-})-}) diff --git a/semantic/test/fixtures/python/corpus/augmented-assignment.parseA.txt b/semantic/test/fixtures/python/corpus/augmented-assignment.parseA.txt new file mode 100644 index 0000000000..e5b9a16e45 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/augmented-assignment.parseA.txt @@ -0,0 +1,37 @@ +(Module + (SimpleStatement + (ExpressionStatement + (AugmentedAssignment + (Token) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "a")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "1"))))))) + (SimpleStatement + (ExpressionStatement + (AugmentedAssignment + (Token) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "b")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "2"))))))) + (SimpleStatement + (ExpressionStatement + (AugmentedAssignment + (Token) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "c")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "1")))))))) diff --git a/semantic/test/fixtures/python/corpus/augmented-assignment.parseB.txt b/semantic/test/fixtures/python/corpus/augmented-assignment.parseB.txt new file mode 100644 index 0000000000..a0d26b2ea7 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/augmented-assignment.parseB.txt @@ -0,0 +1,37 @@ +(Module + (SimpleStatement + (ExpressionStatement + (AugmentedAssignment + (Token) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "a")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "2"))))))) + (SimpleStatement + (ExpressionStatement + (AugmentedAssignment + (Token) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "d")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "1"))))))) + (SimpleStatement + (ExpressionStatement + (AugmentedAssignment + (Token) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "b")))) + (ExpressionList + (Expression + (PrimaryExpression + (Integer "1")))))))) diff --git a/test/fixtures/python/corpus/await.A.py b/semantic/test/fixtures/python/corpus/await.A.py similarity index 100% rename from test/fixtures/python/corpus/await.A.py rename to semantic/test/fixtures/python/corpus/await.A.py diff --git a/test/fixtures/python/corpus/await.B.py b/semantic/test/fixtures/python/corpus/await.B.py similarity index 100% rename from test/fixtures/python/corpus/await.B.py rename to semantic/test/fixtures/python/corpus/await.B.py diff --git a/test/fixtures/python/corpus/await.diffA-B.txt b/semantic/test/fixtures/python/corpus/await.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/await.diffA-B.txt rename to semantic/test/fixtures/python/corpus/await.diffA-B.txt diff --git a/test/fixtures/python/corpus/await.diffB-A.txt b/semantic/test/fixtures/python/corpus/await.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/await.diffB-A.txt rename to semantic/test/fixtures/python/corpus/await.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/await.parseA.txt b/semantic/test/fixtures/python/corpus/await.parseA.txt new file mode 100644 index 0000000000..05f89877f0 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/await.parseA.txt @@ -0,0 +1,20 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (Await + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Integer "1")) + (PrimaryExpression + (Integer "1"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (Await + (Expression + (PrimaryExpression + (Identifier "b")))))))) diff --git a/semantic/test/fixtures/python/corpus/await.parseB.txt b/semantic/test/fixtures/python/corpus/await.parseB.txt new file mode 100644 index 0000000000..5b7c90f6f6 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/await.parseB.txt @@ -0,0 +1,20 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (Await + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Integer "2")) + (PrimaryExpression + (Integer "1"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (Await + (Expression + (PrimaryExpression + (Identifier "c")))))))) diff --git a/test/fixtures/python/corpus/binary-operator.A.py b/semantic/test/fixtures/python/corpus/binary-operator.A.py similarity index 100% rename from test/fixtures/python/corpus/binary-operator.A.py rename to semantic/test/fixtures/python/corpus/binary-operator.A.py diff --git a/test/fixtures/python/corpus/binary-operator.B.py b/semantic/test/fixtures/python/corpus/binary-operator.B.py similarity index 100% rename from test/fixtures/python/corpus/binary-operator.B.py rename to semantic/test/fixtures/python/corpus/binary-operator.B.py diff --git a/test/fixtures/python/corpus/binary-operator.diffA-B.txt b/semantic/test/fixtures/python/corpus/binary-operator.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/binary-operator.diffA-B.txt rename to semantic/test/fixtures/python/corpus/binary-operator.diffA-B.txt diff --git a/test/fixtures/python/corpus/binary-operator.diffB-A.txt b/semantic/test/fixtures/python/corpus/binary-operator.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/binary-operator.diffB-A.txt rename to semantic/test/fixtures/python/corpus/binary-operator.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/binary-operator.parseA.txt b/semantic/test/fixtures/python/corpus/binary-operator.parseA.txt new file mode 100644 index 0000000000..ff9b377baf --- /dev/null +++ b/semantic/test/fixtures/python/corpus/binary-operator.parseA.txt @@ -0,0 +1,121 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "a")) + (PrimaryExpression + (Identifier "b"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "c")) + (PrimaryExpression + (Identifier "d"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "e")) + (PrimaryExpression + (Identifier "f"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "g")) + (PrimaryExpression + (Identifier "h"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "i")) + (PrimaryExpression + (Identifier "j"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "k")) + (PrimaryExpression + (Identifier "l"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "m")) + (PrimaryExpression + (Identifier "n"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "o")) + (PrimaryExpression + (Identifier "p"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "q")) + (PrimaryExpression + (Identifier "r"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "s")) + (PrimaryExpression + (Identifier "t"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "u")) + (PrimaryExpression + (Identifier "v"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "w")) + (PrimaryExpression + (Identifier "x")))))))) diff --git a/semantic/test/fixtures/python/corpus/binary-operator.parseB.txt b/semantic/test/fixtures/python/corpus/binary-operator.parseB.txt new file mode 100644 index 0000000000..ff9b377baf --- /dev/null +++ b/semantic/test/fixtures/python/corpus/binary-operator.parseB.txt @@ -0,0 +1,121 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "a")) + (PrimaryExpression + (Identifier "b"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "c")) + (PrimaryExpression + (Identifier "d"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "e")) + (PrimaryExpression + (Identifier "f"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "g")) + (PrimaryExpression + (Identifier "h"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "i")) + (PrimaryExpression + (Identifier "j"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "k")) + (PrimaryExpression + (Identifier "l"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "m")) + (PrimaryExpression + (Identifier "n"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "o")) + (PrimaryExpression + (Identifier "p"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "q")) + (PrimaryExpression + (Identifier "r"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "s")) + (PrimaryExpression + (Identifier "t"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "u")) + (PrimaryExpression + (Identifier "v"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "w")) + (PrimaryExpression + (Identifier "x")))))))) diff --git a/test/fixtures/python/corpus/boolean-operator.A.py b/semantic/test/fixtures/python/corpus/boolean-operator.A.py similarity index 100% rename from test/fixtures/python/corpus/boolean-operator.A.py rename to semantic/test/fixtures/python/corpus/boolean-operator.A.py diff --git a/test/fixtures/python/corpus/boolean-operator.B.py b/semantic/test/fixtures/python/corpus/boolean-operator.B.py similarity index 100% rename from test/fixtures/python/corpus/boolean-operator.B.py rename to semantic/test/fixtures/python/corpus/boolean-operator.B.py diff --git a/test/fixtures/python/corpus/boolean-operator.diffA-B.txt b/semantic/test/fixtures/python/corpus/boolean-operator.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/boolean-operator.diffA-B.txt rename to semantic/test/fixtures/python/corpus/boolean-operator.diffA-B.txt diff --git a/test/fixtures/python/corpus/boolean-operator.diffB-A.txt b/semantic/test/fixtures/python/corpus/boolean-operator.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/boolean-operator.diffB-A.txt rename to semantic/test/fixtures/python/corpus/boolean-operator.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/boolean-operator.parseA.txt b/semantic/test/fixtures/python/corpus/boolean-operator.parseA.txt new file mode 100644 index 0000000000..c612384422 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/boolean-operator.parseA.txt @@ -0,0 +1,23 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (BooleanOperator + (Token) + (Expression + (PrimaryExpression + (Identifier "foo"))) + (Expression + (PrimaryExpression + (Identifier "bar"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (BooleanOperator + (Token) + (Expression + (PrimaryExpression + (Identifier "baz"))) + (Expression + (PrimaryExpression + (Identifier "buzz")))))))) diff --git a/semantic/test/fixtures/python/corpus/boolean-operator.parseB.txt b/semantic/test/fixtures/python/corpus/boolean-operator.parseB.txt new file mode 100644 index 0000000000..c612384422 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/boolean-operator.parseB.txt @@ -0,0 +1,23 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (BooleanOperator + (Token) + (Expression + (PrimaryExpression + (Identifier "foo"))) + (Expression + (PrimaryExpression + (Identifier "bar"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (BooleanOperator + (Token) + (Expression + (PrimaryExpression + (Identifier "baz"))) + (Expression + (PrimaryExpression + (Identifier "buzz")))))))) diff --git a/test/fixtures/python/corpus/boolean.A.py b/semantic/test/fixtures/python/corpus/boolean.A.py similarity index 100% rename from test/fixtures/python/corpus/boolean.A.py rename to semantic/test/fixtures/python/corpus/boolean.A.py diff --git a/test/fixtures/python/corpus/boolean.B.py b/semantic/test/fixtures/python/corpus/boolean.B.py similarity index 100% rename from test/fixtures/python/corpus/boolean.B.py rename to semantic/test/fixtures/python/corpus/boolean.B.py diff --git a/test/fixtures/python/corpus/boolean.diffA-B.txt b/semantic/test/fixtures/python/corpus/boolean.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/boolean.diffA-B.txt rename to semantic/test/fixtures/python/corpus/boolean.diffA-B.txt diff --git a/test/fixtures/python/corpus/boolean.diffB-A.txt b/semantic/test/fixtures/python/corpus/boolean.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/boolean.diffB-A.txt rename to semantic/test/fixtures/python/corpus/boolean.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/boolean.parseA.txt b/semantic/test/fixtures/python/corpus/boolean.parseA.txt new file mode 100644 index 0000000000..786da14930 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/boolean.parseA.txt @@ -0,0 +1,16 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (False "False"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (True "True"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (True "True")))))) diff --git a/semantic/test/fixtures/python/corpus/boolean.parseB.txt b/semantic/test/fixtures/python/corpus/boolean.parseB.txt new file mode 100644 index 0000000000..6365b03f2b --- /dev/null +++ b/semantic/test/fixtures/python/corpus/boolean.parseB.txt @@ -0,0 +1,16 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (True "True"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (False "False"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (False "False")))))) diff --git a/test/fixtures/python/corpus/break-statement.A.py b/semantic/test/fixtures/python/corpus/break-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/break-statement.A.py rename to semantic/test/fixtures/python/corpus/break-statement.A.py diff --git a/test/fixtures/python/corpus/break-statement.B.py b/semantic/test/fixtures/python/corpus/break-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/break-statement.B.py rename to semantic/test/fixtures/python/corpus/break-statement.B.py diff --git a/test/fixtures/python/corpus/break-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/break-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/break-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/break-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/break-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/break-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/break-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/break-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/break-statement.parseA.txt b/semantic/test/fixtures/python/corpus/break-statement.parseA.txt new file mode 100644 index 0000000000..119338cfcf --- /dev/null +++ b/semantic/test/fixtures/python/corpus/break-statement.parseA.txt @@ -0,0 +1,3 @@ +(Module + (SimpleStatement + (BreakStatement "break"))) diff --git a/semantic/test/fixtures/python/corpus/break-statement.parseB.txt b/semantic/test/fixtures/python/corpus/break-statement.parseB.txt new file mode 100644 index 0000000000..4bd47ba15c --- /dev/null +++ b/semantic/test/fixtures/python/corpus/break-statement.parseB.txt @@ -0,0 +1,5 @@ +(Module + (SimpleStatement + (BreakStatement "break")) + (SimpleStatement + (BreakStatement "break"))) diff --git a/test/fixtures/python/corpus/call.A.py b/semantic/test/fixtures/python/corpus/call.A.py similarity index 100% rename from test/fixtures/python/corpus/call.A.py rename to semantic/test/fixtures/python/corpus/call.A.py diff --git a/test/fixtures/python/corpus/call.B.py b/semantic/test/fixtures/python/corpus/call.B.py similarity index 100% rename from test/fixtures/python/corpus/call.B.py rename to semantic/test/fixtures/python/corpus/call.B.py diff --git a/test/fixtures/python/corpus/call.diffA-B.txt b/semantic/test/fixtures/python/corpus/call.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/call.diffA-B.txt rename to semantic/test/fixtures/python/corpus/call.diffA-B.txt diff --git a/test/fixtures/python/corpus/call.diffB-A.txt b/semantic/test/fixtures/python/corpus/call.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/call.diffB-A.txt rename to semantic/test/fixtures/python/corpus/call.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/call.parseA.txt b/semantic/test/fixtures/python/corpus/call.parseA.txt new file mode 100644 index 0000000000..91dfc29d55 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/call.parseA.txt @@ -0,0 +1,34 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "foo")) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "a"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "bar")) + (ArgumentList)))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "bazz")) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "c"))) + (Expression + (PrimaryExpression + (Identifier "d")))))))))) diff --git a/semantic/test/fixtures/python/corpus/call.parseB.txt b/semantic/test/fixtures/python/corpus/call.parseB.txt new file mode 100644 index 0000000000..559b15e755 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/call.parseB.txt @@ -0,0 +1,48 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "foo")) + (ArgumentList)))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "bar")) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "a"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "bazz")) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "d"))) + (Expression + (PrimaryExpression + (Identifier "c"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Attribute + (Identifier "exit") + (PrimaryExpression + (Identifier "sys")))) + (ArgumentList + (Expression + (PrimaryExpression + (Integer "1")))))))))) diff --git a/test/fixtures/python/corpus/class-definition.A.py b/semantic/test/fixtures/python/corpus/class-definition.A.py similarity index 100% rename from test/fixtures/python/corpus/class-definition.A.py rename to semantic/test/fixtures/python/corpus/class-definition.A.py diff --git a/test/fixtures/python/corpus/class-definition.B.py b/semantic/test/fixtures/python/corpus/class-definition.B.py similarity index 100% rename from test/fixtures/python/corpus/class-definition.B.py rename to semantic/test/fixtures/python/corpus/class-definition.B.py diff --git a/test/fixtures/python/corpus/class-definition.diffA-B.txt b/semantic/test/fixtures/python/corpus/class-definition.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/class-definition.diffA-B.txt rename to semantic/test/fixtures/python/corpus/class-definition.diffA-B.txt diff --git a/test/fixtures/python/corpus/class-definition.diffB-A.txt b/semantic/test/fixtures/python/corpus/class-definition.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/class-definition.diffB-A.txt rename to semantic/test/fixtures/python/corpus/class-definition.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/class-definition.parseA.txt b/semantic/test/fixtures/python/corpus/class-definition.parseA.txt new file mode 100644 index 0000000000..7f5184a73b --- /dev/null +++ b/semantic/test/fixtures/python/corpus/class-definition.parseA.txt @@ -0,0 +1,77 @@ +(Module + (CompoundStatement + (ClassDefinition + (Block + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ReturnStatement + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "c"))))))) + (Identifier "b") + (Parameters + (Parameter + (Identifier "self")))))) + (Identifier "A"))) + (CompoundStatement + (ClassDefinition + (Block + (SimpleStatement + (PassStatement "pass"))) + (ArgumentList) + (Identifier "C"))) + (CompoundStatement + (ClassDefinition + (Block + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ReturnStatement))) + (Identifier "method1") + (Parameters + (Parameter + (Identifier "self")))))) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "method1")))) + (Identifier "B"))) + (CompoundStatement + (ClassDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "f")))) + (Type + (Expression + (PrimaryExpression + (Identifier "str"))))))) + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "g")))) + (Type + (Expression + (PrimaryExpression + (Subscript + (Expression + (PrimaryExpression + (Identifier "int"))) + (PrimaryExpression + (Identifier "Optional")))))))))) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "e")))) + (Identifier "D")))) diff --git a/semantic/test/fixtures/python/corpus/class-definition.parseB.txt b/semantic/test/fixtures/python/corpus/class-definition.parseB.txt new file mode 100644 index 0000000000..6e90ca7374 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/class-definition.parseB.txt @@ -0,0 +1,70 @@ +(Module + (CompoundStatement + (ClassDefinition + (Block + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ReturnStatement))) + (Identifier "method1") + (Parameters + (Parameter + (Identifier "self")))))) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "method1")))) + (Identifier "D"))) + (CompoundStatement + (ClassDefinition + (Block + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ReturnStatement + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "c"))))))) + (Identifier "b") + (Parameters + (Parameter + (Identifier "self")))))) + (Identifier "B"))) + (CompoundStatement + (ClassDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "g")))) + (Type + (Expression + (PrimaryExpression + (Identifier "str"))))))) + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "h")))) + (Type + (Expression + (PrimaryExpression + (Subscript + (Expression + (PrimaryExpression + (Identifier "int"))) + (PrimaryExpression + (Identifier "Optional")))))))))) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "e")))) + (Identifier "E")))) diff --git a/test/fixtures/python/corpus/comment.A.py b/semantic/test/fixtures/python/corpus/comment.A.py similarity index 100% rename from test/fixtures/python/corpus/comment.A.py rename to semantic/test/fixtures/python/corpus/comment.A.py diff --git a/test/fixtures/python/corpus/comment.B.py b/semantic/test/fixtures/python/corpus/comment.B.py similarity index 100% rename from test/fixtures/python/corpus/comment.B.py rename to semantic/test/fixtures/python/corpus/comment.B.py diff --git a/test/fixtures/python/corpus/comment.diffA-B.txt b/semantic/test/fixtures/python/corpus/comment.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/comment.diffA-B.txt rename to semantic/test/fixtures/python/corpus/comment.diffA-B.txt diff --git a/test/fixtures/python/corpus/comment.diffB-A.txt b/semantic/test/fixtures/python/corpus/comment.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/comment.diffB-A.txt rename to semantic/test/fixtures/python/corpus/comment.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/comment.parseA.txt b/semantic/test/fixtures/python/corpus/comment.parseA.txt new file mode 100644 index 0000000000..8178e5242a --- /dev/null +++ b/semantic/test/fixtures/python/corpus/comment.parseA.txt @@ -0,0 +1 @@ +(Module) diff --git a/semantic/test/fixtures/python/corpus/comment.parseB.txt b/semantic/test/fixtures/python/corpus/comment.parseB.txt new file mode 100644 index 0000000000..8178e5242a --- /dev/null +++ b/semantic/test/fixtures/python/corpus/comment.parseB.txt @@ -0,0 +1 @@ +(Module) diff --git a/test/fixtures/python/corpus/comparison-operator.A.py b/semantic/test/fixtures/python/corpus/comparison-operator.A.py similarity index 100% rename from test/fixtures/python/corpus/comparison-operator.A.py rename to semantic/test/fixtures/python/corpus/comparison-operator.A.py diff --git a/test/fixtures/python/corpus/comparison-operator.B.py b/semantic/test/fixtures/python/corpus/comparison-operator.B.py similarity index 100% rename from test/fixtures/python/corpus/comparison-operator.B.py rename to semantic/test/fixtures/python/corpus/comparison-operator.B.py diff --git a/test/fixtures/python/corpus/comparison-operator.diffA-B.txt b/semantic/test/fixtures/python/corpus/comparison-operator.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/comparison-operator.diffA-B.txt rename to semantic/test/fixtures/python/corpus/comparison-operator.diffA-B.txt diff --git a/test/fixtures/python/corpus/comparison-operator.diffB-A.txt b/semantic/test/fixtures/python/corpus/comparison-operator.diffB-A.txt similarity index 89% rename from test/fixtures/python/corpus/comparison-operator.diffB-A.txt rename to semantic/test/fixtures/python/corpus/comparison-operator.diffB-A.txt index 652a28a8fd..fcbfd6c3ff 100644 --- a/test/fixtures/python/corpus/comparison-operator.diffB-A.txt +++ b/semantic/test/fixtures/python/corpus/comparison-operator.diffB-A.txt @@ -29,14 +29,12 @@ {+(Member {+(Identifier)+} {+(Identifier)+})+})+} -{+(Not - {+(Equal - {+(Identifier)+} - {+(Identifier)+})+})+} -{-(Not - {-(Equal - {-(Identifier)-} - {-(Identifier)-})-})-} + (Not + (Equal + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) {-(Not {-(Member {-(Identifier)-} diff --git a/semantic/test/fixtures/python/corpus/comparison-operator.parseA.txt b/semantic/test/fixtures/python/corpus/comparison-operator.parseA.txt new file mode 100644 index 0000000000..602e5e708e --- /dev/null +++ b/semantic/test/fixtures/python/corpus/comparison-operator.parseA.txt @@ -0,0 +1,81 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "a")) + (PrimaryExpression + (Identifier "b")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "c")) + (PrimaryExpression + (Identifier "d")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "e")) + (PrimaryExpression + (Identifier "f")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "g")) + (PrimaryExpression + (Identifier "h")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "i")) + (PrimaryExpression + (Identifier "j")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "k")) + (PrimaryExpression + (Identifier "l")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "m")) + (PrimaryExpression + (Identifier "n")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "o")) + (PrimaryExpression + (Identifier "p")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "q")) + (PrimaryExpression + (Identifier "r")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "s")) + (PrimaryExpression + (Identifier "t"))))))) diff --git a/semantic/test/fixtures/python/corpus/comparison-operator.parseB.txt b/semantic/test/fixtures/python/corpus/comparison-operator.parseB.txt new file mode 100644 index 0000000000..602e5e708e --- /dev/null +++ b/semantic/test/fixtures/python/corpus/comparison-operator.parseB.txt @@ -0,0 +1,81 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "a")) + (PrimaryExpression + (Identifier "b")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "c")) + (PrimaryExpression + (Identifier "d")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "e")) + (PrimaryExpression + (Identifier "f")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "g")) + (PrimaryExpression + (Identifier "h")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "i")) + (PrimaryExpression + (Identifier "j")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "k")) + (PrimaryExpression + (Identifier "l")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "m")) + (PrimaryExpression + (Identifier "n")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "o")) + (PrimaryExpression + (Identifier "p")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "q")) + (PrimaryExpression + (Identifier "r")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ComparisonOperator + (PrimaryExpression + (Identifier "s")) + (PrimaryExpression + (Identifier "t"))))))) diff --git a/test/fixtures/python/corpus/concatenated-string.A.py b/semantic/test/fixtures/python/corpus/concatenated-string.A.py similarity index 100% rename from test/fixtures/python/corpus/concatenated-string.A.py rename to semantic/test/fixtures/python/corpus/concatenated-string.A.py diff --git a/test/fixtures/python/corpus/concatenated-string.B.py b/semantic/test/fixtures/python/corpus/concatenated-string.B.py similarity index 100% rename from test/fixtures/python/corpus/concatenated-string.B.py rename to semantic/test/fixtures/python/corpus/concatenated-string.B.py diff --git a/test/fixtures/python/corpus/concatenated-string.diffA-B.txt b/semantic/test/fixtures/python/corpus/concatenated-string.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/concatenated-string.diffA-B.txt rename to semantic/test/fixtures/python/corpus/concatenated-string.diffA-B.txt diff --git a/test/fixtures/python/corpus/concatenated-string.diffB-A.txt b/semantic/test/fixtures/python/corpus/concatenated-string.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/concatenated-string.diffB-A.txt rename to semantic/test/fixtures/python/corpus/concatenated-string.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/concatenated-string.parseA.txt b/semantic/test/fixtures/python/corpus/concatenated-string.parseA.txt new file mode 100644 index 0000000000..f5160f0194 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/concatenated-string.parseA.txt @@ -0,0 +1,9 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (ConcatenatedString + (String) + (String) + (String))))))) diff --git a/semantic/test/fixtures/python/corpus/concatenated-string.parseB.txt b/semantic/test/fixtures/python/corpus/concatenated-string.parseB.txt new file mode 100644 index 0000000000..f54ab0a37f --- /dev/null +++ b/semantic/test/fixtures/python/corpus/concatenated-string.parseB.txt @@ -0,0 +1,10 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (ConcatenatedString + (String) + (String) + (String) + (String))))))) diff --git a/test/fixtures/python/corpus/conditional-expression.A.py b/semantic/test/fixtures/python/corpus/conditional-expression.A.py similarity index 100% rename from test/fixtures/python/corpus/conditional-expression.A.py rename to semantic/test/fixtures/python/corpus/conditional-expression.A.py diff --git a/test/fixtures/python/corpus/conditional-expression.B.py b/semantic/test/fixtures/python/corpus/conditional-expression.B.py similarity index 100% rename from test/fixtures/python/corpus/conditional-expression.B.py rename to semantic/test/fixtures/python/corpus/conditional-expression.B.py diff --git a/test/fixtures/python/corpus/conditional-expression.diffA-B.txt b/semantic/test/fixtures/python/corpus/conditional-expression.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/conditional-expression.diffA-B.txt rename to semantic/test/fixtures/python/corpus/conditional-expression.diffA-B.txt diff --git a/test/fixtures/python/corpus/conditional-expression.diffB-A.txt b/semantic/test/fixtures/python/corpus/conditional-expression.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/conditional-expression.diffB-A.txt rename to semantic/test/fixtures/python/corpus/conditional-expression.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/conditional-expression.parseA.txt b/semantic/test/fixtures/python/corpus/conditional-expression.parseA.txt new file mode 100644 index 0000000000..1b85b7dfd4 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/conditional-expression.parseA.txt @@ -0,0 +1,36 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (ConditionalExpression + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "foo")) + (ArgumentList)))) + (Expression + (PrimaryExpression + (Identifier "a"))) + (Expression + (PrimaryExpression + (Identifier "g"))))))) + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "b")))) + (ExpressionList + (Expression + (ConditionalExpression + (Expression + (PrimaryExpression + (Identifier "c"))) + (Expression + (PrimaryExpression + (Identifier "d"))) + (Expression + (PrimaryExpression + (Identifier "e")))))))))) diff --git a/semantic/test/fixtures/python/corpus/conditional-expression.parseB.txt b/semantic/test/fixtures/python/corpus/conditional-expression.parseB.txt new file mode 100644 index 0000000000..fcde7518f2 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/conditional-expression.parseB.txt @@ -0,0 +1,39 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "e")))) + (ExpressionList + (Expression + (ConditionalExpression + (Expression + (PrimaryExpression + (Identifier "d"))) + (Expression + (PrimaryExpression + (Identifier "f"))) + (Expression + (PrimaryExpression + (Identifier "g"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (ConditionalExpression + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "foo")) + (ArgumentList)))) + (Expression + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "c")) + (ArgumentList))))))))) diff --git a/test/fixtures/python/corpus/continue-statement.A.py b/semantic/test/fixtures/python/corpus/continue-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/continue-statement.A.py rename to semantic/test/fixtures/python/corpus/continue-statement.A.py diff --git a/test/fixtures/python/corpus/continue-statement.B.py b/semantic/test/fixtures/python/corpus/continue-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/continue-statement.B.py rename to semantic/test/fixtures/python/corpus/continue-statement.B.py diff --git a/test/fixtures/python/corpus/continue-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/continue-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/continue-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/continue-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/continue-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/continue-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/continue-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/continue-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/continue-statement.parseA.txt b/semantic/test/fixtures/python/corpus/continue-statement.parseA.txt new file mode 100644 index 0000000000..0c1fcb03e1 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/continue-statement.parseA.txt @@ -0,0 +1,3 @@ +(Module + (SimpleStatement + (ContinueStatement "continue"))) diff --git a/semantic/test/fixtures/python/corpus/continue-statement.parseB.txt b/semantic/test/fixtures/python/corpus/continue-statement.parseB.txt new file mode 100644 index 0000000000..5f70f84f66 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/continue-statement.parseB.txt @@ -0,0 +1,5 @@ +(Module + (SimpleStatement + (ContinueStatement "continue")) + (SimpleStatement + (ContinueStatement "continue"))) diff --git a/test/fixtures/python/corpus/decorated-definition.A.py b/semantic/test/fixtures/python/corpus/decorated-definition.A.py similarity index 100% rename from test/fixtures/python/corpus/decorated-definition.A.py rename to semantic/test/fixtures/python/corpus/decorated-definition.A.py diff --git a/test/fixtures/python/corpus/decorated-definition.B.py b/semantic/test/fixtures/python/corpus/decorated-definition.B.py similarity index 100% rename from test/fixtures/python/corpus/decorated-definition.B.py rename to semantic/test/fixtures/python/corpus/decorated-definition.B.py diff --git a/semantic/test/fixtures/python/corpus/decorated-definition.diffA-B.txt b/semantic/test/fixtures/python/corpus/decorated-definition.diffA-B.txt new file mode 100644 index 0000000000..acbc018d7c --- /dev/null +++ b/semantic/test/fixtures/python/corpus/decorated-definition.diffA-B.txt @@ -0,0 +1,64 @@ +(Statements + (Decorator + (Identifier) + (Class + { (Identifier) + ->(Identifier) } + (Statements + (Decorator + (Identifier) + (Statements) + (Decorator + { (Identifier) + ->(Identifier) } + {+(Statements + {+(Identifier)+})+} + {-(Integer)-} + (Decorator + { (Identifier) + ->(Identifier) } + (Statements + {+(Identifier)+} + {-(Integer)-} + {-(Integer)-}) + (Decorator + (Identifier) + {+(Statements + {+(Integer)+} + {+(Assignment + {+(Identifier)+} + {+(Boolean)+})+} + {+(Statements + {+(Identifier)+})+} + {+(Statements + {+(Identifier)+})+})+} + {-(Assignment + {-(Identifier)-} + {-(Boolean)-})-} + { (Decorator + {-(Identifier)-} + {-(Statements + {-(Identifier)-})-} + {-(Decorator + {-(Identifier)-} + {-(Statements + {-(Identifier)-})-} + {-(Decorator + {-(Identifier)-} + {-(Statements + {-(Integer)-} + {-(Assignment + {-(Identifier)-} + {-(Boolean)-})-} + {-(Statements + {-(Identifier)-})-} + {-(Statements + {-(Identifier)-})-})-} + {-(Function + {-(Identifier)-} + {-(Statements + {-(Identifier)-})-})-})-})-}) + ->(Function + {+(Identifier)+} + {+(Statements + {+(Identifier)+})+}) })))))))) diff --git a/semantic/test/fixtures/python/corpus/decorated-definition.diffB-A.txt b/semantic/test/fixtures/python/corpus/decorated-definition.diffB-A.txt new file mode 100644 index 0000000000..b13b2a1b09 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/decorated-definition.diffB-A.txt @@ -0,0 +1,64 @@ +(Statements + (Decorator + (Identifier) + (Class + { (Identifier) + ->(Identifier) } + (Statements + (Decorator + (Identifier) + (Statements) + (Decorator + { (Identifier) + ->(Identifier) } + {+(Integer)+} + {-(Statements + {-(Identifier)-})-} + (Decorator + { (Identifier) + ->(Identifier) } + (Statements + {+(Integer)+} + {+(Integer)+} + {-(Identifier)-}) + (Decorator + (Identifier) + {+(Assignment + {+(Identifier)+} + {+(Boolean)+})+} + {-(Statements + {-(Integer)-} + {-(Assignment + {-(Identifier)-} + {-(Boolean)-})-} + {-(Statements + {-(Identifier)-})-} + {-(Statements + {-(Identifier)-})-})-} + { (Function + {-(Identifier)-} + {-(Statements + {-(Identifier)-})-}) + ->(Decorator + {+(Identifier)+} + {+(Statements + {+(Identifier)+})+} + {+(Decorator + {+(Identifier)+} + {+(Statements + {+(Identifier)+})+} + {+(Decorator + {+(Identifier)+} + {+(Statements + {+(Integer)+} + {+(Assignment + {+(Identifier)+} + {+(Boolean)+})+} + {+(Statements + {+(Identifier)+})+} + {+(Statements + {+(Identifier)+})+})+} + {+(Function + {+(Identifier)+} + {+(Statements + {+(Identifier)+})+})+})+})+}) })))))))) diff --git a/semantic/test/fixtures/python/corpus/decorated-definition.parseA.txt b/semantic/test/fixtures/python/corpus/decorated-definition.parseA.txt new file mode 100644 index 0000000000..5047802790 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/decorated-definition.parseA.txt @@ -0,0 +1,87 @@ +(Module + (CompoundStatement + (DecoratedDefinition + (ClassDefinition + (Block + (CompoundStatement + (DecoratedDefinition + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "g")))))) + (Identifier "f") + (Parameters)) + (Decorator + (ArgumentList) + (DottedName + (Identifier "f"))) + (Decorator + (ArgumentList + (Expression + (PrimaryExpression + (Integer "1")))) + (DottedName + (Identifier "d"))) + (Decorator + (ArgumentList + (Expression + (PrimaryExpression + (Integer "2"))) + (Expression + (PrimaryExpression + (Integer "3")))) + (DottedName + (Identifier "e"))) + (Decorator + (ArgumentList + (KeywordArgument + (Expression + (PrimaryExpression + (True "True"))) + (Identifier "b"))) + (DottedName + (Identifier "a"))) + (Decorator + (ArgumentList + (ListSplat + (Expression + (PrimaryExpression + (Identifier "b"))))) + (DottedName + (Identifier "a"))) + (Decorator + (ArgumentList + (DictionarySplat + (Expression + (PrimaryExpression + (Identifier "c"))))) + (DottedName + (Identifier "a"))) + (Decorator + (ArgumentList + (Expression + (PrimaryExpression + (Integer "1"))) + (KeywordArgument + (Expression + (PrimaryExpression + (True "True"))) + (Identifier "b")) + (ListSplat + (Expression + (PrimaryExpression + (Identifier "b")))) + (DictionarySplat + (Expression + (PrimaryExpression + (Identifier "c"))))) + (DottedName + (Identifier "a")))))) + (Identifier "C")) + (Decorator + (DottedName + (Identifier "a") + (Identifier "b")))))) diff --git a/semantic/test/fixtures/python/corpus/decorated-definition.parseB.txt b/semantic/test/fixtures/python/corpus/decorated-definition.parseB.txt new file mode 100644 index 0000000000..c7cb76b9bd --- /dev/null +++ b/semantic/test/fixtures/python/corpus/decorated-definition.parseB.txt @@ -0,0 +1,61 @@ +(Module + (CompoundStatement + (DecoratedDefinition + (ClassDefinition + (Block + (CompoundStatement + (DecoratedDefinition + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "g")))))) + (Identifier "f") + (Parameters)) + (Decorator + (ArgumentList) + (DottedName + (Identifier "f"))) + (Decorator + (ArgumentList + (ListSplat + (Expression + (PrimaryExpression + (Identifier "b"))))) + (DottedName + (Identifier "b"))) + (Decorator + (ArgumentList + (DictionarySplat + (Expression + (PrimaryExpression + (Identifier "c"))))) + (DottedName + (Identifier "c"))) + (Decorator + (ArgumentList + (Expression + (PrimaryExpression + (Integer "2"))) + (KeywordArgument + (Expression + (PrimaryExpression + (True "True"))) + (Identifier "c")) + (ListSplat + (Expression + (PrimaryExpression + (Identifier "a")))) + (DictionarySplat + (Expression + (PrimaryExpression + (Identifier "d"))))) + (DottedName + (Identifier "a")))))) + (Identifier "D")) + (Decorator + (DottedName + (Identifier "a") + (Identifier "b")))))) diff --git a/test/fixtures/python/corpus/delete-statement.A.py b/semantic/test/fixtures/python/corpus/delete-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/delete-statement.A.py rename to semantic/test/fixtures/python/corpus/delete-statement.A.py diff --git a/test/fixtures/python/corpus/delete-statement.B.py b/semantic/test/fixtures/python/corpus/delete-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/delete-statement.B.py rename to semantic/test/fixtures/python/corpus/delete-statement.B.py diff --git a/test/fixtures/python/corpus/delete-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/delete-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/delete-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/delete-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/delete-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/delete-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/delete-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/delete-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/delete-statement.parseA.txt b/semantic/test/fixtures/python/corpus/delete-statement.parseA.txt new file mode 100644 index 0000000000..16cfd3b49f --- /dev/null +++ b/semantic/test/fixtures/python/corpus/delete-statement.parseA.txt @@ -0,0 +1,20 @@ +(Module + (SimpleStatement + (DeleteStatement + (ExpressionList + (Expression + (PrimaryExpression + (Subscript + (Expression + (PrimaryExpression + (Integer "1"))) + (PrimaryExpression + (Identifier "a"))))) + (Expression + (PrimaryExpression + (Subscript + (Expression + (PrimaryExpression + (Integer "2"))) + (PrimaryExpression + (Identifier "b"))))))))) diff --git a/semantic/test/fixtures/python/corpus/delete-statement.parseB.txt b/semantic/test/fixtures/python/corpus/delete-statement.parseB.txt new file mode 100644 index 0000000000..10a72d8a0a --- /dev/null +++ b/semantic/test/fixtures/python/corpus/delete-statement.parseB.txt @@ -0,0 +1,20 @@ +(Module + (SimpleStatement + (DeleteStatement + (ExpressionList + (Expression + (PrimaryExpression + (Subscript + (Expression + (PrimaryExpression + (Integer "1"))) + (PrimaryExpression + (Identifier "b"))))) + (Expression + (PrimaryExpression + (Subscript + (Expression + (PrimaryExpression + (Integer "2"))) + (PrimaryExpression + (Identifier "a"))))))))) diff --git a/test/fixtures/python/corpus/dictionary-comprehension.A.py b/semantic/test/fixtures/python/corpus/dictionary-comprehension.A.py similarity index 100% rename from test/fixtures/python/corpus/dictionary-comprehension.A.py rename to semantic/test/fixtures/python/corpus/dictionary-comprehension.A.py diff --git a/test/fixtures/python/corpus/dictionary-comprehension.B.py b/semantic/test/fixtures/python/corpus/dictionary-comprehension.B.py similarity index 100% rename from test/fixtures/python/corpus/dictionary-comprehension.B.py rename to semantic/test/fixtures/python/corpus/dictionary-comprehension.B.py diff --git a/test/fixtures/python/corpus/dictionary-comprehension.diffA-B.txt b/semantic/test/fixtures/python/corpus/dictionary-comprehension.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/dictionary-comprehension.diffA-B.txt rename to semantic/test/fixtures/python/corpus/dictionary-comprehension.diffA-B.txt diff --git a/test/fixtures/python/corpus/dictionary-comprehension.diffB-A.txt b/semantic/test/fixtures/python/corpus/dictionary-comprehension.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/dictionary-comprehension.diffB-A.txt rename to semantic/test/fixtures/python/corpus/dictionary-comprehension.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/dictionary-comprehension.parseA.txt b/semantic/test/fixtures/python/corpus/dictionary-comprehension.parseA.txt new file mode 100644 index 0000000000..0f544841f8 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/dictionary-comprehension.parseA.txt @@ -0,0 +1,43 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (DictionaryComprehension + (Pair + (Expression + (PrimaryExpression + (Identifier "d"))) + (Expression + (PrimaryExpression + (Identifier "c")))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "a"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (DictionaryComprehension + (Pair + (Expression + (PrimaryExpression + (Identifier "g"))) + (Expression + (PrimaryExpression + (Identifier "d")))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "e"))) + (Expression + (PrimaryExpression + (Identifier "f")))) + (IfClause + (Expression + (PrimaryExpression + (Identifier "d")))))))))) diff --git a/semantic/test/fixtures/python/corpus/dictionary-comprehension.parseB.txt b/semantic/test/fixtures/python/corpus/dictionary-comprehension.parseB.txt new file mode 100644 index 0000000000..71db515149 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/dictionary-comprehension.parseB.txt @@ -0,0 +1,43 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (DictionaryComprehension + (Pair + (Expression + (PrimaryExpression + (Identifier "g"))) + (Expression + (PrimaryExpression + (Identifier "f")))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "e"))) + (Expression + (PrimaryExpression + (Identifier "d")))) + (IfClause + (Expression + (PrimaryExpression + (Identifier "g"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (DictionaryComprehension + (Pair + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Identifier "c")))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "a")))))))))) diff --git a/test/fixtures/python/corpus/dictionary.A.py b/semantic/test/fixtures/python/corpus/dictionary.A.py similarity index 100% rename from test/fixtures/python/corpus/dictionary.A.py rename to semantic/test/fixtures/python/corpus/dictionary.A.py diff --git a/test/fixtures/python/corpus/dictionary.B.py b/semantic/test/fixtures/python/corpus/dictionary.B.py similarity index 100% rename from test/fixtures/python/corpus/dictionary.B.py rename to semantic/test/fixtures/python/corpus/dictionary.B.py diff --git a/test/fixtures/python/corpus/dictionary.diffA-B.txt b/semantic/test/fixtures/python/corpus/dictionary.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/dictionary.diffA-B.txt rename to semantic/test/fixtures/python/corpus/dictionary.diffA-B.txt diff --git a/test/fixtures/python/corpus/dictionary.diffB-A.txt b/semantic/test/fixtures/python/corpus/dictionary.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/dictionary.diffB-A.txt rename to semantic/test/fixtures/python/corpus/dictionary.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/dictionary.parseA.txt b/semantic/test/fixtures/python/corpus/dictionary.parseA.txt new file mode 100644 index 0000000000..623b7fe65d --- /dev/null +++ b/semantic/test/fixtures/python/corpus/dictionary.parseA.txt @@ -0,0 +1,37 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Dictionary))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Dictionary + (Pair + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Identifier "a"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Dictionary + (Pair + (Expression + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "foo")))) + (Pair + (Expression + (PrimaryExpression + (Identifier "c"))) + (Expression + (PrimaryExpression + (Identifier "bar")))))))))) diff --git a/semantic/test/fixtures/python/corpus/dictionary.parseB.txt b/semantic/test/fixtures/python/corpus/dictionary.parseB.txt new file mode 100644 index 0000000000..ac8b011e15 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/dictionary.parseB.txt @@ -0,0 +1,43 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Dictionary + (Pair + (Expression + (PrimaryExpression + (Integer "2"))) + (Expression + (PrimaryExpression + (Identifier "b"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Dictionary))))) + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "a")))) + (ExpressionList + (Expression + (PrimaryExpression + (Dictionary + (Pair + (Expression + (PrimaryExpression + (Identifier "d"))) + (Expression + (PrimaryExpression + (Identifier "bar")))) + (Pair + (Expression + (PrimaryExpression + (Identifier "e"))) + (Expression + (PrimaryExpression + (Identifier "foo")))))))))))) diff --git a/test/fixtures/python/corpus/dotted-name.A.py b/semantic/test/fixtures/python/corpus/dotted-name.A.py similarity index 100% rename from test/fixtures/python/corpus/dotted-name.A.py rename to semantic/test/fixtures/python/corpus/dotted-name.A.py diff --git a/test/fixtures/python/corpus/dotted-name.B.py b/semantic/test/fixtures/python/corpus/dotted-name.B.py similarity index 100% rename from test/fixtures/python/corpus/dotted-name.B.py rename to semantic/test/fixtures/python/corpus/dotted-name.B.py diff --git a/test/fixtures/python/corpus/dotted-name.diffA-B.txt b/semantic/test/fixtures/python/corpus/dotted-name.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/dotted-name.diffA-B.txt rename to semantic/test/fixtures/python/corpus/dotted-name.diffA-B.txt diff --git a/test/fixtures/python/corpus/dotted-name.diffB-A.txt b/semantic/test/fixtures/python/corpus/dotted-name.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/dotted-name.diffB-A.txt rename to semantic/test/fixtures/python/corpus/dotted-name.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/dotted-name.parseA.txt b/semantic/test/fixtures/python/corpus/dotted-name.parseA.txt new file mode 100644 index 0000000000..628e568b5b --- /dev/null +++ b/semantic/test/fixtures/python/corpus/dotted-name.parseA.txt @@ -0,0 +1,20 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Attribute + (Identifier "b") + (PrimaryExpression + (Identifier "a"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Attribute + (Identifier "f") + (PrimaryExpression + (Attribute + (Identifier "e") + (PrimaryExpression + (Identifier "d")))))))))) diff --git a/semantic/test/fixtures/python/corpus/dotted-name.parseB.txt b/semantic/test/fixtures/python/corpus/dotted-name.parseB.txt new file mode 100644 index 0000000000..b4e1bfda7d --- /dev/null +++ b/semantic/test/fixtures/python/corpus/dotted-name.parseB.txt @@ -0,0 +1,20 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Attribute + (Identifier "c") + (PrimaryExpression + (Attribute + (Identifier "b") + (PrimaryExpression + (Identifier "a"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Attribute + (Identifier "e") + (PrimaryExpression + (Identifier "d")))))))) diff --git a/test/fixtures/python/corpus/ellipsis.A.py b/semantic/test/fixtures/python/corpus/ellipsis.A.py similarity index 100% rename from test/fixtures/python/corpus/ellipsis.A.py rename to semantic/test/fixtures/python/corpus/ellipsis.A.py diff --git a/test/fixtures/python/corpus/ellipsis.B.py b/semantic/test/fixtures/python/corpus/ellipsis.B.py similarity index 100% rename from test/fixtures/python/corpus/ellipsis.B.py rename to semantic/test/fixtures/python/corpus/ellipsis.B.py diff --git a/test/fixtures/python/corpus/ellipsis.diffA-B.txt b/semantic/test/fixtures/python/corpus/ellipsis.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/ellipsis.diffA-B.txt rename to semantic/test/fixtures/python/corpus/ellipsis.diffA-B.txt diff --git a/test/fixtures/python/corpus/ellipsis.diffB-A.txt b/semantic/test/fixtures/python/corpus/ellipsis.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/ellipsis.diffB-A.txt rename to semantic/test/fixtures/python/corpus/ellipsis.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/ellipsis.parseA.txt b/semantic/test/fixtures/python/corpus/ellipsis.parseA.txt new file mode 100644 index 0000000000..9156d05bb9 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/ellipsis.parseA.txt @@ -0,0 +1,11 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Ellipsis "..."))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Ellipsis "...")))))) diff --git a/semantic/test/fixtures/python/corpus/ellipsis.parseB.txt b/semantic/test/fixtures/python/corpus/ellipsis.parseB.txt new file mode 100644 index 0000000000..3b1bd90b0b --- /dev/null +++ b/semantic/test/fixtures/python/corpus/ellipsis.parseB.txt @@ -0,0 +1,6 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Ellipsis "...")))))) diff --git a/test/fixtures/python/corpus/exec-statement.A.py b/semantic/test/fixtures/python/corpus/exec-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/exec-statement.A.py rename to semantic/test/fixtures/python/corpus/exec-statement.A.py diff --git a/test/fixtures/python/corpus/exec-statement.B.py b/semantic/test/fixtures/python/corpus/exec-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/exec-statement.B.py rename to semantic/test/fixtures/python/corpus/exec-statement.B.py diff --git a/test/fixtures/python/corpus/exec-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/exec-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/exec-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/exec-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/exec-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/exec-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/exec-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/exec-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/exec-statement.parseA.txt b/semantic/test/fixtures/python/corpus/exec-statement.parseA.txt new file mode 100644 index 0000000000..f1c05aafd4 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/exec-statement.parseA.txt @@ -0,0 +1,19 @@ +(Module + (SimpleStatement + (ExecStatement + (String))) + (SimpleStatement + (ExecStatement + (String) + (Expression + (PrimaryExpression + (None "None"))))) + (SimpleStatement + (ExecStatement + (String) + (Expression + (PrimaryExpression + (Identifier "a"))) + (Expression + (PrimaryExpression + (Identifier "b")))))) diff --git a/semantic/test/fixtures/python/corpus/exec-statement.parseB.txt b/semantic/test/fixtures/python/corpus/exec-statement.parseB.txt new file mode 100644 index 0000000000..81aec8f4a1 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/exec-statement.parseB.txt @@ -0,0 +1,19 @@ +(Module + (SimpleStatement + (ExecStatement + (String) + (Expression + (PrimaryExpression + (Identifier "d"))))) + (SimpleStatement + (ExecStatement + (String) + (Expression + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "c"))))) + (SimpleStatement + (ExecStatement + (String)))) diff --git a/test/fixtures/python/corpus/expression-statement.A.py b/semantic/test/fixtures/python/corpus/expression-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/expression-statement.A.py rename to semantic/test/fixtures/python/corpus/expression-statement.A.py diff --git a/test/fixtures/python/corpus/expression-statement.B.py b/semantic/test/fixtures/python/corpus/expression-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/expression-statement.B.py rename to semantic/test/fixtures/python/corpus/expression-statement.B.py diff --git a/test/fixtures/python/corpus/expression-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/expression-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/expression-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/expression-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/expression-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/expression-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/expression-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/expression-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/expression-statement.parseA.txt b/semantic/test/fixtures/python/corpus/expression-statement.parseA.txt new file mode 100644 index 0000000000..9db8633756 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/expression-statement.parseA.txt @@ -0,0 +1,38 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "a"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "b")) + (PrimaryExpression + (Identifier "c"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "2"))) + (Expression + (PrimaryExpression + (Integer "3"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "2"))) + (Expression + (PrimaryExpression + (Integer "3")))))) diff --git a/semantic/test/fixtures/python/corpus/expression-statement.parseB.txt b/semantic/test/fixtures/python/corpus/expression-statement.parseB.txt new file mode 100644 index 0000000000..479bf8ea5a --- /dev/null +++ b/semantic/test/fixtures/python/corpus/expression-statement.parseB.txt @@ -0,0 +1,38 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "2"))) + (Expression + (PrimaryExpression + (Integer "3"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "3"))) + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "2"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "a")) + (PrimaryExpression + (Identifier "c")))))))) diff --git a/test/fixtures/python/corpus/float.A.py b/semantic/test/fixtures/python/corpus/float.A.py similarity index 100% rename from test/fixtures/python/corpus/float.A.py rename to semantic/test/fixtures/python/corpus/float.A.py diff --git a/test/fixtures/python/corpus/float.B.py b/semantic/test/fixtures/python/corpus/float.B.py similarity index 100% rename from test/fixtures/python/corpus/float.B.py rename to semantic/test/fixtures/python/corpus/float.B.py diff --git a/test/fixtures/python/corpus/float.diffA-B.txt b/semantic/test/fixtures/python/corpus/float.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/float.diffA-B.txt rename to semantic/test/fixtures/python/corpus/float.diffA-B.txt diff --git a/test/fixtures/python/corpus/float.diffB-A.txt b/semantic/test/fixtures/python/corpus/float.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/float.diffB-A.txt rename to semantic/test/fixtures/python/corpus/float.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/float.parseA.txt b/semantic/test/fixtures/python/corpus/float.parseA.txt new file mode 100644 index 0000000000..85944d5745 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/float.parseA.txt @@ -0,0 +1,57 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Float ".6_6"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Float ".1_1"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "123.4123"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "123.123J"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "1_1.3_1"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "1_1."))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "1e+3_4j"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float ".3e1_4"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "1_0.l"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float ".1l")))))) diff --git a/semantic/test/fixtures/python/corpus/float.parseB.txt b/semantic/test/fixtures/python/corpus/float.parseB.txt new file mode 100644 index 0000000000..a4b33e7af7 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/float.parseB.txt @@ -0,0 +1,57 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Float ".7_8"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Float ".2_2"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "123.2345"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "123.321J"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "2_4.8_0"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "2_0."))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "8e+2_3j"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float ".8e2_7"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float "2_1.l"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Float ".2l")))))) diff --git a/test/fixtures/python/corpus/for-statement.A.py b/semantic/test/fixtures/python/corpus/for-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/for-statement.A.py rename to semantic/test/fixtures/python/corpus/for-statement.A.py diff --git a/test/fixtures/python/corpus/for-statement.B.py b/semantic/test/fixtures/python/corpus/for-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/for-statement.B.py rename to semantic/test/fixtures/python/corpus/for-statement.B.py diff --git a/test/fixtures/python/corpus/for-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/for-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/for-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/for-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/for-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/for-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/for-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/for-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/for-statement.parseA.txt b/semantic/test/fixtures/python/corpus/for-statement.parseA.txt new file mode 100644 index 0000000000..5d24fc2d8e --- /dev/null +++ b/semantic/test/fixtures/python/corpus/for-statement.parseA.txt @@ -0,0 +1,75 @@ +(Module + (CompoundStatement + (ForStatement + (ElseClause + (Block + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Identifier "x"))))))) + (Block + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Identifier "line"))))) + (CompoundStatement + (ForStatement + (Block + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Identifier "character")))))) + (Variables + (PrimaryExpression + (Identifier "character")) + (PrimaryExpression + (Identifier "j"))) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "line"))))))) + (Variables + (PrimaryExpression + (Identifier "line")) + (PrimaryExpression + (Identifier "i"))) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "lines")))))) + (CompoundStatement + (ForStatement + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "x")))))) + (Variables + (PrimaryExpression + (Identifier "x"))) + (ExpressionList + (Expression + (PrimaryExpression + (List + (Expression + (PrimaryExpression + (Tuple + (Expression + (PrimaryExpression + (Integer "1")))))) + (Expression + (PrimaryExpression + (Tuple + (Expression + (PrimaryExpression + (Integer "2")))))) + (Expression + (PrimaryExpression + (Tuple + (Expression + (PrimaryExpression + (Integer "3"))))))))))))) diff --git a/semantic/test/fixtures/python/corpus/for-statement.parseB.txt b/semantic/test/fixtures/python/corpus/for-statement.parseB.txt new file mode 100644 index 0000000000..ebaf972888 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/for-statement.parseB.txt @@ -0,0 +1,75 @@ +(Module + (CompoundStatement + (ForStatement + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "y")))))) + (Variables + (PrimaryExpression + (Identifier "y"))) + (ExpressionList + (Expression + (PrimaryExpression + (List + (Expression + (PrimaryExpression + (Tuple + (Expression + (PrimaryExpression + (Integer "1")))))) + (Expression + (PrimaryExpression + (Tuple + (Expression + (PrimaryExpression + (Integer "2")))))) + (Expression + (PrimaryExpression + (Tuple + (Expression + (PrimaryExpression + (Integer "3")))))))))))) + (CompoundStatement + (ForStatement + (ElseClause + (Block + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Identifier "y"))))))) + (Block + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Identifier "line"))))) + (CompoundStatement + (ForStatement + (Block + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Identifier "character")))))) + (Variables + (PrimaryExpression + (Identifier "character")) + (PrimaryExpression + (Identifier "i"))) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "line"))))))) + (Variables + (PrimaryExpression + (Identifier "line")) + (PrimaryExpression + (Identifier "j"))) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "lines"))))))) diff --git a/test/fixtures/python/corpus/function-definition.A.py b/semantic/test/fixtures/python/corpus/function-definition.A.py similarity index 100% rename from test/fixtures/python/corpus/function-definition.A.py rename to semantic/test/fixtures/python/corpus/function-definition.A.py diff --git a/test/fixtures/python/corpus/function-definition.B.py b/semantic/test/fixtures/python/corpus/function-definition.B.py similarity index 100% rename from test/fixtures/python/corpus/function-definition.B.py rename to semantic/test/fixtures/python/corpus/function-definition.B.py diff --git a/test/fixtures/python/corpus/function-definition.diffA-B.txt b/semantic/test/fixtures/python/corpus/function-definition.diffA-B.txt similarity index 88% rename from test/fixtures/python/corpus/function-definition.diffA-B.txt rename to semantic/test/fixtures/python/corpus/function-definition.diffA-B.txt index abae857cbe..4bbaf845af 100644 --- a/test/fixtures/python/corpus/function-definition.diffA-B.txt +++ b/semantic/test/fixtures/python/corpus/function-definition.diffA-B.txt @@ -14,8 +14,9 @@ (RequiredParameter { (Identifier) ->(Identifier) }) - { (Identifier) - ->(Identifier) } + (Statements + { (Identifier) + ->(Identifier) }) (Statements { (Identifier) ->(Identifier) })) @@ -43,7 +44,8 @@ ->(Integer) }) { (Identifier) ->(Identifier) }) - { (Identifier) - ->(Identifier) } + (Statements + { (Identifier) + ->(Identifier) }) (Statements (Identifier)))) diff --git a/test/fixtures/python/corpus/function-definition.diffB-A.txt b/semantic/test/fixtures/python/corpus/function-definition.diffB-A.txt similarity index 85% rename from test/fixtures/python/corpus/function-definition.diffB-A.txt rename to semantic/test/fixtures/python/corpus/function-definition.diffB-A.txt index 28a09529aa..1dcc0ca3f6 100644 --- a/test/fixtures/python/corpus/function-definition.diffB-A.txt +++ b/semantic/test/fixtures/python/corpus/function-definition.diffB-A.txt @@ -4,7 +4,8 @@ ->(Identifier) } {-(RequiredParameter {-(Identifier)-})-} - {-(Identifier)-} + {-(Statements + {-(Identifier)-})-} (Statements { (Identifier) ->(Identifier) })) @@ -21,7 +22,8 @@ (RequiredParameter { (Identifier) ->(Identifier) }) - {+(Identifier)+} + {+(Statements + {+(Identifier)+})+} (Statements { (Identifier) ->(Identifier) })) @@ -41,7 +43,8 @@ ->(TextElement) }) { (Identifier) ->(Identifier) }) - { (Identifier) - ->(Identifier) } + (Statements + { (Identifier) + ->(Identifier) }) (Statements (Identifier)))) diff --git a/semantic/test/fixtures/python/corpus/function-definition.parseA.txt b/semantic/test/fixtures/python/corpus/function-definition.parseA.txt new file mode 100644 index 0000000000..4fffb0c0b0 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/function-definition.parseA.txt @@ -0,0 +1,81 @@ +(Module + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b")))))) + (Identifier "a") + (Parameters))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "e")))))) + (Identifier "c") + (Parameters + (Parameter + (Identifier "d"))))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "i")))))) + (Identifier "g") + (Parameters + (Parameter + (Identifier "g")) + (Parameter + (ListSplat + (Expression + (PrimaryExpression + (Identifier "h")))))))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "i")))))) + (Identifier "h") + (Parameters + (Parameter + (DefaultParameter + (Expression + (PrimaryExpression + (Identifier "j"))) + (Identifier "i")))))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "j")))))) + (Identifier "i") + (Parameters + (Parameter + (TypedDefaultParameter + (Expression + (PrimaryExpression + (String))) + (Identifier "j") + (Type + (Expression + (PrimaryExpression + (Identifier "str")))))) + (Parameter + (DictionarySplat + (Expression + (PrimaryExpression + (Identifier "c"))))))))) diff --git a/semantic/test/fixtures/python/corpus/function-definition.parseB.txt b/semantic/test/fixtures/python/corpus/function-definition.parseB.txt new file mode 100644 index 0000000000..5d9760b5c4 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/function-definition.parseB.txt @@ -0,0 +1,65 @@ +(Module + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "j")))))) + (Identifier "g") + (Parameters + (Parameter + (Identifier "i")) + (Parameter + (ListSplat + (Expression + (PrimaryExpression + (Identifier "j")))))))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b")))))) + (Identifier "c") + (Parameters))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "a")))))) + (Identifier "d") + (Parameters + (Parameter + (Identifier "e"))))) + (CompoundStatement + (FunctionDefinition + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "j")))))) + (Identifier "i") + (Parameters + (Parameter + (TypedDefaultParameter + (Expression + (PrimaryExpression + (Integer "1"))) + (Identifier "j") + (Type + (Expression + (PrimaryExpression + (Identifier "int")))))) + (Parameter + (DictionarySplat + (Expression + (PrimaryExpression + (Identifier "d"))))))))) diff --git a/test/fixtures/python/corpus/future_import_statement.A.py b/semantic/test/fixtures/python/corpus/future_import_statement.A.py similarity index 100% rename from test/fixtures/python/corpus/future_import_statement.A.py rename to semantic/test/fixtures/python/corpus/future_import_statement.A.py diff --git a/test/fixtures/python/corpus/future_import_statement.B.py b/semantic/test/fixtures/python/corpus/future_import_statement.B.py similarity index 100% rename from test/fixtures/python/corpus/future_import_statement.B.py rename to semantic/test/fixtures/python/corpus/future_import_statement.B.py diff --git a/test/fixtures/python/corpus/future_import_statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/future_import_statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/future_import_statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/future_import_statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/future_import_statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/future_import_statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/future_import_statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/future_import_statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/future_import_statement.parseA.txt b/semantic/test/fixtures/python/corpus/future_import_statement.parseA.txt new file mode 100644 index 0000000000..0e5d906908 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/future_import_statement.parseA.txt @@ -0,0 +1,17 @@ +(Module + (SimpleStatement + (FutureImportStatement + (DottedName + (Identifier "print_function")))) + (SimpleStatement + (FutureImportStatement + (DottedName + (Identifier "unicode_literals")) + (DottedName + (Identifier "division")))) + (SimpleStatement + (FutureImportStatement + (AliasedImport + (Identifier "pf") + (DottedName + (Identifier "print_function")))))) diff --git a/semantic/test/fixtures/python/corpus/future_import_statement.parseB.txt b/semantic/test/fixtures/python/corpus/future_import_statement.parseB.txt new file mode 100644 index 0000000000..61188743e6 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/future_import_statement.parseB.txt @@ -0,0 +1,17 @@ +(Module + (SimpleStatement + (FutureImportStatement + (DottedName + (Identifier "division")))) + (SimpleStatement + (FutureImportStatement + (DottedName + (Identifier "unicode_literals")) + (DottedName + (Identifier "print_function")))) + (SimpleStatement + (FutureImportStatement + (AliasedImport + (Identifier "g") + (DottedName + (Identifier "generators")))))) diff --git a/test/fixtures/python/corpus/generator-expression.A.py b/semantic/test/fixtures/python/corpus/generator-expression.A.py similarity index 100% rename from test/fixtures/python/corpus/generator-expression.A.py rename to semantic/test/fixtures/python/corpus/generator-expression.A.py diff --git a/test/fixtures/python/corpus/generator-expression.B.py b/semantic/test/fixtures/python/corpus/generator-expression.B.py similarity index 100% rename from test/fixtures/python/corpus/generator-expression.B.py rename to semantic/test/fixtures/python/corpus/generator-expression.B.py diff --git a/test/fixtures/python/corpus/generator-expression.diffA-B.txt b/semantic/test/fixtures/python/corpus/generator-expression.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/generator-expression.diffA-B.txt rename to semantic/test/fixtures/python/corpus/generator-expression.diffA-B.txt diff --git a/test/fixtures/python/corpus/generator-expression.diffB-A.txt b/semantic/test/fixtures/python/corpus/generator-expression.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/generator-expression.diffB-A.txt rename to semantic/test/fixtures/python/corpus/generator-expression.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/generator-expression.parseA.txt b/semantic/test/fixtures/python/corpus/generator-expression.parseA.txt new file mode 100644 index 0000000000..41b4c9c845 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/generator-expression.parseA.txt @@ -0,0 +1,31 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (GeneratorExpression + (Expression + (PrimaryExpression + (Identifier "c"))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "a"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (GeneratorExpression + (Expression + (PrimaryExpression + (Identifier "d"))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "e"))) + (Expression + (PrimaryExpression + (Identifier "f")))))))))) diff --git a/semantic/test/fixtures/python/corpus/generator-expression.parseB.txt b/semantic/test/fixtures/python/corpus/generator-expression.parseB.txt new file mode 100644 index 0000000000..052eeba0ad --- /dev/null +++ b/semantic/test/fixtures/python/corpus/generator-expression.parseB.txt @@ -0,0 +1,36 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (GeneratorExpression + (Expression + (PrimaryExpression + (Identifier "f"))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "e"))) + (Expression + (PrimaryExpression + (Identifier "d"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (GeneratorExpression + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "c")) + (PrimaryExpression + (Integer "1"))))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "a")))))))))) diff --git a/test/fixtures/python/corpus/global-statement.A.py b/semantic/test/fixtures/python/corpus/global-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/global-statement.A.py rename to semantic/test/fixtures/python/corpus/global-statement.A.py diff --git a/test/fixtures/python/corpus/global-statement.B.py b/semantic/test/fixtures/python/corpus/global-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/global-statement.B.py rename to semantic/test/fixtures/python/corpus/global-statement.B.py diff --git a/test/fixtures/python/corpus/global-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/global-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/global-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/global-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/global-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/global-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/global-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/global-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/global-statement.parseA.txt b/semantic/test/fixtures/python/corpus/global-statement.parseA.txt new file mode 100644 index 0000000000..ac36992740 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/global-statement.parseA.txt @@ -0,0 +1,8 @@ +(Module + (SimpleStatement + (GlobalStatement + (Identifier "a"))) + (SimpleStatement + (GlobalStatement + (Identifier "a") + (Identifier "b")))) diff --git a/semantic/test/fixtures/python/corpus/global-statement.parseB.txt b/semantic/test/fixtures/python/corpus/global-statement.parseB.txt new file mode 100644 index 0000000000..e1e38a689b --- /dev/null +++ b/semantic/test/fixtures/python/corpus/global-statement.parseB.txt @@ -0,0 +1,8 @@ +(Module + (SimpleStatement + (GlobalStatement + (Identifier "b") + (Identifier "a"))) + (SimpleStatement + (GlobalStatement + (Identifier "c")))) diff --git a/test/fixtures/python/corpus/identifier.A.py b/semantic/test/fixtures/python/corpus/identifier.A.py similarity index 100% rename from test/fixtures/python/corpus/identifier.A.py rename to semantic/test/fixtures/python/corpus/identifier.A.py diff --git a/test/fixtures/python/corpus/identifier.B.py b/semantic/test/fixtures/python/corpus/identifier.B.py similarity index 100% rename from test/fixtures/python/corpus/identifier.B.py rename to semantic/test/fixtures/python/corpus/identifier.B.py diff --git a/test/fixtures/python/corpus/identifier.diffA-B.txt b/semantic/test/fixtures/python/corpus/identifier.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/identifier.diffA-B.txt rename to semantic/test/fixtures/python/corpus/identifier.diffA-B.txt diff --git a/test/fixtures/python/corpus/identifier.diffB-A.txt b/semantic/test/fixtures/python/corpus/identifier.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/identifier.diffB-A.txt rename to semantic/test/fixtures/python/corpus/identifier.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/identifier.parseA.txt b/semantic/test/fixtures/python/corpus/identifier.parseA.txt new file mode 100644 index 0000000000..044e916cab --- /dev/null +++ b/semantic/test/fixtures/python/corpus/identifier.parseA.txt @@ -0,0 +1,6 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "a")))))) diff --git a/semantic/test/fixtures/python/corpus/identifier.parseB.txt b/semantic/test/fixtures/python/corpus/identifier.parseB.txt new file mode 100644 index 0000000000..ed813f703c --- /dev/null +++ b/semantic/test/fixtures/python/corpus/identifier.parseB.txt @@ -0,0 +1,11 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "aa"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "print")))))) diff --git a/test/fixtures/python/corpus/if-statement.A.py b/semantic/test/fixtures/python/corpus/if-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/if-statement.A.py rename to semantic/test/fixtures/python/corpus/if-statement.A.py diff --git a/test/fixtures/python/corpus/if-statement.B.py b/semantic/test/fixtures/python/corpus/if-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/if-statement.B.py rename to semantic/test/fixtures/python/corpus/if-statement.B.py diff --git a/test/fixtures/python/corpus/if-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/if-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/if-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/if-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/if-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/if-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/if-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/if-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/if-statement.parseA.txt b/semantic/test/fixtures/python/corpus/if-statement.parseA.txt new file mode 100644 index 0000000000..c567e71196 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/if-statement.parseA.txt @@ -0,0 +1,44 @@ +(Module + (CompoundStatement + (IfStatement + (ElifClause + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "a"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b")))))) + (Expression + (PrimaryExpression + (Identifier "d")))) + (ElseClause + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "x"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "y"))))))) + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "c")))))) + (Expression + (PrimaryExpression + (Identifier "a")))))) diff --git a/semantic/test/fixtures/python/corpus/if-statement.parseB.txt b/semantic/test/fixtures/python/corpus/if-statement.parseB.txt new file mode 100644 index 0000000000..b035212a4b --- /dev/null +++ b/semantic/test/fixtures/python/corpus/if-statement.parseB.txt @@ -0,0 +1,17 @@ +(Module + (CompoundStatement + (IfStatement + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "a"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b")))))) + (Expression + (PrimaryExpression + (Identifier "c")))))) diff --git a/test/fixtures/python/corpus/import-from-statement.A.py b/semantic/test/fixtures/python/corpus/import-from-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/import-from-statement.A.py rename to semantic/test/fixtures/python/corpus/import-from-statement.A.py diff --git a/test/fixtures/python/corpus/import-from-statement.B.py b/semantic/test/fixtures/python/corpus/import-from-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/import-from-statement.B.py rename to semantic/test/fixtures/python/corpus/import-from-statement.B.py diff --git a/test/fixtures/python/corpus/import-from-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/import-from-statement.diffA-B.txt similarity index 87% rename from test/fixtures/python/corpus/import-from-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/import-from-statement.diffA-B.txt index c5d82dc2cc..d4301b9a20 100644 --- a/test/fixtures/python/corpus/import-from-statement.diffA-B.txt +++ b/semantic/test/fixtures/python/corpus/import-from-statement.diffA-B.txt @@ -1,16 +1,28 @@ (Statements -{+(Import +{ (Import + {-(Alias + {-(Identifier)-} + {-(Identifier)-})-}) +->(Import {+(Alias {+(Identifier)+} - {+(Identifier)+})+})+} -{+(Import + {+(Identifier)+})+}) } +{ (Import + {-(Alias + {-(Identifier)-} + {-(Identifier)-})-} + {-(Alias + {-(Identifier)-} + {-(Identifier)-})-}) +->(Import {+(Alias {+(Identifier)+} {+(Identifier)+})+} {+(Alias {+(Identifier)+} - {+(Identifier)+})+})+} -{+(Import)+} + {+(Identifier)+})+}) } +{ (Import) +->(Import) } {+(Import {+(Alias {+(Identifier)+} @@ -18,26 +30,14 @@ {+(Alias {+(Identifier)+} {+(Identifier)+})+})+} -{ (Import - {-(Alias - {-(Identifier)-} - {-(Identifier)-})-}) -->(Import +{+(Import {+(Alias {+(Identifier)+} - {+(Identifier)+})+}) } + {+(Identifier)+})+})+} {+(Import {+(Alias {+(Identifier)+} {+(Identifier)+})+})+} -{-(Import - {-(Alias - {-(Identifier)-} - {-(Identifier)-})-} - {-(Alias - {-(Identifier)-} - {-(Identifier)-})-})-} -{-(Import)-} {-(Import {-(Alias {-(Identifier)-} diff --git a/test/fixtures/python/corpus/import-from-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/import-from-statement.diffB-A.txt similarity index 87% rename from test/fixtures/python/corpus/import-from-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/import-from-statement.diffB-A.txt index 4a45b79b60..533a06f73d 100644 --- a/test/fixtures/python/corpus/import-from-statement.diffB-A.txt +++ b/semantic/test/fixtures/python/corpus/import-from-statement.diffB-A.txt @@ -1,36 +1,36 @@ (Statements -{+(Import - {+(Alias - {+(Identifier)+} - {+(Identifier)+})+})+} -{+(Import - {+(Alias - {+(Identifier)+} - {+(Identifier)+})+} +{ (Import + {-(Alias + {-(Identifier)-} + {-(Identifier)-})-}) +->(Import {+(Alias {+(Identifier)+} - {+(Identifier)+})+})+} -{+(Import)+} + {+(Identifier)+})+}) } { (Import + {-(Alias + {-(Identifier)-} + {-(Identifier)-})-} {-(Alias {-(Identifier)-} {-(Identifier)-})-}) ->(Import + {+(Alias + {+(Identifier)+} + {+(Identifier)+})+} {+(Alias {+(Identifier)+} {+(Identifier)+})+}) } +{ (Import) +->(Import) } +{+(Import + {+(Alias + {+(Identifier)+} + {+(Identifier)+})+})+} {+(Import {+(Alias {+(Identifier)+} {+(Identifier)+})+})+} -{-(Import - {-(Alias - {-(Identifier)-} - {-(Identifier)-})-} - {-(Alias - {-(Identifier)-} - {-(Identifier)-})-})-} -{-(Import)-} {-(Import {-(Alias {-(Identifier)-} diff --git a/semantic/test/fixtures/python/corpus/import-from-statement.parseA.txt b/semantic/test/fixtures/python/corpus/import-from-statement.parseA.txt new file mode 100644 index 0000000000..1b8c3369a2 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/import-from-statement.parseA.txt @@ -0,0 +1,33 @@ +(Module + (SimpleStatement + (ImportFromStatement + (DottedName + (Identifier "b")) + (DottedName + (Identifier "a")))) + (SimpleStatement + (ImportFromStatement + (DottedName + (Identifier "b")) + (DottedName + (Identifier "c")) + (DottedName + (Identifier "a")))) + (SimpleStatement + (ImportFromStatement + (DottedName + (Identifier "a")) + (WildcardImport "*"))) + (SimpleStatement + (ImportFromStatement + (DottedName + (Identifier "c")) + (DottedName + (Identifier "a") + (Identifier "b")))) + (SimpleStatement + (ImportFromStatement + (DottedName + (Identifier "b")) + (RelativeImport + (ImportPrefix "."))))) diff --git a/semantic/test/fixtures/python/corpus/import-from-statement.parseB.txt b/semantic/test/fixtures/python/corpus/import-from-statement.parseB.txt new file mode 100644 index 0000000000..223a78a886 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/import-from-statement.parseB.txt @@ -0,0 +1,45 @@ +(Module + (SimpleStatement + (ImportFromStatement + (DottedName + (Identifier "a")) + (DottedName + (Identifier "b")))) + (SimpleStatement + (ImportFromStatement + (DottedName + (Identifier "c")) + (DottedName + (Identifier "a")) + (DottedName + (Identifier "b")))) + (SimpleStatement + (ImportFromStatement + (DottedName + (Identifier "b")) + (WildcardImport "*"))) + (SimpleStatement + (ImportFromStatement + (AliasedImport + (Identifier "x") + (DottedName + (Identifier "a"))) + (AliasedImport + (Identifier "y") + (DottedName + (Identifier "b"))) + (DottedName + (Identifier "b")))) + (SimpleStatement + (ImportFromStatement + (DottedName + (Identifier "d")) + (DottedName + (Identifier "b") + (Identifier "c")))) + (SimpleStatement + (ImportFromStatement + (DottedName + (Identifier "d")) + (RelativeImport + (ImportPrefix "."))))) diff --git a/test/fixtures/python/corpus/import-statement.A.py b/semantic/test/fixtures/python/corpus/import-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/import-statement.A.py rename to semantic/test/fixtures/python/corpus/import-statement.A.py diff --git a/test/fixtures/python/corpus/import-statement.B.py b/semantic/test/fixtures/python/corpus/import-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/import-statement.B.py rename to semantic/test/fixtures/python/corpus/import-statement.B.py diff --git a/test/fixtures/python/corpus/import-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/import-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/import-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/import-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/import-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/import-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/import-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/import-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/import-statement.parseA.txt b/semantic/test/fixtures/python/corpus/import-statement.parseA.txt new file mode 100644 index 0000000000..96ccdd5b29 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/import-statement.parseA.txt @@ -0,0 +1,24 @@ +(Module + (SimpleStatement + (ImportStatement + (DottedName + (Identifier "a")) + (AliasedImport + (Identifier "c") + (DottedName + (Identifier "b"))))) + (SimpleStatement + (ImportStatement + (AliasedImport + (Identifier "d") + (DottedName + (Identifier "b") + (Identifier "c"))) + (DottedName + (Identifier "e")))) + (SimpleStatement + (ImportStatement + (DottedName + (Identifier "a") + (Identifier "b") + (Identifier "c"))))) diff --git a/semantic/test/fixtures/python/corpus/import-statement.parseB.txt b/semantic/test/fixtures/python/corpus/import-statement.parseB.txt new file mode 100644 index 0000000000..b04b08193b --- /dev/null +++ b/semantic/test/fixtures/python/corpus/import-statement.parseB.txt @@ -0,0 +1,20 @@ +(Module + (SimpleStatement + (ImportStatement + (DottedName + (Identifier "b")) + (DottedName + (Identifier "a")))) + (SimpleStatement + (ImportStatement + (AliasedImport + (Identifier "e") + (DottedName + (Identifier "a") + (Identifier "c"))))) + (SimpleStatement + (ImportStatement + (DottedName + (Identifier "b") + (Identifier "c") + (Identifier "d"))))) diff --git a/test/fixtures/python/corpus/integer.A.py b/semantic/test/fixtures/python/corpus/integer.A.py similarity index 100% rename from test/fixtures/python/corpus/integer.A.py rename to semantic/test/fixtures/python/corpus/integer.A.py diff --git a/test/fixtures/python/corpus/integer.B.py b/semantic/test/fixtures/python/corpus/integer.B.py similarity index 100% rename from test/fixtures/python/corpus/integer.B.py rename to semantic/test/fixtures/python/corpus/integer.B.py diff --git a/test/fixtures/python/corpus/integer.diffA-B.txt b/semantic/test/fixtures/python/corpus/integer.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/integer.diffA-B.txt rename to semantic/test/fixtures/python/corpus/integer.diffA-B.txt diff --git a/test/fixtures/python/corpus/integer.diffB-A.txt b/semantic/test/fixtures/python/corpus/integer.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/integer.diffB-A.txt rename to semantic/test/fixtures/python/corpus/integer.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/integer.parseA.txt b/semantic/test/fixtures/python/corpus/integer.parseA.txt new file mode 100644 index 0000000000..a3b53b9291 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/integer.parseA.txt @@ -0,0 +1,72 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Integer "1"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0xDEAD"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0XDEAD"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "1j"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Integer "1j"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0o123"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0O123"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0b001"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0B001"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "1_1"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0B1_1"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0O1_1"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0L")))))) diff --git a/semantic/test/fixtures/python/corpus/integer.parseB.txt b/semantic/test/fixtures/python/corpus/integer.parseB.txt new file mode 100644 index 0000000000..e427c43e59 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/integer.parseB.txt @@ -0,0 +1,72 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Integer "2"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0xDAD"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0XDAD"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "2j"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Integer "2j"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0o312"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0O312"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0b101"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0B101"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "2_2"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0B1_1_1"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "0O2_3"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Integer "1L")))))) diff --git a/test/fixtures/python/corpus/keyword-identifier.A.py b/semantic/test/fixtures/python/corpus/keyword-identifier.A.py similarity index 100% rename from test/fixtures/python/corpus/keyword-identifier.A.py rename to semantic/test/fixtures/python/corpus/keyword-identifier.A.py diff --git a/test/fixtures/python/corpus/keyword-identifier.B.py b/semantic/test/fixtures/python/corpus/keyword-identifier.B.py similarity index 100% rename from test/fixtures/python/corpus/keyword-identifier.B.py rename to semantic/test/fixtures/python/corpus/keyword-identifier.B.py diff --git a/test/fixtures/python/corpus/keyword-identifier.diffA-B.txt b/semantic/test/fixtures/python/corpus/keyword-identifier.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/keyword-identifier.diffA-B.txt rename to semantic/test/fixtures/python/corpus/keyword-identifier.diffA-B.txt diff --git a/test/fixtures/python/corpus/keyword-identifier.diffB-A.txt b/semantic/test/fixtures/python/corpus/keyword-identifier.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/keyword-identifier.diffB-A.txt rename to semantic/test/fixtures/python/corpus/keyword-identifier.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/keyword-identifier.parseA.txt b/semantic/test/fixtures/python/corpus/keyword-identifier.parseA.txt new file mode 100644 index 0000000000..142d59cc2e --- /dev/null +++ b/semantic/test/fixtures/python/corpus/keyword-identifier.parseA.txt @@ -0,0 +1,11 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "print"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "exec")))))) diff --git a/semantic/test/fixtures/python/corpus/keyword-identifier.parseB.txt b/semantic/test/fixtures/python/corpus/keyword-identifier.parseB.txt new file mode 100644 index 0000000000..f98c149fae --- /dev/null +++ b/semantic/test/fixtures/python/corpus/keyword-identifier.parseB.txt @@ -0,0 +1,11 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "exec"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "print")))))) diff --git a/test/fixtures/python/corpus/lambda.A.py b/semantic/test/fixtures/python/corpus/lambda.A.py similarity index 100% rename from test/fixtures/python/corpus/lambda.A.py rename to semantic/test/fixtures/python/corpus/lambda.A.py diff --git a/test/fixtures/python/corpus/lambda.B.py b/semantic/test/fixtures/python/corpus/lambda.B.py similarity index 100% rename from test/fixtures/python/corpus/lambda.B.py rename to semantic/test/fixtures/python/corpus/lambda.B.py diff --git a/test/fixtures/python/corpus/lambda.diffA-B.txt b/semantic/test/fixtures/python/corpus/lambda.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/lambda.diffA-B.txt rename to semantic/test/fixtures/python/corpus/lambda.diffA-B.txt diff --git a/test/fixtures/python/corpus/lambda.diffB-A.txt b/semantic/test/fixtures/python/corpus/lambda.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/lambda.diffB-A.txt rename to semantic/test/fixtures/python/corpus/lambda.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/lambda.parseA.txt b/semantic/test/fixtures/python/corpus/lambda.parseA.txt new file mode 100644 index 0000000000..deaf73949c --- /dev/null +++ b/semantic/test/fixtures/python/corpus/lambda.parseA.txt @@ -0,0 +1,13 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (Lambda + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Integer "1")) + (PrimaryExpression + (Integer "1")))))))))) diff --git a/semantic/test/fixtures/python/corpus/lambda.parseB.txt b/semantic/test/fixtures/python/corpus/lambda.parseB.txt new file mode 100644 index 0000000000..38ccbbfe77 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/lambda.parseB.txt @@ -0,0 +1,16 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (Lambda + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "a")) + (PrimaryExpression + (Integer "1"))))) + (LambdaParameters + (Parameter + (Identifier "a")))))))) diff --git a/test/fixtures/python/corpus/list-comprehension.A.py b/semantic/test/fixtures/python/corpus/list-comprehension.A.py similarity index 100% rename from test/fixtures/python/corpus/list-comprehension.A.py rename to semantic/test/fixtures/python/corpus/list-comprehension.A.py diff --git a/test/fixtures/python/corpus/list-comprehension.B.py b/semantic/test/fixtures/python/corpus/list-comprehension.B.py similarity index 100% rename from test/fixtures/python/corpus/list-comprehension.B.py rename to semantic/test/fixtures/python/corpus/list-comprehension.B.py diff --git a/test/fixtures/python/corpus/list-comprehension.diffA-B.txt b/semantic/test/fixtures/python/corpus/list-comprehension.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/list-comprehension.diffA-B.txt rename to semantic/test/fixtures/python/corpus/list-comprehension.diffA-B.txt diff --git a/test/fixtures/python/corpus/list-comprehension.diffB-A.txt b/semantic/test/fixtures/python/corpus/list-comprehension.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/list-comprehension.diffB-A.txt rename to semantic/test/fixtures/python/corpus/list-comprehension.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/list-comprehension.parseA.txt b/semantic/test/fixtures/python/corpus/list-comprehension.parseA.txt new file mode 100644 index 0000000000..6e9a49c0e8 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/list-comprehension.parseA.txt @@ -0,0 +1,35 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (ListComprehension + (Expression + (PrimaryExpression + (Identifier "c"))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "a"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (ListComprehension + (Expression + (PrimaryExpression + (Identifier "d"))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "e"))) + (Expression + (PrimaryExpression + (Identifier "f")))) + (IfClause + (Expression + (PrimaryExpression + (Identifier "d")))))))))) diff --git a/semantic/test/fixtures/python/corpus/list-comprehension.parseB.txt b/semantic/test/fixtures/python/corpus/list-comprehension.parseB.txt new file mode 100644 index 0000000000..b57e2a3616 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/list-comprehension.parseB.txt @@ -0,0 +1,57 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (ListComprehension + (Expression + (PrimaryExpression + (Identifier "f"))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "e"))) + (Expression + (PrimaryExpression + (Identifier "d")))) + (IfClause + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "f")) + (ArgumentList))))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "g"))) + (Expression + (PrimaryExpression + (Identifier "h")))) + (IfClause + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "g")) + (ArgumentList)))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (ListComprehension + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "c")) + (PrimaryExpression + (Integer "1"))))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "a")))))))))) diff --git a/test/fixtures/python/corpus/list.A.py b/semantic/test/fixtures/python/corpus/list.A.py similarity index 100% rename from test/fixtures/python/corpus/list.A.py rename to semantic/test/fixtures/python/corpus/list.A.py diff --git a/test/fixtures/python/corpus/list.B.py b/semantic/test/fixtures/python/corpus/list.B.py similarity index 100% rename from test/fixtures/python/corpus/list.B.py rename to semantic/test/fixtures/python/corpus/list.B.py diff --git a/test/fixtures/python/corpus/list.diffA-B.txt b/semantic/test/fixtures/python/corpus/list.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/list.diffA-B.txt rename to semantic/test/fixtures/python/corpus/list.diffA-B.txt diff --git a/test/fixtures/python/corpus/list.diffB-A.txt b/semantic/test/fixtures/python/corpus/list.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/list.diffB-A.txt rename to semantic/test/fixtures/python/corpus/list.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/list.parseA.txt b/semantic/test/fixtures/python/corpus/list.parseA.txt new file mode 100644 index 0000000000..f58dc39fe8 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/list.parseA.txt @@ -0,0 +1,34 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (List))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (List + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "2"))) + (Expression + (PrimaryExpression + (Integer "3")))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (List + (Expression + (PrimaryExpression + (Identifier "a"))) + (Expression + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "c"))))))))) diff --git a/semantic/test/fixtures/python/corpus/list.parseB.txt b/semantic/test/fixtures/python/corpus/list.parseB.txt new file mode 100644 index 0000000000..6cf99c21b1 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/list.parseB.txt @@ -0,0 +1,28 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (List + (Expression + (PrimaryExpression + (Identifier "print")))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (List + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "3")))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (List + (Expression + (PrimaryExpression + (Identifier "b"))))))))) diff --git a/test/fixtures/python/corpus/non-local-statement.A.py b/semantic/test/fixtures/python/corpus/non-local-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/non-local-statement.A.py rename to semantic/test/fixtures/python/corpus/non-local-statement.A.py diff --git a/test/fixtures/python/corpus/non-local-statement.B.py b/semantic/test/fixtures/python/corpus/non-local-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/non-local-statement.B.py rename to semantic/test/fixtures/python/corpus/non-local-statement.B.py diff --git a/test/fixtures/python/corpus/non-local-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/non-local-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/non-local-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/non-local-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/non-local-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/non-local-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/non-local-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/non-local-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/non-local-statement.parseA.txt b/semantic/test/fixtures/python/corpus/non-local-statement.parseA.txt new file mode 100644 index 0000000000..d9ec9b33ae --- /dev/null +++ b/semantic/test/fixtures/python/corpus/non-local-statement.parseA.txt @@ -0,0 +1,4 @@ +(Module + (SimpleStatement + (NonlocalStatement + (Identifier "a")))) diff --git a/semantic/test/fixtures/python/corpus/non-local-statement.parseB.txt b/semantic/test/fixtures/python/corpus/non-local-statement.parseB.txt new file mode 100644 index 0000000000..9ce693eeb0 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/non-local-statement.parseB.txt @@ -0,0 +1,4 @@ +(Module + (SimpleStatement + (NonlocalStatement + (Identifier "b")))) diff --git a/test/fixtures/python/corpus/none.A.py b/semantic/test/fixtures/python/corpus/none.A.py similarity index 100% rename from test/fixtures/python/corpus/none.A.py rename to semantic/test/fixtures/python/corpus/none.A.py diff --git a/test/fixtures/python/corpus/none.B.py b/semantic/test/fixtures/python/corpus/none.B.py similarity index 100% rename from test/fixtures/python/corpus/none.B.py rename to semantic/test/fixtures/python/corpus/none.B.py diff --git a/test/fixtures/python/corpus/none.diffA-B.txt b/semantic/test/fixtures/python/corpus/none.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/none.diffA-B.txt rename to semantic/test/fixtures/python/corpus/none.diffA-B.txt diff --git a/test/fixtures/python/corpus/none.diffB-A.txt b/semantic/test/fixtures/python/corpus/none.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/none.diffB-A.txt rename to semantic/test/fixtures/python/corpus/none.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/none.parseA.txt b/semantic/test/fixtures/python/corpus/none.parseA.txt new file mode 100644 index 0000000000..bfbb9800d7 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/none.parseA.txt @@ -0,0 +1,11 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (None "None"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (None "None")))))) diff --git a/semantic/test/fixtures/python/corpus/none.parseB.txt b/semantic/test/fixtures/python/corpus/none.parseB.txt new file mode 100644 index 0000000000..74f74f74b9 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/none.parseB.txt @@ -0,0 +1,6 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (None "None")))))) diff --git a/test/fixtures/python/corpus/not.A.py b/semantic/test/fixtures/python/corpus/not.A.py similarity index 100% rename from test/fixtures/python/corpus/not.A.py rename to semantic/test/fixtures/python/corpus/not.A.py diff --git a/test/fixtures/python/corpus/not.B.py b/semantic/test/fixtures/python/corpus/not.B.py similarity index 100% rename from test/fixtures/python/corpus/not.B.py rename to semantic/test/fixtures/python/corpus/not.B.py diff --git a/test/fixtures/python/corpus/not.diffA-B.txt b/semantic/test/fixtures/python/corpus/not.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/not.diffA-B.txt rename to semantic/test/fixtures/python/corpus/not.diffA-B.txt diff --git a/test/fixtures/python/corpus/not.diffB-A.txt b/semantic/test/fixtures/python/corpus/not.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/not.diffB-A.txt rename to semantic/test/fixtures/python/corpus/not.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/not.parseA.txt b/semantic/test/fixtures/python/corpus/not.parseA.txt new file mode 100644 index 0000000000..23ee7859dd --- /dev/null +++ b/semantic/test/fixtures/python/corpus/not.parseA.txt @@ -0,0 +1,8 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (NotOperator + (Expression + (PrimaryExpression + (Identifier "a")))))))) diff --git a/semantic/test/fixtures/python/corpus/not.parseB.txt b/semantic/test/fixtures/python/corpus/not.parseB.txt new file mode 100644 index 0000000000..ea7ae409a2 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/not.parseB.txt @@ -0,0 +1,15 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (NotOperator + (Expression + (PrimaryExpression + (Identifier "c"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (NotOperator + (Expression + (PrimaryExpression + (Identifier "b")))))))) diff --git a/semantic/test/fixtures/python/corpus/pass-statement.A.py b/semantic/test/fixtures/python/corpus/pass-statement.A.py new file mode 100644 index 0000000000..2ae28399f5 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/pass-statement.A.py @@ -0,0 +1 @@ +pass diff --git a/test/fixtures/python/corpus/pass-statement.B.py b/semantic/test/fixtures/python/corpus/pass-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/pass-statement.B.py rename to semantic/test/fixtures/python/corpus/pass-statement.B.py diff --git a/test/fixtures/python/corpus/pass-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/pass-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/pass-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/pass-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/pass-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/pass-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/pass-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/pass-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/pass-statement.parseA.txt b/semantic/test/fixtures/python/corpus/pass-statement.parseA.txt new file mode 100644 index 0000000000..7c5a4213a4 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/pass-statement.parseA.txt @@ -0,0 +1,3 @@ +(Module + (SimpleStatement + (PassStatement "pass"))) diff --git a/semantic/test/fixtures/python/corpus/pass-statement.parseB.txt b/semantic/test/fixtures/python/corpus/pass-statement.parseB.txt new file mode 100644 index 0000000000..a671c02bba --- /dev/null +++ b/semantic/test/fixtures/python/corpus/pass-statement.parseB.txt @@ -0,0 +1,5 @@ +(Module + (SimpleStatement + (PassStatement "pass")) + (SimpleStatement + (PassStatement "pass"))) diff --git a/test/fixtures/python/corpus/print-statement.A.py b/semantic/test/fixtures/python/corpus/print-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/print-statement.A.py rename to semantic/test/fixtures/python/corpus/print-statement.A.py diff --git a/test/fixtures/python/corpus/print-statement.B.py b/semantic/test/fixtures/python/corpus/print-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/print-statement.B.py rename to semantic/test/fixtures/python/corpus/print-statement.B.py diff --git a/test/fixtures/python/corpus/print-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/print-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/print-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/print-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/print-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/print-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/print-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/print-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/print-statement.parseA.txt b/semantic/test/fixtures/python/corpus/print-statement.parseA.txt new file mode 100644 index 0000000000..15111de3eb --- /dev/null +++ b/semantic/test/fixtures/python/corpus/print-statement.parseA.txt @@ -0,0 +1,45 @@ +(Module + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Identifier "a"))) + (Expression + (PrimaryExpression + (Identifier "b"))))) + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Identifier "c"))))) + (SimpleStatement + (PrintStatement + (Expression + (BooleanOperator + (Token) + (Expression + (PrimaryExpression + (Integer "0"))) + (Expression + (PrimaryExpression + (Integer "1"))))))) + (SimpleStatement + (PrintStatement + (Expression + (BooleanOperator + (Token) + (Expression + (PrimaryExpression + (Integer "0"))) + (Expression + (PrimaryExpression + (Integer "1"))))) + (Expression + (BooleanOperator + (Token) + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "0")))))))) diff --git a/semantic/test/fixtures/python/corpus/print-statement.parseB.txt b/semantic/test/fixtures/python/corpus/print-statement.parseB.txt new file mode 100644 index 0000000000..eff0d80872 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/print-statement.parseB.txt @@ -0,0 +1,45 @@ +(Module + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Identifier "c"))) + (Expression + (PrimaryExpression + (Identifier "a"))))) + (SimpleStatement + (PrintStatement + (Expression + (PrimaryExpression + (Identifier "b"))))) + (SimpleStatement + (PrintStatement + (Expression + (BooleanOperator + (Token) + (Expression + (PrimaryExpression + (Integer "0"))) + (Expression + (PrimaryExpression + (Integer "1"))))))) + (SimpleStatement + (PrintStatement + (Expression + (BooleanOperator + (Token) + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "0"))))) + (Expression + (BooleanOperator + (Token) + (Expression + (PrimaryExpression + (Integer "0"))) + (Expression + (PrimaryExpression + (Integer "1")))))))) diff --git a/test/fixtures/python/corpus/raise-statement.A.py b/semantic/test/fixtures/python/corpus/raise-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/raise-statement.A.py rename to semantic/test/fixtures/python/corpus/raise-statement.A.py diff --git a/test/fixtures/python/corpus/raise-statement.B.py b/semantic/test/fixtures/python/corpus/raise-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/raise-statement.B.py rename to semantic/test/fixtures/python/corpus/raise-statement.B.py diff --git a/test/fixtures/python/corpus/raise-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/raise-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/raise-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/raise-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/raise-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/raise-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/raise-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/raise-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/raise-statement.parseA.txt b/semantic/test/fixtures/python/corpus/raise-statement.parseA.txt new file mode 100644 index 0000000000..3373b18f74 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/raise-statement.parseA.txt @@ -0,0 +1,30 @@ +(Module + (SimpleStatement + (RaiseStatement)) + (SimpleStatement + (RaiseStatement + (ExpressionList + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "RuntimeError")) + (ArgumentList + (Expression + (PrimaryExpression + (String)))))))))) + (SimpleStatement + (RaiseStatement + (Expression + (PrimaryExpression + (Identifier "e"))) + (ExpressionList + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "RunTimeError")) + (ArgumentList + (Expression + (PrimaryExpression + (String))))))))))) diff --git a/semantic/test/fixtures/python/corpus/raise-statement.parseB.txt b/semantic/test/fixtures/python/corpus/raise-statement.parseB.txt new file mode 100644 index 0000000000..abb354b63a --- /dev/null +++ b/semantic/test/fixtures/python/corpus/raise-statement.parseB.txt @@ -0,0 +1,30 @@ +(Module + (SimpleStatement + (RaiseStatement + (ExpressionList + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "RuntimeError")) + (ArgumentList + (Expression + (PrimaryExpression + (String)))))))))) + (SimpleStatement + (RaiseStatement + (Expression + (PrimaryExpression + (Identifier "f"))) + (ExpressionList + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "RunTimeError")) + (ArgumentList + (Expression + (PrimaryExpression + (String)))))))))) + (SimpleStatement + (RaiseStatement))) diff --git a/test/fixtures/python/corpus/return-statement.A.py b/semantic/test/fixtures/python/corpus/return-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/return-statement.A.py rename to semantic/test/fixtures/python/corpus/return-statement.A.py diff --git a/test/fixtures/python/corpus/return-statement.B.py b/semantic/test/fixtures/python/corpus/return-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/return-statement.B.py rename to semantic/test/fixtures/python/corpus/return-statement.B.py diff --git a/test/fixtures/python/corpus/return-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/return-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/return-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/return-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/return-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/return-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/return-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/return-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/return-statement.parseA.txt b/semantic/test/fixtures/python/corpus/return-statement.parseA.txt new file mode 100644 index 0000000000..e0e43f728c --- /dev/null +++ b/semantic/test/fixtures/python/corpus/return-statement.parseA.txt @@ -0,0 +1,25 @@ +(Module + (SimpleStatement + (ReturnStatement)) + (SimpleStatement + (ReturnStatement + (ExpressionList + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "a")) + (PrimaryExpression + (Identifier "b"))))) + (Expression + (PrimaryExpression + (Identifier "c")))))) + (SimpleStatement + (ReturnStatement + (ExpressionList + (Expression + (NotOperator + (Expression + (PrimaryExpression + (Identifier "b"))))))))) diff --git a/semantic/test/fixtures/python/corpus/return-statement.parseB.txt b/semantic/test/fixtures/python/corpus/return-statement.parseB.txt new file mode 100644 index 0000000000..b0f75f4198 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/return-statement.parseB.txt @@ -0,0 +1,25 @@ +(Module + (SimpleStatement + (ReturnStatement + (ExpressionList + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "c")) + (PrimaryExpression + (Identifier "a"))))) + (Expression + (PrimaryExpression + (Identifier "b")))))) + (SimpleStatement + (ReturnStatement)) + (SimpleStatement + (ReturnStatement + (ExpressionList + (Expression + (NotOperator + (Expression + (PrimaryExpression + (Identifier "a"))))))))) diff --git a/test/fixtures/python/corpus/set-comprehension.A.py b/semantic/test/fixtures/python/corpus/set-comprehension.A.py similarity index 100% rename from test/fixtures/python/corpus/set-comprehension.A.py rename to semantic/test/fixtures/python/corpus/set-comprehension.A.py diff --git a/test/fixtures/python/corpus/set-comprehension.B.py b/semantic/test/fixtures/python/corpus/set-comprehension.B.py similarity index 100% rename from test/fixtures/python/corpus/set-comprehension.B.py rename to semantic/test/fixtures/python/corpus/set-comprehension.B.py diff --git a/test/fixtures/python/corpus/set-comprehension.diffA-B.txt b/semantic/test/fixtures/python/corpus/set-comprehension.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/set-comprehension.diffA-B.txt rename to semantic/test/fixtures/python/corpus/set-comprehension.diffA-B.txt diff --git a/test/fixtures/python/corpus/set-comprehension.diffB-A.txt b/semantic/test/fixtures/python/corpus/set-comprehension.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/set-comprehension.diffB-A.txt rename to semantic/test/fixtures/python/corpus/set-comprehension.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/set-comprehension.parseA.txt b/semantic/test/fixtures/python/corpus/set-comprehension.parseA.txt new file mode 100644 index 0000000000..f39d9a7b82 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/set-comprehension.parseA.txt @@ -0,0 +1,31 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (SetComprehension + (Expression + (PrimaryExpression + (Identifier "c"))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "a"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (SetComprehension + (Expression + (PrimaryExpression + (Identifier "d"))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "e"))) + (Expression + (PrimaryExpression + (Identifier "f")))))))))) diff --git a/semantic/test/fixtures/python/corpus/set-comprehension.parseB.txt b/semantic/test/fixtures/python/corpus/set-comprehension.parseB.txt new file mode 100644 index 0000000000..7a043d2b09 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/set-comprehension.parseB.txt @@ -0,0 +1,36 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (SetComprehension + (Expression + (PrimaryExpression + (Identifier "f"))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "e"))) + (Expression + (PrimaryExpression + (Identifier "d"))))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (SetComprehension + (Expression + (PrimaryExpression + (BinaryOperator + (Token) + (PrimaryExpression + (Identifier "c")) + (PrimaryExpression + (Integer "1"))))) + (ForInClause + (Variables + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "a")))))))))) diff --git a/test/fixtures/python/corpus/set.A.py b/semantic/test/fixtures/python/corpus/set.A.py similarity index 100% rename from test/fixtures/python/corpus/set.A.py rename to semantic/test/fixtures/python/corpus/set.A.py diff --git a/test/fixtures/python/corpus/set.B.py b/semantic/test/fixtures/python/corpus/set.B.py similarity index 100% rename from test/fixtures/python/corpus/set.B.py rename to semantic/test/fixtures/python/corpus/set.B.py diff --git a/test/fixtures/python/corpus/set.diffA-B.txt b/semantic/test/fixtures/python/corpus/set.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/set.diffA-B.txt rename to semantic/test/fixtures/python/corpus/set.diffA-B.txt diff --git a/test/fixtures/python/corpus/set.diffB-A.txt b/semantic/test/fixtures/python/corpus/set.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/set.diffB-A.txt rename to semantic/test/fixtures/python/corpus/set.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/set.parseA.txt b/semantic/test/fixtures/python/corpus/set.parseA.txt new file mode 100644 index 0000000000..791dd916bd --- /dev/null +++ b/semantic/test/fixtures/python/corpus/set.parseA.txt @@ -0,0 +1,20 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Dictionary))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Set + (Expression + (PrimaryExpression + (Integer "1"))) + (Expression + (PrimaryExpression + (Integer "2"))) + (Expression + (PrimaryExpression + (Integer "3"))))))))) diff --git a/semantic/test/fixtures/python/corpus/set.parseB.txt b/semantic/test/fixtures/python/corpus/set.parseB.txt new file mode 100644 index 0000000000..8843c98cce --- /dev/null +++ b/semantic/test/fixtures/python/corpus/set.parseB.txt @@ -0,0 +1,23 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Set + (Expression + (PrimaryExpression + (Integer "1")))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Set + (Expression + (PrimaryExpression + (Integer "3"))) + (Expression + (PrimaryExpression + (Integer "2"))) + (Expression + (PrimaryExpression + (Integer "1"))))))))) diff --git a/test/fixtures/python/corpus/slice.A.py b/semantic/test/fixtures/python/corpus/slice.A.py similarity index 100% rename from test/fixtures/python/corpus/slice.A.py rename to semantic/test/fixtures/python/corpus/slice.A.py diff --git a/test/fixtures/python/corpus/slice.B.py b/semantic/test/fixtures/python/corpus/slice.B.py similarity index 100% rename from test/fixtures/python/corpus/slice.B.py rename to semantic/test/fixtures/python/corpus/slice.B.py diff --git a/test/fixtures/python/corpus/slice.diffA-B.txt b/semantic/test/fixtures/python/corpus/slice.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/slice.diffA-B.txt rename to semantic/test/fixtures/python/corpus/slice.diffA-B.txt diff --git a/test/fixtures/python/corpus/slice.diffB-A.txt b/semantic/test/fixtures/python/corpus/slice.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/slice.diffB-A.txt rename to semantic/test/fixtures/python/corpus/slice.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/slice.parseA.txt b/semantic/test/fixtures/python/corpus/slice.parseA.txt new file mode 100644 index 0000000000..8f895b1f24 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/slice.parseA.txt @@ -0,0 +1,46 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Subscript + (Slice) + (PrimaryExpression + (Identifier "a"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Subscript + (Slice + (Expression + (PrimaryExpression + (Integer "5")))) + (PrimaryExpression + (Identifier "b"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Subscript + (Slice + (Expression + (PrimaryExpression + (Integer "5"))) + (Expression + (PrimaryExpression + (Integer "6")))) + (Token) + (Expression + (PrimaryExpression + (Ellipsis "..."))) + (PrimaryExpression + (Identifier "b"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Subscript + (Slice) + (PrimaryExpression + (Identifier "c")))))))) diff --git a/semantic/test/fixtures/python/corpus/slice.parseB.txt b/semantic/test/fixtures/python/corpus/slice.parseB.txt new file mode 100644 index 0000000000..2213c5a6fb --- /dev/null +++ b/semantic/test/fixtures/python/corpus/slice.parseB.txt @@ -0,0 +1,46 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Subscript + (Slice + (Expression + (PrimaryExpression + (Integer "4"))) + (Expression + (PrimaryExpression + (Integer "5")))) + (Token) + (Expression + (PrimaryExpression + (Ellipsis "..."))) + (PrimaryExpression + (Identifier "c"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Subscript + (Slice) + (PrimaryExpression + (Identifier "a"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Subscript + (Slice + (Expression + (PrimaryExpression + (Integer "3")))) + (PrimaryExpression + (Identifier "d"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Subscript + (Slice) + (PrimaryExpression + (Identifier "e")))))))) diff --git a/test/fixtures/python/corpus/string.A.py b/semantic/test/fixtures/python/corpus/string.A.py similarity index 100% rename from test/fixtures/python/corpus/string.A.py rename to semantic/test/fixtures/python/corpus/string.A.py diff --git a/test/fixtures/python/corpus/string.B.py b/semantic/test/fixtures/python/corpus/string.B.py similarity index 100% rename from test/fixtures/python/corpus/string.B.py rename to semantic/test/fixtures/python/corpus/string.B.py diff --git a/test/fixtures/python/corpus/string.diffA-B.txt b/semantic/test/fixtures/python/corpus/string.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/string.diffA-B.txt rename to semantic/test/fixtures/python/corpus/string.diffA-B.txt diff --git a/test/fixtures/python/corpus/string.diffB-A.txt b/semantic/test/fixtures/python/corpus/string.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/string.diffB-A.txt rename to semantic/test/fixtures/python/corpus/string.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/string.parseA.txt b/semantic/test/fixtures/python/corpus/string.parseA.txt new file mode 100644 index 0000000000..11bf1c4dad --- /dev/null +++ b/semantic/test/fixtures/python/corpus/string.parseA.txt @@ -0,0 +1,48 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String + (EscapeSequence "\\\\")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String + (EscapeSequence "\\\n"))))))) diff --git a/semantic/test/fixtures/python/corpus/string.parseB.txt b/semantic/test/fixtures/python/corpus/string.parseB.txt new file mode 100644 index 0000000000..f6eb0408d8 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/string.parseB.txt @@ -0,0 +1,42 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String + (EscapeSequence "\\\n")))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (String)))))) diff --git a/test/fixtures/python/corpus/subscript.A.py b/semantic/test/fixtures/python/corpus/subscript.A.py similarity index 100% rename from test/fixtures/python/corpus/subscript.A.py rename to semantic/test/fixtures/python/corpus/subscript.A.py diff --git a/test/fixtures/python/corpus/subscript.B.py b/semantic/test/fixtures/python/corpus/subscript.B.py similarity index 100% rename from test/fixtures/python/corpus/subscript.B.py rename to semantic/test/fixtures/python/corpus/subscript.B.py diff --git a/test/fixtures/python/corpus/subscript.diffA-B.txt b/semantic/test/fixtures/python/corpus/subscript.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/subscript.diffA-B.txt rename to semantic/test/fixtures/python/corpus/subscript.diffA-B.txt diff --git a/test/fixtures/python/corpus/subscript.diffB-A.txt b/semantic/test/fixtures/python/corpus/subscript.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/subscript.diffB-A.txt rename to semantic/test/fixtures/python/corpus/subscript.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/subscript.parseA.txt b/semantic/test/fixtures/python/corpus/subscript.parseA.txt new file mode 100644 index 0000000000..755137d5e3 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/subscript.parseA.txt @@ -0,0 +1,11 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Subscript + (Expression + (PrimaryExpression + (Identifier "b"))) + (PrimaryExpression + (Identifier "a")))))))) diff --git a/semantic/test/fixtures/python/corpus/subscript.parseB.txt b/semantic/test/fixtures/python/corpus/subscript.parseB.txt new file mode 100644 index 0000000000..fbbd70f702 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/subscript.parseB.txt @@ -0,0 +1,11 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Subscript + (Expression + (PrimaryExpression + (Identifier "a"))) + (PrimaryExpression + (Identifier "b")))))))) diff --git a/test/fixtures/python/corpus/try-statement.A.py b/semantic/test/fixtures/python/corpus/try-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/try-statement.A.py rename to semantic/test/fixtures/python/corpus/try-statement.A.py diff --git a/test/fixtures/python/corpus/try-statement.B.py b/semantic/test/fixtures/python/corpus/try-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/try-statement.B.py rename to semantic/test/fixtures/python/corpus/try-statement.B.py diff --git a/test/fixtures/python/corpus/try-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/try-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/try-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/try-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/try-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/try-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/try-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/try-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/try-statement.parseA.txt b/semantic/test/fixtures/python/corpus/try-statement.parseA.txt new file mode 100644 index 0000000000..b83185e680 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/try-statement.parseA.txt @@ -0,0 +1,102 @@ +(Module + (CompoundStatement + (TryStatement + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "a"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b")))))) + (ExceptClause + (Expression + (PrimaryExpression + (Identifier "b"))) + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "c"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "d"))))))) + (ExceptClause + (Expression + (PrimaryExpression + (Identifier "d"))) + (Expression + (PrimaryExpression + (Identifier "e"))) + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "f"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "g"))))))) + (ExceptClause + (Expression + (PrimaryExpression + (Identifier "g"))) + (Expression + (PrimaryExpression + (Identifier "h"))) + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "i"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "j"))))))) + (ExceptClause + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "j"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "k"))))))))) + (CompoundStatement + (TryStatement + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "a"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b")))))) + (FinallyClause + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "a"))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b")))))))))) diff --git a/semantic/test/fixtures/python/corpus/try-statement.parseB.txt b/semantic/test/fixtures/python/corpus/try-statement.parseB.txt new file mode 100644 index 0000000000..6a78f8fa38 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/try-statement.parseB.txt @@ -0,0 +1,67 @@ +(Module + (CompoundStatement + (TryStatement + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "b")))))) + (FinallyClause + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "c"))))))))) + (CompoundStatement + (TryStatement + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "e")))))) + (ExceptClause + (Expression + (PrimaryExpression + (Identifier "f"))) + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "d"))))))) + (ExceptClause + (Expression + (PrimaryExpression + (Identifier "g"))) + (Expression + (PrimaryExpression + (Identifier "h"))) + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "a"))))))) + (ExceptClause + (Expression + (PrimaryExpression + (Identifier "i"))) + (Expression + (PrimaryExpression + (Identifier "j"))) + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "k"))))))) + (ExceptClause + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "l")))))))))) diff --git a/test/fixtures/python/corpus/tuple.A.py b/semantic/test/fixtures/python/corpus/tuple.A.py similarity index 100% rename from test/fixtures/python/corpus/tuple.A.py rename to semantic/test/fixtures/python/corpus/tuple.A.py diff --git a/test/fixtures/python/corpus/tuple.B.py b/semantic/test/fixtures/python/corpus/tuple.B.py similarity index 100% rename from test/fixtures/python/corpus/tuple.B.py rename to semantic/test/fixtures/python/corpus/tuple.B.py diff --git a/test/fixtures/python/corpus/tuple.diffA-B.txt b/semantic/test/fixtures/python/corpus/tuple.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/tuple.diffA-B.txt rename to semantic/test/fixtures/python/corpus/tuple.diffA-B.txt diff --git a/test/fixtures/python/corpus/tuple.diffB-A.txt b/semantic/test/fixtures/python/corpus/tuple.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/tuple.diffB-A.txt rename to semantic/test/fixtures/python/corpus/tuple.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/tuple.parseA.txt b/semantic/test/fixtures/python/corpus/tuple.parseA.txt new file mode 100644 index 0000000000..772182734f --- /dev/null +++ b/semantic/test/fixtures/python/corpus/tuple.parseA.txt @@ -0,0 +1,26 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Tuple + (Expression + (PrimaryExpression + (Identifier "a"))) + (Expression + (PrimaryExpression + (Identifier "b")))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Tuple + (Expression + (PrimaryExpression + (Identifier "a"))) + (Expression + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "c"))))))))) diff --git a/semantic/test/fixtures/python/corpus/tuple.parseB.txt b/semantic/test/fixtures/python/corpus/tuple.parseB.txt new file mode 100644 index 0000000000..c8637e676f --- /dev/null +++ b/semantic/test/fixtures/python/corpus/tuple.parseB.txt @@ -0,0 +1,34 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Tuple + (Expression + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "c"))) + (Expression + (PrimaryExpression + (Identifier "a")))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Tuple + (Expression + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "c")))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (ParenthesizedExpression + (Expression + (PrimaryExpression + (Identifier "a"))))))))) diff --git a/test/fixtures/python/corpus/unary-operator.A.py b/semantic/test/fixtures/python/corpus/unary-operator.A.py similarity index 100% rename from test/fixtures/python/corpus/unary-operator.A.py rename to semantic/test/fixtures/python/corpus/unary-operator.A.py diff --git a/test/fixtures/python/corpus/unary-operator.B.py b/semantic/test/fixtures/python/corpus/unary-operator.B.py similarity index 100% rename from test/fixtures/python/corpus/unary-operator.B.py rename to semantic/test/fixtures/python/corpus/unary-operator.B.py diff --git a/test/fixtures/python/corpus/unary-operator.diffA-B.txt b/semantic/test/fixtures/python/corpus/unary-operator.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/unary-operator.diffA-B.txt rename to semantic/test/fixtures/python/corpus/unary-operator.diffA-B.txt diff --git a/semantic/test/fixtures/python/corpus/unary-operator.diffB-A.txt b/semantic/test/fixtures/python/corpus/unary-operator.diffB-A.txt new file mode 100644 index 0000000000..00f0a0845b --- /dev/null +++ b/semantic/test/fixtures/python/corpus/unary-operator.diffB-A.txt @@ -0,0 +1,11 @@ +(Statements +{+(Negate + {+(Identifier)+})+} +{+(Identifier)+} +{+(Complement + {+(Identifier)+})+} +{-(Complement + {-(Identifier)-})-} +{-(Negate + {-(Identifier)-})-} +{-(Identifier)-}) diff --git a/semantic/test/fixtures/python/corpus/unary-operator.parseA.txt b/semantic/test/fixtures/python/corpus/unary-operator.parseA.txt new file mode 100644 index 0000000000..17f4bd3179 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/unary-operator.parseA.txt @@ -0,0 +1,25 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Identifier "a"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Identifier "b"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Identifier "c")))))))) diff --git a/semantic/test/fixtures/python/corpus/unary-operator.parseB.txt b/semantic/test/fixtures/python/corpus/unary-operator.parseB.txt new file mode 100644 index 0000000000..17f4bd3179 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/unary-operator.parseB.txt @@ -0,0 +1,25 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Identifier "a"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Identifier "b"))))))) + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (UnaryOperator + (Token) + (PrimaryExpression + (Identifier "c")))))))) diff --git a/test/fixtures/python/corpus/while-statement.A.py b/semantic/test/fixtures/python/corpus/while-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/while-statement.A.py rename to semantic/test/fixtures/python/corpus/while-statement.A.py diff --git a/test/fixtures/python/corpus/while-statement.B.py b/semantic/test/fixtures/python/corpus/while-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/while-statement.B.py rename to semantic/test/fixtures/python/corpus/while-statement.B.py diff --git a/test/fixtures/python/corpus/while-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/while-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/while-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/while-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/while-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/while-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/while-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/while-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/while-statement.parseA.txt b/semantic/test/fixtures/python/corpus/while-statement.parseA.txt new file mode 100644 index 0000000000..4be9d15680 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/while-statement.parseA.txt @@ -0,0 +1,13 @@ +(Module + (CompoundStatement + (WhileStatement + (Block + (SimpleStatement + (PassStatement "pass")) + (SimpleStatement + (BreakStatement "break")) + (SimpleStatement + (ContinueStatement "continue"))) + (Expression + (PrimaryExpression + (Identifier "true")))))) diff --git a/semantic/test/fixtures/python/corpus/while-statement.parseB.txt b/semantic/test/fixtures/python/corpus/while-statement.parseB.txt new file mode 100644 index 0000000000..e72981f036 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/while-statement.parseB.txt @@ -0,0 +1,13 @@ +(Module + (CompoundStatement + (WhileStatement + (Block + (SimpleStatement + (BreakStatement "break")) + (SimpleStatement + (ContinueStatement "continue")) + (SimpleStatement + (PassStatement "pass"))) + (Expression + (PrimaryExpression + (Identifier "false")))))) diff --git a/test/fixtures/python/corpus/with-statement.A.py b/semantic/test/fixtures/python/corpus/with-statement.A.py similarity index 100% rename from test/fixtures/python/corpus/with-statement.A.py rename to semantic/test/fixtures/python/corpus/with-statement.A.py diff --git a/test/fixtures/python/corpus/with-statement.B.py b/semantic/test/fixtures/python/corpus/with-statement.B.py similarity index 100% rename from test/fixtures/python/corpus/with-statement.B.py rename to semantic/test/fixtures/python/corpus/with-statement.B.py diff --git a/test/fixtures/python/corpus/with-statement.diffA-B.txt b/semantic/test/fixtures/python/corpus/with-statement.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/with-statement.diffA-B.txt rename to semantic/test/fixtures/python/corpus/with-statement.diffA-B.txt diff --git a/test/fixtures/python/corpus/with-statement.diffB-A.txt b/semantic/test/fixtures/python/corpus/with-statement.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/with-statement.diffB-A.txt rename to semantic/test/fixtures/python/corpus/with-statement.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/with-statement.parseA.txt b/semantic/test/fixtures/python/corpus/with-statement.parseA.txt new file mode 100644 index 0000000000..963cbe6828 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/with-statement.parseA.txt @@ -0,0 +1,16 @@ +(Module + (CompoundStatement + (WithStatement + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "c")))))) + (WithItem + (Expression + (PrimaryExpression + (Identifier "a"))) + (Expression + (PrimaryExpression + (Identifier "b"))))))) diff --git a/semantic/test/fixtures/python/corpus/with-statement.parseB.txt b/semantic/test/fixtures/python/corpus/with-statement.parseB.txt new file mode 100644 index 0000000000..cec281db42 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/with-statement.parseB.txt @@ -0,0 +1,16 @@ +(Module + (CompoundStatement + (WithStatement + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "a")))))) + (WithItem + (Expression + (PrimaryExpression + (Identifier "b"))) + (Expression + (PrimaryExpression + (Identifier "c"))))))) diff --git a/test/fixtures/python/corpus/with.A.py b/semantic/test/fixtures/python/corpus/with.A.py similarity index 100% rename from test/fixtures/python/corpus/with.A.py rename to semantic/test/fixtures/python/corpus/with.A.py diff --git a/test/fixtures/python/corpus/with.B.py b/semantic/test/fixtures/python/corpus/with.B.py similarity index 100% rename from test/fixtures/python/corpus/with.B.py rename to semantic/test/fixtures/python/corpus/with.B.py diff --git a/test/fixtures/python/corpus/with.diffA-B.txt b/semantic/test/fixtures/python/corpus/with.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/with.diffA-B.txt rename to semantic/test/fixtures/python/corpus/with.diffA-B.txt diff --git a/test/fixtures/python/corpus/with.diffB-A.txt b/semantic/test/fixtures/python/corpus/with.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/with.diffB-A.txt rename to semantic/test/fixtures/python/corpus/with.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/with.parseA.txt b/semantic/test/fixtures/python/corpus/with.parseA.txt new file mode 100644 index 0000000000..378d6c20e2 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/with.parseA.txt @@ -0,0 +1,52 @@ +(Module + (CompoundStatement + (WithStatement + (Block + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "found")))) + (ExpressionList + (Expression + (PrimaryExpression + (False "False"))))))) + (CompoundStatement + (ForStatement + (Block + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "found")))) + (ExpressionList + (Expression + (PrimaryExpression + (True "True")))))))) + (Variables + (PrimaryExpression + (Identifier "line"))) + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "lines"))))))) + (WithItem + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Identifier "open")) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "nsfile"))) + (Expression + (PrimaryExpression + (String))))))) + (Expression + (PrimaryExpression + (Identifier "f"))))))) diff --git a/semantic/test/fixtures/python/corpus/with.parseB.txt b/semantic/test/fixtures/python/corpus/with.parseB.txt new file mode 100644 index 0000000000..94cc95bd21 --- /dev/null +++ b/semantic/test/fixtures/python/corpus/with.parseB.txt @@ -0,0 +1,68 @@ +(Module + (CompoundStatement + (WithStatement + (Block + (SimpleStatement + (ExpressionStatement + (Assignment + (ExpressionList + (Expression + (PrimaryExpression + (Identifier "found")))) + (ExpressionList + (Expression + (PrimaryExpression + (False "False")))))))) + (WithItem + (Expression + (PrimaryExpression + (Attribute + (Identifier "_lock") + (PrimaryExpression + (Identifier "cls")))))))) + (CompoundStatement + (WithStatement + (Block + (SimpleStatement + (ExpressionStatement + (Expression + (PrimaryExpression + (Identifier "x")))))) + (WithItem + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Attribute + (Identifier "object") + (PrimaryExpression + (Identifier "patch")))) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "sys"))) + (Expression + (PrimaryExpression + (String))) + (Expression + (PrimaryExpression + (Identifier "stdout")))))))) + (WithItem + (Expression + (PrimaryExpression + (Call + (PrimaryExpression + (Attribute + (Identifier "object") + (PrimaryExpression + (Identifier "patch")))) + (ArgumentList + (Expression + (PrimaryExpression + (Identifier "sys"))) + (Expression + (PrimaryExpression + (String))) + (Expression + (PrimaryExpression + (Identifier "stderr"))))))))))) diff --git a/test/fixtures/python/corpus/yield.A.py b/semantic/test/fixtures/python/corpus/yield.A.py similarity index 100% rename from test/fixtures/python/corpus/yield.A.py rename to semantic/test/fixtures/python/corpus/yield.A.py diff --git a/test/fixtures/python/corpus/yield.B.py b/semantic/test/fixtures/python/corpus/yield.B.py similarity index 100% rename from test/fixtures/python/corpus/yield.B.py rename to semantic/test/fixtures/python/corpus/yield.B.py diff --git a/test/fixtures/python/corpus/yield.diffA-B.txt b/semantic/test/fixtures/python/corpus/yield.diffA-B.txt similarity index 100% rename from test/fixtures/python/corpus/yield.diffA-B.txt rename to semantic/test/fixtures/python/corpus/yield.diffA-B.txt diff --git a/test/fixtures/python/corpus/yield.diffB-A.txt b/semantic/test/fixtures/python/corpus/yield.diffB-A.txt similarity index 100% rename from test/fixtures/python/corpus/yield.diffB-A.txt rename to semantic/test/fixtures/python/corpus/yield.diffB-A.txt diff --git a/semantic/test/fixtures/python/corpus/yield.parseA.txt b/semantic/test/fixtures/python/corpus/yield.parseA.txt new file mode 100644 index 0000000000..54f65d9fab --- /dev/null +++ b/semantic/test/fixtures/python/corpus/yield.parseA.txt @@ -0,0 +1,4 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Yield)))) diff --git a/semantic/test/fixtures/python/corpus/yield.parseB.txt b/semantic/test/fixtures/python/corpus/yield.parseB.txt new file mode 100644 index 0000000000..67f59180cb --- /dev/null +++ b/semantic/test/fixtures/python/corpus/yield.parseB.txt @@ -0,0 +1,7 @@ +(Module + (SimpleStatement + (ExpressionStatement + (Yield))) + (SimpleStatement + (ExpressionStatement + (Yield)))) diff --git a/test/fixtures/python/graphing/conditional/conditional.py b/semantic/test/fixtures/python/graphing/conditional/conditional.py similarity index 100% rename from test/fixtures/python/graphing/conditional/conditional.py rename to semantic/test/fixtures/python/graphing/conditional/conditional.py diff --git a/test/fixtures/python/graphing/simple/simple.py b/semantic/test/fixtures/python/graphing/simple/simple.py similarity index 100% rename from test/fixtures/python/graphing/simple/simple.py rename to semantic/test/fixtures/python/graphing/simple/simple.py diff --git a/test/fixtures/python/graphing/typeerror/typeerror.py b/semantic/test/fixtures/python/graphing/typeerror/typeerror.py similarity index 100% rename from test/fixtures/python/graphing/typeerror/typeerror.py rename to semantic/test/fixtures/python/graphing/typeerror/typeerror.py diff --git a/test/fixtures/python/graphing/unbound/unbound.py b/semantic/test/fixtures/python/graphing/unbound/unbound.py similarity index 100% rename from test/fixtures/python/graphing/unbound/unbound.py rename to semantic/test/fixtures/python/graphing/unbound/unbound.py diff --git a/test/fixtures/python/import-graph/main.json b/semantic/test/fixtures/python/import-graph/main.json similarity index 100% rename from test/fixtures/python/import-graph/main.json rename to semantic/test/fixtures/python/import-graph/main.json diff --git a/test/fixtures/python/import-graph/main.py b/semantic/test/fixtures/python/import-graph/main.py similarity index 100% rename from test/fixtures/python/import-graph/main.py rename to semantic/test/fixtures/python/import-graph/main.py diff --git a/test/fixtures/python/matching/docstrings.py b/semantic/test/fixtures/python/matching/docstrings.py similarity index 100% rename from test/fixtures/python/matching/docstrings.py rename to semantic/test/fixtures/python/matching/docstrings.py diff --git a/test/fixtures/python/matching/docstrings_nested.py b/semantic/test/fixtures/python/matching/docstrings_nested.py similarity index 100% rename from test/fixtures/python/matching/docstrings_nested.py rename to semantic/test/fixtures/python/matching/docstrings_nested.py diff --git a/test/fixtures/python/reprinting/function.out.py b/semantic/test/fixtures/python/reprinting/function.out.py similarity index 100% rename from test/fixtures/python/reprinting/function.out.py rename to semantic/test/fixtures/python/reprinting/function.out.py diff --git a/test/fixtures/python/reprinting/function.py b/semantic/test/fixtures/python/reprinting/function.py similarity index 100% rename from test/fixtures/python/reprinting/function.py rename to semantic/test/fixtures/python/reprinting/function.py diff --git a/test/fixtures/python/tags/class.py b/semantic/test/fixtures/python/tags/class.py similarity index 100% rename from test/fixtures/python/tags/class.py rename to semantic/test/fixtures/python/tags/class.py diff --git a/test/fixtures/python/tags/multiline.py b/semantic/test/fixtures/python/tags/multiline.py similarity index 100% rename from test/fixtures/python/tags/multiline.py rename to semantic/test/fixtures/python/tags/multiline.py diff --git a/test/fixtures/python/tags/simple_function_with_docs.py b/semantic/test/fixtures/python/tags/simple_function_with_docs.py similarity index 100% rename from test/fixtures/python/tags/simple_function_with_docs.py rename to semantic/test/fixtures/python/tags/simple_function_with_docs.py diff --git a/test/fixtures/python/tags/simple_functions.py b/semantic/test/fixtures/python/tags/simple_functions.py similarity index 100% rename from test/fixtures/python/tags/simple_functions.py rename to semantic/test/fixtures/python/tags/simple_functions.py diff --git a/test/fixtures/ruby/analysis/break.rb b/semantic/test/fixtures/ruby/analysis/break.rb similarity index 80% rename from test/fixtures/ruby/analysis/break.rb rename to semantic/test/fixtures/ruby/analysis/break.rb index 2be1a64629..fbe1aaca89 100644 --- a/test/fixtures/ruby/analysis/break.rb +++ b/semantic/test/fixtures/ruby/analysis/break.rb @@ -1,6 +1,6 @@ ii = 0 while ii < 5 - ii += 1 + ii = ii + 1 if ii == 3 break end diff --git a/test/fixtures/ruby/analysis/call.rb b/semantic/test/fixtures/ruby/analysis/call.rb similarity index 100% rename from test/fixtures/ruby/analysis/call.rb rename to semantic/test/fixtures/ruby/analysis/call.rb diff --git a/test/fixtures/ruby/analysis/classes.rb b/semantic/test/fixtures/ruby/analysis/classes.rb similarity index 100% rename from test/fixtures/ruby/analysis/classes.rb rename to semantic/test/fixtures/ruby/analysis/classes.rb diff --git a/test/fixtures/ruby/analysis/early-return.rb b/semantic/test/fixtures/ruby/analysis/early-return.rb similarity index 100% rename from test/fixtures/ruby/analysis/early-return.rb rename to semantic/test/fixtures/ruby/analysis/early-return.rb diff --git a/test/fixtures/ruby/analysis/foo.rb b/semantic/test/fixtures/ruby/analysis/foo.rb similarity index 100% rename from test/fixtures/ruby/analysis/foo.rb rename to semantic/test/fixtures/ruby/analysis/foo.rb diff --git a/test/fixtures/ruby/analysis/line.rb b/semantic/test/fixtures/ruby/analysis/line.rb similarity index 100% rename from test/fixtures/ruby/analysis/line.rb rename to semantic/test/fixtures/ruby/analysis/line.rb diff --git a/test/fixtures/ruby/analysis/load-wrap.rb b/semantic/test/fixtures/ruby/analysis/load-wrap.rb similarity index 100% rename from test/fixtures/ruby/analysis/load-wrap.rb rename to semantic/test/fixtures/ruby/analysis/load-wrap.rb diff --git a/test/fixtures/ruby/analysis/load.rb b/semantic/test/fixtures/ruby/analysis/load.rb similarity index 100% rename from test/fixtures/ruby/analysis/load.rb rename to semantic/test/fixtures/ruby/analysis/load.rb diff --git a/test/fixtures/ruby/analysis/main.rb b/semantic/test/fixtures/ruby/analysis/main.rb similarity index 100% rename from test/fixtures/ruby/analysis/main.rb rename to semantic/test/fixtures/ruby/analysis/main.rb diff --git a/test/fixtures/ruby/analysis/modules.rb b/semantic/test/fixtures/ruby/analysis/modules.rb similarity index 100% rename from test/fixtures/ruby/analysis/modules.rb rename to semantic/test/fixtures/ruby/analysis/modules.rb diff --git a/test/fixtures/ruby/analysis/next.rb b/semantic/test/fixtures/ruby/analysis/next.rb similarity index 76% rename from test/fixtures/ruby/analysis/next.rb rename to semantic/test/fixtures/ruby/analysis/next.rb index d037a4e27f..23a9556ef4 100644 --- a/test/fixtures/ruby/analysis/next.rb +++ b/semantic/test/fixtures/ruby/analysis/next.rb @@ -1,8 +1,8 @@ ii = 0 jj = 0 while ii < 5 - ii += 1 - jj += 1 + ii = ii + 1 + jj = jj + 1 if (ii == 3) && (jj == 3) ii = 0 next diff --git a/test/fixtures/ruby/analysis/preluded.rb b/semantic/test/fixtures/ruby/analysis/preluded.rb similarity index 100% rename from test/fixtures/ruby/analysis/preluded.rb rename to semantic/test/fixtures/ruby/analysis/preluded.rb diff --git a/test/fixtures/ruby/analysis/puts.rb b/semantic/test/fixtures/ruby/analysis/puts.rb similarity index 100% rename from test/fixtures/ruby/analysis/puts.rb rename to semantic/test/fixtures/ruby/analysis/puts.rb diff --git a/test/fixtures/ruby/analysis/src/foo.rb b/semantic/test/fixtures/ruby/analysis/src/foo.rb similarity index 100% rename from test/fixtures/ruby/analysis/src/foo.rb rename to semantic/test/fixtures/ruby/analysis/src/foo.rb diff --git a/test/fixtures/ruby/analysis/src/main.rb b/semantic/test/fixtures/ruby/analysis/src/main.rb similarity index 100% rename from test/fixtures/ruby/analysis/src/main.rb rename to semantic/test/fixtures/ruby/analysis/src/main.rb diff --git a/test/fixtures/ruby/analysis/subclass.rb b/semantic/test/fixtures/ruby/analysis/subclass.rb similarity index 100% rename from test/fixtures/ruby/analysis/subclass.rb rename to semantic/test/fixtures/ruby/analysis/subclass.rb diff --git a/test/fixtures/ruby/corpus/alias.A.rb b/semantic/test/fixtures/ruby/corpus/alias.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/alias.A.rb rename to semantic/test/fixtures/ruby/corpus/alias.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/alias.parseA.txt b/semantic/test/fixtures/ruby/corpus/alias.parseA.txt new file mode 100644 index 0000000000..b314381c25 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/alias.parseA.txt @@ -0,0 +1,33 @@ +(Program + (Statement + (Alias + (MethodName + (Symbol)) + (MethodName + (Symbol)))) + (Statement + (Alias + (MethodName + (Identifier "bar")) + (MethodName + (Identifier "foo")))) + (Statement + (Alias + (MethodName + (GlobalVariable "$&")) + (MethodName + (GlobalVariable "$FOO")))) + (Statement + (Alias + (MethodName + (Operator "+")) + (MethodName + (Identifier "foo")))) + (Statement + (Alias + (MethodName + (Setter + (Identifier "bar"))) + (MethodName + (Setter + (Identifier "foo")))))) diff --git a/test/fixtures/ruby/corpus/and-or.A.rb b/semantic/test/fixtures/ruby/corpus/and-or.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/and-or.A.rb rename to semantic/test/fixtures/ruby/corpus/and-or.A.rb diff --git a/test/fixtures/ruby/corpus/and-or.B.rb b/semantic/test/fixtures/ruby/corpus/and-or.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/and-or.B.rb rename to semantic/test/fixtures/ruby/corpus/and-or.B.rb diff --git a/test/fixtures/ruby/corpus/and-or.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/and-or.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/and-or.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/and-or.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/and-or.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/and-or.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/and-or.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/and-or.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/and-or.parseA.txt b/semantic/test/fixtures/ruby/corpus/and-or.parseA.txt new file mode 100644 index 0000000000..9d8751ddc6 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/and-or.parseA.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar")))))))) diff --git a/semantic/test/fixtures/ruby/corpus/and-or.parseB.txt b/semantic/test/fixtures/ruby/corpus/and-or.parseB.txt new file mode 100644 index 0000000000..2dc8f76274 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/and-or.parseB.txt @@ -0,0 +1,35 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))) + (Statement + (Binary + (Token) + (Arg + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "c")))))))) diff --git a/test/fixtures/ruby/corpus/array.A.rb b/semantic/test/fixtures/ruby/corpus/array.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/array.A.rb rename to semantic/test/fixtures/ruby/corpus/array.A.rb diff --git a/test/fixtures/ruby/corpus/array.B.rb b/semantic/test/fixtures/ruby/corpus/array.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/array.B.rb rename to semantic/test/fixtures/ruby/corpus/array.B.rb diff --git a/test/fixtures/ruby/corpus/array.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/array.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/array.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/array.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/array.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/array.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/array.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/array.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/array.parseA.txt b/semantic/test/fixtures/ruby/corpus/array.parseA.txt new file mode 100644 index 0000000000..a7a40ce5fb --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/array.parseA.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (Arg + (Primary + (Array + (Arg + (Primary + (Integer "1"))) + (Arg + (Primary + (Integer "2"))) + (Arg + (Primary + (Integer "3")))))))) diff --git a/semantic/test/fixtures/ruby/corpus/array.parseB.txt b/semantic/test/fixtures/ruby/corpus/array.parseB.txt new file mode 100644 index 0000000000..c35ed7adf8 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/array.parseB.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (Arg + (Primary + (Array + (Arg + (Primary + (String))) + (Arg + (Primary + (String))) + (Arg + (Primary + (String)))))))) diff --git a/test/fixtures/ruby/corpus/assignment.A.rb b/semantic/test/fixtures/ruby/corpus/assignment.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/assignment.A.rb rename to semantic/test/fixtures/ruby/corpus/assignment.A.rb diff --git a/test/fixtures/ruby/corpus/assignment.B.rb b/semantic/test/fixtures/ruby/corpus/assignment.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/assignment.B.rb rename to semantic/test/fixtures/ruby/corpus/assignment.B.rb diff --git a/test/fixtures/ruby/corpus/assignment.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/assignment.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/assignment.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/assignment.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/assignment.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/assignment.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/assignment.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/assignment.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/assignment.parseA.txt b/semantic/test/fixtures/ruby/corpus/assignment.parseA.txt new file mode 100644 index 0000000000..6cd58ec816 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/assignment.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Assignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "0")))))) diff --git a/semantic/test/fixtures/ruby/corpus/assignment.parseB.txt b/semantic/test/fixtures/ruby/corpus/assignment.parseB.txt new file mode 100644 index 0000000000..5e95f451d9 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/assignment.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Assignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "1")))))) diff --git a/test/fixtures/ruby/corpus/begin-block.A.rb b/semantic/test/fixtures/ruby/corpus/begin-block.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/begin-block.A.rb rename to semantic/test/fixtures/ruby/corpus/begin-block.A.rb diff --git a/test/fixtures/ruby/corpus/begin-block.B.rb b/semantic/test/fixtures/ruby/corpus/begin-block.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/begin-block.B.rb rename to semantic/test/fixtures/ruby/corpus/begin-block.B.rb diff --git a/test/fixtures/ruby/corpus/begin-block.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/begin-block.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/begin-block.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/begin-block.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/begin-block.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/begin-block.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/begin-block.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/begin-block.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/begin-block.parseA.txt b/semantic/test/fixtures/ruby/corpus/begin-block.parseA.txt new file mode 100644 index 0000000000..e53d7edde8 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/begin-block.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (BeginBlock + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/begin-block.parseB.txt b/semantic/test/fixtures/ruby/corpus/begin-block.parseB.txt new file mode 100644 index 0000000000..7d2af170b6 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/begin-block.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Statement + (BeginBlock + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))))) diff --git a/test/fixtures/ruby/corpus/begin.A.rb b/semantic/test/fixtures/ruby/corpus/begin.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/begin.A.rb rename to semantic/test/fixtures/ruby/corpus/begin.A.rb diff --git a/test/fixtures/ruby/corpus/begin.B.rb b/semantic/test/fixtures/ruby/corpus/begin.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/begin.B.rb rename to semantic/test/fixtures/ruby/corpus/begin.B.rb diff --git a/test/fixtures/ruby/corpus/begin.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/begin.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/begin.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/begin.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/begin.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/begin.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/begin.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/begin.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/begin.parseA.txt b/semantic/test/fixtures/ruby/corpus/begin.parseA.txt new file mode 100644 index 0000000000..a98b6ac27a --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/begin.parseA.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (Statement + (Arg + (Primary + (Begin))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/begin.parseB.txt b/semantic/test/fixtures/ruby/corpus/begin.parseB.txt new file mode 100644 index 0000000000..675fb855bf --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/begin.parseB.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (Statement + (Arg + (Primary + (Begin + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (String)))) + (Variable + (Identifier "puts"))))))))))))) diff --git a/test/fixtures/ruby/corpus/binary.A.rb b/semantic/test/fixtures/ruby/corpus/binary.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/binary.A.rb rename to semantic/test/fixtures/ruby/corpus/binary.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/binary.parseA.txt b/semantic/test/fixtures/ruby/corpus/binary.parseA.txt new file mode 100644 index 0000000000..54d487f615 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/binary.parseA.txt @@ -0,0 +1,300 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b")))))))) diff --git a/test/fixtures/ruby/corpus/bitwise-operator.A.rb b/semantic/test/fixtures/ruby/corpus/bitwise-operator.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/bitwise-operator.A.rb rename to semantic/test/fixtures/ruby/corpus/bitwise-operator.A.rb diff --git a/test/fixtures/ruby/corpus/bitwise-operator.B.rb b/semantic/test/fixtures/ruby/corpus/bitwise-operator.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/bitwise-operator.B.rb rename to semantic/test/fixtures/ruby/corpus/bitwise-operator.B.rb diff --git a/test/fixtures/ruby/corpus/bitwise-operator.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/bitwise-operator.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/bitwise-operator.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/bitwise-operator.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/bitwise-operator.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/bitwise-operator.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/bitwise-operator.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/bitwise-operator.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/bitwise-operator.parseA.txt b/semantic/test/fixtures/ruby/corpus/bitwise-operator.parseA.txt new file mode 100644 index 0000000000..7205d2e94d --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/bitwise-operator.parseA.txt @@ -0,0 +1,40 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b")))))))) diff --git a/semantic/test/fixtures/ruby/corpus/bitwise-operator.parseB.txt b/semantic/test/fixtures/ruby/corpus/bitwise-operator.parseB.txt new file mode 100644 index 0000000000..237d1f7602 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/bitwise-operator.parseB.txt @@ -0,0 +1,27 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b")))))))) diff --git a/test/fixtures/ruby/corpus/boolean-operator.A.rb b/semantic/test/fixtures/ruby/corpus/boolean-operator.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/boolean-operator.A.rb rename to semantic/test/fixtures/ruby/corpus/boolean-operator.A.rb diff --git a/test/fixtures/ruby/corpus/boolean-operator.B.rb b/semantic/test/fixtures/ruby/corpus/boolean-operator.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/boolean-operator.B.rb rename to semantic/test/fixtures/ruby/corpus/boolean-operator.B.rb diff --git a/test/fixtures/ruby/corpus/boolean-operator.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/boolean-operator.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/boolean-operator.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/boolean-operator.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/boolean-operator.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/boolean-operator.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/boolean-operator.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/boolean-operator.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/boolean-operator.parseA.txt b/semantic/test/fixtures/ruby/corpus/boolean-operator.parseA.txt new file mode 100644 index 0000000000..2154e4d3bf --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/boolean-operator.parseA.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b")))))))) diff --git a/semantic/test/fixtures/ruby/corpus/boolean-operator.parseB.txt b/semantic/test/fixtures/ruby/corpus/boolean-operator.parseB.txt new file mode 100644 index 0000000000..2154e4d3bf --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/boolean-operator.parseB.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b")))))))) diff --git a/test/fixtures/ruby/corpus/break.A.rb b/semantic/test/fixtures/ruby/corpus/break.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/break.A.rb rename to semantic/test/fixtures/ruby/corpus/break.A.rb diff --git a/test/fixtures/ruby/corpus/break.B.rb b/semantic/test/fixtures/ruby/corpus/break.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/break.B.rb rename to semantic/test/fixtures/ruby/corpus/break.B.rb diff --git a/test/fixtures/ruby/corpus/break.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/break.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/break.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/break.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/break.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/break.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/break.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/break.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/break.parseA.txt b/semantic/test/fixtures/ruby/corpus/break.parseA.txt new file mode 100644 index 0000000000..ab7fdff85b --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/break.parseA.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Arg + (Primary + (While + (Do + (Statement + (Break))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b")))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/break.parseB.txt b/semantic/test/fixtures/ruby/corpus/break.parseB.txt new file mode 100644 index 0000000000..ee0c49102f --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/break.parseB.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Arg + (Primary + (Until + (Do + (Statement + (Break))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b")))))))))) diff --git a/test/fixtures/ruby/corpus/calls.A.rb b/semantic/test/fixtures/ruby/corpus/calls.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/calls.A.rb rename to semantic/test/fixtures/ruby/corpus/calls.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/calls.parseA.txt b/semantic/test/fixtures/ruby/corpus/calls.parseA.txt new file mode 100644 index 0000000000..ae785549bb --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/calls.parseA.txt @@ -0,0 +1,88 @@ +(Program + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))) + (Pair + (Arg + (Primary + (Integer "1"))) + (Symbol)) + (Pair + (Arg + (Primary + (Lhs + (True "true")))) + (Symbol))) + (Variable + (Identifier "foo")))) + (Statement + (MethodCall + (ArgumentList) + (Call + (Primary + (Lhs + (Variable + (Identifier "a")))) + (Identifier "b")))) + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (ParenthesizedStatements + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a")))))) + (Variable + (Identifier "foo")))) + (Statement + (MethodCall + (ArgumentList + (BlockArgument + (Arg + (Primary + (Lhs + (Variable + (Identifier "block"))))))) + (Variable + (Identifier "foo")))) + (Statement + (MethodCall + (ArgumentList + (SplatArgument + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))))) + (Variable + (Identifier "foo")))) + (Statement + (MethodCall + (ArgumentList + (HashSplatArgument + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Variable + (Identifier "foo"))))) diff --git a/test/fixtures/ruby/corpus/chained-string.A.rb b/semantic/test/fixtures/ruby/corpus/chained-string.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/chained-string.A.rb rename to semantic/test/fixtures/ruby/corpus/chained-string.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/chained-string.parseA.txt b/semantic/test/fixtures/ruby/corpus/chained-string.parseA.txt new file mode 100644 index 0000000000..7c49f42610 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/chained-string.parseA.txt @@ -0,0 +1,7 @@ +(Program + (Statement + (Arg + (Primary + (ChainedString + (String) + (String)))))) diff --git a/test/fixtures/ruby/corpus/class.A.rb b/semantic/test/fixtures/ruby/corpus/class.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/class.A.rb rename to semantic/test/fixtures/ruby/corpus/class.A.rb diff --git a/test/fixtures/ruby/corpus/class.B.rb b/semantic/test/fixtures/ruby/corpus/class.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/class.B.rb rename to semantic/test/fixtures/ruby/corpus/class.B.rb diff --git a/test/fixtures/ruby/corpus/class.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/class.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/class.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/class.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/class.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/class.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/class.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/class.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/class.parseA.txt b/semantic/test/fixtures/ruby/corpus/class.parseA.txt new file mode 100644 index 0000000000..bbb9ac5a6e --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/class.parseA.txt @@ -0,0 +1,28 @@ +(Program + (Statement + (Arg + (Primary + (Class + (Constant "Foo") + (Superclass + (Arg + (Primary + (Lhs + (Variable + (Constant "Super")))))) + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "test")))))))))) + (Statement + (Arg + (Primary + (Class + (ScopeResolution + (Constant "Bar") + (Primary + (Lhs + (Variable + (Constant "Foo")))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/class.parseB.txt b/semantic/test/fixtures/ruby/corpus/class.parseB.txt new file mode 100644 index 0000000000..338584149d --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/class.parseB.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (Arg + (Primary + (Class + (Constant "Foo") + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "test"))))))))))) diff --git a/test/fixtures/ruby/corpus/comment.A.rb b/semantic/test/fixtures/ruby/corpus/comment.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/comment.A.rb rename to semantic/test/fixtures/ruby/corpus/comment.A.rb diff --git a/test/fixtures/ruby/corpus/comment.B.rb b/semantic/test/fixtures/ruby/corpus/comment.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/comment.B.rb rename to semantic/test/fixtures/ruby/corpus/comment.B.rb diff --git a/test/fixtures/ruby/corpus/comment.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/comment.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/comment.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/comment.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/comment.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/comment.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/comment.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/comment.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/comment.parseA.txt b/semantic/test/fixtures/ruby/corpus/comment.parseA.txt new file mode 100644 index 0000000000..0b05546cdb --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/comment.parseA.txt @@ -0,0 +1 @@ +(Program) diff --git a/semantic/test/fixtures/ruby/corpus/comment.parseB.txt b/semantic/test/fixtures/ruby/corpus/comment.parseB.txt new file mode 100644 index 0000000000..0b05546cdb --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/comment.parseB.txt @@ -0,0 +1 @@ +(Program) diff --git a/test/fixtures/ruby/corpus/comparision-operator.A.rb b/semantic/test/fixtures/ruby/corpus/comparision-operator.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/comparision-operator.A.rb rename to semantic/test/fixtures/ruby/corpus/comparision-operator.A.rb diff --git a/test/fixtures/ruby/corpus/comparision-operator.B.rb b/semantic/test/fixtures/ruby/corpus/comparision-operator.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/comparision-operator.B.rb rename to semantic/test/fixtures/ruby/corpus/comparision-operator.B.rb diff --git a/test/fixtures/ruby/corpus/comparision-operator.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/comparision-operator.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/comparision-operator.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/comparision-operator.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/comparision-operator.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/comparision-operator.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/comparision-operator.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/comparision-operator.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/comparision-operator.parseA.txt b/semantic/test/fixtures/ruby/corpus/comparision-operator.parseA.txt new file mode 100644 index 0000000000..38dde10dfa --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/comparision-operator.parseA.txt @@ -0,0 +1,27 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "x"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "y"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b")))))))) diff --git a/semantic/test/fixtures/ruby/corpus/comparision-operator.parseB.txt b/semantic/test/fixtures/ruby/corpus/comparision-operator.parseB.txt new file mode 100644 index 0000000000..38dde10dfa --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/comparision-operator.parseB.txt @@ -0,0 +1,27 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "x"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "y"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b")))))))) diff --git a/test/fixtures/ruby/corpus/conditional-assignment.A.rb b/semantic/test/fixtures/ruby/corpus/conditional-assignment.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/conditional-assignment.A.rb rename to semantic/test/fixtures/ruby/corpus/conditional-assignment.A.rb diff --git a/test/fixtures/ruby/corpus/conditional-assignment.B.rb b/semantic/test/fixtures/ruby/corpus/conditional-assignment.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/conditional-assignment.B.rb rename to semantic/test/fixtures/ruby/corpus/conditional-assignment.B.rb diff --git a/test/fixtures/ruby/corpus/conditional-assignment.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/conditional-assignment.diffA-B.txt similarity index 78% rename from test/fixtures/ruby/corpus/conditional-assignment.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/conditional-assignment.diffA-B.txt index 19b9919b84..b4e38fce2d 100644 --- a/test/fixtures/ruby/corpus/conditional-assignment.diffA-B.txt +++ b/semantic/test/fixtures/ruby/corpus/conditional-assignment.diffA-B.txt @@ -1,6 +1,5 @@ (Statements - (Assignment - (Identifier) + (AugmentedAssignment { (Or {-(Identifier)-} {-(Integer)-}) diff --git a/test/fixtures/ruby/corpus/conditional-assignment.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/conditional-assignment.diffB-A.txt similarity index 78% rename from test/fixtures/ruby/corpus/conditional-assignment.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/conditional-assignment.diffB-A.txt index bc096df4e9..f7672a33e6 100644 --- a/test/fixtures/ruby/corpus/conditional-assignment.diffB-A.txt +++ b/semantic/test/fixtures/ruby/corpus/conditional-assignment.diffB-A.txt @@ -1,6 +1,5 @@ (Statements - (Assignment - (Identifier) + (AugmentedAssignment { (And {-(Identifier)-} {-(Integer)-}) diff --git a/semantic/test/fixtures/ruby/corpus/conditional-assignment.parseA.txt b/semantic/test/fixtures/ruby/corpus/conditional-assignment.parseA.txt new file mode 100644 index 0000000000..7179a51451 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/conditional-assignment.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "5")))))) diff --git a/semantic/test/fixtures/ruby/corpus/conditional-assignment.parseB.txt b/semantic/test/fixtures/ruby/corpus/conditional-assignment.parseB.txt new file mode 100644 index 0000000000..a268694bff --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/conditional-assignment.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "7")))))) diff --git a/test/fixtures/ruby/corpus/delimiter.A.rb b/semantic/test/fixtures/ruby/corpus/delimiter.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/delimiter.A.rb rename to semantic/test/fixtures/ruby/corpus/delimiter.A.rb diff --git a/test/fixtures/ruby/corpus/delimiter.B.rb b/semantic/test/fixtures/ruby/corpus/delimiter.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/delimiter.B.rb rename to semantic/test/fixtures/ruby/corpus/delimiter.B.rb diff --git a/test/fixtures/ruby/corpus/delimiter.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/delimiter.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/delimiter.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/delimiter.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/delimiter.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/delimiter.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/delimiter.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/delimiter.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/delimiter.parseA.txt b/semantic/test/fixtures/ruby/corpus/delimiter.parseA.txt new file mode 100644 index 0000000000..83ecd389cd --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/delimiter.parseA.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String))))) diff --git a/semantic/test/fixtures/ruby/corpus/delimiter.parseB.txt b/semantic/test/fixtures/ruby/corpus/delimiter.parseB.txt new file mode 100644 index 0000000000..83ecd389cd --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/delimiter.parseB.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String))))) diff --git a/test/fixtures/ruby/corpus/element-reference.A.rb b/semantic/test/fixtures/ruby/corpus/element-reference.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/element-reference.A.rb rename to semantic/test/fixtures/ruby/corpus/element-reference.A.rb diff --git a/test/fixtures/ruby/corpus/element-reference.B.rb b/semantic/test/fixtures/ruby/corpus/element-reference.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/element-reference.B.rb rename to semantic/test/fixtures/ruby/corpus/element-reference.B.rb diff --git a/test/fixtures/ruby/corpus/element-reference.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/element-reference.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/element-reference.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/element-reference.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/element-reference.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/element-reference.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/element-reference.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/element-reference.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/element-reference.parseA.txt b/semantic/test/fixtures/ruby/corpus/element-reference.parseA.txt new file mode 100644 index 0000000000..1d2f690f82 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/element-reference.parseA.txt @@ -0,0 +1,43 @@ +(Program + (Statement + (Arg + (Primary + (Lhs + (ElementReference + (Primary + (Lhs + (Variable + (Identifier "foo")))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar")))))))))) + (Statement + (Arg + (Primary + (Lhs + (ElementReference + (Primary + (Lhs + (Variable + (Identifier "foo")))) + (Arg + (Primary + (Symbol)))))))) + (Statement + (Assignment + (Lhs + (ElementReference + (Primary + (Lhs + (Variable + (Identifier "foo")))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))) + (Arg + (Primary + (Integer "1")))))) diff --git a/semantic/test/fixtures/ruby/corpus/element-reference.parseB.txt b/semantic/test/fixtures/ruby/corpus/element-reference.parseB.txt new file mode 100644 index 0000000000..7ffc3d4c52 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/element-reference.parseB.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (Arg + (Primary + (Lhs + (ElementReference + (Primary + (Lhs + (Variable + (Identifier "x")))) + (Arg + (Primary + (String)))))))) + (Statement + (Arg + (Primary + (Lhs + (ElementReference + (Primary + (Lhs + (Variable + (Identifier "x")))) + (Arg + (Primary + (Symbol))))))))) diff --git a/test/fixtures/ruby/corpus/else.A.rb b/semantic/test/fixtures/ruby/corpus/else.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/else.A.rb rename to semantic/test/fixtures/ruby/corpus/else.A.rb diff --git a/test/fixtures/ruby/corpus/else.B.rb b/semantic/test/fixtures/ruby/corpus/else.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/else.B.rb rename to semantic/test/fixtures/ruby/corpus/else.B.rb diff --git a/test/fixtures/ruby/corpus/else.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/else.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/else.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/else.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/else.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/else.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/else.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/else.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/else.parseA.txt b/semantic/test/fixtures/ruby/corpus/else.parseA.txt new file mode 100644 index 0000000000..b35ee2a5ca --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/else.parseA.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (Arg + (Primary + (Begin + (Statement + (MethodCall + (ArgumentList) + (Variable + (Identifier "foo")))) + (Else)))))) diff --git a/semantic/test/fixtures/ruby/corpus/else.parseB.txt b/semantic/test/fixtures/ruby/corpus/else.parseB.txt new file mode 100644 index 0000000000..833554ccff --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/else.parseB.txt @@ -0,0 +1,16 @@ +(Program + (Statement + (Arg + (Primary + (Begin + (Statement + (MethodCall + (ArgumentList) + (Variable + (Identifier "foo")))) + (Else + (Statement + (MethodCall + (ArgumentList) + (Variable + (Identifier "bar")))))))))) diff --git a/test/fixtures/ruby/corpus/elsif.A.rb b/semantic/test/fixtures/ruby/corpus/elsif.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/elsif.A.rb rename to semantic/test/fixtures/ruby/corpus/elsif.A.rb diff --git a/test/fixtures/ruby/corpus/elsif.B.rb b/semantic/test/fixtures/ruby/corpus/elsif.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/elsif.B.rb rename to semantic/test/fixtures/ruby/corpus/elsif.B.rb diff --git a/test/fixtures/ruby/corpus/elsif.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/elsif.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/elsif.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/elsif.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/elsif.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/elsif.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/elsif.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/elsif.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/elsif.parseA.txt b/semantic/test/fixtures/ruby/corpus/elsif.parseA.txt new file mode 100644 index 0000000000..772c6ebc00 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/elsif.parseA.txt @@ -0,0 +1,24 @@ +(Program + (Statement + (Arg + (Primary + (If + (Elsif + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "baz"))))))) + (Then + (Statement + (MethodCall + (ArgumentList) + (Variable + (Identifier "foo"))))) + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/elsif.parseB.txt b/semantic/test/fixtures/ruby/corpus/elsif.parseB.txt new file mode 100644 index 0000000000..a766562f56 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/elsif.parseB.txt @@ -0,0 +1,30 @@ +(Program + (Statement + (Arg + (Primary + (If + (Elsif + (Then + (Statement + (MethodCall + (ArgumentList) + (Variable + (Identifier "qoz"))))) + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "baz"))))))) + (Then + (Statement + (MethodCall + (ArgumentList) + (Variable + (Identifier "foo"))))) + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))))))) diff --git a/test/fixtures/ruby/corpus/empty-statement.A.rb b/semantic/test/fixtures/ruby/corpus/empty-statement.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/empty-statement.A.rb rename to semantic/test/fixtures/ruby/corpus/empty-statement.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/empty-statement.parseA.txt b/semantic/test/fixtures/ruby/corpus/empty-statement.parseA.txt new file mode 100644 index 0000000000..04d0dd4fac --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/empty-statement.parseA.txt @@ -0,0 +1,2 @@ +(Program + (EmptyStatement ";")) diff --git a/test/fixtures/ruby/corpus/end-block.A.rb b/semantic/test/fixtures/ruby/corpus/end-block.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/end-block.A.rb rename to semantic/test/fixtures/ruby/corpus/end-block.A.rb diff --git a/test/fixtures/ruby/corpus/end-block.B.rb b/semantic/test/fixtures/ruby/corpus/end-block.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/end-block.B.rb rename to semantic/test/fixtures/ruby/corpus/end-block.B.rb diff --git a/test/fixtures/ruby/corpus/end-block.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/end-block.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/end-block.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/end-block.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/end-block.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/end-block.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/end-block.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/end-block.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/end-block.parseA.txt b/semantic/test/fixtures/ruby/corpus/end-block.parseA.txt new file mode 100644 index 0000000000..38556adb5f --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/end-block.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (EndBlock + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/end-block.parseB.txt b/semantic/test/fixtures/ruby/corpus/end-block.parseB.txt new file mode 100644 index 0000000000..12baa22386 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/end-block.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Statement + (EndBlock + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))))) diff --git a/test/fixtures/ruby/corpus/ensure.A.rb b/semantic/test/fixtures/ruby/corpus/ensure.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/ensure.A.rb rename to semantic/test/fixtures/ruby/corpus/ensure.A.rb diff --git a/test/fixtures/ruby/corpus/ensure.B.rb b/semantic/test/fixtures/ruby/corpus/ensure.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/ensure.B.rb rename to semantic/test/fixtures/ruby/corpus/ensure.B.rb diff --git a/test/fixtures/ruby/corpus/ensure.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/ensure.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/ensure.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/ensure.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/ensure.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/ensure.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/ensure.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/ensure.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/ensure.parseA.txt b/semantic/test/fixtures/ruby/corpus/ensure.parseA.txt new file mode 100644 index 0000000000..f6f048a877 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/ensure.parseA.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (Arg + (Primary + (Begin + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Ensure)))))) diff --git a/semantic/test/fixtures/ruby/corpus/ensure.parseB.txt b/semantic/test/fixtures/ruby/corpus/ensure.parseB.txt new file mode 100644 index 0000000000..e4eeb90c86 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/ensure.parseB.txt @@ -0,0 +1,18 @@ +(Program + (Statement + (Arg + (Primary + (Begin + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Ensure + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar")))))))))))) diff --git a/test/fixtures/ruby/corpus/for.A.rb b/semantic/test/fixtures/ruby/corpus/for.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/for.A.rb rename to semantic/test/fixtures/ruby/corpus/for.A.rb diff --git a/test/fixtures/ruby/corpus/for.B.rb b/semantic/test/fixtures/ruby/corpus/for.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/for.B.rb rename to semantic/test/fixtures/ruby/corpus/for.B.rb diff --git a/test/fixtures/ruby/corpus/for.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/for.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/for.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/for.diffA-B.txt diff --git a/semantic/test/fixtures/ruby/corpus/for.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/for.diffB-A.txt new file mode 100644 index 0000000000..b3c1137f37 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/for.diffB-A.txt @@ -0,0 +1,48 @@ +(Statements +{+(ForEach + {+(Statements + {+(Send + {+(Identifier)+})+})+} + {+(Send + {+(Identifier)+})+} + {+(Send + {+(Identifier)+})+})+} +{+(ForEach + {+(Statements + {+(Send + {+(Identifier)+})+} + {+(Send + {+(Identifier)+})+})+} + {+(Send + {+(Identifier)+})+} + {+(Send + {+(Identifier)+})+})+} + (ForEach + (Statements + (Send + { (Identifier) + ->(Identifier) })) + { (Array + {-(Integer)-} + {-(Integer)-} + {-(Integer)-}) + ->(Enumeration + {+(Integer)+} + {+(Integer)+} + {+(Empty)+}) } + { (Send + {-(Identifier)-} + {-(Send + {-(Identifier)-})-}) + ->(Boolean) }) +{+(ForEach + {+(Statements + {+(Send + {+(Identifier)+})+} + {+(Send + {+(Identifier)+})+})+} + {+(Enumeration + {+(Integer)+} + {+(Integer)+} + {+(Empty)+})+} + {+(Boolean)+})+}) diff --git a/semantic/test/fixtures/ruby/corpus/for.parseA.txt b/semantic/test/fixtures/ruby/corpus/for.parseA.txt new file mode 100644 index 0000000000..496e559537 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/for.parseA.txt @@ -0,0 +1,91 @@ +(Program + (Statement + (Arg + (Primary + (For + (Lhs + (Variable + (Identifier "x"))) + (Do + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "f"))))))) + (In + (Arg + (Primary + (Lhs + (Variable + (Identifier "y")))))))))) + (Statement + (Arg + (Primary + (For + (Lhs + (Variable + (Identifier "x"))) + (Lhs + (Variable + (Identifier "y"))) + (Do + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "f"))))))) + (In + (Arg + (Primary + (Lhs + (Variable + (Identifier "z")))))))))) + (Statement + (Arg + (Primary + (For + (Lhs + (Variable + (Identifier "n"))) + (Do + (Statement + (Arg + (Primary + (Lhs + (True "true")))))) + (In + (Arg + (Range + (Arg + (Primary + (Integer "1"))) + (Arg + (Primary + (Integer "3")))))))))) + (Statement + (Arg + (Primary + (For + (Lhs + (Variable + (Identifier "n"))) + (Lhs + (Variable + (Identifier "m"))) + (Do + (Statement + (Arg + (Primary + (Lhs + (True "true")))))) + (In + (Arg + (Range + (Arg + (Primary + (Integer "1"))) + (Arg + (Primary + (Integer "3"))))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/for.parseB.txt b/semantic/test/fixtures/ruby/corpus/for.parseB.txt new file mode 100644 index 0000000000..ce3bfa1823 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/for.parseB.txt @@ -0,0 +1,32 @@ +(Program + (Statement + (Arg + (Primary + (For + (Lhs + (Variable + (Identifier "i"))) + (Do + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (Lhs + (Variable + (Identifier "i")))))) + (Variable + (Identifier "print"))))) + (In + (Arg + (Primary + (Array + (Arg + (Primary + (Integer "1"))) + (Arg + (Primary + (Integer "2"))) + (Arg + (Primary + (Integer "3")))))))))))) diff --git a/test/fixtures/ruby/corpus/hash.A.rb b/semantic/test/fixtures/ruby/corpus/hash.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/hash.A.rb rename to semantic/test/fixtures/ruby/corpus/hash.A.rb diff --git a/test/fixtures/ruby/corpus/hash.B.rb b/semantic/test/fixtures/ruby/corpus/hash.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/hash.B.rb rename to semantic/test/fixtures/ruby/corpus/hash.B.rb diff --git a/test/fixtures/ruby/corpus/hash.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/hash.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/hash.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/hash.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/hash.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/hash.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/hash.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/hash.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/hash.parseA.txt b/semantic/test/fixtures/ruby/corpus/hash.parseA.txt new file mode 100644 index 0000000000..33bbffa65b --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/hash.parseA.txt @@ -0,0 +1,48 @@ +(Program + (Statement + (Arg + (Primary + (Hash + (Pair + (Arg + (Primary + (String))) + (Symbol)) + (Pair + (Arg + (Primary + (Integer "1"))) + (Symbol)) + (Pair + (Arg + (Primary + (Lhs + (False "false")))) + (String)) + (Pair + (Arg + (Primary + (Integer "10"))) + (Symbol)))))) + (Statement + (Arg + (Primary + (Hash)))) + (Statement + (Arg + (Primary + (Hash + (Pair + (Arg + (Primary + (Integer "1"))) + (Symbol)) + (Pair + (Arg + (Primary + (Integer "1"))) + (String)))))) + (Statement + (Arg + (Primary + (Hash))))) diff --git a/semantic/test/fixtures/ruby/corpus/hash.parseB.txt b/semantic/test/fixtures/ruby/corpus/hash.parseB.txt new file mode 100644 index 0000000000..21d47159ff --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/hash.parseB.txt @@ -0,0 +1,21 @@ +(Program + (Statement + (Arg + (Primary + (Hash + (Pair + (Arg + (Primary + (String))) + (Symbol)) + (Pair + (Arg + (Primary + (Integer "2"))) + (Symbol)) + (Pair + (Arg + (Primary + (Lhs + (True "true")))) + (Symbol))))))) diff --git a/test/fixtures/ruby/corpus/heredoc.A.rb b/semantic/test/fixtures/ruby/corpus/heredoc.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/heredoc.A.rb rename to semantic/test/fixtures/ruby/corpus/heredoc.A.rb diff --git a/test/fixtures/ruby/corpus/heredoc.B.rb b/semantic/test/fixtures/ruby/corpus/heredoc.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/heredoc.B.rb rename to semantic/test/fixtures/ruby/corpus/heredoc.B.rb diff --git a/semantic/test/fixtures/ruby/corpus/heredoc.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/heredoc.diffA-B.txt new file mode 100644 index 0000000000..e5315ecb01 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/heredoc.diffA-B.txt @@ -0,0 +1,12 @@ +(Statements +{+(Send + {+(Context + {+(Statements + {+(TextElement)+})+} + {+(Send + {+(Identifier)+} + {+(TextElement)+})+})+} + {+(Identifier)+})+} +{-(TextElement)-} +{-(Statements + {-(TextElement)-})-}) diff --git a/semantic/test/fixtures/ruby/corpus/heredoc.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/heredoc.diffB-A.txt new file mode 100644 index 0000000000..bc9659102b --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/heredoc.diffB-A.txt @@ -0,0 +1,12 @@ +(Statements +{+(TextElement)+} +{+(Statements + {+(TextElement)+})+} +{-(Send + {-(Context + {-(Statements + {-(TextElement)-})-} + {-(Send + {-(Identifier)-} + {-(TextElement)-})-})-} + {-(Identifier)-})-}) diff --git a/semantic/test/fixtures/ruby/corpus/heredoc.parseA.txt b/semantic/test/fixtures/ruby/corpus/heredoc.parseA.txt new file mode 100644 index 0000000000..e2867bee1e --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/heredoc.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (Arg + (Primary + (HeredocBeginning "<(Integer) })) + (AugmentedAssignment + (Minus + (Identifier) + (Integer))) + (AugmentedAssignment + (Times + (Identifier) + (Integer))) + (AugmentedAssignment + (DividedBy + (Identifier) + (Integer))) + (AugmentedAssignment + (Power + (Identifier) + (Integer)))) diff --git a/semantic/test/fixtures/ruby/corpus/math-assignment.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/math-assignment.diffB-A.txt new file mode 100644 index 0000000000..e3143247c1 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/math-assignment.diffB-A.txt @@ -0,0 +1,22 @@ +(Statements + (AugmentedAssignment + (Plus + (Identifier) + { (Integer) + ->(Integer) })) + (AugmentedAssignment + (Minus + (Identifier) + (Integer))) + (AugmentedAssignment + (Times + (Identifier) + (Integer))) + (AugmentedAssignment + (DividedBy + (Identifier) + (Integer))) + (AugmentedAssignment + (Power + (Identifier) + (Integer)))) diff --git a/semantic/test/fixtures/ruby/corpus/math-assignment.parseA.txt b/semantic/test/fixtures/ruby/corpus/math-assignment.parseA.txt new file mode 100644 index 0000000000..8ff93895d2 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/math-assignment.parseA.txt @@ -0,0 +1,41 @@ +(Program + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "1"))))) + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "1"))))) + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "1"))))) + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "1"))))) + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "1")))))) diff --git a/semantic/test/fixtures/ruby/corpus/math-assignment.parseB.txt b/semantic/test/fixtures/ruby/corpus/math-assignment.parseB.txt new file mode 100644 index 0000000000..75e3d40f90 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/math-assignment.parseB.txt @@ -0,0 +1,41 @@ +(Program + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "2"))))) + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "1"))))) + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "1"))))) + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "1"))))) + (Statement + (OperatorAssignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Primary + (Integer "1")))))) diff --git a/test/fixtures/ruby/corpus/method-calls-hash-args.A.rb b/semantic/test/fixtures/ruby/corpus/method-calls-hash-args.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-calls-hash-args.A.rb rename to semantic/test/fixtures/ruby/corpus/method-calls-hash-args.A.rb diff --git a/test/fixtures/ruby/corpus/method-calls-hash-args.B.rb b/semantic/test/fixtures/ruby/corpus/method-calls-hash-args.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-calls-hash-args.B.rb rename to semantic/test/fixtures/ruby/corpus/method-calls-hash-args.B.rb diff --git a/test/fixtures/ruby/corpus/method-calls-hash-args.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/method-calls-hash-args.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-calls-hash-args.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/method-calls-hash-args.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/method-calls-hash-args.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/method-calls-hash-args.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-calls-hash-args.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/method-calls-hash-args.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/method-calls-hash-args.parseA.txt b/semantic/test/fixtures/ruby/corpus/method-calls-hash-args.parseA.txt new file mode 100644 index 0000000000..25a8e810ac --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-calls-hash-args.parseA.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (MethodCall + (ArgumentList + (Pair + (Arg + (Primary + (Lhs + (True "true")))) + (Symbol))) + (Variable + (Identifier "foo"))))) diff --git a/semantic/test/fixtures/ruby/corpus/method-calls-hash-args.parseB.txt b/semantic/test/fixtures/ruby/corpus/method-calls-hash-args.parseB.txt new file mode 100644 index 0000000000..2f34eaa931 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-calls-hash-args.parseB.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (MethodCall + (ArgumentList + (Pair + (Arg + (Primary + (Lhs + (True "true")))) + (Symbol)) + (Pair + (Arg + (Primary + (Integer "1"))) + (Symbol))) + (Variable + (Identifier "foo"))))) diff --git a/test/fixtures/ruby/corpus/method-calls-keyword-args.A.rb b/semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-calls-keyword-args.A.rb rename to semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.A.rb diff --git a/test/fixtures/ruby/corpus/method-calls-keyword-args.B.rb b/semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-calls-keyword-args.B.rb rename to semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.B.rb diff --git a/test/fixtures/ruby/corpus/method-calls-keyword-args.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-calls-keyword-args.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/method-calls-keyword-args.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-calls-keyword-args.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.parseA.txt b/semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.parseA.txt new file mode 100644 index 0000000000..25a8e810ac --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.parseA.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (MethodCall + (ArgumentList + (Pair + (Arg + (Primary + (Lhs + (True "true")))) + (Symbol))) + (Variable + (Identifier "foo"))))) diff --git a/semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.parseB.txt b/semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.parseB.txt new file mode 100644 index 0000000000..2f34eaa931 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-calls-keyword-args.parseB.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (MethodCall + (ArgumentList + (Pair + (Arg + (Primary + (Lhs + (True "true")))) + (Symbol)) + (Pair + (Arg + (Primary + (Integer "1"))) + (Symbol))) + (Variable + (Identifier "foo"))))) diff --git a/test/fixtures/ruby/corpus/method-calls.A.rb b/semantic/test/fixtures/ruby/corpus/method-calls.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-calls.A.rb rename to semantic/test/fixtures/ruby/corpus/method-calls.A.rb diff --git a/test/fixtures/ruby/corpus/method-calls.B.rb b/semantic/test/fixtures/ruby/corpus/method-calls.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-calls.B.rb rename to semantic/test/fixtures/ruby/corpus/method-calls.B.rb diff --git a/test/fixtures/ruby/corpus/method-calls.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/method-calls.diffA-B.txt similarity index 89% rename from test/fixtures/ruby/corpus/method-calls.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/method-calls.diffA-B.txt index 2cbafdced4..80fa15de8d 100644 --- a/test/fixtures/ruby/corpus/method-calls.diffA-B.txt +++ b/semantic/test/fixtures/ruby/corpus/method-calls.diffA-B.txt @@ -27,8 +27,10 @@ {-(KeyValue {-(Array)-} {-(Integer)-})-} - {-(Identifier)-} - {-(Identifier)-} + {-(Send + {-(Identifier)-})-} + {-(Send + {-(Identifier)-})-} {-(Function {-(Empty)-} {-(Identifier)-} diff --git a/test/fixtures/ruby/corpus/method-calls.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/method-calls.diffB-A.txt similarity index 89% rename from test/fixtures/ruby/corpus/method-calls.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/method-calls.diffB-A.txt index 8749bf9d16..cffa5da466 100644 --- a/test/fixtures/ruby/corpus/method-calls.diffB-A.txt +++ b/semantic/test/fixtures/ruby/corpus/method-calls.diffB-A.txt @@ -27,8 +27,10 @@ {+(KeyValue {+(Array)+} {+(Integer)+})+} - {+(Identifier)+} - {+(Identifier)+} + {+(Send + {+(Identifier)+})+} + {+(Send + {+(Identifier)+})+} {+(Function {+(Empty)+} {+(Identifier)+} diff --git a/semantic/test/fixtures/ruby/corpus/method-calls.parseA.txt b/semantic/test/fixtures/ruby/corpus/method-calls.parseA.txt new file mode 100644 index 0000000000..a98d2b9991 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-calls.parseA.txt @@ -0,0 +1,83 @@ +(Program + (Statement + (MethodCall + (ArgumentList) + (Call + (Primary + (Lhs + (Variable + (Identifier "x")))) + (Identifier "foo")))) + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))) + (Pair + (Arg + (Primary + (Integer "2"))) + (Symbol)) + (Pair + (Arg + (Primary + (Integer "3"))) + (Symbol))) + (Variable + (Identifier "foo")))) + (Statement + (MethodCall + (ArgumentList + (MethodCall + (ArgumentList + (Arg + (Primary + (Lhs + (Variable + (Identifier "a")))))) + (Variable + (Identifier "bar")))) + (Variable + (Identifier "foo")))) + (Statement + (MethodCall + (ArgumentList + (Pair + (Arg + (Primary + (Integer "1"))) + (Arg + (Primary + (Array)))) + (SplatArgument + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar")))))) + (BlockArgument + (Arg + (Primary + (Lhs + (Variable + (Identifier "blk")))))) + (Arg + (Primary + (Lambda + (Block + (Statement + (Arg + (Primary + (Integer "1"))))) + (LambdaParameters + (Identifier "a")))))) + (Variable + (Identifier "foo"))))) diff --git a/semantic/test/fixtures/ruby/corpus/method-calls.parseB.txt b/semantic/test/fixtures/ruby/corpus/method-calls.parseB.txt new file mode 100644 index 0000000000..e631f8d470 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-calls.parseB.txt @@ -0,0 +1,6 @@ +(Program + (Statement + (MethodCall + (ArgumentList) + (Variable + (Identifier "bar"))))) diff --git a/test/fixtures/ruby/corpus/method-declaration-keyword-param.A.rb b/semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-keyword-param.A.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.A.rb diff --git a/test/fixtures/ruby/corpus/method-declaration-keyword-param.B.rb b/semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-keyword-param.B.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.B.rb diff --git a/test/fixtures/ruby/corpus/method-declaration-keyword-param.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-keyword-param.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/method-declaration-keyword-param.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-keyword-param.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseA.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseA.txt new file mode 100644 index 0000000000..4ffdfc74fa --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters)))))) diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseB.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseB.txt new file mode 100644 index 0000000000..0666cd09ef --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseB.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters + (KeywordParameter + (Arg + (Primary + (Lhs + (Nil "nil")))) + (Identifier "name")))))))) diff --git a/test/fixtures/ruby/corpus/method-declaration-param-default.A.rb b/semantic/test/fixtures/ruby/corpus/method-declaration-param-default.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-param-default.A.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration-param-default.A.rb diff --git a/test/fixtures/ruby/corpus/method-declaration-param-default.B.rb b/semantic/test/fixtures/ruby/corpus/method-declaration-param-default.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-param-default.B.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration-param-default.B.rb diff --git a/test/fixtures/ruby/corpus/method-declaration-param-default.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-param-default.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-param-default.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration-param-default.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/method-declaration-param-default.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-param-default.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-param-default.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration-param-default.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration-param-default.parseA.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-param-default.parseA.txt new file mode 100644 index 0000000000..4ffdfc74fa --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration-param-default.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters)))))) diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration-param-default.parseB.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-param-default.parseB.txt new file mode 100644 index 0000000000..f96bd227ab --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration-param-default.parseB.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters + (OptionalParameter + (Arg + (Primary + (Lhs + (Nil "nil")))) + (Identifier "name")))))))) diff --git a/test/fixtures/ruby/corpus/method-declaration-params.A.rb b/semantic/test/fixtures/ruby/corpus/method-declaration-params.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-params.A.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration-params.A.rb diff --git a/test/fixtures/ruby/corpus/method-declaration-params.B.rb b/semantic/test/fixtures/ruby/corpus/method-declaration-params.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-params.B.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration-params.B.rb diff --git a/test/fixtures/ruby/corpus/method-declaration-params.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-params.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-params.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration-params.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/method-declaration-params.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-params.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-params.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration-params.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration-params.parseA.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-params.parseA.txt new file mode 100644 index 0000000000..70f46f85c9 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration-params.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters + (Identifier "a"))))))) diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration-params.parseB.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-params.parseB.txt new file mode 100644 index 0000000000..24fa323e7c --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration-params.parseB.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters + (Identifier "a") + (Identifier "b") + (Identifier "c"))))))) diff --git a/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.A.rb b/semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-required-keyword-param.A.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.A.rb diff --git a/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.B.rb b/semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-required-keyword-param.B.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.B.rb diff --git a/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-required-keyword-param.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-required-keyword-param.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseA.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseA.txt new file mode 100644 index 0000000000..4ffdfc74fa --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters)))))) diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseB.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseB.txt new file mode 100644 index 0000000000..5b7567721a --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters + (KeywordParameter + (Identifier "name")))))))) diff --git a/test/fixtures/ruby/corpus/method-declaration-unnamed-param.A.rb b/semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-unnamed-param.A.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.A.rb diff --git a/test/fixtures/ruby/corpus/method-declaration-unnamed-param.B.rb b/semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-unnamed-param.B.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.B.rb diff --git a/test/fixtures/ruby/corpus/method-declaration-unnamed-param.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-unnamed-param.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/method-declaration-unnamed-param.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration-unnamed-param.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseA.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseA.txt new file mode 100644 index 0000000000..1746ed876b --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters + (Identifier "name"))))))) diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseB.txt b/semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseB.txt new file mode 100644 index 0000000000..34812f446f --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters + (Identifier "name") + (HashSplatParameter))))))) diff --git a/test/fixtures/ruby/corpus/method-declaration.A.rb b/semantic/test/fixtures/ruby/corpus/method-declaration.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration.A.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration.A.rb diff --git a/test/fixtures/ruby/corpus/method-declaration.B.rb b/semantic/test/fixtures/ruby/corpus/method-declaration.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration.B.rb rename to semantic/test/fixtures/ruby/corpus/method-declaration.B.rb diff --git a/test/fixtures/ruby/corpus/method-declaration.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/method-declaration.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/method-declaration.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/method-declaration.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-declaration.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/method-declaration.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration.parseA.txt b/semantic/test/fixtures/ruby/corpus/method-declaration.parseA.txt new file mode 100644 index 0000000000..f96643ce0a --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration.parseA.txt @@ -0,0 +1,7 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo"))))))) diff --git a/semantic/test/fixtures/ruby/corpus/method-declaration.parseB.txt b/semantic/test/fixtures/ruby/corpus/method-declaration.parseB.txt new file mode 100644 index 0000000000..b25fa2d81a --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-declaration.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "bar")) + (MethodParameters + (Identifier "a")) + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "baz"))))))))))) diff --git a/test/fixtures/ruby/corpus/method-invocation.A.rb b/semantic/test/fixtures/ruby/corpus/method-invocation.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-invocation.A.rb rename to semantic/test/fixtures/ruby/corpus/method-invocation.A.rb diff --git a/test/fixtures/ruby/corpus/method-invocation.B.rb b/semantic/test/fixtures/ruby/corpus/method-invocation.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/method-invocation.B.rb rename to semantic/test/fixtures/ruby/corpus/method-invocation.B.rb diff --git a/test/fixtures/ruby/corpus/method-invocation.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/method-invocation.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-invocation.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/method-invocation.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/method-invocation.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/method-invocation.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/method-invocation.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/method-invocation.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/method-invocation.parseA.txt b/semantic/test/fixtures/ruby/corpus/method-invocation.parseA.txt new file mode 100644 index 0000000000..9db19085f9 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-invocation.parseA.txt @@ -0,0 +1,23 @@ +(Program + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "print")))))) + (Statement + (Arg + (Primary + (Lhs + (Call + (Primary + (Lhs + (Variable + (Identifier "foo")))) + (Identifier "bar")))))) + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))) diff --git a/semantic/test/fixtures/ruby/corpus/method-invocation.parseB.txt b/semantic/test/fixtures/ruby/corpus/method-invocation.parseB.txt new file mode 100644 index 0000000000..0aee8de5e8 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/method-invocation.parseB.txt @@ -0,0 +1,40 @@ +(Program + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (String)))) + (Variable + (Identifier "print")))) + (Statement + (MethodCall + (ArgumentList) + (Call + (Primary + (Lhs + (Variable + (Identifier "foo")))) + (Identifier "bar")))) + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (Integer "2"))) + (Arg + (Primary + (Integer "3")))) + (Variable + (Identifier "bar")))) + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (Integer "2"))) + (Arg + (Primary + (Integer "3")))) + (Variable + (Identifier "bar"))))) diff --git a/test/fixtures/ruby/corpus/methods.A.rb b/semantic/test/fixtures/ruby/corpus/methods.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/methods.A.rb rename to semantic/test/fixtures/ruby/corpus/methods.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/methods.parseA.txt b/semantic/test/fixtures/ruby/corpus/methods.parseA.txt new file mode 100644 index 0000000000..85d17c7330 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/methods.parseA.txt @@ -0,0 +1,80 @@ +(Program + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")))))) + (Statement + (Arg + (Primary + (Method + (MethodName + (Setter + (Identifier "bar"))))))) + (Statement + (Arg + (Primary + (Method + (MethodName + (Operator "-@")) + (MethodParameters + (Identifier "a")))))) + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters + (Identifier "a") + (KeywordParameter + (Arg + (Primary + (Lhs + (False "false")))) + (Identifier "b")) + (KeywordParameter + (Arg + (Primary + (Lhs + (Nil "nil")))) + (Identifier "c")) + (HashSplatParameter)))))) + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters + (SplatParameter + (Identifier "args"))))))) + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (MethodParameters + (BlockParameter + (Identifier "block"))))))) + (Statement + (Arg + (Primary + (SingletonMethod + (MethodName + (Identifier "foo")) + (Variable + (Self "self")))))) + (Statement + (Arg + (Primary + (SingletonMethod + (MethodName + (Identifier "foo")) + (MethodParameters + (Identifier "a") + (Identifier "b")) + (Variable + (Self "self"))))))) diff --git a/test/fixtures/ruby/corpus/misc.A.rb b/semantic/test/fixtures/ruby/corpus/misc.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/misc.A.rb rename to semantic/test/fixtures/ruby/corpus/misc.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/misc.parseA.txt b/semantic/test/fixtures/ruby/corpus/misc.parseA.txt new file mode 100644 index 0000000000..a63fe6a63c --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/misc.parseA.txt @@ -0,0 +1,46 @@ +(Program + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (Lhs + (Variable + (Identifier "a")))))) + (DoBlock) + (Variable + (Identifier "foo")))) + (Statement + (MethodCall + (DoBlock + (BlockParameters + (Identifier "x") + (KeywordParameter + (Arg + (Primary + (Lhs + (Variable + (Identifier "i"))))) + (Identifier "name")) + (SplatParameter + (Identifier "args")))) + (Call + (Primary + (Lhs + (Variable + (Identifier "foo")))) + (Identifier "bar")))) + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (Lhs + (Variable + (Identifier "a")))))) + (Block + (BlockParameters + (Identifier "x"))) + (Variable + (Identifier "foo")))) + (Uninterpreted "\nword\nx\n")) diff --git a/test/fixtures/ruby/corpus/module.A.rb b/semantic/test/fixtures/ruby/corpus/module.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/module.A.rb rename to semantic/test/fixtures/ruby/corpus/module.A.rb diff --git a/test/fixtures/ruby/corpus/module.B.rb b/semantic/test/fixtures/ruby/corpus/module.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/module.B.rb rename to semantic/test/fixtures/ruby/corpus/module.B.rb diff --git a/test/fixtures/ruby/corpus/module.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/module.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/module.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/module.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/module.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/module.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/module.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/module.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/module.parseA.txt b/semantic/test/fixtures/ruby/corpus/module.parseA.txt new file mode 100644 index 0000000000..a5935208a1 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/module.parseA.txt @@ -0,0 +1,16 @@ +(Program + (Statement + (Arg + (Primary + (Module + (Constant "Foo"))))) + (Statement + (Arg + (Primary + (Module + (ScopeResolution + (Constant "B") + (Primary + (Lhs + (Variable + (Constant "A")))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/module.parseB.txt b/semantic/test/fixtures/ruby/corpus/module.parseB.txt new file mode 100644 index 0000000000..3e5a2dae6b --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/module.parseB.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (Arg + (Primary + (Module + (Constant "Foo") + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "bar"))))))))))) diff --git a/test/fixtures/ruby/corpus/multiple-assignments.A.rb b/semantic/test/fixtures/ruby/corpus/multiple-assignments.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/multiple-assignments.A.rb rename to semantic/test/fixtures/ruby/corpus/multiple-assignments.A.rb diff --git a/test/fixtures/ruby/corpus/multiple-assignments.B.rb b/semantic/test/fixtures/ruby/corpus/multiple-assignments.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/multiple-assignments.B.rb rename to semantic/test/fixtures/ruby/corpus/multiple-assignments.B.rb diff --git a/test/fixtures/ruby/corpus/multiple-assignments.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/multiple-assignments.diffA-B.txt similarity index 91% rename from test/fixtures/ruby/corpus/multiple-assignments.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/multiple-assignments.diffA-B.txt index 7c12ce1392..dfc07a97d9 100644 --- a/test/fixtures/ruby/corpus/multiple-assignments.diffA-B.txt +++ b/semantic/test/fixtures/ruby/corpus/multiple-assignments.diffA-B.txt @@ -2,8 +2,7 @@ (Assignment (Statements (Identifier) - { (Identifier) - ->(Identifier) } + (Identifier) {-(Identifier)-}) (Array (Integer) @@ -34,7 +33,8 @@ {-(Statements {-(Identifier)-} {-(Identifier)-})-} - {-(Identifier)-})-} + {-(Send + {-(Identifier)-})-})-} {-(Assignment {-(Statements {-(Send @@ -57,4 +57,5 @@ {-(Statements {-(Identifier)-} {-(Identifier)-})-})-} - {-(Identifier)-})-}) + {-(Send + {-(Identifier)-})-})-}) diff --git a/test/fixtures/ruby/corpus/multiple-assignments.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/multiple-assignments.diffB-A.txt similarity index 91% rename from test/fixtures/ruby/corpus/multiple-assignments.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/multiple-assignments.diffB-A.txt index 81cf76179d..d167621150 100644 --- a/test/fixtures/ruby/corpus/multiple-assignments.diffB-A.txt +++ b/semantic/test/fixtures/ruby/corpus/multiple-assignments.diffB-A.txt @@ -2,8 +2,7 @@ (Assignment (Statements (Identifier) - { (Identifier) - ->(Identifier) } + (Identifier) {+(Identifier)+}) (Array (Integer) @@ -34,7 +33,8 @@ {+(Statements {+(Identifier)+} {+(Identifier)+})+} - {+(Identifier)+})+} + {+(Send + {+(Identifier)+})+})+} {+(Assignment {+(Statements {+(Send @@ -57,4 +57,5 @@ {+(Statements {+(Identifier)+} {+(Identifier)+})+})+} - {+(Identifier)+})+}) + {+(Send + {+(Identifier)+})+})+}) diff --git a/semantic/test/fixtures/ruby/corpus/multiple-assignments.parseA.txt b/semantic/test/fixtures/ruby/corpus/multiple-assignments.parseA.txt new file mode 100644 index 0000000000..7cf798b1fe --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/multiple-assignments.parseA.txt @@ -0,0 +1,144 @@ +(Program + (Statement + (Assignment + (LeftAssignmentList + (Lhs + (Variable + (Identifier "x"))) + (Lhs + (Variable + (Identifier "y"))) + (Lhs + (Variable + (Identifier "z")))) + (Arg + (Primary + (Array + (Arg + (Primary + (Integer "10"))) + (Arg + (Primary + (Integer "20"))) + (Arg + (Primary + (Integer "30")))))))) + (Statement + (Assignment + (LeftAssignmentList + (Lhs + (Variable + (Identifier "x"))) + (Lhs + (Variable + (Identifier "y")))) + (Arg + (Primary + (Array + (Arg + (Primary + (Integer "1"))) + (Arg + (Primary + (Integer "2")))))))) + (Statement + (Assignment + (LeftAssignmentList + (Lhs + (Variable + (Identifier "x"))) + (RestAssignment)) + (Arg + (Primary + (Array + (Arg + (Primary + (Integer "1"))) + (Arg + (Primary + (Integer "2")))))))) + (Statement + (Assignment + (LeftAssignmentList + (Lhs + (Variable + (Identifier "x"))) + (RestAssignment + (Lhs + (Variable + (Identifier "args"))))) + (Arg + (Primary + (Array + (Arg + (Primary + (Integer "1"))) + (Arg + (Primary + (Integer "2")))))))) + (Statement + (Assignment + (LeftAssignmentList + (Lhs + (Variable + (Identifier "x"))) + (Lhs + (Variable + (Identifier "y")))) + (SplatArgument + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))))) + (Statement + (Assignment + (LeftAssignmentList + (Lhs + (Call + (Primary + (Lhs + (Variable + (Self "self")))) + (Identifier "foo"))) + (Lhs + (Call + (Primary + (Lhs + (Variable + (Self "self")))) + (Identifier "bar")))) + (RightAssignmentList + (Arg + (Primary + (Lhs + (Call + (Primary + (Lhs + (Variable + (Identifier "target")))) + (Identifier "a?"))))) + (Arg + (Primary + (Lhs + (Call + (Primary + (Lhs + (Variable + (Identifier "target")))) + (Identifier "b")))))))) + (Statement + (Assignment + (LeftAssignmentList + (DestructuredLeftAssignment + (Lhs + (Variable + (Identifier "x"))) + (Lhs + (Variable + (Identifier "y"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))))) diff --git a/semantic/test/fixtures/ruby/corpus/multiple-assignments.parseB.txt b/semantic/test/fixtures/ruby/corpus/multiple-assignments.parseB.txt new file mode 100644 index 0000000000..82e5f1852d --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/multiple-assignments.parseB.txt @@ -0,0 +1,23 @@ +(Program + (Statement + (Assignment + (LeftAssignmentList + (Lhs + (Variable + (Identifier "x"))) + (RestAssignment + (Lhs + (Variable + (Identifier "y"))))) + (Arg + (Primary + (Array + (Arg + (Primary + (Integer "10"))) + (Arg + (Primary + (Integer "20"))) + (Arg + (Primary + (Integer "30"))))))))) diff --git a/test/fixtures/ruby/corpus/next.A.rb b/semantic/test/fixtures/ruby/corpus/next.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/next.A.rb rename to semantic/test/fixtures/ruby/corpus/next.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/next.parseA.txt b/semantic/test/fixtures/ruby/corpus/next.parseA.txt new file mode 100644 index 0000000000..e2c89b99ae --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/next.parseA.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (Arg + (Primary + (For + (Lhs + (Variable + (Identifier "x"))) + (Do + (Statement + (Next))) + (In + (Arg + (Primary + (Lhs + (Variable + (Identifier "y"))))))))))) diff --git a/test/fixtures/ruby/corpus/number.A.rb b/semantic/test/fixtures/ruby/corpus/number.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/number.A.rb rename to semantic/test/fixtures/ruby/corpus/number.A.rb diff --git a/test/fixtures/ruby/corpus/number.B.rb b/semantic/test/fixtures/ruby/corpus/number.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/number.B.rb rename to semantic/test/fixtures/ruby/corpus/number.B.rb diff --git a/test/fixtures/ruby/corpus/number.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/number.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/number.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/number.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/number.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/number.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/number.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/number.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/number.parseA.txt b/semantic/test/fixtures/ruby/corpus/number.parseA.txt new file mode 100644 index 0000000000..686eb26050 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/number.parseA.txt @@ -0,0 +1,29 @@ +(Program + (Statement + (Arg + (Primary + (Integer "1234")))) + (Statement + (Arg + (Primary + (Integer "1_234")))) + (Statement + (Arg + (Primary + (Integer "0d1_234")))) + (Statement + (Arg + (Primary + (Integer "0xa_bcd_ef0_123_456_789")))) + (Statement + (Arg + (Primary + (Integer "0o1234567")))) + (Statement + (Arg + (Primary + (Integer "0b1_0")))) + (Statement + (Arg + (Primary + (Float "1.234_5e678_90"))))) diff --git a/semantic/test/fixtures/ruby/corpus/number.parseB.txt b/semantic/test/fixtures/ruby/corpus/number.parseB.txt new file mode 100644 index 0000000000..4315b90d61 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/number.parseB.txt @@ -0,0 +1,29 @@ +(Program + (Statement + (Arg + (Primary + (Integer "1235")))) + (Statement + (Arg + (Primary + (Integer "1_235")))) + (Statement + (Arg + (Primary + (Integer "0d1_235")))) + (Statement + (Arg + (Primary + (Integer "0xa_bcd_ef0_123_456_788")))) + (Statement + (Arg + (Primary + (Integer "0o1234576")))) + (Statement + (Arg + (Primary + (Integer "0b1_1")))) + (Statement + (Arg + (Primary + (Float "1.234_5e678_91"))))) diff --git a/test/fixtures/ruby/corpus/percent-array.A.rb b/semantic/test/fixtures/ruby/corpus/percent-array.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/percent-array.A.rb rename to semantic/test/fixtures/ruby/corpus/percent-array.A.rb diff --git a/test/fixtures/ruby/corpus/percent-array.B.rb b/semantic/test/fixtures/ruby/corpus/percent-array.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/percent-array.B.rb rename to semantic/test/fixtures/ruby/corpus/percent-array.B.rb diff --git a/test/fixtures/ruby/corpus/percent-array.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/percent-array.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/percent-array.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/percent-array.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/percent-array.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/percent-array.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/percent-array.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/percent-array.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/percent-array.parseA.txt b/semantic/test/fixtures/ruby/corpus/percent-array.parseA.txt new file mode 100644 index 0000000000..39f5976a61 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/percent-array.parseA.txt @@ -0,0 +1,7 @@ +(Program + (Statement + (Arg + (Primary + (StringArray + (BareString) + (BareString)))))) diff --git a/semantic/test/fixtures/ruby/corpus/percent-array.parseB.txt b/semantic/test/fixtures/ruby/corpus/percent-array.parseB.txt new file mode 100644 index 0000000000..aa9bfcfd15 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/percent-array.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (Arg + (Primary + (StringArray + (BareString) + (BareString + (Interpolation + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "b")))))))) + (BareString)))))) diff --git a/test/fixtures/ruby/corpus/pseudo-variables.A.rb b/semantic/test/fixtures/ruby/corpus/pseudo-variables.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/pseudo-variables.A.rb rename to semantic/test/fixtures/ruby/corpus/pseudo-variables.A.rb diff --git a/test/fixtures/ruby/corpus/pseudo-variables.B.rb b/semantic/test/fixtures/ruby/corpus/pseudo-variables.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/pseudo-variables.B.rb rename to semantic/test/fixtures/ruby/corpus/pseudo-variables.B.rb diff --git a/test/fixtures/ruby/corpus/pseudo-variables.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/pseudo-variables.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/pseudo-variables.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/pseudo-variables.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/pseudo-variables.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/pseudo-variables.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/pseudo-variables.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/pseudo-variables.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/pseudo-variables.parseA.txt b/semantic/test/fixtures/ruby/corpus/pseudo-variables.parseA.txt new file mode 100644 index 0000000000..44130953c6 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/pseudo-variables.parseA.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (Arg + (Primary + (Lhs + (Nil "nil"))))) + (Statement + (Arg + (Primary + (Lhs + (Variable + (Self "self")))))) + (Statement + (Arg + (Primary + (Lhs + (False "false"))))) + (Statement + (Arg + (Primary + (Lhs + (True "true")))))) diff --git a/semantic/test/fixtures/ruby/corpus/pseudo-variables.parseB.txt b/semantic/test/fixtures/ruby/corpus/pseudo-variables.parseB.txt new file mode 100644 index 0000000000..254838d854 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/pseudo-variables.parseB.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (Arg + (Primary + (Lhs + (Variable + (Self "self")))))) + (Statement + (Arg + (Primary + (Lhs + (Nil "NIL"))))) + (Statement + (Arg + (Primary + (Lhs + (True "TRUE"))))) + (Statement + (Arg + (Primary + (Lhs + (False "FALSE")))))) diff --git a/test/fixtures/ruby/corpus/regex.A.rb b/semantic/test/fixtures/ruby/corpus/regex.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/regex.A.rb rename to semantic/test/fixtures/ruby/corpus/regex.A.rb diff --git a/test/fixtures/ruby/corpus/regex.B.rb b/semantic/test/fixtures/ruby/corpus/regex.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/regex.B.rb rename to semantic/test/fixtures/ruby/corpus/regex.B.rb diff --git a/test/fixtures/ruby/corpus/regex.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/regex.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/regex.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/regex.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/regex.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/regex.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/regex.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/regex.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/regex.parseA.txt b/semantic/test/fixtures/ruby/corpus/regex.parseA.txt new file mode 100644 index 0000000000..5c72ee325b --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/regex.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (Arg + (Primary + (Regex))))) diff --git a/semantic/test/fixtures/ruby/corpus/regex.parseB.txt b/semantic/test/fixtures/ruby/corpus/regex.parseB.txt new file mode 100644 index 0000000000..74fb53a25a --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/regex.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Arg + (Primary + (Regex)))) + (Statement + (Arg + (Primary + (Regex))))) diff --git a/test/fixtures/ruby/corpus/relational-operator.A.rb b/semantic/test/fixtures/ruby/corpus/relational-operator.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/relational-operator.A.rb rename to semantic/test/fixtures/ruby/corpus/relational-operator.A.rb diff --git a/test/fixtures/ruby/corpus/relational-operator.B.rb b/semantic/test/fixtures/ruby/corpus/relational-operator.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/relational-operator.B.rb rename to semantic/test/fixtures/ruby/corpus/relational-operator.B.rb diff --git a/test/fixtures/ruby/corpus/relational-operator.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/relational-operator.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/relational-operator.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/relational-operator.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/relational-operator.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/relational-operator.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/relational-operator.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/relational-operator.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/relational-operator.parseA.txt b/semantic/test/fixtures/ruby/corpus/relational-operator.parseA.txt new file mode 100644 index 0000000000..4ecd894807 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/relational-operator.parseA.txt @@ -0,0 +1,40 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "x"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "y"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "x"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "y"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "x"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "y")))))))) diff --git a/semantic/test/fixtures/ruby/corpus/relational-operator.parseB.txt b/semantic/test/fixtures/ruby/corpus/relational-operator.parseB.txt new file mode 100644 index 0000000000..6e3f529873 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/relational-operator.parseB.txt @@ -0,0 +1,39 @@ +(Program + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "x"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "y"))))))) + (Statement + (Binary + (Token) + (Arg + (Primary + (Lhs + (Variable + (Identifier "x"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "y"))))))) + (Statement + (Assignment + (Lhs + (Variable + (Identifier "x"))) + (Arg + (Unary + (Arg + (Primary + (Lhs + (Variable + (Identifier "y")))))))))) diff --git a/test/fixtures/ruby/corpus/require.A.rb b/semantic/test/fixtures/ruby/corpus/require.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/require.A.rb rename to semantic/test/fixtures/ruby/corpus/require.A.rb diff --git a/test/fixtures/ruby/corpus/require.B.rb b/semantic/test/fixtures/ruby/corpus/require.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/require.B.rb rename to semantic/test/fixtures/ruby/corpus/require.B.rb diff --git a/test/fixtures/ruby/corpus/require.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/require.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/require.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/require.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/require.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/require.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/require.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/require.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/require.parseA.txt b/semantic/test/fixtures/ruby/corpus/require.parseA.txt new file mode 100644 index 0000000000..cfb3289df2 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/require.parseA.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (String)))) + (Variable + (Identifier "require")))) + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (Lhs + (Variable + (Identifier "a")))))) + (Variable + (Identifier "foo"))))) diff --git a/semantic/test/fixtures/ruby/corpus/require.parseB.txt b/semantic/test/fixtures/ruby/corpus/require.parseB.txt new file mode 100644 index 0000000000..413fb30ed5 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/require.parseB.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (String)))) + (Variable + (Identifier "require")))) + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (Symbol))) + (Arg + (Primary + (String)))) + (Variable + (Identifier "autoload"))))) diff --git a/test/fixtures/ruby/corpus/rescue-empty.A.rb b/semantic/test/fixtures/ruby/corpus/rescue-empty.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/rescue-empty.A.rb rename to semantic/test/fixtures/ruby/corpus/rescue-empty.A.rb diff --git a/test/fixtures/ruby/corpus/rescue-empty.B.rb b/semantic/test/fixtures/ruby/corpus/rescue-empty.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/rescue-empty.B.rb rename to semantic/test/fixtures/ruby/corpus/rescue-empty.B.rb diff --git a/test/fixtures/ruby/corpus/rescue-empty.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/rescue-empty.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/rescue-empty.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/rescue-empty.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/rescue-empty.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/rescue-empty.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/rescue-empty.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/rescue-empty.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/rescue-empty.parseA.txt b/semantic/test/fixtures/ruby/corpus/rescue-empty.parseA.txt new file mode 100644 index 0000000000..fd27fa95af --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue-empty.parseA.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (Arg + (Primary + (Begin + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Rescue)))))) diff --git a/semantic/test/fixtures/ruby/corpus/rescue-empty.parseB.txt b/semantic/test/fixtures/ruby/corpus/rescue-empty.parseB.txt new file mode 100644 index 0000000000..5dca6aa25e --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue-empty.parseB.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (Arg + (Primary + (Begin + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Rescue + (Then + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))))))))) diff --git a/test/fixtures/ruby/corpus/rescue-last-ex.A.rb b/semantic/test/fixtures/ruby/corpus/rescue-last-ex.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/rescue-last-ex.A.rb rename to semantic/test/fixtures/ruby/corpus/rescue-last-ex.A.rb diff --git a/test/fixtures/ruby/corpus/rescue-last-ex.B.rb b/semantic/test/fixtures/ruby/corpus/rescue-last-ex.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/rescue-last-ex.B.rb rename to semantic/test/fixtures/ruby/corpus/rescue-last-ex.B.rb diff --git a/test/fixtures/ruby/corpus/rescue-last-ex.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/rescue-last-ex.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/rescue-last-ex.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/rescue-last-ex.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/rescue-last-ex.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/rescue-last-ex.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/rescue-last-ex.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/rescue-last-ex.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/rescue-last-ex.parseA.txt b/semantic/test/fixtures/ruby/corpus/rescue-last-ex.parseA.txt new file mode 100644 index 0000000000..59d41ee859 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue-last-ex.parseA.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (Arg + (Primary + (Begin + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Rescue + (Exceptions + (Arg + (Primary + (Lhs + (Variable + (Constant "Error")))))) + (ExceptionVariable + (Lhs + (Variable + (Identifier "x")))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/rescue-last-ex.parseB.txt b/semantic/test/fixtures/ruby/corpus/rescue-last-ex.parseB.txt new file mode 100644 index 0000000000..49e7be5dc3 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue-last-ex.parseB.txt @@ -0,0 +1,29 @@ +(Program + (Statement + (Arg + (Primary + (Begin + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Rescue + (Exceptions + (Arg + (Primary + (Lhs + (Variable + (Constant "Error")))))) + (Then + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))) + (ExceptionVariable + (Lhs + (Variable + (Identifier "x")))))))))) diff --git a/test/fixtures/ruby/corpus/rescue-modifier.A.rb b/semantic/test/fixtures/ruby/corpus/rescue-modifier.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/rescue-modifier.A.rb rename to semantic/test/fixtures/ruby/corpus/rescue-modifier.A.rb diff --git a/test/fixtures/ruby/corpus/rescue-modifier.B.rb b/semantic/test/fixtures/ruby/corpus/rescue-modifier.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/rescue-modifier.B.rb rename to semantic/test/fixtures/ruby/corpus/rescue-modifier.B.rb diff --git a/test/fixtures/ruby/corpus/rescue-modifier.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/rescue-modifier.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/rescue-modifier.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/rescue-modifier.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/rescue-modifier.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/rescue-modifier.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/rescue-modifier.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/rescue-modifier.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/rescue-modifier.parseA.txt b/semantic/test/fixtures/ruby/corpus/rescue-modifier.parseA.txt new file mode 100644 index 0000000000..1dfe921801 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue-modifier.parseA.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (RescueModifier + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Arg + (Primary + (Lhs + (Nil "nil"))))))) diff --git a/semantic/test/fixtures/ruby/corpus/rescue-modifier.parseB.txt b/semantic/test/fixtures/ruby/corpus/rescue-modifier.parseB.txt new file mode 100644 index 0000000000..61d0152739 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue-modifier.parseB.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (RescueModifier + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Arg + (Primary + (Lhs + (False "false"))))))) diff --git a/test/fixtures/ruby/corpus/rescue-modifier2.A.rb b/semantic/test/fixtures/ruby/corpus/rescue-modifier2.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/rescue-modifier2.A.rb rename to semantic/test/fixtures/ruby/corpus/rescue-modifier2.A.rb diff --git a/test/fixtures/ruby/corpus/rescue-modifier2.B.rb b/semantic/test/fixtures/ruby/corpus/rescue-modifier2.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/rescue-modifier2.B.rb rename to semantic/test/fixtures/ruby/corpus/rescue-modifier2.B.rb diff --git a/test/fixtures/ruby/corpus/rescue-modifier2.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/rescue-modifier2.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/rescue-modifier2.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/rescue-modifier2.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/rescue-modifier2.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/rescue-modifier2.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/rescue-modifier2.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/rescue-modifier2.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/rescue-modifier2.parseA.txt b/semantic/test/fixtures/ruby/corpus/rescue-modifier2.parseA.txt new file mode 100644 index 0000000000..1dfe921801 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue-modifier2.parseA.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (RescueModifier + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Arg + (Primary + (Lhs + (Nil "nil"))))))) diff --git a/semantic/test/fixtures/ruby/corpus/rescue-modifier2.parseB.txt b/semantic/test/fixtures/ruby/corpus/rescue-modifier2.parseB.txt new file mode 100644 index 0000000000..f0ef8eb87b --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue-modifier2.parseB.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (RescueModifier + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar")))))) + (Arg + (Primary + (Lhs + (Nil "nil"))))))) diff --git a/test/fixtures/ruby/corpus/rescue.A.rb b/semantic/test/fixtures/ruby/corpus/rescue.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/rescue.A.rb rename to semantic/test/fixtures/ruby/corpus/rescue.A.rb diff --git a/test/fixtures/ruby/corpus/rescue.B.rb b/semantic/test/fixtures/ruby/corpus/rescue.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/rescue.B.rb rename to semantic/test/fixtures/ruby/corpus/rescue.B.rb diff --git a/semantic/test/fixtures/ruby/corpus/rescue.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/rescue.diffA-B.txt new file mode 100644 index 0000000000..195732097c --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue.diffA-B.txt @@ -0,0 +1,67 @@ +(Statements +{+(Try + {+(Statements + {+(Send + {+(Identifier)+})+} + {+(Catch + {+(Statements + {+(Statements + {+(Send + {+(Identifier)+})+})+})+} + {+(Send + {+(Identifier)+})+})+})+})+} +{-(Try + {-(Statements + {-(Send + {-(Identifier)-})-} + {-(Catch + {-(Statements + {-(Statements + {-(Identifier)-})-})-} + {-(Statements)-})-} + {-(Catch + {-(Statements + {-(Statements + {-(Identifier)-} + {-(Identifier)-})-} + {-(Statements + {-(Send + {-(Identifier)-})-})-})-} + {-(Send + {-(Identifier)-})-})-} + {-(Else + {-(Empty)-} + {-(Send + {-(Identifier)-})-})-} + {-(Finally + {-(Send + {-(Identifier)-})-})-})-})-} +{-(Method + {-(Empty)-} + {-(Identifier)-} + {-(Statements + {-(Catch + {-(Statements + {-(Statements + {-(Identifier)-})-})-} + {-(Statements)-})-} + {-(Catch + {-(Statements + {-(Statements + {-(Identifier)-} + {-(Identifier)-})-} + {-(Statements + {-(Send + {-(Identifier)-})-})-})-} + {-(Statements)-})-} + {-(Else + {-(Empty)-} + {-(Statements)-})-} + {-(Finally + {-(Statements)-})-})-})-} +{-(Try + {-(Send + {-(Identifier)-})-} + {-(Catch + {-(Null)-} + {-(Empty)-})-})-}) diff --git a/semantic/test/fixtures/ruby/corpus/rescue.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/rescue.diffB-A.txt new file mode 100644 index 0000000000..92283f64a3 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue.diffB-A.txt @@ -0,0 +1,66 @@ +(Statements +{+(Try + {+(Statements + {+(Send + {+(Identifier)+})+} + {+(Catch + {+(Statements + {+(Statements + {+(Identifier)+})+})+} + {+(Statements)+})+} + {+(Catch + {+(Statements + {+(Statements + {+(Identifier)+} + {+(Identifier)+})+} + {+(Statements + {+(Send + {+(Identifier)+})+})+})+} + {+(Send + {+(Identifier)+})+})+} + {+(Else + {+(Empty)+} + {+(Send + {+(Identifier)+})+})+} + {+(Finally + {+(Send + {+(Identifier)+})+})+})+})+} +{+(Method + {+(Empty)+} + {+(Identifier)+} + {+(Statements + {+(Catch + {+(Statements + {+(Statements + {+(Identifier)+})+})+} + {+(Statements)+})+} + {+(Catch + {+(Statements + {+(Statements + {+(Identifier)+} + {+(Identifier)+})+} + {+(Statements + {+(Send + {+(Identifier)+})+})+})+} + {+(Statements)+})+} + {+(Else + {+(Empty)+} + {+(Statements)+})+} + {+(Finally + {+(Statements)+})+})+})+} + (Try + { (Statements + {-(Send + {-(Identifier)-})-} + {-(Catch + {-(Statements + {-(Statements + {-(Send + {-(Identifier)-})-})-})-} + {-(Send + {-(Identifier)-})-})-}) + ->(Send + {+(Identifier)+}) } + {+(Catch + {+(Null)+} + {+(Empty)+})+})) diff --git a/semantic/test/fixtures/ruby/corpus/rescue.parseA.txt b/semantic/test/fixtures/ruby/corpus/rescue.parseA.txt new file mode 100644 index 0000000000..73558b72f0 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue.parseA.txt @@ -0,0 +1,98 @@ +(Program + (Statement + (Arg + (Primary + (Begin + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Rescue + (Exceptions + (Arg + (Primary + (Lhs + (Variable + (Constant "Error"))))))) + (Rescue + (Exceptions + (Arg + (Primary + (Lhs + (Variable + (Constant "StandardError"))))) + (Arg + (Primary + (Lhs + (Variable + (Constant "TimeoutError")))))) + (Then + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "x"))))))) + (ExceptionVariable + (Lhs + (Variable + (Identifier "x"))))) + (Else + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "z"))))))) + (Ensure + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "y"))))))))))) + (Statement + (Arg + (Primary + (Method + (MethodName + (Identifier "foo")) + (Rescue + (Exceptions + (Arg + (Primary + (Lhs + (Variable + (Constant "Error"))))))) + (Rescue + (Exceptions + (Arg + (Primary + (Lhs + (Variable + (Constant "StandardError"))))) + (Arg + (Primary + (Lhs + (Variable + (Constant "TimeoutError")))))) + (ExceptionVariable + (Lhs + (Variable + (Identifier "x"))))) + (Else) + (Ensure))))) + (Statement + (RescueModifier + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar")))))) + (Arg + (Primary + (Lhs + (Nil "nil"))))))) diff --git a/semantic/test/fixtures/ruby/corpus/rescue.parseB.txt b/semantic/test/fixtures/ruby/corpus/rescue.parseB.txt new file mode 100644 index 0000000000..dfe1a001c8 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/rescue.parseB.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (Arg + (Primary + (Begin + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Rescue + (Exceptions + (Arg + (Primary + (Lhs + (Variable + (Identifier "x")))))) + (Then + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))))))))) diff --git a/test/fixtures/ruby/corpus/return.A.rb b/semantic/test/fixtures/ruby/corpus/return.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/return.A.rb rename to semantic/test/fixtures/ruby/corpus/return.A.rb diff --git a/test/fixtures/ruby/corpus/return.B.rb b/semantic/test/fixtures/ruby/corpus/return.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/return.B.rb rename to semantic/test/fixtures/ruby/corpus/return.B.rb diff --git a/test/fixtures/ruby/corpus/return.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/return.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/return.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/return.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/return.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/return.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/return.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/return.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/return.parseA.txt b/semantic/test/fixtures/ruby/corpus/return.parseA.txt new file mode 100644 index 0000000000..87a2f30e67 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/return.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Return + (ArgumentList + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/return.parseB.txt b/semantic/test/fixtures/ruby/corpus/return.parseB.txt new file mode 100644 index 0000000000..1485b103d8 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/return.parseB.txt @@ -0,0 +1,3 @@ +(Program + (Statement + (Return))) diff --git a/test/fixtures/ruby/corpus/singleton-class.A.rb b/semantic/test/fixtures/ruby/corpus/singleton-class.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/singleton-class.A.rb rename to semantic/test/fixtures/ruby/corpus/singleton-class.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/singleton-class.parseA.txt b/semantic/test/fixtures/ruby/corpus/singleton-class.parseA.txt new file mode 100644 index 0000000000..587f18a7d2 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/singleton-class.parseA.txt @@ -0,0 +1,31 @@ +(Program + (Statement + (Arg + (Primary + (SingletonClass + (Arg + (Primary + (Lhs + (Variable + (Self "self"))))))))) + (Statement + (Arg + (Primary + (SingletonClass + (Arg + (Primary + (Lhs + (ScopeResolution + (Constant "Bar") + (Primary + (Lhs + (Variable + (Constant "Foo")))))))) + (Statement + (MethodCall + (ArgumentList + (Arg + (Primary + (Symbol)))) + (Variable + (Identifier "att_reader"))))))))) diff --git a/test/fixtures/ruby/corpus/string.A.rb b/semantic/test/fixtures/ruby/corpus/string.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/string.A.rb rename to semantic/test/fixtures/ruby/corpus/string.A.rb diff --git a/test/fixtures/ruby/corpus/string.B.rb b/semantic/test/fixtures/ruby/corpus/string.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/string.B.rb rename to semantic/test/fixtures/ruby/corpus/string.B.rb diff --git a/test/fixtures/ruby/corpus/string.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/string.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/string.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/string.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/string.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/string.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/string.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/string.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/string.parseA.txt b/semantic/test/fixtures/ruby/corpus/string.parseA.txt new file mode 100644 index 0000000000..603edd603c --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/string.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String))))) diff --git a/semantic/test/fixtures/ruby/corpus/string.parseB.txt b/semantic/test/fixtures/ruby/corpus/string.parseB.txt new file mode 100644 index 0000000000..603edd603c --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/string.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Arg + (Primary + (String)))) + (Statement + (Arg + (Primary + (String))))) diff --git a/test/fixtures/ruby/corpus/subshell.A.rb b/semantic/test/fixtures/ruby/corpus/subshell.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/subshell.A.rb rename to semantic/test/fixtures/ruby/corpus/subshell.A.rb diff --git a/test/fixtures/ruby/corpus/subshell.B.rb b/semantic/test/fixtures/ruby/corpus/subshell.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/subshell.B.rb rename to semantic/test/fixtures/ruby/corpus/subshell.B.rb diff --git a/test/fixtures/ruby/corpus/subshell.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/subshell.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/subshell.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/subshell.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/subshell.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/subshell.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/subshell.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/subshell.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/subshell.parseA.txt b/semantic/test/fixtures/ruby/corpus/subshell.parseA.txt new file mode 100644 index 0000000000..593dd7624e --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/subshell.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (Arg + (Primary + (Subshell))))) diff --git a/semantic/test/fixtures/ruby/corpus/subshell.parseB.txt b/semantic/test/fixtures/ruby/corpus/subshell.parseB.txt new file mode 100644 index 0000000000..593dd7624e --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/subshell.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (Arg + (Primary + (Subshell))))) diff --git a/test/fixtures/ruby/corpus/symbol.A.rb b/semantic/test/fixtures/ruby/corpus/symbol.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/symbol.A.rb rename to semantic/test/fixtures/ruby/corpus/symbol.A.rb diff --git a/test/fixtures/ruby/corpus/symbol.B.rb b/semantic/test/fixtures/ruby/corpus/symbol.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/symbol.B.rb rename to semantic/test/fixtures/ruby/corpus/symbol.B.rb diff --git a/test/fixtures/ruby/corpus/symbol.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/symbol.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/symbol.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/symbol.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/symbol.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/symbol.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/symbol.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/symbol.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/symbol.parseA.txt b/semantic/test/fixtures/ruby/corpus/symbol.parseA.txt new file mode 100644 index 0000000000..d6f9d90d2a --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/symbol.parseA.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Arg + (Primary + (Symbol)))) + (Statement + (Arg + (Primary + (Symbol)))) + (Statement + (Arg + (Primary + (Symbol))))) diff --git a/semantic/test/fixtures/ruby/corpus/symbol.parseB.txt b/semantic/test/fixtures/ruby/corpus/symbol.parseB.txt new file mode 100644 index 0000000000..d6f9d90d2a --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/symbol.parseB.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Arg + (Primary + (Symbol)))) + (Statement + (Arg + (Primary + (Symbol)))) + (Statement + (Arg + (Primary + (Symbol))))) diff --git a/test/fixtures/ruby/corpus/ternary.A.rb b/semantic/test/fixtures/ruby/corpus/ternary.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/ternary.A.rb rename to semantic/test/fixtures/ruby/corpus/ternary.A.rb diff --git a/test/fixtures/ruby/corpus/ternary.B.rb b/semantic/test/fixtures/ruby/corpus/ternary.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/ternary.B.rb rename to semantic/test/fixtures/ruby/corpus/ternary.B.rb diff --git a/test/fixtures/ruby/corpus/ternary.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/ternary.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/ternary.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/ternary.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/ternary.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/ternary.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/ternary.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/ternary.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/ternary.parseA.txt b/semantic/test/fixtures/ruby/corpus/ternary.parseA.txt new file mode 100644 index 0000000000..e1a90ecd5d --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/ternary.parseA.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (Arg + (Conditional + (Arg + (Primary + (Lhs + (Variable + (Identifier "case2"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "case1"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/ternary.parseB.txt b/semantic/test/fixtures/ruby/corpus/ternary.parseB.txt new file mode 100644 index 0000000000..90404242a8 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/ternary.parseB.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (Arg + (Conditional + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))))) diff --git a/test/fixtures/ruby/corpus/unary.A.rb b/semantic/test/fixtures/ruby/corpus/unary.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/unary.A.rb rename to semantic/test/fixtures/ruby/corpus/unary.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/unary.parseA.txt b/semantic/test/fixtures/ruby/corpus/unary.parseA.txt new file mode 100644 index 0000000000..4ee60a25bc --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/unary.parseA.txt @@ -0,0 +1,49 @@ +(Program + (Statement + (Arg + (Unary + (Arg + (Primary + (Lhs + (Variable + (Identifier "a")))))))) + (Statement + (Arg + (Unary + (Arg + (Primary + (Lhs + (Variable + (Identifier "a")))))))) + (Statement + (Arg + (Unary + (Arg + (Primary + (Lhs + (Variable + (Identifier "a")))))))) + (Statement + (Arg + (Unary + (Arg + (Primary + (Lhs + (Variable + (Identifier "a")))))))) + (Statement + (Arg + (Unary + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))))) + (Statement + (Arg + (Unary + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))))))) diff --git a/test/fixtures/ruby/corpus/undef.A.rb b/semantic/test/fixtures/ruby/corpus/undef.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/undef.A.rb rename to semantic/test/fixtures/ruby/corpus/undef.A.rb diff --git a/semantic/test/fixtures/ruby/corpus/undef.parseA.txt b/semantic/test/fixtures/ruby/corpus/undef.parseA.txt new file mode 100644 index 0000000000..9ef574d7e7 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/undef.parseA.txt @@ -0,0 +1,28 @@ +(Program + (Statement + (Undef + (MethodName + (Symbol)))) + (Statement + (Undef + (MethodName + (Identifier "foo")))) + (Statement + (Undef + (MethodName + (Setter + (Identifier "foo"))))) + (Statement + (Undef + (MethodName + (Operator "+")))) + (Statement + (Undef + (MethodName + (GlobalVariable "$FOO")))) + (Statement + (Undef + (MethodName + (Symbol)) + (MethodName + (Symbol))))) diff --git a/test/fixtures/ruby/corpus/unless.A.rb b/semantic/test/fixtures/ruby/corpus/unless.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/unless.A.rb rename to semantic/test/fixtures/ruby/corpus/unless.A.rb diff --git a/test/fixtures/ruby/corpus/unless.B.rb b/semantic/test/fixtures/ruby/corpus/unless.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/unless.B.rb rename to semantic/test/fixtures/ruby/corpus/unless.B.rb diff --git a/test/fixtures/ruby/corpus/unless.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/unless.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/unless.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/unless.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/unless.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/unless.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/unless.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/unless.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/unless.parseA.txt b/semantic/test/fixtures/ruby/corpus/unless.parseA.txt new file mode 100644 index 0000000000..523d17eeda --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/unless.parseA.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (Arg + (Primary + (Unless + (Else + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bat"))))))) + (Then + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))) + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/unless.parseB.txt b/semantic/test/fixtures/ruby/corpus/unless.parseB.txt new file mode 100644 index 0000000000..d6eb7f76a7 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/unless.parseB.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (Arg + (Primary + (Unless + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "x")))))))))) + (Statement + (Arg + (Primary + (Unless + (Then) + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "y"))))))))))) diff --git a/test/fixtures/ruby/corpus/until.A.rb b/semantic/test/fixtures/ruby/corpus/until.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/until.A.rb rename to semantic/test/fixtures/ruby/corpus/until.A.rb diff --git a/test/fixtures/ruby/corpus/until.B.rb b/semantic/test/fixtures/ruby/corpus/until.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/until.B.rb rename to semantic/test/fixtures/ruby/corpus/until.B.rb diff --git a/test/fixtures/ruby/corpus/until.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/until.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/until.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/until.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/until.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/until.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/until.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/until.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/until.parseA.txt b/semantic/test/fixtures/ruby/corpus/until.parseA.txt new file mode 100644 index 0000000000..c3c2141a06 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/until.parseA.txt @@ -0,0 +1,24 @@ +(Program + (Statement + (Arg + (Primary + (Until + (Do) + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))))))) + (Statement + (UntilModifier + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "done")))))))) diff --git a/semantic/test/fixtures/ruby/corpus/until.parseB.txt b/semantic/test/fixtures/ruby/corpus/until.parseB.txt new file mode 100644 index 0000000000..cfb6ea2206 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/until.parseB.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (Arg + (Primary + (Until + (Do + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))))))) diff --git a/test/fixtures/ruby/corpus/when-else.A.rb b/semantic/test/fixtures/ruby/corpus/when-else.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/when-else.A.rb rename to semantic/test/fixtures/ruby/corpus/when-else.A.rb diff --git a/test/fixtures/ruby/corpus/when-else.B.rb b/semantic/test/fixtures/ruby/corpus/when-else.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/when-else.B.rb rename to semantic/test/fixtures/ruby/corpus/when-else.B.rb diff --git a/test/fixtures/ruby/corpus/when-else.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/when-else.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/when-else.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/when-else.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/when-else.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/when-else.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/when-else.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/when-else.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/when-else.parseA.txt b/semantic/test/fixtures/ruby/corpus/when-else.parseA.txt new file mode 100644 index 0000000000..d2364c469b --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/when-else.parseA.txt @@ -0,0 +1,40 @@ +(Program + (Statement + (Arg + (Primary + (Case + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))) + (When + (Pattern + (Arg + (Primary + (Lhs + (Variable + (Identifier "qux"))))))) + (When + (Pattern + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar")))))) + (Token) + (Pattern + (SplatArgument + (Arg + (Primary + (Lhs + (Variable + (Identifier "a"))))))) + (Then + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "baz")))))))) + (Else)))))) diff --git a/semantic/test/fixtures/ruby/corpus/when-else.parseB.txt b/semantic/test/fixtures/ruby/corpus/when-else.parseB.txt new file mode 100644 index 0000000000..f599f86b81 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/when-else.parseB.txt @@ -0,0 +1,45 @@ +(Program + (Statement + (Arg + (Primary + (Case + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))) + (When + (Pattern + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar")))))) + (Then + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "baz")))))))) + (When + (Pattern + (Arg + (Primary + (Lhs + (Variable + (Identifier "x"))))))) + (When + (Pattern + (Arg + (Primary + (Lhs + (Variable + (Identifier "y"))))))) + (Else + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "qoz")))))))))))) diff --git a/test/fixtures/ruby/corpus/when.A.rb b/semantic/test/fixtures/ruby/corpus/when.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/when.A.rb rename to semantic/test/fixtures/ruby/corpus/when.A.rb diff --git a/test/fixtures/ruby/corpus/when.B.rb b/semantic/test/fixtures/ruby/corpus/when.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/when.B.rb rename to semantic/test/fixtures/ruby/corpus/when.B.rb diff --git a/test/fixtures/ruby/corpus/when.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/when.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/when.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/when.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/when.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/when.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/when.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/when.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/when.parseA.txt b/semantic/test/fixtures/ruby/corpus/when.parseA.txt new file mode 100644 index 0000000000..f5e896025c --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/when.parseA.txt @@ -0,0 +1,32 @@ +(Program + (Statement + (Arg + (Primary + (Case + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))) + (When + (Pattern + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))))))) + (Statement + (Arg + (Primary + (Case + (When + (Pattern + (Arg + (Primary + (Lhs + (True "true"))))) + (Then + (Statement + (Arg + (Primary + (String))))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/when.parseB.txt b/semantic/test/fixtures/ruby/corpus/when.parseB.txt new file mode 100644 index 0000000000..d858b6cabb --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/when.parseB.txt @@ -0,0 +1,45 @@ +(Program + (Statement + (Arg + (Primary + (Case + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))) + (When + (Pattern + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar")))))) + (Then + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "baz")))))))) + (When + (Pattern + (Arg + (Primary + (Lhs + (Variable + (Identifier "a")))))) + (Token) + (Pattern + (Arg + (Primary + (Lhs + (Variable + (Identifier "b"))))))) + (Else + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bat")))))))))))) diff --git a/test/fixtures/ruby/corpus/while.A.rb b/semantic/test/fixtures/ruby/corpus/while.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/while.A.rb rename to semantic/test/fixtures/ruby/corpus/while.A.rb diff --git a/test/fixtures/ruby/corpus/while.B.rb b/semantic/test/fixtures/ruby/corpus/while.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/while.B.rb rename to semantic/test/fixtures/ruby/corpus/while.B.rb diff --git a/test/fixtures/ruby/corpus/while.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/while.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/while.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/while.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/while.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/while.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/while.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/while.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/while.parseA.txt b/semantic/test/fixtures/ruby/corpus/while.parseA.txt new file mode 100644 index 0000000000..e3e174e81e --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/while.parseA.txt @@ -0,0 +1,24 @@ +(Program + (Statement + (Arg + (Primary + (While + (Do) + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))))))) + (Statement + (WhileModifier + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "run")))))))) diff --git a/semantic/test/fixtures/ruby/corpus/while.parseB.txt b/semantic/test/fixtures/ruby/corpus/while.parseB.txt new file mode 100644 index 0000000000..72145d38f2 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/while.parseB.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (Arg + (Primary + (While + (Do + (Statement + (Arg + (Primary + (Lhs + (Variable + (Identifier "bar"))))))) + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo")))))))))) diff --git a/test/fixtures/ruby/corpus/yield.A.rb b/semantic/test/fixtures/ruby/corpus/yield.A.rb similarity index 100% rename from test/fixtures/ruby/corpus/yield.A.rb rename to semantic/test/fixtures/ruby/corpus/yield.A.rb diff --git a/test/fixtures/ruby/corpus/yield.B.rb b/semantic/test/fixtures/ruby/corpus/yield.B.rb similarity index 100% rename from test/fixtures/ruby/corpus/yield.B.rb rename to semantic/test/fixtures/ruby/corpus/yield.B.rb diff --git a/test/fixtures/ruby/corpus/yield.diffA-B.txt b/semantic/test/fixtures/ruby/corpus/yield.diffA-B.txt similarity index 100% rename from test/fixtures/ruby/corpus/yield.diffA-B.txt rename to semantic/test/fixtures/ruby/corpus/yield.diffA-B.txt diff --git a/test/fixtures/ruby/corpus/yield.diffB-A.txt b/semantic/test/fixtures/ruby/corpus/yield.diffB-A.txt similarity index 100% rename from test/fixtures/ruby/corpus/yield.diffB-A.txt rename to semantic/test/fixtures/ruby/corpus/yield.diffB-A.txt diff --git a/semantic/test/fixtures/ruby/corpus/yield.parseA.txt b/semantic/test/fixtures/ruby/corpus/yield.parseA.txt new file mode 100644 index 0000000000..834a4e10f2 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/yield.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Yield + (ArgumentList + (Arg + (Primary + (Lhs + (Variable + (Identifier "foo"))))))))) diff --git a/semantic/test/fixtures/ruby/corpus/yield.parseB.txt b/semantic/test/fixtures/ruby/corpus/yield.parseB.txt new file mode 100644 index 0000000000..9a24dbb473 --- /dev/null +++ b/semantic/test/fixtures/ruby/corpus/yield.parseB.txt @@ -0,0 +1,3 @@ +(Program + (Statement + (Yield))) diff --git a/test/fixtures/ruby/import-graph/app.json b/semantic/test/fixtures/ruby/import-graph/app.json similarity index 100% rename from test/fixtures/ruby/import-graph/app.json rename to semantic/test/fixtures/ruby/import-graph/app.json diff --git a/test/fixtures/ruby/import-graph/app.rb b/semantic/test/fixtures/ruby/import-graph/app.rb similarity index 100% rename from test/fixtures/ruby/import-graph/app.rb rename to semantic/test/fixtures/ruby/import-graph/app.rb diff --git a/test/fixtures/ruby/reprinting/function.out.rb b/semantic/test/fixtures/ruby/reprinting/function.out.rb similarity index 100% rename from test/fixtures/ruby/reprinting/function.out.rb rename to semantic/test/fixtures/ruby/reprinting/function.out.rb diff --git a/test/fixtures/ruby/reprinting/function.rb b/semantic/test/fixtures/ruby/reprinting/function.rb similarity index 100% rename from test/fixtures/ruby/reprinting/function.rb rename to semantic/test/fixtures/ruby/reprinting/function.rb diff --git a/test/fixtures/ruby/reprinting/infix.rb b/semantic/test/fixtures/ruby/reprinting/infix.rb similarity index 100% rename from test/fixtures/ruby/reprinting/infix.rb rename to semantic/test/fixtures/ruby/reprinting/infix.rb diff --git a/test/fixtures/ruby/tags/class_module.rb b/semantic/test/fixtures/ruby/tags/class_module.rb similarity index 100% rename from test/fixtures/ruby/tags/class_module.rb rename to semantic/test/fixtures/ruby/tags/class_module.rb diff --git a/test/fixtures/ruby/tags/simple_method.rb b/semantic/test/fixtures/ruby/tags/simple_method.rb similarity index 100% rename from test/fixtures/ruby/tags/simple_method.rb rename to semantic/test/fixtures/ruby/tags/simple_method.rb diff --git a/test/fixtures/ruby/tags/simple_method_with_docs.rb b/semantic/test/fixtures/ruby/tags/simple_method_with_docs.rb similarity index 100% rename from test/fixtures/ruby/tags/simple_method_with_docs.rb rename to semantic/test/fixtures/ruby/tags/simple_method_with_docs.rb diff --git a/semantic/test/fixtures/ruby/tags/unicode_identifiers.rb b/semantic/test/fixtures/ruby/tags/unicode_identifiers.rb new file mode 100644 index 0000000000..50a42b0a0a --- /dev/null +++ b/semantic/test/fixtures/ruby/tags/unicode_identifiers.rb @@ -0,0 +1,4 @@ +# coding: utf-8 +def ζ—₯本θͺž + "hello" +end diff --git a/test/fixtures/ruby/toc/classes.A.rb b/semantic/test/fixtures/ruby/toc/classes.A.rb similarity index 100% rename from test/fixtures/ruby/toc/classes.A.rb rename to semantic/test/fixtures/ruby/toc/classes.A.rb diff --git a/test/fixtures/ruby/toc/classes.B.rb b/semantic/test/fixtures/ruby/toc/classes.B.rb similarity index 100% rename from test/fixtures/ruby/toc/classes.B.rb rename to semantic/test/fixtures/ruby/toc/classes.B.rb diff --git a/test/fixtures/ruby/toc/lambda.A.rb b/semantic/test/fixtures/ruby/toc/lambda.A.rb similarity index 100% rename from test/fixtures/ruby/toc/lambda.A.rb rename to semantic/test/fixtures/ruby/toc/lambda.A.rb diff --git a/test/fixtures/ruby/toc/lambda.B.rb b/semantic/test/fixtures/ruby/toc/lambda.B.rb similarity index 100% rename from test/fixtures/ruby/toc/lambda.B.rb rename to semantic/test/fixtures/ruby/toc/lambda.B.rb diff --git a/test/fixtures/ruby/toc/method-starts-with-two-identifiers.A.rb b/semantic/test/fixtures/ruby/toc/method-starts-with-two-identifiers.A.rb similarity index 100% rename from test/fixtures/ruby/toc/method-starts-with-two-identifiers.A.rb rename to semantic/test/fixtures/ruby/toc/method-starts-with-two-identifiers.A.rb diff --git a/test/fixtures/ruby/toc/method-starts-with-two-identifiers.B.rb b/semantic/test/fixtures/ruby/toc/method-starts-with-two-identifiers.B.rb similarity index 100% rename from test/fixtures/ruby/toc/method-starts-with-two-identifiers.B.rb rename to semantic/test/fixtures/ruby/toc/method-starts-with-two-identifiers.B.rb diff --git a/test/fixtures/ruby/toc/methods.A.rb b/semantic/test/fixtures/ruby/toc/methods.A.rb similarity index 100% rename from test/fixtures/ruby/toc/methods.A.rb rename to semantic/test/fixtures/ruby/toc/methods.A.rb diff --git a/test/fixtures/ruby/toc/methods.B.rb b/semantic/test/fixtures/ruby/toc/methods.B.rb similarity index 100% rename from test/fixtures/ruby/toc/methods.B.rb rename to semantic/test/fixtures/ruby/toc/methods.B.rb diff --git a/semantic/test/fixtures/ruby/toc/methods.X.rb b/semantic/test/fixtures/ruby/toc/methods.X.rb new file mode 100644 index 0000000000..fc76c3d07a --- /dev/null +++ b/semantic/test/fixtures/ruby/toc/methods.X.rb @@ -0,0 +1,2 @@ +def bar +end diff --git a/test/fixtures/ruby/toc/unicode.A.rb b/semantic/test/fixtures/ruby/toc/unicode.A.rb similarity index 100% rename from test/fixtures/ruby/toc/unicode.A.rb rename to semantic/test/fixtures/ruby/toc/unicode.A.rb diff --git a/test/fixtures/ruby/toc/unicode.B.rb b/semantic/test/fixtures/ruby/toc/unicode.B.rb similarity index 100% rename from test/fixtures/ruby/toc/unicode.B.rb rename to semantic/test/fixtures/ruby/toc/unicode.B.rb diff --git a/test/fixtures/tsx/corpus/jsx-elements.A.tsx b/semantic/test/fixtures/tsx/corpus/jsx-elements.A.tsx similarity index 100% rename from test/fixtures/tsx/corpus/jsx-elements.A.tsx rename to semantic/test/fixtures/tsx/corpus/jsx-elements.A.tsx diff --git a/test/fixtures/tsx/corpus/jsx-elements.B.tsx b/semantic/test/fixtures/tsx/corpus/jsx-elements.B.tsx similarity index 100% rename from test/fixtures/tsx/corpus/jsx-elements.B.tsx rename to semantic/test/fixtures/tsx/corpus/jsx-elements.B.tsx diff --git a/test/fixtures/tsx/corpus/jsx-elements.diffA-B.txt b/semantic/test/fixtures/tsx/corpus/jsx-elements.diffA-B.txt similarity index 94% rename from test/fixtures/tsx/corpus/jsx-elements.diffA-B.txt rename to semantic/test/fixtures/tsx/corpus/jsx-elements.diffA-B.txt index 9e330c8d5c..04d7fa6870 100644 --- a/test/fixtures/tsx/corpus/jsx-elements.diffA-B.txt +++ b/semantic/test/fixtures/tsx/corpus/jsx-elements.diffA-B.txt @@ -6,6 +6,7 @@ (JsxElement (JsxOpeningElement (Identifier) + (Empty) {+(JsxAttribute {+(Identifier)+} {+(JsxExpression @@ -31,7 +32,8 @@ {-(JsxOpeningElement {-(NestedIdentifier {-(Identifier)-} - {-(Identifier)-})-})-} + {-(Identifier)-})-} + {-(Empty)-})-} {-(JsxClosingElement {-(NestedIdentifier {-(Identifier)-} diff --git a/test/fixtures/tsx/corpus/jsx-elements.diffB-A.txt b/semantic/test/fixtures/tsx/corpus/jsx-elements.diffB-A.txt similarity index 94% rename from test/fixtures/tsx/corpus/jsx-elements.diffB-A.txt rename to semantic/test/fixtures/tsx/corpus/jsx-elements.diffB-A.txt index 6f4ba9f23e..bb6402bef0 100644 --- a/test/fixtures/tsx/corpus/jsx-elements.diffB-A.txt +++ b/semantic/test/fixtures/tsx/corpus/jsx-elements.diffB-A.txt @@ -6,6 +6,7 @@ (JsxElement (JsxOpeningElement (Identifier) + (Empty) {+(JsxExpression {+(Call {+(Identifier)+} @@ -31,7 +32,8 @@ {+(JsxOpeningElement {+(NestedIdentifier {+(Identifier)+} - {+(Identifier)+})+})+} + {+(Identifier)+})+} + {+(Empty)+})+} {+(JsxClosingElement {+(NestedIdentifier {+(Identifier)+} diff --git a/semantic/test/fixtures/tsx/corpus/jsx-elements.parseA.txt b/semantic/test/fixtures/tsx/corpus/jsx-elements.parseA.txt new file mode 100644 index 0000000000..34730e7844 --- /dev/null +++ b/semantic/test/fixtures/tsx/corpus/jsx-elements.parseA.txt @@ -0,0 +1,57 @@ +(Program + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (JsxElement + (JsxClosingElement + (Identifier "Text")) + (JsxOpeningElement + (JsxExpression + (SpreadElement + (Expression + (CallExpression + (Expression + (Identifier "css")) + (Arguments + (Expression + (MemberExpression + (PropertyIdentifier "titleText") + (Expression + (Identifier "styles"))))))))) + (Identifier "Text")) + (JsxExpression + (Expression + (Identifier "children"))))) + (Identifier "a"))))) + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (JsxElement + (JsxClosingElement + (NestedIdentifier + (Identifier "Foo") + (Identifier "Text"))) + (JsxOpeningElement + (NestedIdentifier + (Identifier "Foo") + (Identifier "Text"))))) + (Identifier "b"))))) + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (JsxSelfClosingElement + (JsxAttribute + (PropertyIdentifier "foo")) + (JsxAttribute + (PropertyIdentifier "bar") + (String)) + (NestedIdentifier + (Identifier "Foo") + (Identifier "Text")))) + (Identifier "c")))))) diff --git a/semantic/test/fixtures/tsx/corpus/jsx-elements.parseB.txt b/semantic/test/fixtures/tsx/corpus/jsx-elements.parseB.txt new file mode 100644 index 0000000000..08c0302dd1 --- /dev/null +++ b/semantic/test/fixtures/tsx/corpus/jsx-elements.parseB.txt @@ -0,0 +1,23 @@ +(Program + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (JsxElement + (JsxClosingElement + (Identifier "Text")) + (JsxOpeningElement + (JsxAttribute + (PropertyIdentifier "bar") + (JsxExpression + (Expression + (MemberExpression + (PropertyIdentifier "titleText") + (Expression + (Identifier "styles")))))) + (Identifier "Text")) + (JsxExpression + (Expression + (Identifier "children"))))) + (Identifier "a")))))) diff --git a/test/fixtures/typescript/analysis/.gitignore b/semantic/test/fixtures/typescript/analysis/.gitignore similarity index 100% rename from test/fixtures/typescript/analysis/.gitignore rename to semantic/test/fixtures/typescript/analysis/.gitignore diff --git a/test/fixtures/typescript/analysis/a.ts b/semantic/test/fixtures/typescript/analysis/a.ts similarity index 100% rename from test/fixtures/typescript/analysis/a.ts rename to semantic/test/fixtures/typescript/analysis/a.ts diff --git a/test/fixtures/typescript/analysis/access_control/adder.ts b/semantic/test/fixtures/typescript/analysis/access_control/adder.ts similarity index 100% rename from test/fixtures/typescript/analysis/access_control/adder.ts rename to semantic/test/fixtures/typescript/analysis/access_control/adder.ts diff --git a/test/fixtures/typescript/analysis/access_control/private_field_definition.ts b/semantic/test/fixtures/typescript/analysis/access_control/private_field_definition.ts similarity index 100% rename from test/fixtures/typescript/analysis/access_control/private_field_definition.ts rename to semantic/test/fixtures/typescript/analysis/access_control/private_field_definition.ts diff --git a/test/fixtures/typescript/analysis/access_control/private_method.ts b/semantic/test/fixtures/typescript/analysis/access_control/private_method.ts similarity index 100% rename from test/fixtures/typescript/analysis/access_control/private_method.ts rename to semantic/test/fixtures/typescript/analysis/access_control/private_method.ts diff --git a/test/fixtures/typescript/analysis/access_control/private_static_field_definition.ts b/semantic/test/fixtures/typescript/analysis/access_control/private_static_field_definition.ts similarity index 100% rename from test/fixtures/typescript/analysis/access_control/private_static_field_definition.ts rename to semantic/test/fixtures/typescript/analysis/access_control/private_static_field_definition.ts diff --git a/test/fixtures/typescript/analysis/await.ts b/semantic/test/fixtures/typescript/analysis/await.ts similarity index 100% rename from test/fixtures/typescript/analysis/await.ts rename to semantic/test/fixtures/typescript/analysis/await.ts diff --git a/test/fixtures/typescript/analysis/bad-export.ts b/semantic/test/fixtures/typescript/analysis/bad-export.ts similarity index 100% rename from test/fixtures/typescript/analysis/bad-export.ts rename to semantic/test/fixtures/typescript/analysis/bad-export.ts diff --git a/test/fixtures/typescript/analysis/band.ts b/semantic/test/fixtures/typescript/analysis/band.ts similarity index 100% rename from test/fixtures/typescript/analysis/band.ts rename to semantic/test/fixtures/typescript/analysis/band.ts diff --git a/test/fixtures/typescript/analysis/baz.ts b/semantic/test/fixtures/typescript/analysis/baz.ts similarity index 100% rename from test/fixtures/typescript/analysis/baz.ts rename to semantic/test/fixtures/typescript/analysis/baz.ts diff --git a/test/fixtures/typescript/analysis/bor.ts b/semantic/test/fixtures/typescript/analysis/bor.ts similarity index 100% rename from test/fixtures/typescript/analysis/bor.ts rename to semantic/test/fixtures/typescript/analysis/bor.ts diff --git a/test/fixtures/typescript/analysis/bxor.ts b/semantic/test/fixtures/typescript/analysis/bxor.ts similarity index 100% rename from test/fixtures/typescript/analysis/bxor.ts rename to semantic/test/fixtures/typescript/analysis/bxor.ts diff --git a/test/fixtures/typescript/analysis/class1.ts b/semantic/test/fixtures/typescript/analysis/class1.ts similarity index 100% rename from test/fixtures/typescript/analysis/class1.ts rename to semantic/test/fixtures/typescript/analysis/class1.ts diff --git a/test/fixtures/typescript/analysis/class2.ts b/semantic/test/fixtures/typescript/analysis/class2.ts similarity index 100% rename from test/fixtures/typescript/analysis/class2.ts rename to semantic/test/fixtures/typescript/analysis/class2.ts diff --git a/test/fixtures/typescript/analysis/complement.ts b/semantic/test/fixtures/typescript/analysis/complement.ts similarity index 100% rename from test/fixtures/typescript/analysis/complement.ts rename to semantic/test/fixtures/typescript/analysis/complement.ts diff --git a/test/fixtures/typescript/analysis/delete.ts b/semantic/test/fixtures/typescript/analysis/delete.ts similarity index 100% rename from test/fixtures/typescript/analysis/delete.ts rename to semantic/test/fixtures/typescript/analysis/delete.ts diff --git a/test/fixtures/typescript/analysis/early-return.ts b/semantic/test/fixtures/typescript/analysis/early-return.ts similarity index 100% rename from test/fixtures/typescript/analysis/early-return.ts rename to semantic/test/fixtures/typescript/analysis/early-return.ts diff --git a/test/fixtures/typescript/analysis/foo.ts b/semantic/test/fixtures/typescript/analysis/foo.ts similarity index 100% rename from test/fixtures/typescript/analysis/foo.ts rename to semantic/test/fixtures/typescript/analysis/foo.ts diff --git a/test/fixtures/typescript/analysis/foo/b.ts b/semantic/test/fixtures/typescript/analysis/foo/b.ts similarity index 100% rename from test/fixtures/typescript/analysis/foo/b.ts rename to semantic/test/fixtures/typescript/analysis/foo/b.ts diff --git a/test/fixtures/typescript/analysis/foo2.ts b/semantic/test/fixtures/typescript/analysis/foo2.ts similarity index 100% rename from test/fixtures/typescript/analysis/foo2.ts rename to semantic/test/fixtures/typescript/analysis/foo2.ts diff --git a/test/fixtures/typescript/analysis/lshift.ts b/semantic/test/fixtures/typescript/analysis/lshift.ts similarity index 100% rename from test/fixtures/typescript/analysis/lshift.ts rename to semantic/test/fixtures/typescript/analysis/lshift.ts diff --git a/test/fixtures/typescript/analysis/main.ts b/semantic/test/fixtures/typescript/analysis/main.ts similarity index 100% rename from test/fixtures/typescript/analysis/main.ts rename to semantic/test/fixtures/typescript/analysis/main.ts diff --git a/test/fixtures/typescript/analysis/main1.ts b/semantic/test/fixtures/typescript/analysis/main1.ts similarity index 100% rename from test/fixtures/typescript/analysis/main1.ts rename to semantic/test/fixtures/typescript/analysis/main1.ts diff --git a/test/fixtures/typescript/analysis/main2.ts b/semantic/test/fixtures/typescript/analysis/main2.ts similarity index 100% rename from test/fixtures/typescript/analysis/main2.ts rename to semantic/test/fixtures/typescript/analysis/main2.ts diff --git a/test/fixtures/typescript/analysis/main3.ts b/semantic/test/fixtures/typescript/analysis/main3.ts similarity index 100% rename from test/fixtures/typescript/analysis/main3.ts rename to semantic/test/fixtures/typescript/analysis/main3.ts diff --git a/test/fixtures/typescript/analysis/main4.ts b/semantic/test/fixtures/typescript/analysis/main4.ts similarity index 100% rename from test/fixtures/typescript/analysis/main4.ts rename to semantic/test/fixtures/typescript/analysis/main4.ts diff --git a/test/fixtures/typescript/analysis/main5.ts b/semantic/test/fixtures/typescript/analysis/main5.ts similarity index 100% rename from test/fixtures/typescript/analysis/main5.ts rename to semantic/test/fixtures/typescript/analysis/main5.ts diff --git a/test/fixtures/typescript/analysis/main6.ts b/semantic/test/fixtures/typescript/analysis/main6.ts similarity index 100% rename from test/fixtures/typescript/analysis/main6.ts rename to semantic/test/fixtures/typescript/analysis/main6.ts diff --git a/test/fixtures/typescript/analysis/main7.ts b/semantic/test/fixtures/typescript/analysis/main7.ts similarity index 100% rename from test/fixtures/typescript/analysis/main7.ts rename to semantic/test/fixtures/typescript/analysis/main7.ts diff --git a/test/fixtures/typescript/analysis/pip.ts b/semantic/test/fixtures/typescript/analysis/pip.ts similarity index 100% rename from test/fixtures/typescript/analysis/pip.ts rename to semantic/test/fixtures/typescript/analysis/pip.ts diff --git a/test/fixtures/typescript/analysis/rshift.ts b/semantic/test/fixtures/typescript/analysis/rshift.ts similarity index 100% rename from test/fixtures/typescript/analysis/rshift.ts rename to semantic/test/fixtures/typescript/analysis/rshift.ts diff --git a/test/fixtures/typescript/analysis/sequence-expression.ts b/semantic/test/fixtures/typescript/analysis/sequence-expression.ts similarity index 100% rename from test/fixtures/typescript/analysis/sequence-expression.ts rename to semantic/test/fixtures/typescript/analysis/sequence-expression.ts diff --git a/test/fixtures/typescript/analysis/unsignedrshift.ts b/semantic/test/fixtures/typescript/analysis/unsignedrshift.ts similarity index 100% rename from test/fixtures/typescript/analysis/unsignedrshift.ts rename to semantic/test/fixtures/typescript/analysis/unsignedrshift.ts diff --git a/test/fixtures/typescript/analysis/void.ts b/semantic/test/fixtures/typescript/analysis/void.ts similarity index 100% rename from test/fixtures/typescript/analysis/void.ts rename to semantic/test/fixtures/typescript/analysis/void.ts diff --git a/test/fixtures/typescript/corpus/ambient-declarations.A.ts b/semantic/test/fixtures/typescript/corpus/ambient-declarations.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/ambient-declarations.A.ts rename to semantic/test/fixtures/typescript/corpus/ambient-declarations.A.ts diff --git a/test/fixtures/typescript/corpus/ambient-declarations.B.ts b/semantic/test/fixtures/typescript/corpus/ambient-declarations.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/ambient-declarations.B.ts rename to semantic/test/fixtures/typescript/corpus/ambient-declarations.B.ts diff --git a/test/fixtures/typescript/corpus/ambient-declarations.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/ambient-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/ambient-declarations.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/ambient-declarations.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/ambient-declarations.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/ambient-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/ambient-declarations.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/ambient-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/ambient-declarations.parseA.txt b/semantic/test/fixtures/typescript/corpus/ambient-declarations.parseA.txt new file mode 100644 index 0000000000..607097cdfd --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/ambient-declarations.parseA.txt @@ -0,0 +1,108 @@ +(Program + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (ClassDeclaration + (ClassBody + (PublicFieldDefinition + (PropertyIdentifier "constructor") + (TypeAnnotation + (TypeIdentifier "Function")))) + (TypeIdentifier "Error")))))) + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (VariableDeclaration + (VariableDeclarator + (Identifier "foo") + (TypeAnnotation + (PredefinedType "number")))))))) + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (FunctionSignature + (TypeAnnotation + (PredefinedType "void")) + (Identifier "greet") + (FormalParameters + (RequiredParameter + (Identifier "greeting") + (TypeAnnotation + (PredefinedType "string"))))))))) + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (InternalModule + (StatementBlock + (Statement + (Declaration + (FunctionSignature + (TypeAnnotation + (PredefinedType "string")) + (Identifier "makeGreeting") + (FormalParameters + (RequiredParameter + (Identifier "s") + (TypeAnnotation + (PredefinedType "string"))))))) + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "numberOfGreetings") + (TypeAnnotation + (PredefinedType "number")))))) + (Statement + (Declaration + (InterfaceDeclaration + (ObjectType + (PropertySignature + (PropertyIdentifier "verbose") + (TypeAnnotation + (PredefinedType "boolean")))) + (TypeIdentifier "LogOptions")))) + (Statement + (Declaration + (InterfaceDeclaration + (ObjectType + (PropertySignature + (PropertyIdentifier "modal") + (TypeAnnotation + (PredefinedType "boolean"))) + (PropertySignature + (PropertyIdentifier "title") + (TypeAnnotation + (PredefinedType "string"))) + (PropertySignature + (PropertyIdentifier "color") + (TypeAnnotation + (PredefinedType "string")))) + (TypeIdentifier "AlertOptions"))))) + (Identifier "myLib")))))) + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (ClassDeclaration + (ClassBody + (MethodSignature + (PropertyIdentifier "constructor") + (FormalParameters + (RequiredParameter + (Identifier "greeting") + (TypeAnnotation + (PredefinedType "string"))))) + (PublicFieldDefinition + (PropertyIdentifier "greeting") + (TypeAnnotation + (PredefinedType "string"))) + (MethodSignature + (TypeAnnotation + (PredefinedType "void")) + (PropertyIdentifier "showGreeting") + (FormalParameters))) + (TypeIdentifier "Greeter"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/ambient-declarations.parseB.txt b/semantic/test/fixtures/typescript/corpus/ambient-declarations.parseB.txt new file mode 100644 index 0000000000..411e0be404 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/ambient-declarations.parseB.txt @@ -0,0 +1,54 @@ +(Program + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (InternalModule + (StatementBlock) + (Identifier "Erro")))))) + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (ClassDeclaration + (ClassBody) + (TypeIdentifier "Bar")))))) + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (InterfaceDeclaration + (ObjectType) + (TypeIdentifier "LogOptions")))))) + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (ClassDeclaration + (ClassBody + (MethodSignature + (PropertyIdentifier "constructor") + (FormalParameters + (RequiredParameter + (Identifier "greeting") + (TypeAnnotation + (PredefinedType "string"))))) + (PublicFieldDefinition + (PropertyIdentifier "greeting") + (TypeAnnotation + (PredefinedType "string"))) + (MethodSignature + (TypeAnnotation + (PredefinedType "void")) + (PropertyIdentifier "showGreeting") + (FormalParameters))) + (TypeIdentifier "Greeter")))))) + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (FunctionSignature + (TypeAnnotation + (TypeIdentifier "Bar")) + (Identifier "foo") + (FormalParameters))))))) diff --git a/test/fixtures/typescript/corpus/ambient-exports.A.ts b/semantic/test/fixtures/typescript/corpus/ambient-exports.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/ambient-exports.A.ts rename to semantic/test/fixtures/typescript/corpus/ambient-exports.A.ts diff --git a/test/fixtures/typescript/corpus/ambient-exports.B.ts b/semantic/test/fixtures/typescript/corpus/ambient-exports.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/ambient-exports.B.ts rename to semantic/test/fixtures/typescript/corpus/ambient-exports.B.ts diff --git a/test/fixtures/typescript/corpus/ambient-exports.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/ambient-exports.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/ambient-exports.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/ambient-exports.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/ambient-exports.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/ambient-exports.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/ambient-exports.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/ambient-exports.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/ambient-exports.parseA.txt b/semantic/test/fixtures/typescript/corpus/ambient-exports.parseA.txt new file mode 100644 index 0000000000..9b450e9f8a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/ambient-exports.parseA.txt @@ -0,0 +1,7 @@ +(Program + (Statement + (ExportStatement + (Expression + (Class + (ClassBody) + (TypeIdentifier "Foo")))))) diff --git a/semantic/test/fixtures/typescript/corpus/ambient-exports.parseB.txt b/semantic/test/fixtures/typescript/corpus/ambient-exports.parseB.txt new file mode 100644 index 0000000000..cf9550e9b6 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/ambient-exports.parseB.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (ExportStatement + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Object + (ShorthandPropertyIdentifier "x") + (ShorthandPropertyIdentifier "y")))))) + (Identifier "bar") + (FormalParameters + (RequiredParameter + (Identifier "x") + (TypeAnnotation + (PredefinedType "number"))) + (RequiredParameter + (Identifier "y") + (TypeAnnotation + (PredefinedType "number"))))))))) diff --git a/test/fixtures/typescript/corpus/ambient-type-declarations.A.ts b/semantic/test/fixtures/typescript/corpus/ambient-type-declarations.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/ambient-type-declarations.A.ts rename to semantic/test/fixtures/typescript/corpus/ambient-type-declarations.A.ts diff --git a/test/fixtures/typescript/corpus/ambient-type-declarations.B.ts b/semantic/test/fixtures/typescript/corpus/ambient-type-declarations.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/ambient-type-declarations.B.ts rename to semantic/test/fixtures/typescript/corpus/ambient-type-declarations.B.ts diff --git a/test/fixtures/typescript/corpus/ambient-type-declarations.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/ambient-type-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/ambient-type-declarations.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/ambient-type-declarations.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/ambient-type-declarations.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/ambient-type-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/ambient-type-declarations.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/ambient-type-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/ambient-type-declarations.parseA.txt b/semantic/test/fixtures/typescript/corpus/ambient-type-declarations.parseA.txt new file mode 100644 index 0000000000..7d1bdca9fd --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/ambient-type-declarations.parseA.txt @@ -0,0 +1,21 @@ +(Program + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (TypeAliasDeclaration + (UnionType + (UnionType + (UnionType + (PredefinedType "string") + (PredefinedType "number")) + (TypeIdentifier "Date")) + (GenericType + (TypeIdentifier "Array") + (TypeArguments + (UnionType + (UnionType + (PredefinedType "string") + (PredefinedType "number")) + (TypeIdentifier "Date"))))) + (TypeIdentifier "IndexableType"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/ambient-type-declarations.parseB.txt b/semantic/test/fixtures/typescript/corpus/ambient-type-declarations.parseB.txt new file mode 100644 index 0000000000..eed568b2cc --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/ambient-type-declarations.parseB.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (Declaration + (TypeAliasDeclaration + (UnionType + (UnionType + (UnionType + (PredefinedType "string") + (PredefinedType "number")) + (TypeIdentifier "Date")) + (GenericType + (TypeIdentifier "Array") + (TypeArguments + (UnionType + (UnionType + (PredefinedType "string") + (PredefinedType "number")) + (TypeIdentifier "Date"))))) + (TypeIdentifier "IndexableType"))))) diff --git a/test/fixtures/typescript/corpus/anonymous-function.A.ts b/semantic/test/fixtures/typescript/corpus/anonymous-function.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/anonymous-function.A.ts rename to semantic/test/fixtures/typescript/corpus/anonymous-function.A.ts diff --git a/test/fixtures/typescript/corpus/anonymous-function.B.ts b/semantic/test/fixtures/typescript/corpus/anonymous-function.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/anonymous-function.B.ts rename to semantic/test/fixtures/typescript/corpus/anonymous-function.B.ts diff --git a/test/fixtures/typescript/corpus/anonymous-function.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/anonymous-function.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/anonymous-function.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/anonymous-function.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/anonymous-function.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/anonymous-function.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/anonymous-function.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/anonymous-function.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/anonymous-function.parseA.txt b/semantic/test/fixtures/typescript/corpus/anonymous-function.parseA.txt new file mode 100644 index 0000000000..69d7b866ed --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/anonymous-function.parseA.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "a")) + (Expression + (Identifier "b"))))))) + (FormalParameters + (RequiredParameter + (Identifier "a")) + (RequiredParameter + (Identifier "b")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/anonymous-function.parseB.txt b/semantic/test/fixtures/typescript/corpus/anonymous-function.parseB.txt new file mode 100644 index 0000000000..f5356effb4 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/anonymous-function.parseB.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "b")) + (Expression + (Identifier "c"))))))) + (FormalParameters + (RequiredParameter + (Identifier "b")) + (RequiredParameter + (Identifier "c")))))))) diff --git a/test/fixtures/typescript/corpus/anonymous-parameterless-function.A.ts b/semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/anonymous-parameterless-function.A.ts rename to semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.A.ts diff --git a/test/fixtures/typescript/corpus/anonymous-parameterless-function.B.ts b/semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/anonymous-parameterless-function.B.ts rename to semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.B.ts diff --git a/test/fixtures/typescript/corpus/anonymous-parameterless-function.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/anonymous-parameterless-function.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/anonymous-parameterless-function.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/anonymous-parameterless-function.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseA.txt b/semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseA.txt new file mode 100644 index 0000000000..c0b50535f5 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseA.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (String))))) + (FormalParameters)))))) diff --git a/semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseB.txt b/semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseB.txt new file mode 100644 index 0000000000..c0b50535f5 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseB.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (String))))) + (FormalParameters)))))) diff --git a/test/fixtures/typescript/corpus/array-type.A.ts b/semantic/test/fixtures/typescript/corpus/array-type.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/array-type.A.ts rename to semantic/test/fixtures/typescript/corpus/array-type.A.ts diff --git a/test/fixtures/typescript/corpus/array-type.B.ts b/semantic/test/fixtures/typescript/corpus/array-type.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/array-type.B.ts rename to semantic/test/fixtures/typescript/corpus/array-type.B.ts diff --git a/test/fixtures/typescript/corpus/array-type.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/array-type.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/array-type.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/array-type.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/array-type.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/array-type.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/array-type.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/array-type.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/array-type.parseA.txt b/semantic/test/fixtures/typescript/corpus/array-type.parseA.txt new file mode 100644 index 0000000000..f0683dcfb8 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/array-type.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "x") + (TypeAnnotation + (ArrayType + (TypeIdentifier "A")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/array-type.parseB.txt b/semantic/test/fixtures/typescript/corpus/array-type.parseB.txt new file mode 100644 index 0000000000..3b641f1435 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/array-type.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "x") + (TypeAnnotation + (TupleType + (TypeIdentifier "A") + (TypeIdentifier "B")))))))) diff --git a/test/fixtures/typescript/corpus/array.A.ts b/semantic/test/fixtures/typescript/corpus/array.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/array.A.ts rename to semantic/test/fixtures/typescript/corpus/array.A.ts diff --git a/test/fixtures/typescript/corpus/array.B.ts b/semantic/test/fixtures/typescript/corpus/array.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/array.B.ts rename to semantic/test/fixtures/typescript/corpus/array.B.ts diff --git a/test/fixtures/typescript/corpus/array.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/array.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/array.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/array.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/array.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/array.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/array.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/array.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/array.parseA.txt b/semantic/test/fixtures/typescript/corpus/array.parseA.txt new file mode 100644 index 0000000000..51199093a4 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/array.parseA.txt @@ -0,0 +1,7 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Array + (Expression + (String))))))) diff --git a/semantic/test/fixtures/typescript/corpus/array.parseB.txt b/semantic/test/fixtures/typescript/corpus/array.parseB.txt new file mode 100644 index 0000000000..985c789dda --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/array.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Array + (Expression + (String)) + (Expression + (String))))))) diff --git a/test/fixtures/typescript/corpus/arrow-function.A.ts b/semantic/test/fixtures/typescript/corpus/arrow-function.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/arrow-function.A.ts rename to semantic/test/fixtures/typescript/corpus/arrow-function.A.ts diff --git a/test/fixtures/typescript/corpus/arrow-function.B.ts b/semantic/test/fixtures/typescript/corpus/arrow-function.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/arrow-function.B.ts rename to semantic/test/fixtures/typescript/corpus/arrow-function.B.ts diff --git a/test/fixtures/typescript/corpus/arrow-function.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/arrow-function.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/arrow-function.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/arrow-function.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/arrow-function.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/arrow-function.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/arrow-function.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/arrow-function.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/arrow-function.parseA.txt b/semantic/test/fixtures/typescript/corpus/arrow-function.parseA.txt new file mode 100644 index 0000000000..ed34ac268d --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/arrow-function.parseA.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (ArrowFunction + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "h"))))) + (FormalParameters + (RequiredParameter + (Identifier "f")) + (RequiredParameter + (Identifier "g")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/arrow-function.parseB.txt b/semantic/test/fixtures/typescript/corpus/arrow-function.parseB.txt new file mode 100644 index 0000000000..67efe73fd9 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/arrow-function.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (ArrowFunction + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "g"))))) + (FormalParameters + (RequiredParameter + (Identifier "f")) + (RequiredParameter + (Identifier "g")))))))) diff --git a/test/fixtures/typescript/corpus/assignment-pattern.A.ts b/semantic/test/fixtures/typescript/corpus/assignment-pattern.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/assignment-pattern.A.ts rename to semantic/test/fixtures/typescript/corpus/assignment-pattern.A.ts diff --git a/test/fixtures/typescript/corpus/assignment-pattern.B.ts b/semantic/test/fixtures/typescript/corpus/assignment-pattern.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/assignment-pattern.B.ts rename to semantic/test/fixtures/typescript/corpus/assignment-pattern.B.ts diff --git a/test/fixtures/typescript/corpus/assignment-pattern.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/assignment-pattern.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/assignment-pattern.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/assignment-pattern.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/assignment-pattern.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/assignment-pattern.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/assignment-pattern.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/assignment-pattern.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/assignment-pattern.parseA.txt b/semantic/test/fixtures/typescript/corpus/assignment-pattern.parseA.txt new file mode 100644 index 0000000000..d31efb2e71 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/assignment-pattern.parseA.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (Identifier "foo")) + (DestructuringPattern + (ObjectPattern + (AssignmentPattern + (ShorthandPropertyIdentifier "x") + (Expression + (Number "0")))))))))) diff --git a/semantic/test/fixtures/typescript/corpus/assignment-pattern.parseB.txt b/semantic/test/fixtures/typescript/corpus/assignment-pattern.parseB.txt new file mode 100644 index 0000000000..1fc7003545 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/assignment-pattern.parseB.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (Identifier "foo")) + (DestructuringPattern + (ObjectPattern + (AssignmentPattern + (ShorthandPropertyIdentifier "y") + (Expression + (Number "1")))))))))) diff --git a/test/fixtures/typescript/corpus/assignment.A.ts b/semantic/test/fixtures/typescript/corpus/assignment.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/assignment.A.ts rename to semantic/test/fixtures/typescript/corpus/assignment.A.ts diff --git a/test/fixtures/typescript/corpus/assignment.B.ts b/semantic/test/fixtures/typescript/corpus/assignment.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/assignment.B.ts rename to semantic/test/fixtures/typescript/corpus/assignment.B.ts diff --git a/test/fixtures/typescript/corpus/assignment.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/assignment.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/assignment.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/assignment.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/assignment.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/assignment.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/assignment.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/assignment.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/assignment.parseA.txt b/semantic/test/fixtures/typescript/corpus/assignment.parseA.txt new file mode 100644 index 0000000000..a076e47c31 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/assignment.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "x") + (Expression + (Number "0"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/assignment.parseB.txt b/semantic/test/fixtures/typescript/corpus/assignment.parseB.txt new file mode 100644 index 0000000000..5b6c6262c7 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/assignment.parseB.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "x") + (Expression + (Number "1"))))))) diff --git a/test/fixtures/typescript/corpus/bitwise-operator.A.ts b/semantic/test/fixtures/typescript/corpus/bitwise-operator.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/bitwise-operator.A.ts rename to semantic/test/fixtures/typescript/corpus/bitwise-operator.A.ts diff --git a/test/fixtures/typescript/corpus/bitwise-operator.B.ts b/semantic/test/fixtures/typescript/corpus/bitwise-operator.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/bitwise-operator.B.ts rename to semantic/test/fixtures/typescript/corpus/bitwise-operator.B.ts diff --git a/test/fixtures/typescript/corpus/bitwise-operator.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/bitwise-operator.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/bitwise-operator.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/bitwise-operator.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/bitwise-operator.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/bitwise-operator.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/bitwise-operator.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/bitwise-operator.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/bitwise-operator.parseA.txt b/semantic/test/fixtures/typescript/corpus/bitwise-operator.parseA.txt new file mode 100644 index 0000000000..6a1cc6460d --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/bitwise-operator.parseA.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "j"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/bitwise-operator.parseB.txt b/semantic/test/fixtures/typescript/corpus/bitwise-operator.parseB.txt new file mode 100644 index 0000000000..032d59b53b --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/bitwise-operator.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "k"))))))) diff --git a/test/fixtures/typescript/corpus/boolean-operator.A.ts b/semantic/test/fixtures/typescript/corpus/boolean-operator.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/boolean-operator.A.ts rename to semantic/test/fixtures/typescript/corpus/boolean-operator.A.ts diff --git a/test/fixtures/typescript/corpus/boolean-operator.B.ts b/semantic/test/fixtures/typescript/corpus/boolean-operator.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/boolean-operator.B.ts rename to semantic/test/fixtures/typescript/corpus/boolean-operator.B.ts diff --git a/test/fixtures/typescript/corpus/boolean-operator.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/boolean-operator.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/boolean-operator.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/boolean-operator.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/boolean-operator.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/boolean-operator.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/boolean-operator.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/boolean-operator.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/boolean-operator.parseA.txt b/semantic/test/fixtures/typescript/corpus/boolean-operator.parseA.txt new file mode 100644 index 0000000000..6a1cc6460d --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/boolean-operator.parseA.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "j"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/boolean-operator.parseB.txt b/semantic/test/fixtures/typescript/corpus/boolean-operator.parseB.txt new file mode 100644 index 0000000000..6a1cc6460d --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/boolean-operator.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "j"))))))) diff --git a/test/fixtures/typescript/corpus/break.A.ts b/semantic/test/fixtures/typescript/corpus/break.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/break.A.ts rename to semantic/test/fixtures/typescript/corpus/break.A.ts diff --git a/test/fixtures/typescript/corpus/break.B.ts b/semantic/test/fixtures/typescript/corpus/break.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/break.B.ts rename to semantic/test/fixtures/typescript/corpus/break.B.ts diff --git a/test/fixtures/typescript/corpus/break.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/break.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/break.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/break.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/break.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/break.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/break.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/break.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/break.parseA.txt b/semantic/test/fixtures/typescript/corpus/break.parseA.txt new file mode 100644 index 0000000000..3be6cbb928 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/break.parseA.txt @@ -0,0 +1,44 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (BreakStatement)))) + (ParenthesizedExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "4"))))))) + (Statement + (EmptyStatement ";")) + (Statement + (ExpressionStatement + (Expression + (Identifier "i")))))) + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "10"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/break.parseB.txt b/semantic/test/fixtures/typescript/corpus/break.parseB.txt new file mode 100644 index 0000000000..a835ae53a8 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/break.parseB.txt @@ -0,0 +1,44 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (ContinueStatement)))) + (ParenthesizedExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "4"))))))) + (Statement + (EmptyStatement ";")) + (Statement + (ExpressionStatement + (Expression + (Identifier "i")))))) + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "10"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/test/fixtures/typescript/corpus/chained-callbacks.A.ts b/semantic/test/fixtures/typescript/corpus/chained-callbacks.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/chained-callbacks.A.ts rename to semantic/test/fixtures/typescript/corpus/chained-callbacks.A.ts diff --git a/test/fixtures/typescript/corpus/chained-callbacks.B.ts b/semantic/test/fixtures/typescript/corpus/chained-callbacks.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/chained-callbacks.B.ts rename to semantic/test/fixtures/typescript/corpus/chained-callbacks.B.ts diff --git a/test/fixtures/typescript/corpus/chained-callbacks.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/chained-callbacks.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/chained-callbacks.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/chained-callbacks.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/chained-callbacks.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/chained-callbacks.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/chained-callbacks.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/chained-callbacks.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/chained-callbacks.parseA.txt b/semantic/test/fixtures/typescript/corpus/chained-callbacks.parseA.txt new file mode 100644 index 0000000000..5ff0a3f710 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/chained-callbacks.parseA.txt @@ -0,0 +1,24 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "map") + (Expression + (This "this")))) + (Arguments + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (MemberExpression + (PropertyIdentifier "b") + (Expression + (Identifier "a"))))))) + (FormalParameters + (RequiredParameter + (Identifier "a"))))))))))) diff --git a/semantic/test/fixtures/typescript/corpus/chained-callbacks.parseB.txt b/semantic/test/fixtures/typescript/corpus/chained-callbacks.parseB.txt new file mode 100644 index 0000000000..66b9e870e9 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/chained-callbacks.parseB.txt @@ -0,0 +1,24 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "reduce") + (Expression + (This "this")))) + (Arguments + (Expression + (Function + (StatementBlock + (Statement + (ReturnStatement + (Expression + (MemberExpression + (PropertyIdentifier "a") + (Expression + (Identifier "b"))))))) + (FormalParameters + (RequiredParameter + (Identifier "a"))))))))))) diff --git a/test/fixtures/typescript/corpus/chained-property-access.A.ts b/semantic/test/fixtures/typescript/corpus/chained-property-access.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/chained-property-access.A.ts rename to semantic/test/fixtures/typescript/corpus/chained-property-access.A.ts diff --git a/test/fixtures/typescript/corpus/chained-property-access.B.ts b/semantic/test/fixtures/typescript/corpus/chained-property-access.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/chained-property-access.B.ts rename to semantic/test/fixtures/typescript/corpus/chained-property-access.B.ts diff --git a/test/fixtures/typescript/corpus/chained-property-access.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/chained-property-access.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/chained-property-access.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/chained-property-access.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/chained-property-access.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/chained-property-access.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/chained-property-access.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/chained-property-access.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/chained-property-access.parseA.txt b/semantic/test/fixtures/typescript/corpus/chained-property-access.parseA.txt new file mode 100644 index 0000000000..99a5346ed7 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/chained-property-access.parseA.txt @@ -0,0 +1,33 @@ +(Program + (Statement + (ReturnStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "fail") + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "done") + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "promise") + (Expression + (Identifier "returned")))) + (Arguments))))) + (Arguments + (Expression + (MemberExpression + (PropertyIdentifier "resolve") + (Expression + (Identifier "newDefer"))))))))) + (Arguments + (Expression + (MemberExpression + (PropertyIdentifier "reject") + (Expression + (Identifier "newDefer")))))))))) diff --git a/semantic/test/fixtures/typescript/corpus/chained-property-access.parseB.txt b/semantic/test/fixtures/typescript/corpus/chained-property-access.parseB.txt new file mode 100644 index 0000000000..43bca65393 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/chained-property-access.parseB.txt @@ -0,0 +1,33 @@ +(Program + (Statement + (ReturnStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "fail") + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "done") + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "promise") + (Expression + (Identifier "returned")))) + (Arguments))))) + (Arguments + (Expression + (MemberExpression + (PropertyIdentifier "resolve") + (Expression + (Identifier "otherDefer"))))))))) + (Arguments + (Expression + (MemberExpression + (PropertyIdentifier "reject") + (Expression + (Identifier "otherDefer")))))))))) diff --git a/test/fixtures/typescript/corpus/class.A.ts b/semantic/test/fixtures/typescript/corpus/class.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/class.A.ts rename to semantic/test/fixtures/typescript/corpus/class.A.ts diff --git a/test/fixtures/typescript/corpus/class.B.ts b/semantic/test/fixtures/typescript/corpus/class.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/class.B.ts rename to semantic/test/fixtures/typescript/corpus/class.B.ts diff --git a/test/fixtures/typescript/corpus/class.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/class.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/class.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/class.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/class.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/class.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/class.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/class.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/class.parseA.txt b/semantic/test/fixtures/typescript/corpus/class.parseA.txt new file mode 100644 index 0000000000..67e12d45ae --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/class.parseA.txt @@ -0,0 +1,46 @@ +(Program + (Statement + (Declaration + (ClassDeclaration + (ClassBody + (PublicFieldDefinition + (Expression + (Number "5")) + (PropertyIdentifier "bar")) + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "a"))))) + (PropertyIdentifier "one") + (FormalParameters + (RequiredParameter + (Identifier "a")))) + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "b"))))) + (PropertyIdentifier "two") + (FormalParameters + (RequiredParameter + (Identifier "b")))) + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "c"))))) + (PropertyIdentifier "three") + (FormalParameters + (RequiredParameter + (Identifier "c"))))) + (TypeIdentifier "Foo") + (TypeParameters + (TypeParameter + (TypeIdentifier "Bar"))) + (ClassHeritage + (ExtendsClause + (TypeIdentifier "Baz"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/class.parseB.txt b/semantic/test/fixtures/typescript/corpus/class.parseB.txt new file mode 100644 index 0000000000..27e483b1f0 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/class.parseB.txt @@ -0,0 +1,42 @@ +(Program + (Statement + (Declaration + (ClassDeclaration + (ClassBody + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "a"))))) + (PropertyIdentifier "foo") + (FormalParameters + (RequiredParameter + (Identifier "a")))) + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "b"))))) + (PropertyIdentifier "bar") + (FormalParameters + (RequiredParameter + (Identifier "b")))) + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (Identifier "c"))))) + (PropertyIdentifier "baz") + (FormalParameters + (RequiredParameter + (Identifier "c"))))) + (TypeIdentifier "Bar") + (TypeParameters + (TypeParameter + (TypeIdentifier "Z"))) + (ClassHeritage + (ExtendsClause + (TypeIdentifier "A"))))))) diff --git a/test/fixtures/typescript/corpus/comma-operator.A.ts b/semantic/test/fixtures/typescript/corpus/comma-operator.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/comma-operator.A.ts rename to semantic/test/fixtures/typescript/corpus/comma-operator.A.ts diff --git a/test/fixtures/typescript/corpus/comma-operator.B.ts b/semantic/test/fixtures/typescript/corpus/comma-operator.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/comma-operator.B.ts rename to semantic/test/fixtures/typescript/corpus/comma-operator.B.ts diff --git a/test/fixtures/typescript/corpus/comma-operator.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/comma-operator.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/comma-operator.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/comma-operator.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/comma-operator.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/comma-operator.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/comma-operator.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/comma-operator.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/comma-operator.parseA.txt b/semantic/test/fixtures/typescript/corpus/comma-operator.parseA.txt new file mode 100644 index 0000000000..960b93c671 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/comma-operator.parseA.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (ExpressionStatement + (SequenceExpression + (Expression + (AssignmentExpression + (Identifier "a") + (Expression + (Number "1")))) + (Expression + (AssignmentExpression + (Identifier "b") + (Expression + (Number "2")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/comma-operator.parseB.txt b/semantic/test/fixtures/typescript/corpus/comma-operator.parseB.txt new file mode 100644 index 0000000000..e1ead07707 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/comma-operator.parseB.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "c") + (Expression + (Object + (Pair + (Expression + (ParenthesizedExpression + (SequenceExpression + (Expression + (Number "3")) + (SequenceExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Number "4")) + (Expression + (Number "5")))) + (Expression + (Number "6")))))) + (PropertyIdentifier "d"))))))))) diff --git a/test/fixtures/typescript/corpus/comment.A.ts b/semantic/test/fixtures/typescript/corpus/comment.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/comment.A.ts rename to semantic/test/fixtures/typescript/corpus/comment.A.ts diff --git a/test/fixtures/typescript/corpus/comment.B.ts b/semantic/test/fixtures/typescript/corpus/comment.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/comment.B.ts rename to semantic/test/fixtures/typescript/corpus/comment.B.ts diff --git a/test/fixtures/typescript/corpus/comment.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/comment.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/comment.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/comment.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/comment.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/comment.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/comment.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/comment.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/comment.parseA.txt b/semantic/test/fixtures/typescript/corpus/comment.parseA.txt new file mode 100644 index 0000000000..0b05546cdb --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/comment.parseA.txt @@ -0,0 +1 @@ +(Program) diff --git a/semantic/test/fixtures/typescript/corpus/comment.parseB.txt b/semantic/test/fixtures/typescript/corpus/comment.parseB.txt new file mode 100644 index 0000000000..0b05546cdb --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/comment.parseB.txt @@ -0,0 +1 @@ +(Program) diff --git a/test/fixtures/typescript/corpus/constructor-call.A.ts b/semantic/test/fixtures/typescript/corpus/constructor-call.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/constructor-call.A.ts rename to semantic/test/fixtures/typescript/corpus/constructor-call.A.ts diff --git a/test/fixtures/typescript/corpus/constructor-call.B.ts b/semantic/test/fixtures/typescript/corpus/constructor-call.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/constructor-call.B.ts rename to semantic/test/fixtures/typescript/corpus/constructor-call.B.ts diff --git a/test/fixtures/typescript/corpus/constructor-call.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/constructor-call.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/constructor-call.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/constructor-call.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/constructor-call.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/constructor-call.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/constructor-call.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/constructor-call.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/constructor-call.parseA.txt b/semantic/test/fixtures/typescript/corpus/constructor-call.parseA.txt new file mode 100644 index 0000000000..3f61ff455c --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/constructor-call.parseA.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (NewExpression + (Arguments + (Expression + (Number "1")) + (Expression + (String))) + (MemberExpression + (PropertyIdentifier "Klass") + (Expression + (Identifier "module")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/constructor-call.parseB.txt b/semantic/test/fixtures/typescript/corpus/constructor-call.parseB.txt new file mode 100644 index 0000000000..3f61ff455c --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/constructor-call.parseB.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (NewExpression + (Arguments + (Expression + (Number "1")) + (Expression + (String))) + (MemberExpression + (PropertyIdentifier "Klass") + (Expression + (Identifier "module")))))))) diff --git a/test/fixtures/typescript/corpus/continue.A.ts b/semantic/test/fixtures/typescript/corpus/continue.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/continue.A.ts rename to semantic/test/fixtures/typescript/corpus/continue.A.ts diff --git a/test/fixtures/typescript/corpus/continue.B.ts b/semantic/test/fixtures/typescript/corpus/continue.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/continue.B.ts rename to semantic/test/fixtures/typescript/corpus/continue.B.ts diff --git a/test/fixtures/typescript/corpus/continue.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/continue.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/continue.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/continue.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/continue.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/continue.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/continue.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/continue.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/continue.parseA.txt b/semantic/test/fixtures/typescript/corpus/continue.parseA.txt new file mode 100644 index 0000000000..a835ae53a8 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/continue.parseA.txt @@ -0,0 +1,44 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (ContinueStatement)))) + (ParenthesizedExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "4"))))))) + (Statement + (EmptyStatement ";")) + (Statement + (ExpressionStatement + (Expression + (Identifier "i")))))) + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "10"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/continue.parseB.txt b/semantic/test/fixtures/typescript/corpus/continue.parseB.txt new file mode 100644 index 0000000000..3be6cbb928 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/continue.parseB.txt @@ -0,0 +1,44 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (BreakStatement)))) + (ParenthesizedExpression + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "4"))))))) + (Statement + (EmptyStatement ";")) + (Statement + (ExpressionStatement + (Expression + (Identifier "i")))))) + (ExpressionStatement + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "10"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/test/fixtures/typescript/corpus/delete-operator.A.ts b/semantic/test/fixtures/typescript/corpus/delete-operator.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/delete-operator.A.ts rename to semantic/test/fixtures/typescript/corpus/delete-operator.A.ts diff --git a/test/fixtures/typescript/corpus/delete-operator.B.ts b/semantic/test/fixtures/typescript/corpus/delete-operator.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/delete-operator.B.ts rename to semantic/test/fixtures/typescript/corpus/delete-operator.B.ts diff --git a/test/fixtures/typescript/corpus/delete-operator.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/delete-operator.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/delete-operator.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/delete-operator.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/delete-operator.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/delete-operator.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/delete-operator.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/delete-operator.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/delete-operator.parseA.txt b/semantic/test/fixtures/typescript/corpus/delete-operator.parseA.txt new file mode 100644 index 0000000000..688cf8e684 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/delete-operator.parseA.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (UnaryExpression + (Token) + (Expression + (SubscriptExpression + (Expression + (Identifier "thing")) + (Expression + (String))))))))) diff --git a/semantic/test/fixtures/typescript/corpus/delete-operator.parseB.txt b/semantic/test/fixtures/typescript/corpus/delete-operator.parseB.txt new file mode 100644 index 0000000000..88ee6a2c30 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/delete-operator.parseB.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (UnaryExpression + (Token) + (Expression + (MemberExpression + (PropertyIdentifier "prop") + (Expression + (Identifier "thing"))))))))) diff --git a/test/fixtures/typescript/corpus/do-while-statement.A.ts b/semantic/test/fixtures/typescript/corpus/do-while-statement.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/do-while-statement.A.ts rename to semantic/test/fixtures/typescript/corpus/do-while-statement.A.ts diff --git a/test/fixtures/typescript/corpus/do-while-statement.B.ts b/semantic/test/fixtures/typescript/corpus/do-while-statement.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/do-while-statement.B.ts rename to semantic/test/fixtures/typescript/corpus/do-while-statement.B.ts diff --git a/test/fixtures/typescript/corpus/do-while-statement.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/do-while-statement.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/do-while-statement.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/do-while-statement.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/do-while-statement.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/do-while-statement.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/do-while-statement.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/do-while-statement.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/do-while-statement.parseA.txt b/semantic/test/fixtures/typescript/corpus/do-while-statement.parseA.txt new file mode 100644 index 0000000000..7923b18cb6 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/do-while-statement.parseA.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (DoStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "insert"))))))))) + (ParenthesizedExpression + (Expression + (True "true")))))) diff --git a/semantic/test/fixtures/typescript/corpus/do-while-statement.parseB.txt b/semantic/test/fixtures/typescript/corpus/do-while-statement.parseB.txt new file mode 100644 index 0000000000..22e1834e74 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/do-while-statement.parseB.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (DoStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "replacement"))))))))) + (ParenthesizedExpression + (Expression + (False "false")))))) diff --git a/test/fixtures/typescript/corpus/export-assignments.A.ts b/semantic/test/fixtures/typescript/corpus/export-assignments.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/export-assignments.A.ts rename to semantic/test/fixtures/typescript/corpus/export-assignments.A.ts diff --git a/test/fixtures/typescript/corpus/export-assignments.B.ts b/semantic/test/fixtures/typescript/corpus/export-assignments.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/export-assignments.B.ts rename to semantic/test/fixtures/typescript/corpus/export-assignments.B.ts diff --git a/test/fixtures/typescript/corpus/export-assignments.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/export-assignments.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/export-assignments.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/export-assignments.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/export-assignments.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/export-assignments.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/export-assignments.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/export-assignments.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/export-assignments.parseA.txt b/semantic/test/fixtures/typescript/corpus/export-assignments.parseA.txt new file mode 100644 index 0000000000..c106b122bf --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/export-assignments.parseA.txt @@ -0,0 +1,4 @@ +(Program + (Statement + (ExportStatement + (Identifier "Linter")))) diff --git a/semantic/test/fixtures/typescript/corpus/export-assignments.parseB.txt b/semantic/test/fixtures/typescript/corpus/export-assignments.parseB.txt new file mode 100644 index 0000000000..606c005a5a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/export-assignments.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (Identifier "Foo"))))) diff --git a/test/fixtures/typescript/corpus/export.A.ts b/semantic/test/fixtures/typescript/corpus/export.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/export.A.ts rename to semantic/test/fixtures/typescript/corpus/export.A.ts diff --git a/test/fixtures/typescript/corpus/export.B.ts b/semantic/test/fixtures/typescript/corpus/export.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/export.B.ts rename to semantic/test/fixtures/typescript/corpus/export.B.ts diff --git a/semantic/test/fixtures/typescript/corpus/export.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/export.diffA-B.txt new file mode 100644 index 0000000000..3af549f561 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/export.diffA-B.txt @@ -0,0 +1,77 @@ +(Statements +{ (QualifiedExport) +->(QualifiedExport) } +{ (QualifiedExport) +->(QualifiedExport) } + (DefaultExport + (VariableDeclaration + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)))) + (DefaultExport + (VariableDeclaration + {-(Assignment + {-(Empty)-} + {-(Identifier)-} + {-(Identifier)-})-} + (Assignment + (Empty) + (Identifier) + (Identifier)) + (Assignment + (Empty) + (Identifier) + { (Empty) + ->(Identifier) }) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + {+(Assignment + {+(Empty)+} + {+(Identifier)+} + {+(Empty)+})+})) + (DefaultExport + { (Identifier) + ->(Identifier) }) +{+(DefaultExport + {+(Function + {+(Empty)+} + {+(Empty)+} + {+(Identifier)+} + {+(StatementBlock)+})+})+} + (DefaultExport + (Function + (Empty) + (Empty) + (Empty) + (StatementBlock))) +{+(QualifiedExport)+} +{+(DefaultExport + {+(TextElement)+})+} +{+(QualifiedExportFrom)+} +{+(QualifiedExportFrom)+} +{-(DefaultExport + {-(Function + {-(Empty)-} + {-(Empty)-} + {-(Identifier)-} + {-(StatementBlock)-})-})-} +{-(QualifiedExport)-} +{-(DefaultExport + {-(TextElement)-})-} +{-(QualifiedExportFrom)-} +{-(QualifiedExportFrom)-}) diff --git a/semantic/test/fixtures/typescript/corpus/export.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/export.diffB-A.txt new file mode 100644 index 0000000000..4a0ec2fa57 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/export.diffB-A.txt @@ -0,0 +1,76 @@ +(Statements +{ (QualifiedExport) +->(QualifiedExport) } +{ (QualifiedExport) +->(QualifiedExport) } + (DefaultExport + (VariableDeclaration + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)))) + (DefaultExport + (VariableDeclaration + {+(Assignment + {+(Empty)+} + {+(Identifier)+} + {+(Identifier)+})+} + (Assignment + (Empty) + (Identifier) + (Identifier)) + (Assignment + (Empty) + (Identifier) + { (Identifier) + ->(Empty) }) + (Assignment + (Empty) + { (Identifier) + ->(Identifier) } + (Empty)) + {-(Assignment + {-(Empty)-} + {-(Identifier)-} + {-(Empty)-})-})) + (DefaultExport + { (Identifier) + ->(Identifier) }) +{-(DefaultExport + {-(Function + {-(Empty)-} + {-(Empty)-} + {-(Identifier)-} + {-(StatementBlock)-})-})-} + (DefaultExport + (Function + (Empty) + (Empty) + (Empty) + (StatementBlock))) +{+(DefaultExport + {+(Function + {+(Empty)+} + {+(Empty)+} + {+(Identifier)+} + {+(StatementBlock)+})+})+} +{ (QualifiedExport) +->(QualifiedExport) } + (DefaultExport + { (TextElement) + ->(TextElement) }) +{ (QualifiedExportFrom) +->(QualifiedExportFrom) } +{ (QualifiedExportFrom) +->(QualifiedExportFrom) }) diff --git a/semantic/test/fixtures/typescript/corpus/export.parseA.txt b/semantic/test/fixtures/typescript/corpus/export.parseA.txt new file mode 100644 index 0000000000..a1e5b0619d --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/export.parseA.txt @@ -0,0 +1,97 @@ +(Program + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "name1")) + (ExportSpecifier + (Identifier "name2")) + (ExportSpecifier + (Identifier "name3")) + (ExportSpecifier + (Identifier "nameN"))))) + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "name1") + (Identifier "variable1")) + (ExportSpecifier + (Identifier "name2") + (Identifier "variable2")) + (ExportSpecifier + (Identifier "nameN"))))) + (Statement + (ExportStatement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "name1")) + (VariableDeclarator + (Identifier "name2")) + (VariableDeclarator + (Identifier "nameN")))))) + (Statement + (ExportStatement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Expression + (Identifier "value1")) + (Identifier "name1")) + (VariableDeclarator + (Expression + (Identifier "value2")) + (Identifier "name2")) + (VariableDeclarator + (Identifier "name3")) + (VariableDeclarator + (Identifier "nameN")))))) + (Statement + (ExportStatement + (Expression + (Identifier "namedFunction")))) + (Statement + (ExportStatement + (Expression + (Function + (StatementBlock) + (FormalParameters))))) + (Statement + (ExportStatement + (Expression + (Function + (StatementBlock) + (Identifier "name1") + (FormalParameters))))) + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "default") + (Identifier "name1"))))) + (Statement + (ExportStatement + (String))) + (Statement + (ExportStatement + (String) + (ExportClause + (ExportSpecifier + (Identifier "name1")) + (ExportSpecifier + (Identifier "name2")) + (ExportSpecifier + (Identifier "nameN"))))) + (Statement + (ExportStatement + (String) + (ExportClause + (ExportSpecifier + (Identifier "name1") + (Identifier "import1")) + (ExportSpecifier + (Identifier "name2") + (Identifier "import2")) + (ExportSpecifier + (Identifier "nameN")))))) diff --git a/semantic/test/fixtures/typescript/corpus/export.parseB.txt b/semantic/test/fixtures/typescript/corpus/export.parseB.txt new file mode 100644 index 0000000000..56e369e27a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/export.parseB.txt @@ -0,0 +1,97 @@ +(Program + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "name4")) + (ExportSpecifier + (Identifier "name5")) + (ExportSpecifier + (Identifier "name6")) + (ExportSpecifier + (Identifier "nameZ"))))) + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "name2") + (Identifier "variable2")) + (ExportSpecifier + (Identifier "name3") + (Identifier "variable3")) + (ExportSpecifier + (Identifier "nameY"))))) + (Statement + (ExportStatement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "name3")) + (VariableDeclarator + (Identifier "name4")) + (VariableDeclarator + (Identifier "nameT")))))) + (Statement + (ExportStatement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Expression + (Identifier "value2")) + (Identifier "name2")) + (VariableDeclarator + (Expression + (Identifier "value3")) + (Identifier "name3")) + (VariableDeclarator + (Identifier "name4")) + (VariableDeclarator + (Identifier "nameO")))))) + (Statement + (ExportStatement + (Expression + (Identifier "otherNamedFunction")))) + (Statement + (ExportStatement + (Expression + (Function + (StatementBlock) + (Identifier "newName1") + (FormalParameters))))) + (Statement + (ExportStatement + (Expression + (Function + (StatementBlock) + (FormalParameters))))) + (Statement + (ExportStatement + (ExportClause + (ExportSpecifier + (Identifier "statement") + (Identifier "name2"))))) + (Statement + (ExportStatement + (String))) + (Statement + (ExportStatement + (String) + (ExportClause + (ExportSpecifier + (Identifier "name7")) + (ExportSpecifier + (Identifier "name8")) + (ExportSpecifier + (Identifier "nameP"))))) + (Statement + (ExportStatement + (String) + (ExportClause + (ExportSpecifier + (Identifier "name6") + (Identifier "import6")) + (ExportSpecifier + (Identifier "name7") + (Identifier "import7")) + (ExportSpecifier + (Identifier "nameB")))))) diff --git a/test/fixtures/typescript/corpus/false.A.ts b/semantic/test/fixtures/typescript/corpus/false.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/false.A.ts rename to semantic/test/fixtures/typescript/corpus/false.A.ts diff --git a/test/fixtures/typescript/corpus/false.B.ts b/semantic/test/fixtures/typescript/corpus/false.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/false.B.ts rename to semantic/test/fixtures/typescript/corpus/false.B.ts diff --git a/test/fixtures/typescript/corpus/false.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/false.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/false.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/false.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/false.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/false.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/false.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/false.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/false.parseA.txt b/semantic/test/fixtures/typescript/corpus/false.parseA.txt new file mode 100644 index 0000000000..3be6991ba9 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/false.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (False "false"))))) diff --git a/semantic/test/fixtures/typescript/corpus/false.parseB.txt b/semantic/test/fixtures/typescript/corpus/false.parseB.txt new file mode 100644 index 0000000000..1123c876f6 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/false.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (False "false"))))) diff --git a/test/fixtures/typescript/corpus/for-in-statement.A.ts b/semantic/test/fixtures/typescript/corpus/for-in-statement.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/for-in-statement.A.ts rename to semantic/test/fixtures/typescript/corpus/for-in-statement.A.ts diff --git a/test/fixtures/typescript/corpus/for-in-statement.B.ts b/semantic/test/fixtures/typescript/corpus/for-in-statement.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/for-in-statement.B.ts rename to semantic/test/fixtures/typescript/corpus/for-in-statement.B.ts diff --git a/test/fixtures/typescript/corpus/for-in-statement.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/for-in-statement.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/for-in-statement.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/for-in-statement.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/for-in-statement.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/for-in-statement.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/for-in-statement.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/for-in-statement.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/for-in-statement.parseA.txt b/semantic/test/fixtures/typescript/corpus/for-in-statement.parseA.txt new file mode 100644 index 0000000000..ade0620a48 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/for-in-statement.parseA.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ForInStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "thing")) + (Arguments))))))) + (Identifier "thing") + (Expression + (Identifier "things"))))) diff --git a/semantic/test/fixtures/typescript/corpus/for-in-statement.parseB.txt b/semantic/test/fixtures/typescript/corpus/for-in-statement.parseB.txt new file mode 100644 index 0000000000..879fadc02e --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/for-in-statement.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ForInStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "item")) + (Arguments))))))) + (Identifier "item") + (Expression + (Identifier "items"))))) diff --git a/test/fixtures/typescript/corpus/for-loop-with-in-statement.A.ts b/semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/for-loop-with-in-statement.A.ts rename to semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.A.ts diff --git a/test/fixtures/typescript/corpus/for-loop-with-in-statement.B.ts b/semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/for-loop-with-in-statement.B.ts rename to semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.B.ts diff --git a/test/fixtures/typescript/corpus/for-loop-with-in-statement.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/for-loop-with-in-statement.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/for-loop-with-in-statement.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/for-loop-with-in-statement.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseA.txt b/semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseA.txt new file mode 100644 index 0000000000..1832273d2d --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseA.txt @@ -0,0 +1,41 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "doSomething")) + (Arguments))))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "key")) + (Expression + (Identifier "something")))) + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "n"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseB.txt b/semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseB.txt new file mode 100644 index 0000000000..818f9c602a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseB.txt @@ -0,0 +1,41 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "doOtherSomething")) + (Arguments))))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "otherKey")) + (Expression + (Identifier "something")))) + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0"))))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Identifier "n"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/test/fixtures/typescript/corpus/for-of-statement.A.ts b/semantic/test/fixtures/typescript/corpus/for-of-statement.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/for-of-statement.A.ts rename to semantic/test/fixtures/typescript/corpus/for-of-statement.A.ts diff --git a/test/fixtures/typescript/corpus/for-of-statement.B.ts b/semantic/test/fixtures/typescript/corpus/for-of-statement.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/for-of-statement.B.ts rename to semantic/test/fixtures/typescript/corpus/for-of-statement.B.ts diff --git a/semantic/test/fixtures/typescript/corpus/for-of-statement.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/for-of-statement.diffA-B.txt new file mode 100644 index 0000000000..ec81af0f91 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/for-of-statement.diffA-B.txt @@ -0,0 +1,13 @@ +(Statements + (ForEach + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + (Statements + (Call + (Identifier) + { (Identifier) + ->(Identifier) } + (Empty)))) + (Empty)) diff --git a/semantic/test/fixtures/typescript/corpus/for-of-statement.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/for-of-statement.diffB-A.txt new file mode 100644 index 0000000000..ec81af0f91 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/for-of-statement.diffB-A.txt @@ -0,0 +1,13 @@ +(Statements + (ForEach + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + (Statements + (Call + (Identifier) + { (Identifier) + ->(Identifier) } + (Empty)))) + (Empty)) diff --git a/semantic/test/fixtures/typescript/corpus/for-of-statement.parseA.txt b/semantic/test/fixtures/typescript/corpus/for-of-statement.parseA.txt new file mode 100644 index 0000000000..b45bbc8519 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/for-of-statement.parseA.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (ForInStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "process")) + (Arguments + (Expression + (Identifier "item"))))))))) + (Identifier "item") + (Expression + (Identifier "items")))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/typescript/corpus/for-of-statement.parseB.txt b/semantic/test/fixtures/typescript/corpus/for-of-statement.parseB.txt new file mode 100644 index 0000000000..9bf63fefa5 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/for-of-statement.parseB.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (ForInStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "process")) + (Arguments + (Expression + (Identifier "thing"))))))))) + (Identifier "thing") + (Expression + (Identifier "things")))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/typescript/corpus/for-statement.A.ts b/semantic/test/fixtures/typescript/corpus/for-statement.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/for-statement.A.ts rename to semantic/test/fixtures/typescript/corpus/for-statement.A.ts diff --git a/test/fixtures/typescript/corpus/for-statement.B.ts b/semantic/test/fixtures/typescript/corpus/for-statement.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/for-statement.B.ts rename to semantic/test/fixtures/typescript/corpus/for-statement.B.ts diff --git a/test/fixtures/typescript/corpus/for-statement.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/for-statement.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/for-statement.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/for-statement.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/for-statement.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/for-statement.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/for-statement.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/for-statement.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/for-statement.parseA.txt b/semantic/test/fixtures/typescript/corpus/for-statement.parseA.txt new file mode 100644 index 0000000000..241a178f42 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/for-statement.parseA.txt @@ -0,0 +1,39 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "log")) + (Arguments + (Expression + (Identifier "i"))))))))) + (ExpressionStatement + (SequenceExpression + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0")))) + (Expression + (CallExpression + (Expression + (Identifier "init")) + (Arguments))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "10"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/for-statement.parseB.txt b/semantic/test/fixtures/typescript/corpus/for-statement.parseB.txt new file mode 100644 index 0000000000..432defeb15 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/for-statement.parseB.txt @@ -0,0 +1,39 @@ +(Program + (Statement + (ForStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "log")) + (Arguments + (Expression + (Identifier "i"))))))))) + (ExpressionStatement + (SequenceExpression + (Expression + (AssignmentExpression + (Identifier "i") + (Expression + (Number "0")))) + (Expression + (CallExpression + (Expression + (Identifier "init")) + (Arguments))))) + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (Number "100"))))) + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))) diff --git a/test/fixtures/typescript/corpus/function-call-args.A.ts b/semantic/test/fixtures/typescript/corpus/function-call-args.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/function-call-args.A.ts rename to semantic/test/fixtures/typescript/corpus/function-call-args.A.ts diff --git a/test/fixtures/typescript/corpus/function-call-args.B.ts b/semantic/test/fixtures/typescript/corpus/function-call-args.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/function-call-args.B.ts rename to semantic/test/fixtures/typescript/corpus/function-call-args.B.ts diff --git a/test/fixtures/typescript/corpus/function-call-args.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/function-call-args.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/function-call-args.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/function-call-args.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/function-call-args.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/function-call-args.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/function-call-args.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/function-call-args.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/function-call-args.parseA.txt b/semantic/test/fixtures/typescript/corpus/function-call-args.parseA.txt new file mode 100644 index 0000000000..6bd83a38ce --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/function-call-args.parseA.txt @@ -0,0 +1,38 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "someFunction")) + (Arguments + (Expression + (Number "1")) + (Expression + (String)) + (Expression + (Function + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "a"))))))) + (Statement + (ReturnStatement + (Expression + (Identifier "b"))))) + (FormalParameters + (RequiredParameter + (Identifier "a")) + (RequiredParameter + (Identifier "b"))))) + (Expression + (True "true")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/function-call-args.parseB.txt b/semantic/test/fixtures/typescript/corpus/function-call-args.parseB.txt new file mode 100644 index 0000000000..19c869209b --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/function-call-args.parseB.txt @@ -0,0 +1,38 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "someFunction")) + (Arguments + (Expression + (Number "1")) + (Expression + (String)) + (Expression + (Function + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "b"))))))) + (Statement + (ReturnStatement + (Expression + (Identifier "c"))))) + (FormalParameters + (RequiredParameter + (Identifier "b")) + (RequiredParameter + (Identifier "c"))))) + (Expression + (False "false")))))))) diff --git a/test/fixtures/typescript/corpus/function-call.A.ts b/semantic/test/fixtures/typescript/corpus/function-call.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/function-call.A.ts rename to semantic/test/fixtures/typescript/corpus/function-call.A.ts diff --git a/test/fixtures/typescript/corpus/function-call.B.ts b/semantic/test/fixtures/typescript/corpus/function-call.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/function-call.B.ts rename to semantic/test/fixtures/typescript/corpus/function-call.B.ts diff --git a/test/fixtures/typescript/corpus/function-call.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/function-call.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/function-call.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/function-call.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/function-call.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/function-call.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/function-call.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/function-call.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/function-call.parseA.txt b/semantic/test/fixtures/typescript/corpus/function-call.parseA.txt new file mode 100644 index 0000000000..82483fe8cb --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/function-call.parseA.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "someFunction")) + (Arguments + (Expression + (Identifier "arg1")) + (Expression + (String))) + (TypeArguments + (TypeIdentifier "A"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/function-call.parseB.txt b/semantic/test/fixtures/typescript/corpus/function-call.parseB.txt new file mode 100644 index 0000000000..213adfcd9d --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/function-call.parseB.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "someFunction")) + (Arguments + (Expression + (Identifier "arg1")) + (Expression + (String))) + (TypeArguments + (TypeIdentifier "B"))))))) diff --git a/test/fixtures/typescript/corpus/function-type.A.ts b/semantic/test/fixtures/typescript/corpus/function-type.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/function-type.A.ts rename to semantic/test/fixtures/typescript/corpus/function-type.A.ts diff --git a/test/fixtures/typescript/corpus/function-type.B.ts b/semantic/test/fixtures/typescript/corpus/function-type.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/function-type.B.ts rename to semantic/test/fixtures/typescript/corpus/function-type.B.ts diff --git a/test/fixtures/typescript/corpus/function-type.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/function-type.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/function-type.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/function-type.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/function-type.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/function-type.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/function-type.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/function-type.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/function-type.parseA.txt b/semantic/test/fixtures/typescript/corpus/function-type.parseA.txt new file mode 100644 index 0000000000..ac7071ed40 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/function-type.parseA.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "x") + (TypeAnnotation + (FunctionType + (FormalParameters) + (TypeIdentifier "A")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/function-type.parseB.txt b/semantic/test/fixtures/typescript/corpus/function-type.parseB.txt new file mode 100644 index 0000000000..f0683dcfb8 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/function-type.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "x") + (TypeAnnotation + (ArrayType + (TypeIdentifier "A")))))))) diff --git a/test/fixtures/typescript/corpus/function.A.ts b/semantic/test/fixtures/typescript/corpus/function.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/function.A.ts rename to semantic/test/fixtures/typescript/corpus/function.A.ts diff --git a/test/fixtures/typescript/corpus/function.B.ts b/semantic/test/fixtures/typescript/corpus/function.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/function.B.ts rename to semantic/test/fixtures/typescript/corpus/function.B.ts diff --git a/semantic/test/fixtures/typescript/corpus/function.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/function.diffA-B.txt new file mode 100644 index 0000000000..7f4dadd4f8 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/function.diffA-B.txt @@ -0,0 +1,26 @@ +(Statements + (Function + {+(Empty)+} + {+(Annotation + {+(TypeIdentifier)+})+} + {-(TypeParameters + {-(TypeParameter + {-(TypeIdentifier)-} + {-(Empty)-} + {-(Empty)-})-})-} + {-(Annotation + {-(PredefinedType)-})-} + (Empty) + (RequiredParameter + (Empty) + (Empty) + (Identifier) + (Empty)) + (RequiredParameter + (Empty) + (Empty) + (Identifier) + (Empty)) + (StatementBlock + { (Identifier) + ->(Identifier) }))) diff --git a/semantic/test/fixtures/typescript/corpus/function.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/function.diffB-A.txt new file mode 100644 index 0000000000..f036300f32 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/function.diffB-A.txt @@ -0,0 +1,26 @@ +(Statements + (Function + {+(TypeParameters + {+(TypeParameter + {+(TypeIdentifier)+} + {+(Empty)+} + {+(Empty)+})+})+} + {+(Annotation + {+(PredefinedType)+})+} + {-(Empty)-} + {-(Annotation + {-(TypeIdentifier)-})-} + (Empty) + (RequiredParameter + (Empty) + (Empty) + (Identifier) + (Empty)) + (RequiredParameter + (Empty) + (Empty) + (Identifier) + (Empty)) + (StatementBlock + { (Identifier) + ->(Identifier) }))) diff --git a/semantic/test/fixtures/typescript/corpus/function.parseA.txt b/semantic/test/fixtures/typescript/corpus/function.parseA.txt new file mode 100644 index 0000000000..908fcf67e6 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/function.parseA.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (TypeAnnotation + (PredefinedType "string")) + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "arg2"))))) + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2"))) + (TypeParameters + (TypeParameter + (TypeIdentifier "A")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/function.parseB.txt b/semantic/test/fixtures/typescript/corpus/function.parseB.txt new file mode 100644 index 0000000000..0897f8dd78 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/function.parseB.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Function + (TypeAnnotation + (TypeIdentifier "int")) + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "arg1"))))) + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2")))))))) diff --git a/test/fixtures/typescript/corpus/generator-function.A.ts b/semantic/test/fixtures/typescript/corpus/generator-function.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/generator-function.A.ts rename to semantic/test/fixtures/typescript/corpus/generator-function.A.ts diff --git a/test/fixtures/typescript/corpus/generator-function.B.ts b/semantic/test/fixtures/typescript/corpus/generator-function.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/generator-function.B.ts rename to semantic/test/fixtures/typescript/corpus/generator-function.B.ts diff --git a/test/fixtures/typescript/corpus/generator-function.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/generator-function.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/generator-function.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/generator-function.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/generator-function.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/generator-function.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/generator-function.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/generator-function.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/generator-function.parseA.txt b/semantic/test/fixtures/typescript/corpus/generator-function.parseA.txt new file mode 100644 index 0000000000..141f4ed8b8 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/generator-function.parseA.txt @@ -0,0 +1,23 @@ +(Program + (Statement + (Declaration + (GeneratorFunctionDeclaration + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (YieldExpression)))) + (Statement + (ExpressionStatement + (Expression + (YieldExpression + (Expression + (Identifier "arg2"))))))) + (Identifier "generateStuff") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2")))))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/typescript/corpus/generator-function.parseB.txt b/semantic/test/fixtures/typescript/corpus/generator-function.parseB.txt new file mode 100644 index 0000000000..c69d986e9b --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/generator-function.parseB.txt @@ -0,0 +1,23 @@ +(Program + (Statement + (Declaration + (GeneratorFunctionDeclaration + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (YieldExpression)))) + (Statement + (ExpressionStatement + (Expression + (YieldExpression + (Expression + (Identifier "arg2"))))))) + (Identifier "generateNewStuff") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2")))))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/typescript/corpus/identifier.A.ts b/semantic/test/fixtures/typescript/corpus/identifier.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/identifier.A.ts rename to semantic/test/fixtures/typescript/corpus/identifier.A.ts diff --git a/test/fixtures/typescript/corpus/identifier.B.ts b/semantic/test/fixtures/typescript/corpus/identifier.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/identifier.B.ts rename to semantic/test/fixtures/typescript/corpus/identifier.B.ts diff --git a/test/fixtures/typescript/corpus/identifier.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/identifier.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/identifier.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/identifier.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/identifier.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/identifier.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/identifier.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/identifier.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/identifier.parseA.txt b/semantic/test/fixtures/typescript/corpus/identifier.parseA.txt new file mode 100644 index 0000000000..ee36557999 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/identifier.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Identifier "theVar"))))) diff --git a/semantic/test/fixtures/typescript/corpus/identifier.parseB.txt b/semantic/test/fixtures/typescript/corpus/identifier.parseB.txt new file mode 100644 index 0000000000..420643ed8a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/identifier.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Identifier "theVar2"))))) diff --git a/test/fixtures/typescript/corpus/if-else.A.ts b/semantic/test/fixtures/typescript/corpus/if-else.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/if-else.A.ts rename to semantic/test/fixtures/typescript/corpus/if-else.A.ts diff --git a/test/fixtures/typescript/corpus/if-else.B.ts b/semantic/test/fixtures/typescript/corpus/if-else.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/if-else.B.ts rename to semantic/test/fixtures/typescript/corpus/if-else.B.ts diff --git a/test/fixtures/typescript/corpus/if-else.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/if-else.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/if-else.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/if-else.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/if-else.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/if-else.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/if-else.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/if-else.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/if-else.parseA.txt b/semantic/test/fixtures/typescript/corpus/if-else.parseA.txt new file mode 100644 index 0000000000..d18a55158c --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/if-else.parseA.txt @@ -0,0 +1,41 @@ +(Program + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (ExpressionStatement + (Expression + (Identifier "g")))) + (Statement + (ExpressionStatement + (Expression + (Identifier "f")))) + (ParenthesizedExpression + (Expression + (Identifier "e"))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "d")))) + (ParenthesizedExpression + (Expression + (Identifier "c"))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "b")))) + (ParenthesizedExpression + (Expression + (Identifier "a"))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "y")))) + (ParenthesizedExpression + (Expression + (Identifier "x")))))) diff --git a/semantic/test/fixtures/typescript/corpus/if-else.parseB.txt b/semantic/test/fixtures/typescript/corpus/if-else.parseB.txt new file mode 100644 index 0000000000..181d88a299 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/if-else.parseB.txt @@ -0,0 +1,45 @@ +(Program + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (IfStatement + (Statement + (ExpressionStatement + (Expression + (Identifier "o")))) + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "n")))))) + (ParenthesizedExpression + (Expression + (Identifier "m"))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "l")))) + (ParenthesizedExpression + (Expression + (Identifier "k"))))) + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "j")))))) + (ParenthesizedExpression + (Expression + (Identifier "i"))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "h")))) + (ParenthesizedExpression + (Expression + (Identifier "g")))))) diff --git a/test/fixtures/typescript/corpus/if.A.ts b/semantic/test/fixtures/typescript/corpus/if.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/if.A.ts rename to semantic/test/fixtures/typescript/corpus/if.A.ts diff --git a/test/fixtures/typescript/corpus/if.B.ts b/semantic/test/fixtures/typescript/corpus/if.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/if.B.ts rename to semantic/test/fixtures/typescript/corpus/if.B.ts diff --git a/test/fixtures/typescript/corpus/if.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/if.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/if.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/if.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/if.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/if.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/if.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/if.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/if.parseA.txt b/semantic/test/fixtures/typescript/corpus/if.parseA.txt new file mode 100644 index 0000000000..335293f9f8 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/if.parseA.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "log")) + (Arguments + (Expression + (Identifier "y"))))))))) + (ParenthesizedExpression + (Expression + (Identifier "x")))))) diff --git a/semantic/test/fixtures/typescript/corpus/if.parseB.txt b/semantic/test/fixtures/typescript/corpus/if.parseB.txt new file mode 100644 index 0000000000..8ad1565604 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/if.parseB.txt @@ -0,0 +1,24 @@ +(Program + (Statement + (IfStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "log")) + (Arguments + (Expression + (Identifier "c"))))))) + (Statement + (ExpressionStatement + (Expression + (Identifier "d")))))) + (ParenthesizedExpression + (Expression + (MemberExpression + (PropertyIdentifier "b") + (Expression + (Identifier "a")))))))) diff --git a/test/fixtures/typescript/corpus/import.A.ts b/semantic/test/fixtures/typescript/corpus/import.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/import.A.ts rename to semantic/test/fixtures/typescript/corpus/import.A.ts diff --git a/test/fixtures/typescript/corpus/import.B.ts b/semantic/test/fixtures/typescript/corpus/import.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/import.B.ts rename to semantic/test/fixtures/typescript/corpus/import.B.ts diff --git a/semantic/test/fixtures/typescript/corpus/import.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/import.diffA-B.txt new file mode 100644 index 0000000000..5fa52034da --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/import.diffA-B.txt @@ -0,0 +1,31 @@ +(Statements +{+(Import)+} +{+(QualifiedAliasedImport + {+(Identifier)+})+} +{+(Import)+} +{ (Import) +->(Import) } +{+(Import)+} +{+(Statements + {+(Import)+} + {+(Import)+})+} +{+(Statements + {+(Import)+} + {+(QualifiedAliasedImport + {+(Identifier)+})+})+} +{+(SideEffectImport)+} +{-(QualifiedAliasedImport + {-(Identifier)-})-} +{-(Import)-} +{-(Import)-} +{-(Import)-} +{-(Statements + {-(Import)-} + {-(Import)-})-} +{-(Statements + {-(Import)-} + {-(QualifiedAliasedImport + {-(Identifier)-})-})-} +{-(SideEffectImport)-} +{-(QualifiedAliasedImport + {-(Identifier)-})-}) diff --git a/semantic/test/fixtures/typescript/corpus/import.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/import.diffB-A.txt new file mode 100644 index 0000000000..b7a0f3801b --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/import.diffB-A.txt @@ -0,0 +1,31 @@ +(Statements +{+(Import)+} +{+(QualifiedAliasedImport + {+(Identifier)+})+} +{+(Import)+} +{ (Import) +->(Import) } +{+(Import)+} +{+(Statements + {+(Import)+} + {+(Import)+})+} +{+(Statements + {+(Import)+} + {+(QualifiedAliasedImport + {+(Identifier)+})+})+} +{+(SideEffectImport)+} +{ (QualifiedAliasedImport + {-(Identifier)-}) +->(QualifiedAliasedImport + {+(Identifier)+}) } +{-(Import)-} +{-(Import)-} +{-(Import)-} +{-(Statements + {-(Import)-} + {-(Import)-})-} +{-(Statements + {-(Import)-} + {-(QualifiedAliasedImport + {-(Identifier)-})-})-} +{-(SideEffectImport)-}) diff --git a/semantic/test/fixtures/typescript/corpus/import.parseA.txt b/semantic/test/fixtures/typescript/corpus/import.parseA.txt new file mode 100644 index 0000000000..1be30d4dd1 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/import.parseA.txt @@ -0,0 +1,64 @@ +(Program + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember")))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamespaceImport + (Identifier "name"))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "member")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "member1")) + (ImportSpecifier + (Identifier "member2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "member1")) + (ImportSpecifier + (Identifier "alias2") + (Identifier "member2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember") + (NamedImports + (ImportSpecifier + (Identifier "member1")) + (ImportSpecifier + (Identifier "alias2") + (Identifier "member2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember") + (NamespaceImport + (Identifier "name"))))) + (Statement + (ImportStatement + (String))) + (Statement + (ImportStatement + (ImportRequireClause + (Identifier "zip") + (String))))) diff --git a/semantic/test/fixtures/typescript/corpus/import.parseB.txt b/semantic/test/fixtures/typescript/corpus/import.parseB.txt new file mode 100644 index 0000000000..30fc0c7e39 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/import.parseB.txt @@ -0,0 +1,59 @@ +(Program + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember")))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamespaceImport + (Identifier "otherName"))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "element")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "element1")) + (ImportSpecifier + (Identifier "element2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (NamedImports + (ImportSpecifier + (Identifier "element1")) + (ImportSpecifier + (Identifier "elementAlias2") + (Identifier "element2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember") + (NamedImports + (ImportSpecifier + (Identifier "element1")) + (ImportSpecifier + (Identifier "elementAlias2") + (Identifier "element2")))))) + (Statement + (ImportStatement + (String) + (ImportClause + (Identifier "defaultMember") + (NamespaceImport + (Identifier "element"))))) + (Statement + (ImportStatement + (String)))) diff --git a/test/fixtures/typescript/corpus/interface.A.ts b/semantic/test/fixtures/typescript/corpus/interface.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/interface.A.ts rename to semantic/test/fixtures/typescript/corpus/interface.A.ts diff --git a/test/fixtures/typescript/corpus/interface.B.ts b/semantic/test/fixtures/typescript/corpus/interface.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/interface.B.ts rename to semantic/test/fixtures/typescript/corpus/interface.B.ts diff --git a/test/fixtures/typescript/corpus/interface.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/interface.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/interface.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/interface.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/interface.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/interface.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/interface.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/interface.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/interface.parseA.txt b/semantic/test/fixtures/typescript/corpus/interface.parseA.txt new file mode 100644 index 0000000000..d249404eea --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/interface.parseA.txt @@ -0,0 +1,19 @@ +(Program + (Statement + (Declaration + (InterfaceDeclaration + (ObjectType + (PropertySignature + (PropertyIdentifier "type") + (TypeAnnotation + (LiteralType + (String)))) + (PropertySignature + (PropertyIdentifier "result") + (TypeAnnotation + (TypeIdentifier "T")) + (Readonly "readonly"))) + (TypeIdentifier "IResult") + (TypeParameters + (TypeParameter + (TypeIdentifier "T"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/interface.parseB.txt b/semantic/test/fixtures/typescript/corpus/interface.parseB.txt new file mode 100644 index 0000000000..bd7de4a977 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/interface.parseB.txt @@ -0,0 +1,16 @@ +(Program + (Statement + (Declaration + (InterfaceDeclaration + (ObjectType + (PropertySignature + (PropertyIdentifier "type") + (TypeAnnotation + (LiteralType + (String)))) + (PropertySignature + (PropertyIdentifier "error") + (TypeAnnotation + (TypeIdentifier "Error")) + (Readonly "readonly"))) + (TypeIdentifier "IError"))))) diff --git a/test/fixtures/typescript/corpus/intersection-type.A.ts b/semantic/test/fixtures/typescript/corpus/intersection-type.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/intersection-type.A.ts rename to semantic/test/fixtures/typescript/corpus/intersection-type.A.ts diff --git a/test/fixtures/typescript/corpus/intersection-type.B.ts b/semantic/test/fixtures/typescript/corpus/intersection-type.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/intersection-type.B.ts rename to semantic/test/fixtures/typescript/corpus/intersection-type.B.ts diff --git a/test/fixtures/typescript/corpus/intersection-type.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/intersection-type.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/intersection-type.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/intersection-type.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/intersection-type.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/intersection-type.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/intersection-type.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/intersection-type.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/intersection-type.parseA.txt b/semantic/test/fixtures/typescript/corpus/intersection-type.parseA.txt new file mode 100644 index 0000000000..0677f867e3 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/intersection-type.parseA.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "x") + (TypeAnnotation + (UnionType + (TypeIdentifier "Foo") + (TypeIdentifier "Bar")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/intersection-type.parseB.txt b/semantic/test/fixtures/typescript/corpus/intersection-type.parseB.txt new file mode 100644 index 0000000000..bbf858bfe4 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/intersection-type.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "x") + (TypeAnnotation + (IntersectionType + (TypeIdentifier "A") + (TypeIdentifier "B")))))))) diff --git a/test/fixtures/typescript/corpus/math-assignment-operator.A.ts b/semantic/test/fixtures/typescript/corpus/math-assignment-operator.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/math-assignment-operator.A.ts rename to semantic/test/fixtures/typescript/corpus/math-assignment-operator.A.ts diff --git a/test/fixtures/typescript/corpus/math-assignment-operator.B.ts b/semantic/test/fixtures/typescript/corpus/math-assignment-operator.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/math-assignment-operator.B.ts rename to semantic/test/fixtures/typescript/corpus/math-assignment-operator.B.ts diff --git a/semantic/test/fixtures/typescript/corpus/math-assignment-operator.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/math-assignment-operator.diffA-B.txt new file mode 100644 index 0000000000..469533a1fb --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/math-assignment-operator.diffA-B.txt @@ -0,0 +1,6 @@ +(Statements + (AugmentedAssignment + (Plus + (Identifier) + { (Float) + ->(Float) }))) diff --git a/semantic/test/fixtures/typescript/corpus/math-assignment-operator.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/math-assignment-operator.diffB-A.txt new file mode 100644 index 0000000000..469533a1fb --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/math-assignment-operator.diffB-A.txt @@ -0,0 +1,6 @@ +(Statements + (AugmentedAssignment + (Plus + (Identifier) + { (Float) + ->(Float) }))) diff --git a/semantic/test/fixtures/typescript/corpus/math-assignment-operator.parseA.txt b/semantic/test/fixtures/typescript/corpus/math-assignment-operator.parseA.txt new file mode 100644 index 0000000000..af0d3a8633 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/math-assignment-operator.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AugmentedAssignmentExpression + (Identifier "x") + (Expression + (Number "1"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/math-assignment-operator.parseB.txt b/semantic/test/fixtures/typescript/corpus/math-assignment-operator.parseB.txt new file mode 100644 index 0000000000..b4837c6733 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/math-assignment-operator.parseB.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AugmentedAssignmentExpression + (Identifier "x") + (Expression + (Number "2"))))))) diff --git a/test/fixtures/typescript/corpus/math-operator.A.ts b/semantic/test/fixtures/typescript/corpus/math-operator.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/math-operator.A.ts rename to semantic/test/fixtures/typescript/corpus/math-operator.A.ts diff --git a/test/fixtures/typescript/corpus/math-operator.B.ts b/semantic/test/fixtures/typescript/corpus/math-operator.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/math-operator.B.ts rename to semantic/test/fixtures/typescript/corpus/math-operator.B.ts diff --git a/test/fixtures/typescript/corpus/math-operator.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/math-operator.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/math-operator.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/math-operator.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/math-operator.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/math-operator.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/math-operator.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/math-operator.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/math-operator.parseA.txt b/semantic/test/fixtures/typescript/corpus/math-operator.parseA.txt new file mode 100644 index 0000000000..dd88c3c650 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/math-operator.parseA.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "j")) + (Expression + (Number "3")))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "j")) + (Expression + (Number "5"))))))))) diff --git a/semantic/test/fixtures/typescript/corpus/math-operator.parseB.txt b/semantic/test/fixtures/typescript/corpus/math-operator.parseB.txt new file mode 100644 index 0000000000..62fb2bb752 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/math-operator.parseB.txt @@ -0,0 +1,25 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "i")) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "j")) + (Expression + (Number "2")))))) + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "j")) + (Expression + (Number "4"))))))))) diff --git a/test/fixtures/typescript/corpus/member-access-assignment.A.ts b/semantic/test/fixtures/typescript/corpus/member-access-assignment.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/member-access-assignment.A.ts rename to semantic/test/fixtures/typescript/corpus/member-access-assignment.A.ts diff --git a/test/fixtures/typescript/corpus/member-access-assignment.B.ts b/semantic/test/fixtures/typescript/corpus/member-access-assignment.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/member-access-assignment.B.ts rename to semantic/test/fixtures/typescript/corpus/member-access-assignment.B.ts diff --git a/test/fixtures/typescript/corpus/member-access-assignment.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/member-access-assignment.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/member-access-assignment.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/member-access-assignment.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/member-access-assignment.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/member-access-assignment.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/member-access-assignment.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/member-access-assignment.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/member-access-assignment.parseA.txt b/semantic/test/fixtures/typescript/corpus/member-access-assignment.parseA.txt new file mode 100644 index 0000000000..cbd2b32859 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/member-access-assignment.parseA.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (MemberExpression + (PropertyIdentifier "x") + (Expression + (Identifier "y"))) + (Expression + (Number "0"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/member-access-assignment.parseB.txt b/semantic/test/fixtures/typescript/corpus/member-access-assignment.parseB.txt new file mode 100644 index 0000000000..bdc68e3d2e --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/member-access-assignment.parseB.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (MemberExpression + (PropertyIdentifier "x") + (Expression + (Identifier "y"))) + (Expression + (Number "1"))))))) diff --git a/test/fixtures/typescript/corpus/member-access.A.ts b/semantic/test/fixtures/typescript/corpus/member-access.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/member-access.A.ts rename to semantic/test/fixtures/typescript/corpus/member-access.A.ts diff --git a/test/fixtures/typescript/corpus/member-access.B.ts b/semantic/test/fixtures/typescript/corpus/member-access.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/member-access.B.ts rename to semantic/test/fixtures/typescript/corpus/member-access.B.ts diff --git a/test/fixtures/typescript/corpus/member-access.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/member-access.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/member-access.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/member-access.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/member-access.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/member-access.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/member-access.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/member-access.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/member-access.parseA.txt b/semantic/test/fixtures/typescript/corpus/member-access.parseA.txt new file mode 100644 index 0000000000..4561833d53 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/member-access.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (MemberExpression + (PropertyIdentifier "someProperty") + (Expression + (Identifier "x"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/member-access.parseB.txt b/semantic/test/fixtures/typescript/corpus/member-access.parseB.txt new file mode 100644 index 0000000000..ad76fcda57 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/member-access.parseB.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (MemberExpression + (PropertyIdentifier "someOtherProperty") + (Expression + (Identifier "x"))))))) diff --git a/test/fixtures/typescript/corpus/method-call.A.ts b/semantic/test/fixtures/typescript/corpus/method-call.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/method-call.A.ts rename to semantic/test/fixtures/typescript/corpus/method-call.A.ts diff --git a/test/fixtures/typescript/corpus/method-call.B.ts b/semantic/test/fixtures/typescript/corpus/method-call.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/method-call.B.ts rename to semantic/test/fixtures/typescript/corpus/method-call.B.ts diff --git a/test/fixtures/typescript/corpus/method-call.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/method-call.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/method-call.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/method-call.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/method-call.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/method-call.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/method-call.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/method-call.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/method-call.parseA.txt b/semantic/test/fixtures/typescript/corpus/method-call.parseA.txt new file mode 100644 index 0000000000..87d432c283 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/method-call.parseA.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "someMethod") + (Expression + (Identifier "object")))) + (Arguments + (Expression + (Identifier "arg1")) + (Expression + (String)))))))) diff --git a/semantic/test/fixtures/typescript/corpus/method-call.parseB.txt b/semantic/test/fixtures/typescript/corpus/method-call.parseB.txt new file mode 100644 index 0000000000..87d432c283 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/method-call.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "someMethod") + (Expression + (Identifier "object")))) + (Arguments + (Expression + (Identifier "arg1")) + (Expression + (String)))))))) diff --git a/test/fixtures/typescript/corpus/method-definition.A.ts b/semantic/test/fixtures/typescript/corpus/method-definition.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/method-definition.A.ts rename to semantic/test/fixtures/typescript/corpus/method-definition.A.ts diff --git a/test/fixtures/typescript/corpus/method-definition.B.ts b/semantic/test/fixtures/typescript/corpus/method-definition.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/method-definition.B.ts rename to semantic/test/fixtures/typescript/corpus/method-definition.B.ts diff --git a/test/fixtures/typescript/corpus/method-definition.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/method-definition.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/method-definition.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/method-definition.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/method-definition.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/method-definition.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/method-definition.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/method-definition.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/method-definition.parseA.txt b/semantic/test/fixtures/typescript/corpus/method-definition.parseA.txt new file mode 100644 index 0000000000..d3b3e02cd1 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/method-definition.parseA.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Declaration + (ClassDeclaration + (ClassBody + (MethodDefinition + (TypeAnnotation + (TypeIdentifier "Int")) + (StatementBlock) + (PropertyIdentifier "foo") + (FormalParameters) + (AccessibilityModifier "public"))) + (TypeIdentifier "Foo"))))) diff --git a/semantic/test/fixtures/typescript/corpus/method-definition.parseB.txt b/semantic/test/fixtures/typescript/corpus/method-definition.parseB.txt new file mode 100644 index 0000000000..2dc2a90027 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/method-definition.parseB.txt @@ -0,0 +1,14 @@ +(Program + (Statement + (Declaration + (ClassDeclaration + (ClassBody + (MethodDefinition + (TypeAnnotation + (PredefinedType "string")) + (StatementBlock) + (PropertyIdentifier "foo") + (FormalParameters) + (AccessibilityModifier "public") + (Readonly "readonly"))) + (TypeIdentifier "Foo"))))) diff --git a/test/fixtures/typescript/corpus/module-declarations.A.ts b/semantic/test/fixtures/typescript/corpus/module-declarations.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/module-declarations.A.ts rename to semantic/test/fixtures/typescript/corpus/module-declarations.A.ts diff --git a/test/fixtures/typescript/corpus/module-declarations.B.ts b/semantic/test/fixtures/typescript/corpus/module-declarations.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/module-declarations.B.ts rename to semantic/test/fixtures/typescript/corpus/module-declarations.B.ts diff --git a/test/fixtures/typescript/corpus/module-declarations.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/module-declarations.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/module-declarations.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/module-declarations.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/module-declarations.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/module-declarations.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/module-declarations.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/module-declarations.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/module-declarations.parseA.txt b/semantic/test/fixtures/typescript/corpus/module-declarations.parseA.txt new file mode 100644 index 0000000000..863de07e09 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/module-declarations.parseA.txt @@ -0,0 +1,6 @@ +(Program + (Statement + (Declaration + (Module + (StatementBlock) + (Identifier "Promise"))))) diff --git a/semantic/test/fixtures/typescript/corpus/module-declarations.parseB.txt b/semantic/test/fixtures/typescript/corpus/module-declarations.parseB.txt new file mode 100644 index 0000000000..dc8af99a82 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/module-declarations.parseB.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (Declaration + (AmbientDeclaration + (Declaration + (InternalModule + (StatementBlock) + (Identifier "Promise"))))))) diff --git a/test/fixtures/typescript/corpus/named-function.A.ts b/semantic/test/fixtures/typescript/corpus/named-function.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/named-function.A.ts rename to semantic/test/fixtures/typescript/corpus/named-function.A.ts diff --git a/test/fixtures/typescript/corpus/named-function.B.ts b/semantic/test/fixtures/typescript/corpus/named-function.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/named-function.B.ts rename to semantic/test/fixtures/typescript/corpus/named-function.B.ts diff --git a/test/fixtures/typescript/corpus/named-function.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/named-function.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/named-function.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/named-function.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/named-function.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/named-function.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/named-function.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/named-function.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/named-function.parseA.txt b/semantic/test/fixtures/typescript/corpus/named-function.parseA.txt new file mode 100644 index 0000000000..0cda33e832 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/named-function.parseA.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "arg2"))))) + (Identifier "myFunction") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2")))))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/typescript/corpus/named-function.parseB.txt b/semantic/test/fixtures/typescript/corpus/named-function.parseB.txt new file mode 100644 index 0000000000..d6c28317a9 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/named-function.parseB.txt @@ -0,0 +1,13 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (ReturnStatement + (Expression + (False "false"))))) + (Identifier "anotherFunction") + (FormalParameters)))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/typescript/corpus/nested-do-while-in-function.A.ts b/semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/nested-do-while-in-function.A.ts rename to semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.A.ts diff --git a/test/fixtures/typescript/corpus/nested-do-while-in-function.B.ts b/semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/nested-do-while-in-function.B.ts rename to semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.B.ts diff --git a/test/fixtures/typescript/corpus/nested-do-while-in-function.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/nested-do-while-in-function.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/nested-do-while-in-function.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/nested-do-while-in-function.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.parseA.txt b/semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.parseA.txt new file mode 100644 index 0000000000..2f4755aa2d --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.parseA.txt @@ -0,0 +1,27 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (DoStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "something")) + (Arguments + (Expression + (Identifier "arg1"))))))))) + (ParenthesizedExpression + (Expression + (Identifier "arg2")))))) + (Identifier "f") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.parseB.txt b/semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.parseB.txt new file mode 100644 index 0000000000..24ccf3949b --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/nested-do-while-in-function.parseB.txt @@ -0,0 +1,27 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (DoStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "something")) + (Arguments + (Expression + (Identifier "arg2"))))))))) + (ParenthesizedExpression + (Expression + (Identifier "arg1")))))) + (Identifier "f") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2"))))))) diff --git a/test/fixtures/typescript/corpus/nested-functions.A.ts b/semantic/test/fixtures/typescript/corpus/nested-functions.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/nested-functions.A.ts rename to semantic/test/fixtures/typescript/corpus/nested-functions.A.ts diff --git a/test/fixtures/typescript/corpus/nested-functions.B.ts b/semantic/test/fixtures/typescript/corpus/nested-functions.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/nested-functions.B.ts rename to semantic/test/fixtures/typescript/corpus/nested-functions.B.ts diff --git a/test/fixtures/typescript/corpus/nested-functions.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/nested-functions.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/nested-functions.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/nested-functions.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/nested-functions.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/nested-functions.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/nested-functions.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/nested-functions.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/nested-functions.parseA.txt b/semantic/test/fixtures/typescript/corpus/nested-functions.parseA.txt new file mode 100644 index 0000000000..87a0a98774 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/nested-functions.parseA.txt @@ -0,0 +1,45 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "arg3"))))))) + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "arg4")))))))) + (Identifier "child") + (FormalParameters + (RequiredParameter + (Identifier "arg3")) + (RequiredParameter + (Identifier "arg4"))))))) + (Identifier "parent") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/nested-functions.parseB.txt b/semantic/test/fixtures/typescript/corpus/nested-functions.parseB.txt new file mode 100644 index 0000000000..61537b42ce --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/nested-functions.parseB.txt @@ -0,0 +1,45 @@ +(Program + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (Declaration + (FunctionDeclaration + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "arg1"))))))) + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (MemberExpression + (PropertyIdentifier "log") + (Expression + (Identifier "console")))) + (Arguments + (Expression + (Identifier "arg2")))))))) + (Identifier "child") + (FormalParameters + (RequiredParameter + (Identifier "arg3")) + (RequiredParameter + (Identifier "arg4"))))))) + (Identifier "parent") + (FormalParameters + (RequiredParameter + (Identifier "arg1")) + (RequiredParameter + (Identifier "arg2"))))))) diff --git a/test/fixtures/typescript/corpus/null.A.ts b/semantic/test/fixtures/typescript/corpus/null.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/null.A.ts rename to semantic/test/fixtures/typescript/corpus/null.A.ts diff --git a/test/fixtures/typescript/corpus/null.B.ts b/semantic/test/fixtures/typescript/corpus/null.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/null.B.ts rename to semantic/test/fixtures/typescript/corpus/null.B.ts diff --git a/test/fixtures/typescript/corpus/null.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/null.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/null.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/null.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/null.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/null.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/null.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/null.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/null.parseA.txt b/semantic/test/fixtures/typescript/corpus/null.parseA.txt new file mode 100644 index 0000000000..48ab292e21 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/null.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Null "null"))))) diff --git a/semantic/test/fixtures/typescript/corpus/null.parseB.txt b/semantic/test/fixtures/typescript/corpus/null.parseB.txt new file mode 100644 index 0000000000..9a5613678e --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/null.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (Null "null"))))) diff --git a/test/fixtures/typescript/corpus/number.A.ts b/semantic/test/fixtures/typescript/corpus/number.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/number.A.ts rename to semantic/test/fixtures/typescript/corpus/number.A.ts diff --git a/test/fixtures/typescript/corpus/number.B.ts b/semantic/test/fixtures/typescript/corpus/number.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/number.B.ts rename to semantic/test/fixtures/typescript/corpus/number.B.ts diff --git a/test/fixtures/typescript/corpus/number.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/number.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/number.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/number.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/number.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/number.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/number.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/number.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/number.parseA.txt b/semantic/test/fixtures/typescript/corpus/number.parseA.txt new file mode 100644 index 0000000000..e52f85ba19 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/number.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Number "101"))))) diff --git a/semantic/test/fixtures/typescript/corpus/number.parseB.txt b/semantic/test/fixtures/typescript/corpus/number.parseB.txt new file mode 100644 index 0000000000..a9f2df2689 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/number.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Number "102"))))) diff --git a/test/fixtures/typescript/corpus/object.A.ts b/semantic/test/fixtures/typescript/corpus/object.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/object.A.ts rename to semantic/test/fixtures/typescript/corpus/object.A.ts diff --git a/test/fixtures/typescript/corpus/object.B.ts b/semantic/test/fixtures/typescript/corpus/object.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/object.B.ts rename to semantic/test/fixtures/typescript/corpus/object.B.ts diff --git a/test/fixtures/typescript/corpus/object.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/object.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/object.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/object.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/object.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/object.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/object.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/object.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/object.parseA.txt b/semantic/test/fixtures/typescript/corpus/object.parseA.txt new file mode 100644 index 0000000000..2cd9f24e22 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/object.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Object + (Pair + (Expression + (String)) + (String))))))) diff --git a/semantic/test/fixtures/typescript/corpus/object.parseB.txt b/semantic/test/fixtures/typescript/corpus/object.parseB.txt new file mode 100644 index 0000000000..09376d123c --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/object.parseB.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Object + (Pair + (Expression + (String)) + (String)) + (Pair + (Expression + (String)) + (String)) + (Pair + (Expression + (String)) + (String))))))) diff --git a/test/fixtures/typescript/corpus/objects-with-methods.A.ts b/semantic/test/fixtures/typescript/corpus/objects-with-methods.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/objects-with-methods.A.ts rename to semantic/test/fixtures/typescript/corpus/objects-with-methods.A.ts diff --git a/test/fixtures/typescript/corpus/objects-with-methods.B.ts b/semantic/test/fixtures/typescript/corpus/objects-with-methods.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/objects-with-methods.B.ts rename to semantic/test/fixtures/typescript/corpus/objects-with-methods.B.ts diff --git a/test/fixtures/typescript/corpus/objects-with-methods.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/objects-with-methods.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/objects-with-methods.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/objects-with-methods.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/objects-with-methods.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/objects-with-methods.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/objects-with-methods.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/objects-with-methods.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/objects-with-methods.parseA.txt b/semantic/test/fixtures/typescript/corpus/objects-with-methods.parseA.txt new file mode 100644 index 0000000000..fa21519dea --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/objects-with-methods.parseA.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Object + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "a")) + (Expression + (Identifier "b"))))))) + (PropertyIdentifier "add") + (FormalParameters + (RequiredParameter + (Identifier "a")) + (RequiredParameter + (Identifier "b"))))))))) diff --git a/semantic/test/fixtures/typescript/corpus/objects-with-methods.parseB.txt b/semantic/test/fixtures/typescript/corpus/objects-with-methods.parseB.txt new file mode 100644 index 0000000000..0c8c433ab1 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/objects-with-methods.parseB.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Object + (MethodDefinition + (StatementBlock + (Statement + (ReturnStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "a")) + (Expression + (Identifier "b"))))))) + (PropertyIdentifier "subtract") + (FormalParameters + (RequiredParameter + (Identifier "a")) + (RequiredParameter + (Identifier "b"))))))))) diff --git a/test/fixtures/typescript/corpus/public-field-definition.A.ts b/semantic/test/fixtures/typescript/corpus/public-field-definition.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/public-field-definition.A.ts rename to semantic/test/fixtures/typescript/corpus/public-field-definition.A.ts diff --git a/test/fixtures/typescript/corpus/public-field-definition.B.ts b/semantic/test/fixtures/typescript/corpus/public-field-definition.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/public-field-definition.B.ts rename to semantic/test/fixtures/typescript/corpus/public-field-definition.B.ts diff --git a/test/fixtures/typescript/corpus/public-field-definition.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/public-field-definition.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/public-field-definition.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/public-field-definition.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/public-field-definition.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/public-field-definition.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/public-field-definition.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/public-field-definition.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/public-field-definition.parseA.txt b/semantic/test/fixtures/typescript/corpus/public-field-definition.parseA.txt new file mode 100644 index 0000000000..28e426fc66 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/public-field-definition.parseA.txt @@ -0,0 +1,66 @@ +(Program + (Statement + (Declaration + (ClassDeclaration + (ClassBody + (PublicFieldDefinition + (PropertyIdentifier "foo") + (Readonly "readonly")) + (PublicFieldDefinition + (PropertyIdentifier "foo1") + (Readonly "readonly")) + (PublicFieldDefinition + (PropertyIdentifier "foo2") + (AccessibilityModifier "public") + (Readonly "readonly")) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo3") + (AccessibilityModifier "public") + (Readonly "readonly")) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo4") + (TypeAnnotation + (TypeIdentifier "Number")) + (AccessibilityModifier "public") + (Readonly "readonly")) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo5") + (TypeAnnotation + (TypeIdentifier "Number"))) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo6") + (TypeAnnotation + (TypeIdentifier "Number"))) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo7") + (TypeAnnotation + (TypeIdentifier "Number")) + (Readonly "readonly")) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo8") + (TypeAnnotation + (TypeIdentifier "Number")) + (Readonly "readonly")) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo9") + (TypeAnnotation + (TypeIdentifier "Number"))) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo10"))) + (TypeIdentifier "Foo"))))) diff --git a/semantic/test/fixtures/typescript/corpus/public-field-definition.parseB.txt b/semantic/test/fixtures/typescript/corpus/public-field-definition.parseB.txt new file mode 100644 index 0000000000..38582ccdb5 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/public-field-definition.parseB.txt @@ -0,0 +1,68 @@ +(Program + (Statement + (Declaration + (ClassDeclaration + (ClassBody + (PublicFieldDefinition + (PropertyIdentifier "foo") + (Readonly "readonly")) + (PublicFieldDefinition + (PropertyIdentifier "foo1") + (Readonly "readonly")) + (PublicFieldDefinition + (PropertyIdentifier "foo2") + (AccessibilityModifier "public") + (Readonly "readonly")) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo3") + (TypeAnnotation + (TypeIdentifier "Number")) + (AccessibilityModifier "public") + (Readonly "readonly")) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo4") + (TypeAnnotation + (TypeIdentifier "Number")) + (AccessibilityModifier "private")) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo5") + (TypeAnnotation + (TypeIdentifier "Number"))) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo6") + (TypeAnnotation + (TypeIdentifier "Number"))) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo7") + (TypeAnnotation + (TypeIdentifier "Number")) + (AccessibilityModifier "public")) + (PublicFieldDefinition + (Expression + (String)) + (PropertyIdentifier "foo8") + (TypeAnnotation + (TypeIdentifier "String")) + (AccessibilityModifier "protected") + (Readonly "readonly")) + (PublicFieldDefinition + (Expression + (Number "1")) + (PropertyIdentifier "foo11") + (TypeAnnotation + (TypeIdentifier "Number"))) + (PublicFieldDefinition + (Expression + (Number "2")) + (PropertyIdentifier "foo10"))) + (TypeIdentifier "Foo"))))) diff --git a/test/fixtures/typescript/corpus/regex.A.ts b/semantic/test/fixtures/typescript/corpus/regex.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/regex.A.ts rename to semantic/test/fixtures/typescript/corpus/regex.A.ts diff --git a/test/fixtures/typescript/corpus/regex.B.ts b/semantic/test/fixtures/typescript/corpus/regex.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/regex.B.ts rename to semantic/test/fixtures/typescript/corpus/regex.B.ts diff --git a/test/fixtures/typescript/corpus/regex.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/regex.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/regex.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/regex.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/regex.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/regex.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/regex.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/regex.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/regex.parseA.txt b/semantic/test/fixtures/typescript/corpus/regex.parseA.txt new file mode 100644 index 0000000000..89f64913b0 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/regex.parseA.txt @@ -0,0 +1,7 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Regex + (RegexFlags "g") + (RegexPattern "one")))))) diff --git a/semantic/test/fixtures/typescript/corpus/regex.parseB.txt b/semantic/test/fixtures/typescript/corpus/regex.parseB.txt new file mode 100644 index 0000000000..c71a96e155 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/regex.parseB.txt @@ -0,0 +1,7 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Regex + (RegexFlags "gim") + (RegexPattern "on[^/]afe")))))) diff --git a/test/fixtures/typescript/corpus/relational-operator.A.ts b/semantic/test/fixtures/typescript/corpus/relational-operator.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/relational-operator.A.ts rename to semantic/test/fixtures/typescript/corpus/relational-operator.A.ts diff --git a/test/fixtures/typescript/corpus/relational-operator.B.ts b/semantic/test/fixtures/typescript/corpus/relational-operator.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/relational-operator.B.ts rename to semantic/test/fixtures/typescript/corpus/relational-operator.B.ts diff --git a/test/fixtures/typescript/corpus/relational-operator.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/relational-operator.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/relational-operator.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/relational-operator.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/relational-operator.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/relational-operator.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/relational-operator.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/relational-operator.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/relational-operator.parseA.txt b/semantic/test/fixtures/typescript/corpus/relational-operator.parseA.txt new file mode 100644 index 0000000000..39e1b0511e --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/relational-operator.parseA.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (Identifier "y"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/relational-operator.parseB.txt b/semantic/test/fixtures/typescript/corpus/relational-operator.parseB.txt new file mode 100644 index 0000000000..39e1b0511e --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/relational-operator.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (Identifier "y"))))))) diff --git a/test/fixtures/typescript/corpus/return-statement.A.ts b/semantic/test/fixtures/typescript/corpus/return-statement.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/return-statement.A.ts rename to semantic/test/fixtures/typescript/corpus/return-statement.A.ts diff --git a/test/fixtures/typescript/corpus/return-statement.B.ts b/semantic/test/fixtures/typescript/corpus/return-statement.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/return-statement.B.ts rename to semantic/test/fixtures/typescript/corpus/return-statement.B.ts diff --git a/test/fixtures/typescript/corpus/return-statement.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/return-statement.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/return-statement.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/return-statement.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/return-statement.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/return-statement.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/return-statement.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/return-statement.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/return-statement.parseA.txt b/semantic/test/fixtures/typescript/corpus/return-statement.parseA.txt new file mode 100644 index 0000000000..d82329d1d1 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/return-statement.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (Number "5"))))) diff --git a/semantic/test/fixtures/typescript/corpus/return-statement.parseB.txt b/semantic/test/fixtures/typescript/corpus/return-statement.parseB.txt new file mode 100644 index 0000000000..034d014adc --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/return-statement.parseB.txt @@ -0,0 +1,3 @@ +(Program + (Statement + (ReturnStatement))) diff --git a/test/fixtures/typescript/corpus/string.A.ts b/semantic/test/fixtures/typescript/corpus/string.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/string.A.ts rename to semantic/test/fixtures/typescript/corpus/string.A.ts diff --git a/test/fixtures/typescript/corpus/string.B.ts b/semantic/test/fixtures/typescript/corpus/string.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/string.B.ts rename to semantic/test/fixtures/typescript/corpus/string.B.ts diff --git a/test/fixtures/typescript/corpus/string.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/string.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/string.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/string.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/string.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/string.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/string.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/string.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/string.parseA.txt b/semantic/test/fixtures/typescript/corpus/string.parseA.txt new file mode 100644 index 0000000000..1d43efb305 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/string.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (String))))) diff --git a/semantic/test/fixtures/typescript/corpus/string.parseB.txt b/semantic/test/fixtures/typescript/corpus/string.parseB.txt new file mode 100644 index 0000000000..1d43efb305 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/string.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (String))))) diff --git a/test/fixtures/typescript/corpus/subscript-access-assignment.A.ts b/semantic/test/fixtures/typescript/corpus/subscript-access-assignment.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-assignment.A.ts rename to semantic/test/fixtures/typescript/corpus/subscript-access-assignment.A.ts diff --git a/test/fixtures/typescript/corpus/subscript-access-assignment.B.ts b/semantic/test/fixtures/typescript/corpus/subscript-access-assignment.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-assignment.B.ts rename to semantic/test/fixtures/typescript/corpus/subscript-access-assignment.B.ts diff --git a/test/fixtures/typescript/corpus/subscript-access-assignment.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-assignment.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-assignment.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/subscript-access-assignment.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/subscript-access-assignment.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-assignment.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-assignment.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/subscript-access-assignment.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/subscript-access-assignment.parseA.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-assignment.parseA.txt new file mode 100644 index 0000000000..54b1595a8b --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/subscript-access-assignment.parseA.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (SubscriptExpression + (Expression + (Identifier "y")) + (Expression + (String))) + (Expression + (Number "0"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/subscript-access-assignment.parseB.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-assignment.parseB.txt new file mode 100644 index 0000000000..3303da8dde --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/subscript-access-assignment.parseB.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (SubscriptExpression + (Expression + (Identifier "y")) + (Expression + (String))) + (Expression + (Number "1"))))))) diff --git a/test/fixtures/typescript/corpus/subscript-access-string.A.ts b/semantic/test/fixtures/typescript/corpus/subscript-access-string.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-string.A.ts rename to semantic/test/fixtures/typescript/corpus/subscript-access-string.A.ts diff --git a/test/fixtures/typescript/corpus/subscript-access-string.B.ts b/semantic/test/fixtures/typescript/corpus/subscript-access-string.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-string.B.ts rename to semantic/test/fixtures/typescript/corpus/subscript-access-string.B.ts diff --git a/test/fixtures/typescript/corpus/subscript-access-string.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-string.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-string.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/subscript-access-string.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/subscript-access-string.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-string.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-string.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/subscript-access-string.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/subscript-access-string.parseA.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-string.parseA.txt new file mode 100644 index 0000000000..329f8704b1 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/subscript-access-string.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (SubscriptExpression + (Expression + (Identifier "x")) + (Expression + (String))))))) diff --git a/semantic/test/fixtures/typescript/corpus/subscript-access-string.parseB.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-string.parseB.txt new file mode 100644 index 0000000000..329f8704b1 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/subscript-access-string.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (SubscriptExpression + (Expression + (Identifier "x")) + (Expression + (String))))))) diff --git a/test/fixtures/typescript/corpus/subscript-access-variable.A.ts b/semantic/test/fixtures/typescript/corpus/subscript-access-variable.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-variable.A.ts rename to semantic/test/fixtures/typescript/corpus/subscript-access-variable.A.ts diff --git a/test/fixtures/typescript/corpus/subscript-access-variable.B.ts b/semantic/test/fixtures/typescript/corpus/subscript-access-variable.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-variable.B.ts rename to semantic/test/fixtures/typescript/corpus/subscript-access-variable.B.ts diff --git a/test/fixtures/typescript/corpus/subscript-access-variable.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-variable.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-variable.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/subscript-access-variable.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/subscript-access-variable.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-variable.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/subscript-access-variable.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/subscript-access-variable.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/subscript-access-variable.parseA.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-variable.parseA.txt new file mode 100644 index 0000000000..649b3f104f --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/subscript-access-variable.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (SubscriptExpression + (Expression + (Identifier "x")) + (Expression + (Identifier "someVariable"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/subscript-access-variable.parseB.txt b/semantic/test/fixtures/typescript/corpus/subscript-access-variable.parseB.txt new file mode 100644 index 0000000000..ef75413806 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/subscript-access-variable.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (SubscriptExpression + (Expression + (Identifier "x")) + (Expression + (Identifier "someOtherVariable"))))))) diff --git a/test/fixtures/typescript/corpus/switch-statement.A.ts b/semantic/test/fixtures/typescript/corpus/switch-statement.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/switch-statement.A.ts rename to semantic/test/fixtures/typescript/corpus/switch-statement.A.ts diff --git a/test/fixtures/typescript/corpus/switch-statement.B.ts b/semantic/test/fixtures/typescript/corpus/switch-statement.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/switch-statement.B.ts rename to semantic/test/fixtures/typescript/corpus/switch-statement.B.ts diff --git a/test/fixtures/typescript/corpus/switch-statement.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/switch-statement.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/switch-statement.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/switch-statement.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/switch-statement.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/switch-statement.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/switch-statement.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/switch-statement.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/switch-statement.parseA.txt b/semantic/test/fixtures/typescript/corpus/switch-statement.parseA.txt new file mode 100644 index 0000000000..e0a1277bef --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/switch-statement.parseA.txt @@ -0,0 +1,30 @@ +(Program + (Statement + (SwitchStatement + (SwitchBody + (SwitchCase + (Expression + (Number "1")) + (Statement + (ExpressionStatement + (Expression + (Number "1"))))) + (SwitchCase + (Expression + (Number "2")) + (Statement + (ExpressionStatement + (Expression + (Number "1"))))) + (SwitchCase + (Expression + (Number "3")) + (Statement + (ExpressionStatement + (Expression + (Number "3")))))) + (ParenthesizedExpression + (Expression + (Number "1"))))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/typescript/corpus/switch-statement.parseB.txt b/semantic/test/fixtures/typescript/corpus/switch-statement.parseB.txt new file mode 100644 index 0000000000..87786f3f52 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/switch-statement.parseB.txt @@ -0,0 +1,30 @@ +(Program + (Statement + (SwitchStatement + (SwitchBody + (SwitchCase + (Expression + (Number "1")) + (Statement + (ExpressionStatement + (Expression + (Number "1"))))) + (SwitchCase + (Expression + (Number "2")) + (Statement + (ExpressionStatement + (Expression + (Number "2"))))) + (SwitchCase + (Expression + (Number "3")) + (Statement + (ExpressionStatement + (Expression + (Number "3")))))) + (ParenthesizedExpression + (Expression + (Number "2"))))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/typescript/corpus/template-string.A.ts b/semantic/test/fixtures/typescript/corpus/template-string.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/template-string.A.ts rename to semantic/test/fixtures/typescript/corpus/template-string.A.ts diff --git a/test/fixtures/typescript/corpus/template-string.B.ts b/semantic/test/fixtures/typescript/corpus/template-string.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/template-string.B.ts rename to semantic/test/fixtures/typescript/corpus/template-string.B.ts diff --git a/test/fixtures/typescript/corpus/template-string.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/template-string.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/template-string.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/template-string.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/template-string.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/template-string.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/template-string.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/template-string.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/template-string.parseA.txt b/semantic/test/fixtures/typescript/corpus/template-string.parseA.txt new file mode 100644 index 0000000000..75bebd8e92 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/template-string.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (TemplateString))))) diff --git a/semantic/test/fixtures/typescript/corpus/template-string.parseB.txt b/semantic/test/fixtures/typescript/corpus/template-string.parseB.txt new file mode 100644 index 0000000000..75bebd8e92 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/template-string.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (TemplateString))))) diff --git a/test/fixtures/typescript/corpus/ternary.A.ts b/semantic/test/fixtures/typescript/corpus/ternary.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/ternary.A.ts rename to semantic/test/fixtures/typescript/corpus/ternary.A.ts diff --git a/test/fixtures/typescript/corpus/ternary.B.ts b/semantic/test/fixtures/typescript/corpus/ternary.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/ternary.B.ts rename to semantic/test/fixtures/typescript/corpus/ternary.B.ts diff --git a/test/fixtures/typescript/corpus/ternary.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/ternary.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/ternary.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/ternary.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/ternary.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/ternary.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/ternary.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/ternary.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/ternary.parseA.txt b/semantic/test/fixtures/typescript/corpus/ternary.parseA.txt new file mode 100644 index 0000000000..7486c9466a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/ternary.parseA.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (TernaryExpression + (Expression + (Identifier "case2")) + (Expression + (Identifier "case1")) + (Expression + (Identifier "condition"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/ternary.parseB.txt b/semantic/test/fixtures/typescript/corpus/ternary.parseB.txt new file mode 100644 index 0000000000..24f03ad5aa --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/ternary.parseB.txt @@ -0,0 +1,29 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AssignmentExpression + (MemberExpression + (PropertyIdentifier "y") + (Expression + (Identifier "x"))) + (Expression + (TernaryExpression + (Expression + (MemberExpression + (PropertyIdentifier "case") + (Expression + (MemberExpression + (PropertyIdentifier "other") + (Expression + (Identifier "some")))))) + (Expression + (MemberExpression + (PropertyIdentifier "case") + (Expression + (Identifier "some")))) + (Expression + (MemberExpression + (PropertyIdentifier "condition") + (Expression + (Identifier "some"))))))))))) diff --git a/test/fixtures/typescript/corpus/this-expression.A.ts b/semantic/test/fixtures/typescript/corpus/this-expression.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/this-expression.A.ts rename to semantic/test/fixtures/typescript/corpus/this-expression.A.ts diff --git a/test/fixtures/typescript/corpus/this-expression.B.ts b/semantic/test/fixtures/typescript/corpus/this-expression.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/this-expression.B.ts rename to semantic/test/fixtures/typescript/corpus/this-expression.B.ts diff --git a/test/fixtures/typescript/corpus/this-expression.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/this-expression.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/this-expression.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/this-expression.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/this-expression.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/this-expression.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/this-expression.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/this-expression.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/this-expression.parseA.txt b/semantic/test/fixtures/typescript/corpus/this-expression.parseA.txt new file mode 100644 index 0000000000..7a21a87443 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/this-expression.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (This "this"))))) diff --git a/semantic/test/fixtures/typescript/corpus/this-expression.parseB.txt b/semantic/test/fixtures/typescript/corpus/this-expression.parseB.txt new file mode 100644 index 0000000000..28e054b881 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/this-expression.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (This "this"))))) diff --git a/test/fixtures/typescript/corpus/throw-statement.A.ts b/semantic/test/fixtures/typescript/corpus/throw-statement.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/throw-statement.A.ts rename to semantic/test/fixtures/typescript/corpus/throw-statement.A.ts diff --git a/test/fixtures/typescript/corpus/throw-statement.B.ts b/semantic/test/fixtures/typescript/corpus/throw-statement.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/throw-statement.B.ts rename to semantic/test/fixtures/typescript/corpus/throw-statement.B.ts diff --git a/test/fixtures/typescript/corpus/throw-statement.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/throw-statement.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/throw-statement.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/throw-statement.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/throw-statement.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/throw-statement.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/throw-statement.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/throw-statement.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/throw-statement.parseA.txt b/semantic/test/fixtures/typescript/corpus/throw-statement.parseA.txt new file mode 100644 index 0000000000..f73f01a1a3 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/throw-statement.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ThrowStatement + (Expression + (NewExpression + (Arguments + (Expression + (String))) + (Identifier "Error")))))) diff --git a/semantic/test/fixtures/typescript/corpus/throw-statement.parseB.txt b/semantic/test/fixtures/typescript/corpus/throw-statement.parseB.txt new file mode 100644 index 0000000000..f73f01a1a3 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/throw-statement.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ThrowStatement + (Expression + (NewExpression + (Arguments + (Expression + (String))) + (Identifier "Error")))))) diff --git a/test/fixtures/typescript/corpus/true.A.ts b/semantic/test/fixtures/typescript/corpus/true.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/true.A.ts rename to semantic/test/fixtures/typescript/corpus/true.A.ts diff --git a/test/fixtures/typescript/corpus/true.B.ts b/semantic/test/fixtures/typescript/corpus/true.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/true.B.ts rename to semantic/test/fixtures/typescript/corpus/true.B.ts diff --git a/test/fixtures/typescript/corpus/true.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/true.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/true.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/true.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/true.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/true.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/true.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/true.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/true.parseA.txt b/semantic/test/fixtures/typescript/corpus/true.parseA.txt new file mode 100644 index 0000000000..aa0ec6291a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/true.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (True "true"))))) diff --git a/semantic/test/fixtures/typescript/corpus/true.parseB.txt b/semantic/test/fixtures/typescript/corpus/true.parseB.txt new file mode 100644 index 0000000000..a5273bbdea --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/true.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (True "true"))))) diff --git a/test/fixtures/typescript/corpus/try-statement.A.ts b/semantic/test/fixtures/typescript/corpus/try-statement.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/try-statement.A.ts rename to semantic/test/fixtures/typescript/corpus/try-statement.A.ts diff --git a/test/fixtures/typescript/corpus/try-statement.B.ts b/semantic/test/fixtures/typescript/corpus/try-statement.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/try-statement.B.ts rename to semantic/test/fixtures/typescript/corpus/try-statement.B.ts diff --git a/test/fixtures/typescript/corpus/try-statement.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/try-statement.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/try-statement.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/try-statement.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/try-statement.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/try-statement.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/try-statement.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/try-statement.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/try-statement.parseA.txt b/semantic/test/fixtures/typescript/corpus/try-statement.parseA.txt new file mode 100644 index 0000000000..49738edd6f --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/try-statement.parseA.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (TryStatement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "f"))))) + (CatchClause + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "g")))))) + (FinallyClause + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "h")))))))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/typescript/corpus/try-statement.parseB.txt b/semantic/test/fixtures/typescript/corpus/try-statement.parseB.txt new file mode 100644 index 0000000000..5728f6c703 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/try-statement.parseB.txt @@ -0,0 +1,22 @@ +(Program + (Statement + (TryStatement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "f"))))) + (CatchClause + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "h")))))) + (FinallyClause + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (Identifier "g")))))))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/typescript/corpus/tuple-type.A.ts b/semantic/test/fixtures/typescript/corpus/tuple-type.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/tuple-type.A.ts rename to semantic/test/fixtures/typescript/corpus/tuple-type.A.ts diff --git a/test/fixtures/typescript/corpus/tuple-type.B.ts b/semantic/test/fixtures/typescript/corpus/tuple-type.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/tuple-type.B.ts rename to semantic/test/fixtures/typescript/corpus/tuple-type.B.ts diff --git a/test/fixtures/typescript/corpus/tuple-type.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/tuple-type.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/tuple-type.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/tuple-type.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/tuple-type.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/tuple-type.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/tuple-type.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/tuple-type.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/tuple-type.parseA.txt b/semantic/test/fixtures/typescript/corpus/tuple-type.parseA.txt new file mode 100644 index 0000000000..3b641f1435 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/tuple-type.parseA.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "x") + (TypeAnnotation + (TupleType + (TypeIdentifier "A") + (TypeIdentifier "B")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/tuple-type.parseB.txt b/semantic/test/fixtures/typescript/corpus/tuple-type.parseB.txt new file mode 100644 index 0000000000..bbf858bfe4 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/tuple-type.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "x") + (TypeAnnotation + (IntersectionType + (TypeIdentifier "A") + (TypeIdentifier "B")))))))) diff --git a/test/fixtures/typescript/corpus/type-assertions.A.ts b/semantic/test/fixtures/typescript/corpus/type-assertions.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/type-assertions.A.ts rename to semantic/test/fixtures/typescript/corpus/type-assertions.A.ts diff --git a/test/fixtures/typescript/corpus/type-assertions.B.ts b/semantic/test/fixtures/typescript/corpus/type-assertions.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/type-assertions.B.ts rename to semantic/test/fixtures/typescript/corpus/type-assertions.B.ts diff --git a/test/fixtures/typescript/corpus/type-assertions.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/type-assertions.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/type-assertions.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/type-assertions.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/type-assertions.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/type-assertions.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/type-assertions.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/type-assertions.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/type-assertions.parseA.txt b/semantic/test/fixtures/typescript/corpus/type-assertions.parseA.txt new file mode 100644 index 0000000000..fa644d26e4 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/type-assertions.parseA.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (TypeAssertion + (TypeArguments + (PredefinedType "string")) + (Expression + (Identifier "foo"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/type-assertions.parseB.txt b/semantic/test/fixtures/typescript/corpus/type-assertions.parseB.txt new file mode 100644 index 0000000000..ab6fca0237 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/type-assertions.parseB.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (AsExpression + (Expression + (Identifier "foo")) + (PredefinedType "any")))))) diff --git a/test/fixtures/typescript/corpus/type-operator.A.ts b/semantic/test/fixtures/typescript/corpus/type-operator.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/type-operator.A.ts rename to semantic/test/fixtures/typescript/corpus/type-operator.A.ts diff --git a/test/fixtures/typescript/corpus/type-operator.B.ts b/semantic/test/fixtures/typescript/corpus/type-operator.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/type-operator.B.ts rename to semantic/test/fixtures/typescript/corpus/type-operator.B.ts diff --git a/test/fixtures/typescript/corpus/type-operator.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/type-operator.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/type-operator.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/type-operator.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/type-operator.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/type-operator.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/type-operator.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/type-operator.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/type-operator.parseA.txt b/semantic/test/fixtures/typescript/corpus/type-operator.parseA.txt new file mode 100644 index 0000000000..06e961690d --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/type-operator.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (UnaryExpression + (Token) + (Expression + (Identifier "x"))))))) diff --git a/semantic/test/fixtures/typescript/corpus/type-operator.parseB.txt b/semantic/test/fixtures/typescript/corpus/type-operator.parseB.txt new file mode 100644 index 0000000000..e4d8f4cebe --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/type-operator.parseB.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (BinaryExpression + (Token) + (Expression + (Identifier "x")) + (Expression + (Identifier "String"))))))) diff --git a/test/fixtures/typescript/corpus/typeof-types.A.ts b/semantic/test/fixtures/typescript/corpus/typeof-types.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/typeof-types.A.ts rename to semantic/test/fixtures/typescript/corpus/typeof-types.A.ts diff --git a/test/fixtures/typescript/corpus/typeof-types.B.ts b/semantic/test/fixtures/typescript/corpus/typeof-types.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/typeof-types.B.ts rename to semantic/test/fixtures/typescript/corpus/typeof-types.B.ts diff --git a/test/fixtures/typescript/corpus/typeof-types.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/typeof-types.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/typeof-types.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/typeof-types.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/typeof-types.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/typeof-types.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/typeof-types.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/typeof-types.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/typeof-types.parseA.txt b/semantic/test/fixtures/typescript/corpus/typeof-types.parseA.txt new file mode 100644 index 0000000000..59f306a31a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/typeof-types.parseA.txt @@ -0,0 +1,16 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "foo") + (TypeAnnotation + (TypeIdentifier "Z")))))) + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "bar") + (TypeAnnotation + (TypeQuery + (Identifier "Foo")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/typeof-types.parseB.txt b/semantic/test/fixtures/typescript/corpus/typeof-types.parseB.txt new file mode 100644 index 0000000000..72a6af7c12 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/typeof-types.parseB.txt @@ -0,0 +1,16 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "foo") + (TypeAnnotation + (TypeQuery + (Identifier "Bar"))))))) + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "bar") + (TypeAnnotation + (TypeIdentifier "G"))))))) diff --git a/test/fixtures/typescript/corpus/undefined.A.ts b/semantic/test/fixtures/typescript/corpus/undefined.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/undefined.A.ts rename to semantic/test/fixtures/typescript/corpus/undefined.A.ts diff --git a/test/fixtures/typescript/corpus/undefined.B.ts b/semantic/test/fixtures/typescript/corpus/undefined.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/undefined.B.ts rename to semantic/test/fixtures/typescript/corpus/undefined.B.ts diff --git a/test/fixtures/typescript/corpus/undefined.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/undefined.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/undefined.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/undefined.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/undefined.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/undefined.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/undefined.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/undefined.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/undefined.parseA.txt b/semantic/test/fixtures/typescript/corpus/undefined.parseA.txt new file mode 100644 index 0000000000..26370fbb4b --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/undefined.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Undefined "undefined"))))) diff --git a/semantic/test/fixtures/typescript/corpus/undefined.parseB.txt b/semantic/test/fixtures/typescript/corpus/undefined.parseB.txt new file mode 100644 index 0000000000..d7ad4f1c7a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/undefined.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ReturnStatement + (Expression + (Undefined "undefined"))))) diff --git a/test/fixtures/typescript/corpus/union-type.A.ts b/semantic/test/fixtures/typescript/corpus/union-type.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/union-type.A.ts rename to semantic/test/fixtures/typescript/corpus/union-type.A.ts diff --git a/test/fixtures/typescript/corpus/union-type.B.ts b/semantic/test/fixtures/typescript/corpus/union-type.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/union-type.B.ts rename to semantic/test/fixtures/typescript/corpus/union-type.B.ts diff --git a/test/fixtures/typescript/corpus/union-type.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/union-type.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/union-type.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/union-type.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/union-type.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/union-type.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/union-type.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/union-type.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/union-type.parseA.txt b/semantic/test/fixtures/typescript/corpus/union-type.parseA.txt new file mode 100644 index 0000000000..bbf858bfe4 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/union-type.parseA.txt @@ -0,0 +1,10 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "x") + (TypeAnnotation + (IntersectionType + (TypeIdentifier "A") + (TypeIdentifier "B")))))))) diff --git a/semantic/test/fixtures/typescript/corpus/union-type.parseB.txt b/semantic/test/fixtures/typescript/corpus/union-type.parseB.txt new file mode 100644 index 0000000000..4d3dc4aeb9 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/union-type.parseB.txt @@ -0,0 +1,9 @@ +(Program + (Statement + (Declaration + (LexicalDeclaration + (VariableDeclarator + (Identifier "x") + (TypeAnnotation + (TypeQuery + (Identifier "A")))))))) diff --git a/test/fixtures/typescript/corpus/var-declaration.A.ts b/semantic/test/fixtures/typescript/corpus/var-declaration.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/var-declaration.A.ts rename to semantic/test/fixtures/typescript/corpus/var-declaration.A.ts diff --git a/test/fixtures/typescript/corpus/var-declaration.B.ts b/semantic/test/fixtures/typescript/corpus/var-declaration.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/var-declaration.B.ts rename to semantic/test/fixtures/typescript/corpus/var-declaration.B.ts diff --git a/test/fixtures/typescript/corpus/var-declaration.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/var-declaration.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/var-declaration.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/var-declaration.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/var-declaration.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/var-declaration.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/var-declaration.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/var-declaration.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/var-declaration.parseA.txt b/semantic/test/fixtures/typescript/corpus/var-declaration.parseA.txt new file mode 100644 index 0000000000..7add3ac35e --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/var-declaration.parseA.txt @@ -0,0 +1,8 @@ +(Program + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (Number "1")) + (Identifier "x")))))) diff --git a/semantic/test/fixtures/typescript/corpus/var-declaration.parseB.txt b/semantic/test/fixtures/typescript/corpus/var-declaration.parseB.txt new file mode 100644 index 0000000000..b6166d8f82 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/var-declaration.parseB.txt @@ -0,0 +1,12 @@ +(Program + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Identifier "x")) + (VariableDeclarator + (Expression + (Object)) + (Identifier "y")) + (VariableDeclarator + (Identifier "z")))))) diff --git a/test/fixtures/typescript/corpus/variable.A.ts b/semantic/test/fixtures/typescript/corpus/variable.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/variable.A.ts rename to semantic/test/fixtures/typescript/corpus/variable.A.ts diff --git a/test/fixtures/typescript/corpus/variable.B.ts b/semantic/test/fixtures/typescript/corpus/variable.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/variable.B.ts rename to semantic/test/fixtures/typescript/corpus/variable.B.ts diff --git a/test/fixtures/typescript/corpus/variable.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/variable.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/variable.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/variable.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/variable.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/variable.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/variable.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/variable.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/variable.parseA.txt b/semantic/test/fixtures/typescript/corpus/variable.parseA.txt new file mode 100644 index 0000000000..ee36557999 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/variable.parseA.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Identifier "theVar"))))) diff --git a/semantic/test/fixtures/typescript/corpus/variable.parseB.txt b/semantic/test/fixtures/typescript/corpus/variable.parseB.txt new file mode 100644 index 0000000000..420643ed8a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/variable.parseB.txt @@ -0,0 +1,5 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (Identifier "theVar2"))))) diff --git a/test/fixtures/typescript/corpus/void-operator.A.ts b/semantic/test/fixtures/typescript/corpus/void-operator.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/void-operator.A.ts rename to semantic/test/fixtures/typescript/corpus/void-operator.A.ts diff --git a/test/fixtures/typescript/corpus/void-operator.B.ts b/semantic/test/fixtures/typescript/corpus/void-operator.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/void-operator.B.ts rename to semantic/test/fixtures/typescript/corpus/void-operator.B.ts diff --git a/test/fixtures/typescript/corpus/void-operator.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/void-operator.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/void-operator.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/void-operator.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/void-operator.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/void-operator.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/void-operator.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/void-operator.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/void-operator.parseA.txt b/semantic/test/fixtures/typescript/corpus/void-operator.parseA.txt new file mode 100644 index 0000000000..c5d371aa5e --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/void-operator.parseA.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (UnaryExpression + (Token) + (Expression + (CallExpression + (Expression + (Identifier "b")) + (Arguments)))))))) diff --git a/semantic/test/fixtures/typescript/corpus/void-operator.parseB.txt b/semantic/test/fixtures/typescript/corpus/void-operator.parseB.txt new file mode 100644 index 0000000000..486e852f3a --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/void-operator.parseB.txt @@ -0,0 +1,11 @@ +(Program + (Statement + (ExpressionStatement + (Expression + (UnaryExpression + (Token) + (Expression + (CallExpression + (Expression + (Identifier "c")) + (Arguments)))))))) diff --git a/test/fixtures/typescript/corpus/while-statement.A.ts b/semantic/test/fixtures/typescript/corpus/while-statement.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/while-statement.A.ts rename to semantic/test/fixtures/typescript/corpus/while-statement.A.ts diff --git a/test/fixtures/typescript/corpus/while-statement.B.ts b/semantic/test/fixtures/typescript/corpus/while-statement.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/while-statement.B.ts rename to semantic/test/fixtures/typescript/corpus/while-statement.B.ts diff --git a/test/fixtures/typescript/corpus/while-statement.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/while-statement.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/while-statement.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/while-statement.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/while-statement.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/while-statement.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/while-statement.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/while-statement.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/while-statement.parseA.txt b/semantic/test/fixtures/typescript/corpus/while-statement.parseA.txt new file mode 100644 index 0000000000..edb9d27fb9 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/while-statement.parseA.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (WhileStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "b")) + (Arguments))))))) + (ParenthesizedExpression + (Expression + (Identifier "a"))))) + (Statement + (EmptyStatement ";"))) diff --git a/semantic/test/fixtures/typescript/corpus/while-statement.parseB.txt b/semantic/test/fixtures/typescript/corpus/while-statement.parseB.txt new file mode 100644 index 0000000000..d9c98394de --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/while-statement.parseB.txt @@ -0,0 +1,17 @@ +(Program + (Statement + (WhileStatement + (Statement + (StatementBlock + (Statement + (ExpressionStatement + (Expression + (CallExpression + (Expression + (Identifier "a")) + (Arguments))))))) + (ParenthesizedExpression + (Expression + (Identifier "b"))))) + (Statement + (EmptyStatement ";"))) diff --git a/test/fixtures/typescript/corpus/yield.A.ts b/semantic/test/fixtures/typescript/corpus/yield.A.ts similarity index 100% rename from test/fixtures/typescript/corpus/yield.A.ts rename to semantic/test/fixtures/typescript/corpus/yield.A.ts diff --git a/test/fixtures/typescript/corpus/yield.B.ts b/semantic/test/fixtures/typescript/corpus/yield.B.ts similarity index 100% rename from test/fixtures/typescript/corpus/yield.B.ts rename to semantic/test/fixtures/typescript/corpus/yield.B.ts diff --git a/test/fixtures/typescript/corpus/yield.diffA-B.txt b/semantic/test/fixtures/typescript/corpus/yield.diffA-B.txt similarity index 100% rename from test/fixtures/typescript/corpus/yield.diffA-B.txt rename to semantic/test/fixtures/typescript/corpus/yield.diffA-B.txt diff --git a/test/fixtures/typescript/corpus/yield.diffB-A.txt b/semantic/test/fixtures/typescript/corpus/yield.diffB-A.txt similarity index 100% rename from test/fixtures/typescript/corpus/yield.diffB-A.txt rename to semantic/test/fixtures/typescript/corpus/yield.diffB-A.txt diff --git a/semantic/test/fixtures/typescript/corpus/yield.parseA.txt b/semantic/test/fixtures/typescript/corpus/yield.parseA.txt new file mode 100644 index 0000000000..5b2b9a2543 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/yield.parseA.txt @@ -0,0 +1,20 @@ +(Program + (Statement + (Declaration + (GeneratorFunctionDeclaration + (StatementBlock + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (Number "0")) + (Identifier "index"))))) + (Statement + (ExpressionStatement + (Expression + (YieldExpression + (Expression + (Identifier "i"))))))) + (Identifier "foo") + (FormalParameters))))) diff --git a/semantic/test/fixtures/typescript/corpus/yield.parseB.txt b/semantic/test/fixtures/typescript/corpus/yield.parseB.txt new file mode 100644 index 0000000000..492c1ced74 --- /dev/null +++ b/semantic/test/fixtures/typescript/corpus/yield.parseB.txt @@ -0,0 +1,23 @@ +(Program + (Statement + (Declaration + (GeneratorFunctionDeclaration + (StatementBlock + (Statement + (Declaration + (VariableDeclaration + (VariableDeclarator + (Expression + (Number "0")) + (Identifier "index"))))) + (Statement + (ExpressionStatement + (Expression + (YieldExpression + (Expression + (UpdateExpression + (Token) + (Expression + (Identifier "i"))))))))) + (Identifier "foo") + (FormalParameters))))) diff --git a/test/fixtures/typescript/import-graph/app.json b/semantic/test/fixtures/typescript/import-graph/app.json similarity index 100% rename from test/fixtures/typescript/import-graph/app.json rename to semantic/test/fixtures/typescript/import-graph/app.json diff --git a/test/fixtures/typescript/import-graph/app.ts b/semantic/test/fixtures/typescript/import-graph/app.ts similarity index 100% rename from test/fixtures/typescript/import-graph/app.ts rename to semantic/test/fixtures/typescript/import-graph/app.ts diff --git a/test/fixtures/typescript/tags/class.ts b/semantic/test/fixtures/typescript/tags/class.ts similarity index 100% rename from test/fixtures/typescript/tags/class.ts rename to semantic/test/fixtures/typescript/tags/class.ts diff --git a/test/fixtures/typescript/tags/module.ts b/semantic/test/fixtures/typescript/tags/module.ts similarity index 100% rename from test/fixtures/typescript/tags/module.ts rename to semantic/test/fixtures/typescript/tags/module.ts diff --git a/src/Analysis/Abstract/Caching/FlowInsensitive.hs b/src/Analysis/Abstract/Caching/FlowInsensitive.hs deleted file mode 100644 index c5670e6bc0..0000000000 --- a/src/Analysis/Abstract/Caching/FlowInsensitive.hs +++ /dev/null @@ -1,210 +0,0 @@ -{-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, TypeOperators #-} -module Analysis.Abstract.Caching.FlowInsensitive -( cachingTerms -, convergingModules -, caching -) where - -import Control.Abstract -import Data.Abstract.Module -import Data.Map.Monoidal as Monoidal hiding (empty) -import Prologue - --- | Look up the set of values for a given configuration in the in-cache. -consultOracle :: (Member (Reader (Cache term address value)) sig, Carrier sig m, Ord address, Ord term, Ord value) - => Configuration term address - -> Evaluator term address value m (Set value) -consultOracle configuration = asks (fromMaybe mempty . cacheLookup configuration) - --- | Run an action with the given in-cache. -withOracle :: (Member (Reader (Cache term address value)) sig, Carrier sig m) - => Cache term address value - -> Evaluator term address value m a - -> Evaluator term address value m a -withOracle cache = local (const cache) - - --- | Look up the set of values for a given configuration in the out-cache. -lookupCache :: (Member (State (Cache term address value)) sig, Carrier sig m, Ord address, Ord term) - => Configuration term address - -> Evaluator term address value m (Maybe (Set value)) -lookupCache configuration = cacheLookup configuration <$> get - --- | Run an action, caching its result and 'Heap' under the given configuration. -cachingConfiguration :: (Member (State (Cache term address value)) sig, Carrier sig m, Ord address, Ord term, Ord value) - => Configuration term address - -> Set value - -> Evaluator term address value m value - -> Evaluator term address value m value -cachingConfiguration configuration values action = do - modify (cacheSet configuration values) - result <- action - result <$ modify (cacheInsert configuration result) - -putCache :: (Member (State (Cache term address value)) sig, Carrier sig m) - => Cache term address value - -> Evaluator term address value m () -putCache = put - --- | Run an action starting from an empty out-cache, and return the out-cache afterwards. -isolateCache :: (Member (State (Cache term address value)) sig, Member (State (Heap address address value)) sig, Carrier sig m) - => Evaluator term address value m a - -> Evaluator term address value m (Cache term address value, Heap address address value) -isolateCache action = putCache lowerBound *> action *> ((,) <$> get <*> get) - - --- | Analyze a term using the in-cache as an oracle & storing the results of the analysis in the out-cache. -cachingTerms :: ( Member (Reader (Cache term address value)) sig - , Member (Reader (Live address)) sig - , Member (State (Cache term address value)) sig - , Carrier sig m - , Ord address - , Ord term - , Ord value - , Alternative m - ) - => Open (term -> Evaluator term address value m value) -cachingTerms recur term = do - c <- getConfiguration term - cached <- lookupCache c - case cached of - Just values -> scatter values - Nothing -> do - values <- consultOracle c - cachingConfiguration c values (recur term) - -convergingModules :: ( Eq value - , Member Fresh sig - , Member (Reader (Cache term address value)) sig - , Member (Reader (Live address)) sig - , Member (State (Cache term address value)) sig - , Member (State (Heap address address value)) sig - , Ord address - , Ord term - , Carrier sig m - , Alternative m - ) - => (Module (Either prelude term) -> Evaluator term address value (NonDetC m) value) - -> (Module (Either prelude term) -> Evaluator term address value m value) -convergingModules recur m@(Module _ (Left _)) = raiseHandler runNonDet (recur m) >>= maybeM empty -convergingModules recur m@(Module _ (Right term)) = do - c <- getConfiguration term - heap <- getHeap - -- Convergence here is predicated upon an Eq instance, not Ξ±-equivalence - (cache, _) <- converge (lowerBound, heap) (\ (prevCache, _) -> isolateCache $ do - -- We need to reset fresh generation so that this invocation converges. - resetFresh $ - -- This is subtle: though the calling context supports nondeterminism, we want - -- to corral all the nondeterminism that happens in this @eval@ invocation, so - -- that it doesn't "leak" to the calling context and diverge (otherwise this - -- would never complete). We don’t need to use the values, so we 'gather' the - -- nondeterministic values into @()@. - withOracle prevCache (raiseHandler (runNonDet @Maybe) (recur m))) - maybe empty scatter (cacheLookup c cache) - --- | Iterate a monadic action starting from some initial seed until the results converge. --- --- This applies the Kleene fixed-point theorem to finitize a monotone action. cf https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem -converge :: (Eq a, Monad m) - => a -- ^ An initial seed value to iterate from. - -> (a -> m a) -- ^ A monadic action to perform at each iteration, starting from the result of the previous iteration or from the seed value for the first iteration. - -> m a -- ^ A computation producing the least fixed point (the first value at which the actions converge). -converge seed f = loop seed - where loop x = do - x' <- f x - if x' == x then - pure x - else - loop x' - --- | Nondeterministically write each of a collection of stores & return their associated results. -scatter :: (Foldable t, Carrier sig m, Alternative m) => t value -> Evaluator term address value m value -scatter = foldMapA pure - --- | Get the current 'Configuration' with a passed-in term. -getConfiguration :: (Member (Reader (Live address)) sig, Carrier sig m) - => term - -> Evaluator term address value m (Configuration term address) -getConfiguration term = Configuration term <$> askRoots - - -caching :: Carrier sig m - => Evaluator term address value (NonDetC - (ReaderC (Cache term address value) - (StateC (Cache term address value) - m))) a - -> Evaluator term address value m (Cache term address value, [a]) -caching - = raiseHandler (runState lowerBound) - . raiseHandler (runReader lowerBound) - . fmap (toList @B) - . raiseHandler runNonDet - -data B a = E | L a | B (B a) (B a) - deriving (Functor) - -instance Foldable B where - toList = flip go [] - where go E rest = rest - go (L a) rest = a : rest - go (B a b) rest = go a (go b rest) - - foldMap f = go - where go E = mempty - go (L a) = f a - go (B a b) = go a <> go b - - null E = True - null _ = False - -instance Traversable B where - traverse f = go - where go E = pure E - go (L a) = L <$> f a - go (B a b) = B <$> go a <*> go b - -instance Applicative B where - pure = L - E <*> _ = E - L f <*> a = fmap f a - B l r <*> a = B (l <*> a) (r <*> a) - -instance Alternative B where - empty = E - E <|> b = b - a <|> E = a - a <|> b = B a b - -instance Monad B where - return = pure - E >>= _ = E - L a >>= f = f a - B l r >>= f = B (l >>= f) (r >>= f) - - --- | A map of 'Configuration's to 'Set's of resulting values & 'Heap's. -newtype Cache term address value = Cache { unCache :: Monoidal.Map (Configuration term address) (Set value) } - deriving (Eq, Lower, Monoid, Ord, Reducer (Configuration term address, value), Semigroup) - --- | A single point in a program’s execution. -data Configuration term address = Configuration - { configurationTerm :: term -- ^ The β€œinstruction,” i.e. the current term to evaluate. - , configurationRoots :: Live address -- ^ The set of rooted addresses. - } - deriving (Eq, Ord, Show) - - --- | Look up the resulting value & 'Heap' for a given 'Configuration'. -cacheLookup :: (Ord address, Ord term) => Configuration term address -> Cache term address value -> Maybe (Set value) -cacheLookup key = Monoidal.lookup key . unCache - --- | Set the resulting value & 'Heap' for a given 'Configuration', overwriting any previous entry. -cacheSet :: (Ord address, Ord term) => Configuration term address -> Set value -> Cache term address value -> Cache term address value -cacheSet key value = Cache . Monoidal.insert key value . unCache - --- | Insert the resulting value & 'Heap' for a given 'Configuration', appending onto any previous entry. -cacheInsert :: (Ord address, Ord term, Ord value) => Configuration term address -> value -> Cache term address value -> Cache term address value -cacheInsert = curry cons - -instance (Show term, Show address, Show value) => Show (Cache term address value) where - showsPrec d = showsUnaryWith showsPrec "Cache" d . map (second toList) . Monoidal.pairs . unCache diff --git a/src/Analysis/Abstract/Caching/FlowSensitive.hs b/src/Analysis/Abstract/Caching/FlowSensitive.hs deleted file mode 100644 index 226aef748a..0000000000 --- a/src/Analysis/Abstract/Caching/FlowSensitive.hs +++ /dev/null @@ -1,175 +0,0 @@ -{-# LANGUAGE ConstraintKinds, GADTs, GeneralizedNewtypeDeriving, TypeOperators #-} -module Analysis.Abstract.Caching.FlowSensitive -( Cache -, cachingTerms -, convergingModules -, caching -) where - -import Control.Abstract -import Data.Abstract.Module -import Data.Map.Monoidal as Monoidal hiding (empty) -import Prologue - --- | Look up the set of values for a given configuration in the in-cache. -consultOracle :: (Cacheable term address value, Member (Reader (Cache term address value)) sig, Carrier sig m) - => Configuration term address value - -> Evaluator term address value m (Set (Cached address value)) -consultOracle configuration = fromMaybe mempty . cacheLookup configuration <$> ask - --- | Run an action with the given in-cache. -withOracle :: (Member (Reader (Cache term address value)) sig, Carrier sig m) - => Cache term address value - -> Evaluator term address value m a - -> Evaluator term address value m a -withOracle cache = local (const cache) - - --- | Look up the set of values for a given configuration in the out-cache. -lookupCache :: (Cacheable term address value, Member (State (Cache term address value)) sig, Carrier sig m) - => Configuration term address value - -> Evaluator term address value m (Maybe (Set (Cached address value))) -lookupCache configuration = cacheLookup configuration <$> get - --- | Run an action, caching its result and 'Heap' under the given configuration. -cachingConfiguration :: (Cacheable term address value, Member (State (Cache term address value)) sig, Member (State (Heap address address value)) sig, Carrier sig m) - => Configuration term address value - -> Set (Cached address value) - -> Evaluator term address value m value - -> Evaluator term address value m value -cachingConfiguration configuration values action = do - modify (cacheSet configuration values) - result <- Cached <$> action <*> getHeap - cachedValue result <$ modify (cacheInsert configuration result) - -putCache :: (Member (State (Cache term address value)) sig, Carrier sig m) - => Cache term address value - -> Evaluator term address value m () -putCache = put - --- | Run an action starting from an empty out-cache, and return the out-cache afterwards. -isolateCache :: (Member (State (Cache term address value)) sig, Carrier sig m) - => Evaluator term address value m a - -> Evaluator term address value m (Cache term address value) -isolateCache action = putCache lowerBound *> action *> get - - --- | Analyze a term using the in-cache as an oracle & storing the results of the analysis in the out-cache. -cachingTerms :: ( Cacheable term address value - , Member (Reader (Cache term address value)) sig - , Member (Reader (Live address)) sig - , Member (State (Cache term address value)) sig - , Member (State (Heap address address value)) sig - , Carrier sig m - , Alternative m - ) - => Open (term -> Evaluator term address value m value) -cachingTerms recur term = do - c <- getConfiguration term - cached <- lookupCache c - case cached of - Just pairs -> scatter pairs - Nothing -> do - pairs <- consultOracle c - cachingConfiguration c pairs (recur term) - -convergingModules :: ( Cacheable term address value - , Member Fresh sig - , Member (Reader (Cache term address value)) sig - , Member (Reader (Live address)) sig - , Member (State (Cache term address value)) sig - , Member (State (Heap address address value)) sig - , Carrier sig m - , Alternative m - ) - => (Module (Either prelude term) -> Evaluator term address value (NonDetC m) value) - -> (Module (Either prelude term) -> Evaluator term address value m value) -convergingModules recur m@(Module _ (Left _)) = raiseHandler runNonDet (recur m) >>= maybeM empty -convergingModules recur m@(Module _ (Right term)) = do - c <- getConfiguration term - -- Convergence here is predicated upon an Eq instance, not Ξ±-equivalence - cache <- converge lowerBound (\ prevCache -> isolateCache $ do - putHeap (configurationHeap c) - -- We need to reset fresh generation so that this invocation converges. - resetFresh $ - -- This is subtle: though the calling context supports nondeterminism, we want - -- to corral all the nondeterminism that happens in this @eval@ invocation, so - -- that it doesn't "leak" to the calling context and diverge (otherwise this - -- would never complete). We don’t need to use the values, so we 'gather' the - -- nondeterministic values into @()@. - withOracle prevCache (raiseHandler (runNonDet @Maybe) (recur m))) - maybe empty scatter (cacheLookup c cache) - --- | Iterate a monadic action starting from some initial seed until the results converge. --- --- This applies the Kleene fixed-point theorem to finitize a monotone action. cf https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem -converge :: (Eq a, Monad m) - => a -- ^ An initial seed value to iterate from. - -> (a -> m a) -- ^ A monadic action to perform at each iteration, starting from the result of the previous iteration or from the seed value for the first iteration. - -> m a -- ^ A computation producing the least fixed point (the first value at which the actions converge). -converge seed f = loop seed - where loop x = do - x' <- f x - if x' == x then - pure x - else - loop x' - --- | Nondeterministically write each of a collection of stores & return their associated results. -scatter :: (Foldable t, Member (State (Heap address address value)) sig, Alternative m, Carrier sig m) => t (Cached address value) -> Evaluator term address value m value -scatter = foldMapA (\ (Cached value heap') -> putHeap heap' $> value) - --- | Get the current 'Configuration' with a passed-in term. -getConfiguration :: (Member (Reader (Live address)) sig, Member (State (Heap address address value)) sig, Carrier sig m) - => term - -> Evaluator term address value m (Configuration term address value) -getConfiguration term = Configuration term <$> askRoots <*> getHeap - - -caching :: Monad m - => Evaluator term address value ( NonDetC - (ReaderC (Cache term address value) - (StateC (Cache term address value) - m))) a - -> Evaluator term address value m (Cache term address value, [a]) -caching - = raiseHandler (runState lowerBound) - . raiseHandler (runReader lowerBound) - . raiseHandler runNonDet - - --- | A map of 'Configuration's to 'Set's of resulting values & 'Heap's. -newtype Cache term address value = Cache { unCache :: Monoidal.Map (Configuration term address value) (Set (Cached address value)) } - deriving (Eq, Lower, Monoid, Ord, Reducer (Configuration term address value, Cached address value), Semigroup) - --- | A single point in a program’s execution. -data Configuration term address value = Configuration - { configurationTerm :: term -- ^ The β€œinstruction,” i.e. the current term to evaluate. - , configurationRoots :: Live address -- ^ The set of rooted addresses. - , configurationHeap :: Heap address address value -- ^ The heap of values. - } - deriving (Eq, Ord, Show) - -data Cached address value = Cached - { cachedValue :: value - , cachedHeap :: Heap address address value - } - deriving (Eq, Ord, Show) - - -type Cacheable term address value = (Ord address, Ord term, Ord value) - --- | Look up the resulting value & 'Heap' for a given 'Configuration'. -cacheLookup :: Cacheable term address value => Configuration term address value -> Cache term address value -> Maybe (Set (Cached address value)) -cacheLookup key = Monoidal.lookup key . unCache - --- | Set the resulting value & 'Heap' for a given 'Configuration', overwriting any previous entry. -cacheSet :: Cacheable term address value => Configuration term address value -> Set (Cached address value) -> Cache term address value -> Cache term address value -cacheSet key value = Cache . Monoidal.insert key value . unCache - --- | Insert the resulting value & 'Heap' for a given 'Configuration', appending onto any previous entry. -cacheInsert :: Cacheable term address value => Configuration term address value -> Cached address value -> Cache term address value -> Cache term address value -cacheInsert = curry cons - -instance (Show term, Show address, Show value) => Show (Cache term address value) where - showsPrec d = showsUnaryWith showsPrec "Cache" d . map (second toList) . Monoidal.pairs . unCache diff --git a/src/Analysis/Abstract/Collecting.hs b/src/Analysis/Abstract/Collecting.hs deleted file mode 100644 index 4a7d11f3c0..0000000000 --- a/src/Analysis/Abstract/Collecting.hs +++ /dev/null @@ -1,9 +0,0 @@ -module Analysis.Abstract.Collecting -( providingLiveSet -) where - -import Control.Abstract -import Prologue - -providingLiveSet :: Evaluator term address value (ReaderC (Live address) m) a -> Evaluator term address value m a -providingLiveSet = raiseHandler (runReader lowerBound) diff --git a/src/Analysis/Abstract/Dead.hs b/src/Analysis/Abstract/Dead.hs deleted file mode 100644 index 984c910d38..0000000000 --- a/src/Analysis/Abstract/Dead.hs +++ /dev/null @@ -1,52 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, TypeOperators #-} -module Analysis.Abstract.Dead -( Dead(..) -, revivingTerms -, killingModules -, providingDeadSet -) where - -import Control.Abstract -import Data.Abstract.Module -import Data.Semigroup.Reducer as Reducer -import Data.Set (delete) -import Prologue - --- | A set of β€œdead” (unreachable) terms. -newtype Dead term = Dead { unDead :: Set term } - deriving (Eq, Foldable, Lower, Monoid, Ord, Semigroup, Show) - -deriving instance Ord term => Reducer term (Dead term) - --- | Update the current 'Dead' set. -killAll :: (Member (State (Dead term)) sig, Carrier sig m) => Dead term -> Evaluator term address value m () -killAll = put - --- | Revive a single term, removing it from the current 'Dead' set. -revive :: (Member (State (Dead term)) sig, Carrier sig m, Ord term) => term -> Evaluator term address value m () -revive t = modify (Dead . delete t . unDead) - --- | Compute the set of all subterms recursively. -subterms :: (Ord term, Recursive term, Foldable (Base term)) => term -> Dead term -subterms term = term `cons` para (foldMap (uncurry cons)) term - - -revivingTerms :: ( Member (State (Dead term)) sig - , Ord term - , Carrier sig m - ) - => Open (term -> Evaluator term address value m a) -revivingTerms recur term = revive term *> recur term - -killingModules :: ( Foldable (Base term) - , Member (State (Dead term)) sig - , Ord term - , Recursive term - , Carrier sig m - ) - => Open (Module term -> Evaluator term address value m a) -killingModules recur m = killAll (subterms (moduleBody m)) *> recur m - -providingDeadSet :: Evaluator term address value (StateC (Dead term) (Evaluator term address value m)) a - -> Evaluator term address value m (Dead term, a) -providingDeadSet = runState lowerBound . runEvaluator diff --git a/src/Analysis/Abstract/Graph.hs b/src/Analysis/Abstract/Graph.hs deleted file mode 100644 index bee2e2a022..0000000000 --- a/src/Analysis/Abstract/Graph.hs +++ /dev/null @@ -1,210 +0,0 @@ -{-# LANGUAGE DerivingVia, LambdaCase, RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-} -module Analysis.Abstract.Graph -( Graph(..) -, ControlFlowVertex(..) -, moduleVertex -, unknownModuleVertex -, style -, appendGraph -, variableDefinition -, moduleInclusion -, packageInclusion -, graphingTerms -, graphingPackages -, graphingModules -, graphingModuleInfo -, graphing -) where - -import Algebra.Graph.Export.Dot hiding (vertexName) -import Control.Abstract hiding (Function(..)) -import Control.Effect.Carrier -import Control.Effect.Sum -import Data.Abstract.BaseError -import Data.Abstract.Declarations -import Data.Abstract.Module (Module (moduleInfo), ModuleInfo (..)) -import Data.Abstract.Package (PackageInfo (..)) -import Data.ByteString.Builder -import Data.Graph -import Data.Graph.ControlFlowVertex -import Data.Term -import Data.Location -import qualified Data.Map as Map -import qualified Data.Text.Encoding as T -import Prologue - -style :: Style ControlFlowVertex Builder -style = (defaultStyle (T.encodeUtf8Builder . vertexIdentifier)) - { vertexAttributes = vertexAttributes - , edgeAttributes = edgeAttributes - } - where vertexAttributes Package{} = [ "style" := "dashed", "shape" := "box" ] - vertexAttributes Module{} = [ "style" := "dotted, rounded", "shape" := "box" ] - vertexAttributes UnknownModule{} = [ "style" := "dotted, rounded", "shape" := "box", "color" := "red", "fontcolor" := "red" ] - vertexAttributes Variable{..} = [ "label" := T.encodeUtf8Builder (vertexName <> " (Variable)"), "tooltip" := T.encodeUtf8Builder (showSpan vertexSpan), "style" := "rounded", "shape" := "box" ] - vertexAttributes Method{..} = [ "label" := T.encodeUtf8Builder (vertexName <> " (Method)"), "tooltip" := T.encodeUtf8Builder (showSpan vertexSpan) , "style" := "rounded", "shape" := "box" ] - vertexAttributes Function{..} = [ "label" := T.encodeUtf8Builder (vertexName <> " (Function)"), "tooltip" := T.encodeUtf8Builder (showSpan vertexSpan), "style" := "rounded", "shape" := "box" ] - edgeAttributes Module{} Module{} = [ "len" := "5.0", "label" := "imports" ] - edgeAttributes Module{} UnknownModule{} = [ "len" := "5.0", "label" := "imports" ] - edgeAttributes Package{} Module{} = [ "len" := "5.0", "style" := "dashed" ] - edgeAttributes Variable{} Module{} = [ "len" := "5.0", "color" := "blue", "label" := "refers to symbol defined in" ] - edgeAttributes _ Module{} = [ "len" := "5.0", "color" := "blue", "label" := "defined in" ] - edgeAttributes Method{} Variable{} = [ "len" := "2.0", "color" := "green", "label" := "calls" ] - edgeAttributes Function{} Variable{} = [ "len" := "2.0", "color" := "green", "label" := "calls" ] - edgeAttributes Module{} Function{} = [ "len" := "2.0", "color" := "red", "label" := "defines" ] - edgeAttributes Module{} Method{} = [ "len" := "2.0", "color" := "red", "label" := "defines" ] - edgeAttributes Module{} _ = [ "len" := "2.0", "color" := "green", "label" := "calls" ] - edgeAttributes Variable{} Function{} = [ "len" := "2.0", "color" := "blue", "label" := "references" ] - edgeAttributes Variable{} Method{} = [ "len" := "2.0", "color" := "blue", "label" := "references" ] - edgeAttributes _ _ = [] - - --- | Add vertices to the graph for evaluated identifiers. -graphingTerms :: ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (State (Graph ControlFlowVertex)) sig - , Member (State (Map (Slot address) ControlFlowVertex)) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ControlFlowVertex) sig - , VertexDeclaration syntax - , Declarations1 syntax - , Ord address - , Foldable syntax - , term ~ Term syntax Location - , Carrier sig m - ) - => Open (term -> Evaluator term address value m a) -graphingTerms recur term@(Term (In a syntax)) = do - definedInModule <- currentModule - case toVertex a definedInModule syntax of - Just (v@Function{}, name) -> recurWithContext v name - Just (v@Method{}, name) -> recurWithContext v name - Just (v@Variable{..}, name) -> do - variableDefinition v - slot <- lookupSlot (Declaration name) - defined <- gets (Map.lookup slot) - maybe (pure ()) (appendGraph . connect (vertex v) . vertex) defined - recur term - _ -> recur term - where - recurWithContext v name = do - variableDefinition v - moduleInclusion v - local (const v) $ do - valRef <- recur term - slot <- lookupSlot (Declaration name) - modify (Map.insert slot v) - pure valRef - --- | Add vertices to the graph for evaluated modules and the packages containing them. -graphingPackages :: ( Member (Reader PackageInfo) sig - , Member (State (Graph ControlFlowVertex)) sig - , Member (Reader ControlFlowVertex) sig - , Carrier sig m - ) - => Open (Module term -> m a) -graphingPackages recur m = - let v = moduleVertex (moduleInfo m) in packageInclusion v *> local (const v) (recur m) - --- | Add vertices to the graph for imported modules. -graphingModules :: ( Member (Reader ModuleInfo) sig - , Member (State (Graph ControlFlowVertex)) sig - , Member (Reader ControlFlowVertex) sig - , Carrier sig m - ) - => (Module body -> Evaluator term address value (EavesdropC address value m) a) - -> (Module body -> Evaluator term address value m a) -graphingModules recur m = do - let v = moduleVertex (moduleInfo m) - appendGraph (vertex v) - local (const v) $ - eavesdrop (recur m) $ \case - Load path _ -> includeModule path - Lookup path _ -> includeModule path - _ -> pure () - where - -- NB: path is null for Languages like Ruby that have module imports that require concrete value semantics. - includeModule path - = let path' = if Prologue.null path then "unknown, concrete semantics required" else path - info = moduleInfo m - in moduleInclusion (moduleVertex (ModuleInfo path' (moduleLanguage info) (moduleOid info))) - --- | Add vertices to the graph for imported modules. -graphingModuleInfo :: ( Member (Reader ModuleInfo) sig - , Member (State (Graph ModuleInfo)) sig - , Carrier sig m - ) - => (Module body -> Evaluator term address value (EavesdropC address value m) a) - -> (Module body -> Evaluator term address value m a) -graphingModuleInfo recur m = do - let info = moduleInfo m - appendGraph (vertex info) - eavesdrop (recur m) $ \case - Load path _ -> currentModule >>= appendGraph . (`connect` vertex (ModuleInfo path (moduleLanguage info) (moduleOid info))) . vertex - Lookup path _ -> currentModule >>= appendGraph . (`connect` vertex (ModuleInfo path (moduleLanguage info) (moduleOid info))) . vertex - _ -> pure () - -eavesdrop :: Evaluator term address value (EavesdropC address value m) a - -> (forall x . Modules address value m (m x) -> Evaluator term address value m ()) - -> Evaluator term address value m a -eavesdrop m f = raiseHandler (runEavesdropC (runEvaluator . f)) m - -newtype EavesdropC address value m a = EavesdropC ((forall x . Modules address value m (m x) -> m ()) -> m a) - deriving (Alternative, Applicative, Functor, Monad) via (ReaderC (forall x . Modules address value m (m x) -> m ()) m) - -runEavesdropC :: (forall x . Modules address value m (m x) -> m ()) -> EavesdropC address value m a -> m a -runEavesdropC f (EavesdropC m) = m f - -instance (Carrier sig m, Member (Modules address value) sig, Applicative m) => Carrier sig (EavesdropC address value m) where - eff op - | Just eff <- prj op = EavesdropC (\ handler -> let eff' = handlePure (runEavesdropC handler) eff in handler eff' *> send eff') - | otherwise = EavesdropC (\ handler -> eff (handlePure (runEavesdropC handler) op)) - --- | Add an edge from the current package to the passed vertex. -packageInclusion :: ( Member (Reader PackageInfo) sig - , Member (State (Graph ControlFlowVertex)) sig - , Carrier sig m - ) - => ControlFlowVertex - -> m () -packageInclusion v = do - p <- currentPackage - appendGraph (vertex (packageVertex p) `connect` vertex v) - --- | Add an edge from the current module to the passed vertex. -moduleInclusion :: ( Member (Reader ModuleInfo) sig - , Member (State (Graph ControlFlowVertex)) sig - , Carrier sig m - ) - => ControlFlowVertex - -> m () -moduleInclusion v = do - m <- currentModule - appendGraph (vertex (moduleVertex m) `connect` vertex v) - --- | Add an edge from the passed variable name to the context it originated within. -variableDefinition :: ( Member (State (Graph ControlFlowVertex)) sig - , Member (Reader ControlFlowVertex) sig - , Carrier sig m - ) - => ControlFlowVertex - -> m () -variableDefinition var = do - context <- ask - appendGraph (vertex context `connect` vertex var) - -appendGraph :: (Member (State (Graph v)) sig, Carrier sig m) => Graph v -> m () -appendGraph = modify . (<>) - - -graphing :: Carrier sig m - => Evaluator term address value (StateC (Map (Slot address) ControlFlowVertex) - (StateC (Graph ControlFlowVertex) - m)) result - -> Evaluator term address value m (Graph ControlFlowVertex, result) -graphing = raiseHandler $ runState mempty . fmap snd . runState lowerBound diff --git a/src/Analysis/Abstract/Tracing.hs b/src/Analysis/Abstract/Tracing.hs deleted file mode 100644 index e2643164a5..0000000000 --- a/src/Analysis/Abstract/Tracing.hs +++ /dev/null @@ -1,47 +0,0 @@ -{-# LANGUAGE TypeOperators #-} -module Analysis.Abstract.Tracing -( tracingTerms -, tracing -) where - -import Control.Abstract hiding (trace) -import Control.Effect.Writer -import Data.Semigroup.Reducer as Reducer - --- | Trace analysis. --- --- Instantiating @trace@ to @[]@ yields a linear trace analysis, while @Set@ yields a reachable state analysis. -tracingTerms :: ( Member (State (Heap address address value)) sig - , Member (Writer (trace (Configuration term address value))) sig - , Carrier sig m - , Reducer (Configuration term address value) (trace (Configuration term address value)) - ) - => trace (Configuration term address value) - -> Open (term -> Evaluator term address value m a) -tracingTerms proxy recur term = getConfiguration term >>= trace . (`asTypeOf` proxy) . Reducer.unit >> recur term - -trace :: ( Member (Writer (trace (Configuration term address value))) sig - , Carrier sig m - ) - => trace (Configuration term address value) - -> Evaluator term address value m () -trace = tell - -tracing :: (Monoid (trace (Configuration term address value))) - => Evaluator term address value (WriterC (trace (Configuration term address value)) (Evaluator term address value m)) a - -> Evaluator term address value m (trace (Configuration term address value), a) -tracing = runWriter . runEvaluator - - --- | Get the current 'Configuration' with a passed-in term. -getConfiguration :: (Member (State (Heap address address value)) sig, Carrier sig m) - => term - -> Evaluator term address value m (Configuration term address value) -getConfiguration term = Configuration term <$> getHeap - --- | A single point in a program’s execution. -data Configuration term address value = Configuration - { configurationTerm :: term -- ^ The β€œinstruction,” i.e. the current term to evaluate. - , configurationHeap :: Heap address address value -- ^ The heap of values. - } - deriving (Eq, Ord, Show) diff --git a/src/Analysis/ConstructorName.hs b/src/Analysis/ConstructorName.hs deleted file mode 100644 index 4834cc3bac..0000000000 --- a/src/Analysis/ConstructorName.hs +++ /dev/null @@ -1,55 +0,0 @@ -{-# LANGUAGE ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-} -module Analysis.ConstructorName -( ConstructorName(..) -) where - -import Data.Sum -import Data.Term -import GHC.Generics -import Prologue - --- | A typeclass to retrieve the name of the data constructor for a value. --- --- This typeclass employs the Advanced Overlap techniques designed by Oleg Kiselyov & Simon Peyton Jones: https://wiki.haskell.org/GHC/AdvancedOverlap; see also src/Analysis/Declaration.hs for discussion of the details of the mechanism. -class ConstructorName syntax where - constructorName :: syntax a -> String - -instance (ConstructorNameStrategy syntax ~ strategy, ConstructorNameWithStrategy strategy syntax) => ConstructorName syntax where - constructorName = constructorNameWithStrategy (Proxy :: Proxy strategy) - -instance Apply ConstructorName fs => ConstructorNameWithStrategy 'Custom (Sum fs) where - constructorNameWithStrategy _ = apply @ConstructorName constructorName - -instance ConstructorNameWithStrategy 'Custom [] where - constructorNameWithStrategy _ _ = "Statements" - -instance (ConstructorName syntax) => ConstructorNameWithStrategy 'Custom (TermF syntax ann) where - constructorNameWithStrategy _ = constructorName . termFOut - -data Strategy = Default | Custom - -type family ConstructorNameStrategy syntax where - ConstructorNameStrategy (Sum _) = 'Custom - ConstructorNameStrategy [] = 'Custom - ConstructorNameStrategy (TermF _ _) = 'Custom - ConstructorNameStrategy syntax = 'Default - -class ConstructorNameWithStrategy (strategy :: Strategy) syntax where - constructorNameWithStrategy :: proxy strategy -> syntax a -> String - -instance (Generic1 syntax, GConstructorName (Rep1 syntax)) => ConstructorNameWithStrategy 'Default syntax where - constructorNameWithStrategy _ = gconstructorName . from1 - - -class GConstructorName f where - gconstructorName :: f a -> String - -instance GConstructorName f => GConstructorName (M1 D c f) where - gconstructorName = gconstructorName . unM1 - -instance (GConstructorName f, GConstructorName g) => GConstructorName (f :+: g) where - gconstructorName (L1 l) = gconstructorName l - gconstructorName (R1 r) = gconstructorName r - -instance Constructor c => GConstructorName (M1 C c f) where - gconstructorName = conName diff --git a/src/Analysis/CyclomaticComplexity.hs b/src/Analysis/CyclomaticComplexity.hs deleted file mode 100644 index 46ef4beab7..0000000000 --- a/src/Analysis/CyclomaticComplexity.hs +++ /dev/null @@ -1,116 +0,0 @@ -{-# LANGUAGE DataKinds, DefaultSignatures, GeneralizedNewtypeDeriving, MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies, UndecidableInstances #-} -module Analysis.CyclomaticComplexity -( CyclomaticComplexity(..) -, HasCyclomaticComplexity -, cyclomaticComplexityAlgebra -) where - -import Data.Aeson -import Data.Sum -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Statement as Statement -import Data.Term -import Prologue - --- | The cyclomatic complexity of a (sub)term. -newtype CyclomaticComplexity = CyclomaticComplexity Int - deriving (Enum, Eq, Num, Ord, Show, ToJSON) - --- | Compute the cyclomatic complexity of a (sub)term, measured as the number places where control exits scope, e.g. returns and yields. --- --- TODO: Explicit returns at the end of methods or functions should only count once. --- TODO: Anonymous functions should not increase parent scope’s complexity. --- TODO: Inner functions should not increase parent scope’s complexity. - --- | An f-algebra producing a 'CyclomaticComplexity' for syntax nodes corresponding to their summary cyclomatic complexity, defaulting to the sum of their contents’ cyclomatic complexities. --- --- Customizing this for a given syntax type involves two steps: --- --- 1. Defining a 'CustomHasCyclomaticComplexity' instance for the type. --- 2. Adding the type to the 'CyclomaticComplexityStrategy' type family. --- --- If you’re getting errors about missing a 'CustomHasCyclomaticComplexity' instance for your syntax type, you probably forgot step 1. --- --- If you’re getting 'Nothing' for your syntax node at runtime, you probably forgot step 2. -cyclomaticComplexityAlgebra :: HasCyclomaticComplexity syntax => TermF syntax ann CyclomaticComplexity -> CyclomaticComplexity -cyclomaticComplexityAlgebra (In _ syntax) = toCyclomaticComplexity syntax - - --- | Types for which we can produce a 'CyclomaticComplexity'. There is exactly one instance of this typeclass; adding customized 'CyclomaticComplexity's for a new type is done by defining an instance of 'CustomHasCyclomaticComplexity' instead. --- --- This typeclass employs the Advanced Overlap techniques designed by Oleg Kiselyov & Simon Peyton Jones: https://wiki.haskell.org/GHC/AdvancedOverlap. -class HasCyclomaticComplexity syntax where - -- | Compute a 'CyclomaticComplexity' for a syntax type using its 'CustomHasCyclomaticComplexity' instance, if any, or else falling back to the default definition (which simply returns the sum of any contained cyclomatic complexities). - toCyclomaticComplexity :: syntax CyclomaticComplexity -> CyclomaticComplexity - --- | Define 'toCyclomaticComplexity' using the 'CustomHasCyclomaticComplexity' instance for a type if there is one or else use the default definition. --- --- This instance determines whether or not there is an instance for @syntax@ by looking it up in the 'CyclomaticComplexityStrategy' type family. Thus producing a 'CyclomaticComplexity' for a node requires both defining a 'CustomHasCyclomaticComplexity' instance _and_ adding a definition for the type to the 'CyclomaticComplexityStrategy' type family to return 'Custom'. --- --- Note that since 'CyclomaticComplexityStrategy' has a fallback case for its final entry, this instance will hold for all types of kind @* -> *@. Thus, this must be the only instance of 'HasCyclomaticComplexity', as any other instance would be indistinguishable. -instance (CyclomaticComplexityStrategy syntax ~ strategy, HasCyclomaticComplexityWithStrategy strategy syntax) => HasCyclomaticComplexity syntax where - toCyclomaticComplexity = toCyclomaticComplexityWithStrategy (Proxy :: Proxy strategy) - - --- | Types for which we can produce a customized 'CyclomaticComplexity'. -class CustomHasCyclomaticComplexity syntax where - -- | Produce a customized 'CyclomaticComplexity' for a given syntax node. - customToCyclomaticComplexity :: syntax CyclomaticComplexity -> CyclomaticComplexity - - -- | Because we perform the same operation wherever we use the custom strategy, we can define the default method for all instances. - default customToCyclomaticComplexity :: Foldable syntax => syntax CyclomaticComplexity -> CyclomaticComplexity - customToCyclomaticComplexity = succ . sum - -instance CustomHasCyclomaticComplexity Declaration.Function -instance CustomHasCyclomaticComplexity Declaration.Method -instance CustomHasCyclomaticComplexity Statement.Catch -instance CustomHasCyclomaticComplexity Statement.DoWhile -instance CustomHasCyclomaticComplexity Statement.Else -instance CustomHasCyclomaticComplexity Statement.For -instance CustomHasCyclomaticComplexity Statement.ForEach -instance CustomHasCyclomaticComplexity Statement.If -instance CustomHasCyclomaticComplexity Statement.Pattern -instance CustomHasCyclomaticComplexity Statement.While - --- | Produce a 'CyclomaticComplexity' for 'Sum's using the 'HasCyclomaticComplexity' instance & therefore using a 'CustomHasCyclomaticComplexity' instance when one exists & the type is listed in 'CyclomaticComplexityStrategy'. -instance Apply HasCyclomaticComplexity fs => CustomHasCyclomaticComplexity (Sum fs) where - customToCyclomaticComplexity = apply @HasCyclomaticComplexity toCyclomaticComplexity - - --- | A strategy for defining a 'HasCyclomaticComplexity' instance. Intended to be promoted to the kind level using @-XDataKinds@. -data Strategy = Default | Custom - --- | Produce a 'CyclomaticComplexity' for a syntax node using either the 'Default' or 'Custom' strategy. --- --- You should probably be using 'CustomHasCyclomaticComplexity' instead of this class; and you should not define new instances of this class. -class HasCyclomaticComplexityWithStrategy (strategy :: Strategy) syntax where - toCyclomaticComplexityWithStrategy :: proxy strategy -> syntax CyclomaticComplexity -> CyclomaticComplexity - - --- | A predicate on syntax types selecting either the 'Custom' or 'Default' strategy. --- --- Only entries for which we want to use the 'Custom' strategy should be listed, with the exception of the final entry which maps all other types onto the 'Default' strategy. --- --- If you’re seeing errors about missing a 'CustomHasCyclomaticComplexity' instance for a given type, you’ve probably listed it in here but not defined a 'CustomHasCyclomaticComplexity' instance for it, or else you’ve listed the wrong type in here. Conversely, if your 'customHasCyclomaticComplexity' method is never being called, you may have forgotten to list the type in here. -type family CyclomaticComplexityStrategy syntax where - CyclomaticComplexityStrategy Declaration.Function = 'Custom - CyclomaticComplexityStrategy Declaration.Method = 'Custom - CyclomaticComplexityStrategy Statement.Catch = 'Custom - CyclomaticComplexityStrategy Statement.DoWhile = 'Custom - CyclomaticComplexityStrategy Statement.Else = 'Custom - CyclomaticComplexityStrategy Statement.For = 'Custom - CyclomaticComplexityStrategy Statement.ForEach = 'Custom - CyclomaticComplexityStrategy Statement.If = 'Custom - CyclomaticComplexityStrategy Statement.Pattern = 'Custom - CyclomaticComplexityStrategy Statement.While = 'Custom - CyclomaticComplexityStrategy (Sum fs) = 'Custom - CyclomaticComplexityStrategy a = 'Default - - --- | The 'Default' strategy takes the sum without incrementing. -instance Foldable syntax => HasCyclomaticComplexityWithStrategy 'Default syntax where - toCyclomaticComplexityWithStrategy _ = sum - --- | The 'Custom' strategy delegates the selection of the strategy to the 'CustomHasCyclomaticComplexity' instance for the type. -instance CustomHasCyclomaticComplexity syntax => HasCyclomaticComplexityWithStrategy 'Custom syntax where - toCyclomaticComplexityWithStrategy _ = customToCyclomaticComplexity diff --git a/src/Analysis/Decorator.hs b/src/Analysis/Decorator.hs deleted file mode 100644 index 413ad7b169..0000000000 --- a/src/Analysis/Decorator.hs +++ /dev/null @@ -1,14 +0,0 @@ -{-# LANGUAGE DataKinds, TypeOperators #-} -module Analysis.Decorator -( decoratorWithAlgebra -) where - -import Data.Term -import Prologue - --- | Lift an algebra into a decorator for terms annotated with records. -decoratorWithAlgebra :: Functor syntax - => RAlgebra (TermF syntax a) (Term syntax a) b -- ^ An R-algebra on terms. - -> Term syntax a -- ^ A term to decorate with values produced by the R-algebra. - -> Term syntax b -- ^ A term decorated with values produced by the R-algebra. -decoratorWithAlgebra alg = para $ \ c@(In _ f) -> termIn (alg (fmap (second termAnnotation) c)) (fmap snd f) diff --git a/src/Analysis/HasTextElement.hs b/src/Analysis/HasTextElement.hs deleted file mode 100644 index 56a2498ed1..0000000000 --- a/src/Analysis/HasTextElement.hs +++ /dev/null @@ -1,39 +0,0 @@ -{-# LANGUAGE ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-} -module Analysis.HasTextElement -( HasTextElement(..) -) where - -import Data.Sum -import Prologue -import qualified Data.Syntax.Literal as Literal - -class HasTextElement syntax where - isTextElement :: syntax a -> Bool - -instance (TextElementStrategy syntax ~ strategy, HasTextElementWithStrategy strategy syntax) => HasTextElement syntax where - isTextElement = isTextElementWithStrategy (Proxy :: Proxy strategy) - -class CustomHasTextElement syntax where - customIsTextElement :: syntax a -> Bool - -instance CustomHasTextElement Literal.TextElement where - customIsTextElement _ = True - -instance Apply HasTextElement fs => CustomHasTextElement (Sum fs) where - customIsTextElement = apply @HasTextElement isTextElement - -data Strategy = Default | Custom - -class HasTextElementWithStrategy (strategy :: Strategy) syntax where - isTextElementWithStrategy :: proxy strategy -> syntax a -> Bool - -type family TextElementStrategy syntax where - TextElementStrategy Literal.TextElement = 'Custom - TextElementStrategy (Sum fs) = 'Custom - TextElementStrategy a = 'Default - -instance HasTextElementWithStrategy 'Default syntax where - isTextElementWithStrategy _ _ = False - -instance CustomHasTextElement syntax => HasTextElementWithStrategy 'Custom syntax where - isTextElementWithStrategy _ = customIsTextElement diff --git a/src/Analysis/PackageDef.hs b/src/Analysis/PackageDef.hs deleted file mode 100644 index 149a7ecb99..0000000000 --- a/src/Analysis/PackageDef.hs +++ /dev/null @@ -1,93 +0,0 @@ -{-# LANGUAGE ScopedTypeVariables, TypeFamilies, UndecidableInstances #-} -module Analysis.PackageDef -( PackageDef(..) -, HasPackageDef -, packageDefAlgebra -) where - -import Data.Blob -import Data.Location -import Data.Source as Source -import Data.Sum -import Data.Term -import qualified Data.Text as T -import qualified Language.Go.Syntax -import Prologue - -newtype PackageDef = PackageDef { moduleDefIdentifier :: T.Text } - deriving (Eq, Generic, Show) - --- | An r-algebra producing 'Just' a 'PackageDef' for syntax nodes corresponding to high-level declarations, or 'Nothing' otherwise. --- --- Customizing this for a given syntax type involves two steps: --- --- 1. Defining a 'CustomHasPackageDef' instance for the type. --- 2. Adding the type to the 'PackageDefStrategy' type family. --- --- If you’re getting errors about missing a 'CustomHasPackageDef' instance for your syntax type, you probably forgot step 1. --- --- If you’re getting 'Nothing' for your syntax node at runtime, you probably forgot step 2. -packageDefAlgebra :: (Foldable syntax, HasPackageDef syntax) => Blob -> RAlgebra (TermF syntax Location) (Term syntax Location) (Maybe PackageDef) -packageDefAlgebra blob (In ann syntax) = toPackageDef blob ann syntax - - --- | Types for which we can produce a 'PackageDef' in 'Maybe'. There is exactly one instance of this typeclass; adding customized 'PackageDef's for a new type is done by defining an instance of 'CustomHasPackageDef' instead. --- --- This typeclass employs the Advanced Overlap techniques designed by Oleg Kiselyov & Simon Peyton Jones: https://wiki.haskell.org/GHC/AdvancedOverlap. -class HasPackageDef syntax where - -- | Compute a 'PackageDef' for a syntax type using its 'CustomHasPackageDef' instance, if any, or else falling back to the default definition (which simply returns 'Nothing'). - toPackageDef :: (Foldable whole) => Blob -> Location -> syntax (Term whole Location, Maybe PackageDef) -> Maybe PackageDef - --- | Define 'toPackageDef' using the 'CustomHasPackageDef' instance for a type if there is one or else use the default definition. --- --- This instance determines whether or not there is an instance for @syntax@ by looking it up in the 'PackageDefStrategy' type family. Thus producing a 'PackageDef' for a node requires both defining a 'CustomHasPackageDef' instance _and_ adding a definition for the type to the 'PackageDefStrategy' type family to return 'Custom'. --- --- Note that since 'PackageDefStrategy' has a fallback case for its final entry, this instance will hold for all types of kind @* -> *@. Thus, this must be the only instance of 'HasPackageDef', as any other instance would be indistinguishable. -instance (PackageDefStrategy syntax ~ strategy, HasPackageDefWithStrategy strategy syntax) => HasPackageDef syntax where - toPackageDef = toPackageDefWithStrategy (Proxy :: Proxy strategy) - - --- | Types for which we can produce a customized 'PackageDef'. This returns in 'Maybe' so that some values can be opted out (e.g. anonymous functions). -class CustomHasPackageDef syntax where - -- | Produce a customized 'PackageDef' for a given syntax node. - customToPackageDef :: (Foldable whole) => Blob -> Location -> syntax (Term whole Location, Maybe PackageDef) -> Maybe PackageDef - - -instance CustomHasPackageDef Language.Go.Syntax.Package where - customToPackageDef Blob{..} _ (Language.Go.Syntax.Package (Term (In fromAnn _), _) _) - = Just $ PackageDef (getSource fromAnn) - where getSource = toText . flip Source.slice blobSource . locationByteRange - --- | Produce a 'PackageDef' for 'Sum's using the 'HasPackageDef' instance & therefore using a 'CustomHasPackageDef' instance when one exists & the type is listed in 'PackageDefStrategy'. -instance Apply HasPackageDef fs => CustomHasPackageDef (Sum fs) where - customToPackageDef blob ann = apply @HasPackageDef (toPackageDef blob ann) - - --- | A strategy for defining a 'HasPackageDef' instance. Intended to be promoted to the kind level using @-XDataKinds@. -data Strategy = Default | Custom - --- | Produce a 'PackageDef' for a syntax node using either the 'Default' or 'Custom' strategy. --- --- You should probably be using 'CustomHasPackageDef' instead of this class; and you should not define new instances of this class. -class HasPackageDefWithStrategy (strategy :: Strategy) syntax where - toPackageDefWithStrategy :: (Foldable whole) => proxy strategy -> Blob -> Location -> syntax (Term whole Location, Maybe PackageDef) -> Maybe PackageDef - - --- | A predicate on syntax types selecting either the 'Custom' or 'Default' strategy. --- --- Only entries for which we want to use the 'Custom' strategy should be listed, with the exception of the final entry which maps all other types onto the 'Default' strategy. --- --- If you’re seeing errors about missing a 'CustomHasPackageDef' instance for a given type, you’ve probably listed it in here but not defined a 'CustomHasPackageDef' instance for it, or else you’ve listed the wrong type in here. Conversely, if your 'customHasPackageDef' method is never being called, you may have forgotten to list the type in here. -type family PackageDefStrategy syntax where - PackageDefStrategy Language.Go.Syntax.Package = 'Custom - PackageDefStrategy (Sum fs) = 'Custom - PackageDefStrategy a = 'Default - - --- | The 'Default' strategy produces 'Nothing'. -instance HasPackageDefWithStrategy 'Default syntax where - toPackageDefWithStrategy _ _ _ _ = Nothing - --- | The 'Custom' strategy delegates the selection of the strategy to the 'CustomHasPackageDef' instance for the type. -instance CustomHasPackageDef syntax => HasPackageDefWithStrategy 'Custom syntax where - toPackageDefWithStrategy _ = customToPackageDef diff --git a/src/Analysis/TOCSummary.hs b/src/Analysis/TOCSummary.hs deleted file mode 100644 index cb13c50df8..0000000000 --- a/src/Analysis/TOCSummary.hs +++ /dev/null @@ -1,170 +0,0 @@ -{-# LANGUAGE RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-} -module Analysis.TOCSummary -( Declaration(..) -, HasDeclaration -, declarationAlgebra -) where - -import Prologue hiding (project) - -import Control.Arrow -import Control.Rewriting -import Data.Blob -import Data.Error (Error (..), Colourize (..), showExpectation) -import Data.Flag -import Data.Language as Language -import Data.Location -import Data.Range -import Data.Source as Source -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Declaration as Declaration -import Data.Term -import qualified Data.Text as T -import qualified Language.Markdown.Syntax as Markdown - --- | A declaration’s identifier and type. -data Declaration - = MethodDeclaration { declarationIdentifier :: Text, declarationText :: Text, declarationSpan :: Span, declarationLanguage :: Language, declarationReceiver :: Maybe Text } - | FunctionDeclaration { declarationIdentifier :: Text, declarationText :: Text, declarationSpan :: Span, declarationLanguage :: Language } - | HeadingDeclaration { declarationIdentifier :: Text, declarationText :: Text, declarationSpan :: Span, declarationLanguage :: Language, declarationLevel :: Int } - | ErrorDeclaration { declarationIdentifier :: Text, declarationText :: Text, declarationSpan :: Span, declarationLanguage :: Language } - deriving (Eq, Generic, Show) - - --- | An r-algebra producing 'Just' a 'Declaration' for syntax nodes corresponding to high-level declarations, or 'Nothing' otherwise. --- --- Customizing this for a given syntax type involves two steps: --- --- 1. Defining a 'CustomHasDeclaration' instance for the type. --- 2. Adding the type to the 'DeclarationStrategy' type family. --- --- If you’re getting errors about missing a 'CustomHasDeclaration' instance for your syntax type, you probably forgot step 1. --- --- If you’re getting 'Nothing' for your syntax node at runtime, you probably forgot step 2. -declarationAlgebra :: (Foldable syntax, HasDeclaration syntax) - => Blob -> RAlgebra (TermF syntax Location) (Term syntax Location) (Maybe Declaration) -declarationAlgebra blob (In ann syntax) = toDeclaration blob ann syntax - --- | Types for which we can produce a 'Declaration' in 'Maybe'. There is exactly one instance of this typeclass -class HasDeclaration syntax where - toDeclaration :: (Foldable syntax) => Blob -> Location -> syntax (Term syntax Location, Maybe Declaration) -> Maybe Declaration - -instance (HasDeclaration' syntax syntax) => HasDeclaration syntax where - toDeclaration = toDeclaration' - --- | Types for which we can produce a 'Declaration' in 'Maybe'. There is exactly one instance of this typeclass; adding customized 'Declaration's for a new type is done by defining an instance of 'CustomHasDeclaration' instead. --- --- This typeclass employs the Advanced Overlap techniques designed by Oleg Kiselyov & Simon Peyton Jones: https://wiki.haskell.org/GHC/AdvancedOverlap. -class HasDeclaration' whole syntax where - -- | Compute a 'Declaration' for a syntax type using its 'CustomHasDeclaration' instance, if any, or else falling back to the default definition (which simply returns 'Nothing'). - toDeclaration' :: (Foldable whole) => Blob -> Location -> syntax (Term whole Location, Maybe Declaration) -> Maybe Declaration - --- | Define 'toDeclaration' using the 'CustomHasDeclaration' instance for a type if there is one or else use the default definition. --- --- This instance determines whether or not there is an instance for @syntax@ by looking it up in the 'DeclarationStrategy' type family. Thus producing a 'Declaration' for a node requires both defining a 'CustomHasDeclaration' instance _and_ adding a definition for the type to the 'DeclarationStrategy' type family to return 'Custom'. --- --- Note that since 'DeclarationStrategy' has a fallback case for its final entry, this instance will hold for all types of kind @* -> *@. Thus, this must be the only instance of 'HasDeclaration', as any other instance would be indistinguishable. -instance (DeclarationStrategy syntax ~ strategy, HasDeclarationWithStrategy strategy whole syntax) => HasDeclaration' whole syntax where - toDeclaration' = toDeclarationWithStrategy (Proxy :: Proxy strategy) - - --- | Types for which we can produce a customized 'Declaration'. This returns in 'Maybe' so that some values can be opted out (e.g. anonymous functions). -class CustomHasDeclaration whole syntax where - -- | Produce a customized 'Declaration' for a given syntax node. - customToDeclaration :: (Foldable whole) => Blob -> Location -> syntax (Term whole Location, Maybe Declaration) -> Maybe Declaration - - --- | Produce a 'HeadingDeclaration' from the first line of the heading of a 'Markdown.Heading' node. -instance CustomHasDeclaration whole Markdown.Heading where - customToDeclaration blob@Blob{..} ann (Markdown.Heading level terms _) - = Just $ HeadingDeclaration (headingText terms) mempty (locationSpan ann) (blobLanguage blob) level - where headingText terms = getSource $ maybe (locationByteRange ann) sconcat (nonEmpty (headingByteRange <$> toList terms)) - headingByteRange (Term (In ann _), _) = locationByteRange ann - getSource = firstLine . toText . flip Source.slice blobSource - firstLine = T.takeWhile (/= '\n') - --- | Produce an 'ErrorDeclaration' for 'Syntax.Error' nodes. -instance CustomHasDeclaration whole Syntax.Error where - customToDeclaration blob@Blob{..} ann err@Syntax.Error{} - = Just $ ErrorDeclaration (T.pack (formatTOCError (Syntax.unError (locationSpan ann) err))) mempty (locationSpan ann) (blobLanguage blob) - where formatTOCError e = showExpectation (flag Colourize False) (errorExpected e) (errorActual e) "" - --- | Produce a 'FunctionDeclaration' for 'Declaration.Function' nodes so long as their identifier is non-empty (defined as having a non-empty 'Range'). -instance CustomHasDeclaration whole Declaration.Function where - customToDeclaration blob@Blob{..} ann decl@(Declaration.Function _ (Term (In identifierAnn _), _) _ _) - -- Do not summarize anonymous functions - | isEmpty identifierAnn = Nothing - -- Named functions - | otherwise = Just $ FunctionDeclaration (getSource blobSource identifierAnn) functionSource (locationSpan ann) (blobLanguage blob) - where isEmpty = (== 0) . rangeLength . locationByteRange - functionSource = getIdentifier (arr Declaration.functionBody) blob (In ann decl) - --- | Produce a 'MethodDeclaration' for 'Declaration.Method' nodes. If the method’s receiver is non-empty (defined as having a non-empty 'Range'), the 'declarationIdentifier' will be formatted as 'receiver.method_name'; otherwise it will be simply 'method_name'. -instance CustomHasDeclaration whole Declaration.Method where - customToDeclaration blob@Blob{..} ann decl@(Declaration.Method _ (Term (In receiverAnn receiverF), _) (Term (In identifierAnn _), _) _ _ _) - -- Methods without a receiver - | isEmpty receiverAnn = Just $ MethodDeclaration (getSource blobSource identifierAnn) methodSource (locationSpan ann) (blobLanguage blob) Nothing - -- Methods with a receiver type and an identifier (e.g. (a *Type) in Go). - | blobLanguage blob == Go - , [ _, Term (In receiverType _) ] <- toList receiverF = Just $ MethodDeclaration (getSource blobSource identifierAnn) methodSource (locationSpan ann) (blobLanguage blob) (Just (getSource blobSource receiverType)) - -- Methods with a receiver (class methods) are formatted like `receiver.method_name` - | otherwise = Just $ MethodDeclaration (getSource blobSource identifierAnn) methodSource (locationSpan ann) (blobLanguage blob) (Just (getSource blobSource receiverAnn)) - where - isEmpty = (== 0) . rangeLength . locationByteRange - methodSource = getIdentifier (arr Declaration.methodBody) blob (In ann decl) - --- When encountering a Declaration-annotated term, we need to extract a Text --- for the resulting Declaration's 'declarationIdentifier' field. This text --- is constructed by slicing out text from the original blob corresponding --- to a location, which is found via the passed-in rule. -getIdentifier :: Functor m - => Rewrite (m (Term syntax Location)) (Term syntax Location) - -> Blob - -> TermF m Location (Term syntax Location, a) - -> Text -getIdentifier finder Blob{..} (In a r) - = let declRange = locationByteRange a - bodyRange = locationByteRange <$> rewrite (fmap fst r) (finder >>^ annotation) - -- Text-based gyrations to slice the identifier out of the provided blob source - sliceFrom = T.stripEnd . toText . flip Source.slice blobSource . subtractRange declRange - in maybe mempty sliceFrom bodyRange - -getSource :: Source -> Location -> Text -getSource blobSource = toText . flip Source.slice blobSource . locationByteRange - --- | Produce a 'Declaration' for 'Sum's using the 'HasDeclaration' instance & therefore using a 'CustomHasDeclaration' instance when one exists & the type is listed in 'DeclarationStrategy'. -instance Apply (HasDeclaration' whole) fs => CustomHasDeclaration whole (Sum fs) where - customToDeclaration blob ann = apply @(HasDeclaration' whole) (toDeclaration' blob ann) - - --- | A strategy for defining a 'HasDeclaration' instance. Intended to be promoted to the kind level using @-XDataKinds@. -data Strategy = Default | Custom - --- | Produce a 'Declaration' for a syntax node using either the 'Default' or 'Custom' strategy. --- --- You should probably be using 'CustomHasDeclaration' instead of this class; and you should not define new instances of this class. -class HasDeclarationWithStrategy (strategy :: Strategy) whole syntax where - toDeclarationWithStrategy :: (Foldable whole) => proxy strategy -> Blob -> Location -> syntax (Term whole Location, Maybe Declaration) -> Maybe Declaration - - --- | A predicate on syntax types selecting either the 'Custom' or 'Default' strategy. --- --- Only entries for which we want to use the 'Custom' strategy should be listed, with the exception of the final entry which maps all other types onto the 'Default' strategy. --- --- If you’re seeing errors about missing a 'CustomHasDeclaration' instance for a given type, you’ve probably listed it in here but not defined a 'CustomHasDeclaration' instance for it, or else you’ve listed the wrong type in here. Conversely, if your 'customHasDeclaration' method is never being called, you may have forgotten to list the type in here. -type family DeclarationStrategy syntax where - DeclarationStrategy Declaration.Function = 'Custom - DeclarationStrategy Declaration.Method = 'Custom - DeclarationStrategy Markdown.Heading = 'Custom - DeclarationStrategy Syntax.Error = 'Custom - DeclarationStrategy (Sum fs) = 'Custom - DeclarationStrategy a = 'Default - - --- | The 'Default' strategy produces 'Nothing'. -instance HasDeclarationWithStrategy 'Default whole syntax where - toDeclarationWithStrategy _ _ _ _ = Nothing - --- | The 'Custom' strategy delegates the selection of the strategy to the 'CustomHasDeclaration' instance for the type. -instance CustomHasDeclaration whole syntax => HasDeclarationWithStrategy 'Custom whole syntax where - toDeclarationWithStrategy _ = customToDeclaration diff --git a/src/Assigning/Assignment.hs b/src/Assigning/Assignment.hs deleted file mode 100644 index 18a1b7ac00..0000000000 --- a/src/Assigning/Assignment.hs +++ /dev/null @@ -1,434 +0,0 @@ -{-# LANGUAGE DataKinds, GADTs, InstanceSigs, MultiParamTypeClasses, RankNTypes, ScopedTypeVariables, StandaloneDeriving, TypeFamilies, TypeOperators #-} -{-# OPTIONS_GHC -Wno-redundant-constraints #-} -- For HasCallStack --- | Assignment of AST onto some other structure (typically terms). --- --- Parsing yields an AST represented as a Rose tree labelled with symbols in the language’s grammar and source locations (byte Range and Span). An Assignment represents a (partial) map from AST nodes onto some other structure; in essence, it’s a parser that operates over trees. (For our purposes, this structure is typically Terms annotated with source locations.) Assignments are able to match based on symbol, sequence, and hierarchy; thus, in @x = y@, both @x@ and @y@ might have the same symbol, @Identifier@, the left can be assigned to a variable declaration, while the right can be assigned to a variable reference. --- --- Assignments can be any of the following primitive rules: --- --- 1. 'symbol' rules match a node against a specific symbol in the source language’s grammar; they succeed iff a) there is a current node, and b) its symbol is equal to the argument symbol. Matching a 'symbol' rule does not advance past the current node, meaning that you can match a node against a symbol and also e.g. match against the node’s 'children'. This also means that some care must be taken, as repeating a symbol with 'many' or 'some' (see below) will never advance past the current node and could therefore loop forever. --- --- 2. 'location' rules always succeed, and produce the current node’s Location (byte Range and Span). If there is no current node (i.e. if matching has advanced past the root node or past the last child node when operating within a 'children' rule), the location is instead the end of the most recently matched node, specified as a zero-width Range and Span. 'location' rules do not advance past the current node, meaning that you can both match a node’s 'location' and other properties. --- --- 3. 'source' rules succeed whenever there is a current node (i.e. matching has not advanced past the root node or the last child node when operating within a 'children' rule), and produce its source as a ByteString. 'source' is intended to match leaf nodes such as e.g. comments. 'source' rules advance past the current node. --- --- 4. 'children' rules apply their argument (an assignment) to the children of the current node, succeeding iff a) there is a current node, b) the argument assignment matches the children, and c) there are no (regular) nodes left over (see below re: tokens), producing the result of matching the argument assignment against the children. 'children' rules can match a node with no child nodes if their argument can successfully match at the end of input. --- --- 5. Via the 'Alternative' instance, 'empty' assignments always fail. This can be used (in combination with the 'Monad' instance) to (for example) fail if a 'source' assignment produces an ill-formatted ByteString. However, see below re: committed choice. --- --- 6. Via the 'Applicative' instance, 'pure' (or via the 'Monad' instance, 'pure') assignments always succeed, producing the passed value. They do not advance past the current node. In combination with the 'Alternative' instance, 'pure' can provide default values when optional syntax is not present in the AST. --- --- Assignments can further be combined in a few different ways: --- --- 1. The 'Functor' instance maps values from the AST (Location, ByteString, etc.) into another structure. --- --- 2. The 'Applicative' instance assigns sequences of (sibling) AST nodes in order, as well as providing 'pure' assignments (see above). Most assignments of a single piece of syntax consist of an 'Applicative' chain of assignments. --- --- 3. The 'Alternative' instance chooses between a set of assignments, as well as providing 'empty' assignments (see above). See below re: committed choice for best practices for efficiency & error reporting when it comes to assigning multiple alternatives. Most high-level assignments (e.g. β€œdeclaration” or β€œstatement” assignments) consist of choices among two or more 'Applicative' chains of assignments, mirroring the structure of the parser’s choices. The 'Alternative' instance also enables repetitions via the 'many' (β‰₯ 0 repetitions) and 'some' (β‰₯ 1 repetition) methods. Finally, the 'optional' function uses the 'Alternative' instance to assign a value in 'Maybe', succeeding with 'Nothing' when unmatched. --- --- 4. The 'Monad' instance allows assignments to depend on the results of earlier assignments. In general, most assignments should not be written using the 'Monad' instance; however, some specific situations require it, e.g. assigning 'x += y' to be equivalent to 'x = x + y'. --- --- --- == Best practices --- --- Because of their flexibility, the same assignment can often be written in multiple different ways. The following best practices should ensure efficient assignment with clear error messages for ill-formed AST. --- --- === Committed choice --- --- Assignments can represent alternatives as either committed or uncommitted choices, both written with '<|>'. β€œCommitted” in this context means that a failure in one of the alternatives will not result in backtracking followed by an attempt of one of the other alternatives; thus, committed choice is more efficient. (By the same token, it enables much better error messages since backtracking erases most of the relevant context.) Committed choices are constructed via the following rules: --- --- 1. 'empty' is dropped from choices. --- --- 2. 'symbol' rules construct a committed choice (with only a single alternative). --- --- 3. 'fmap' (and by extension '<$>' and '<$') of a committed choice is a committed choice. --- --- 4. '<*>' (and by extension '*>' and '<*') with a committed choice on the left is a committed choice. --- --- 5. '>>=' (and by extension '>>', '=<<', and '<<') of a committed choice is a committed choice. It may be helpful to think of this and the above rule for '<*>' as β€œsequences starting with committed choices remain committed choices.” --- --- 6. '<|>' of two committed choices is a committed choice. --- --- Finally, if a given choice is not a committed choice, it is an uncommitted choice. --- --- Distilling the above, the rule of thumb is to always start an assignment for a given piece of syntax with either a 'symbol' rule or an 'fmap' over a 'symbol' rule. When assigning multiple pieces of syntax, place any known uncommitted choices at the (rightmost) end of the chain; '<|>' is left-associative, so this guarantees that you’re adding at most one uncommitted choice on top of the ones already present. --- --- === Matching tokens --- --- AST symbols are classified by their 'symbolType' as either 'Regular', 'Anonymous', or 'Auxiliary'. 'Auxiliary' never appears in ASTs; 'Regular' is for the symbols of explicitly named productions in the grammar, and 'Anonymous' is for unnamed productions of content such as tokens. Most of the time, assignments are only concerned with the named productions, and thus will be using 'Regular' symbols. Therefore, when matching a committed choice of all-'Regular' symbols, nodes with 'Anonymous' symbols will be skipped. However, in some cases grammars don’t provide a named symbol for e.g. every kind of infix operator, and thus the only way to differentiate between them is by means of a 'symbol' rule for an 'Anonymous' token. In these cases, and before every other kind of assignment, the 'Anonymous' nodes will not be skipped so that matching can succeed. --- --- Therefore, in addition to the rule of thumb for committed choices (see above), try to match 'Regular' symbols up front, and only match 'Anonymous' ones in the middle of a chain. That will ensure that you don’t have to make redundant effort to explicitly skip 'Anonymous' nodes ahead of multiple alternatives, and can instead rely on them being automatically skipped except when explicitly required. -module Assigning.Assignment --- Types -( Assignment -, L.Location(..) --- Combinators -, branchNode -, leafNode -, toTerm -, Alternative(..) -, MonadError(..) -, MonadFail(..) -, location -, currentNode -, symbol -, rawSource -, source -, children -, advance -, choice -, token -, manyThrough -, getLocals -, putLocals --- Results -, Error(..) -, nodeError -, firstSet --- Running -, assign -, runAssignment --- Implementation details (for testing) -, State(..) -, makeState -, module Parsers -) where - -import Prologue -import Prelude hiding (fail) -import qualified Assigning.Assignment.Table as Table -import Control.Monad.Except (MonadError (..)) -import Data.AST -import Data.Error -import Data.Range -import qualified Data.Location as L -import qualified Data.Source as Source (Source, slice, sourceBytes) -import Data.Span hiding (HasSpan(..)) -import Data.Term -import Data.Text (Text) -import Data.Text.Encoding (decodeUtf8') -import Text.Parser.Combinators as Parsers hiding (choice) -import TreeSitter.Language - --- | Match a branch node, matching its children with the supplied 'Assignment' & returning the result. -branchNode :: (Enum grammar, Ix grammar) => grammar -> Assignment ast grammar a -> Assignment ast grammar a -branchNode sym child = symbol sym *> children child - --- | Match a leaf node, returning the corresponding 'Text'. -leafNode :: (Enum grammar, Ix grammar) => grammar -> Assignment ast grammar Text -leafNode sym = symbol sym *> source - --- | Wrap an 'Assignment' producing @syntax@ up into an 'Assignment' producing 'Term's. -toTerm :: Element syntax syntaxes - => Assignment ast grammar (syntax (Term (Sum syntaxes) L.Location)) - -> Assignment ast grammar (Term (Sum syntaxes) L.Location) -toTerm syntax = termIn <$> location <*> (inject <$> syntax) - - --- | Assignment from an AST with some set of 'symbol's onto some other value. --- --- This is essentially a parser. -type Assignment ast grammar = Freer (Tracing (AssignmentF ast grammar)) - -data AssignmentF ast grammar a where - End :: AssignmentF ast grammar () - Location :: AssignmentF ast grammar L.Location - CurrentNode :: AssignmentF ast grammar (TermF ast (Node grammar) ()) - Source :: AssignmentF ast grammar ByteString - Children :: Assignment ast grammar a -> AssignmentF ast grammar a - Choose :: Table.Table grammar (Assignment ast grammar a) -> Maybe (Assignment ast grammar a) -> Maybe (Error (Either String grammar) -> Assignment ast grammar a) -> AssignmentF ast grammar a - Many :: Assignment ast grammar a -> AssignmentF ast grammar [a] - Alt :: [a] -> AssignmentF ast grammar a - Label :: Assignment ast grammar a -> String -> AssignmentF ast grammar a - Fail :: String -> AssignmentF ast grammar a - GetLocals :: AssignmentF ast grammar [Text] - PutLocals :: [Text] -> AssignmentF ast grammar () - -data Tracing f a where - Tracing :: { tracingCallSite :: Maybe (String, SrcLoc), runTracing :: f a } -> Tracing f a - -assignmentCallSite :: Assignment ast grammar a -> Maybe (String, SrcLoc) -assignmentCallSite (Tracing site _ `Then` _) = site -assignmentCallSite _ = Nothing - -tracing :: HasCallStack => f a -> Tracing f a -tracing f = case getCallStack callStack of - (_ : site : _) -> Tracing (Just site) f - _ -> Tracing Nothing f - --- | Zero-width production of the current location. --- --- If assigning at the end of input or at the end of a list of children, the location will be returned as an empty Range and Span at the current offset. Otherwise, it will be the Range and Span of the current node. -location :: Assignment ast grammar L.Location -location = tracing Location `Then` pure - -getLocals :: HasCallStack => Assignment ast grammar [Text] -getLocals = tracing GetLocals `Then` pure - -putLocals :: (HasCallStack, Enum grammar, Eq1 ast, Ix grammar) => [Text] -> Assignment ast grammar () -putLocals l = (tracing (PutLocals l) `Then` pure) - <|> (tracing End `Then` pure) - --- | Zero-width production of the current node. -currentNode :: HasCallStack => Assignment ast grammar (TermF ast (Node grammar) ()) -currentNode = tracing CurrentNode `Then` pure - --- | Zero-width match of a node with the given symbol, producing the current node’s location. -symbol :: (Enum grammar, Ix grammar, HasCallStack) => grammar -> Assignment ast grammar L.Location -symbol s = tracing (Choose (Table.singleton s location) Nothing Nothing) `Then` pure - --- | A rule to produce a node’s source as a ByteString. --- You probably want to use 'source', unless you're throwing away the result. -rawSource :: HasCallStack => Assignment ast grammar ByteString -rawSource = tracing Source `Then` pure - --- | A rule to produce a node's source as Text. Fails if the node's source can't be parsed as UTF-8. -source :: HasCallStack => Assignment ast grammar Text -source = fmap decodeUtf8' rawSource >>= either (\e -> fail ("UTF-8 decoding failed: " <> show e)) pure - --- | Match a node by applying an assignment to its children. -children :: HasCallStack => Assignment ast grammar a -> Assignment ast grammar a -children child = tracing (Children child) `Then` pure - --- | Advance past the current node. -advance :: HasCallStack => Assignment ast grammar () -advance = () <$ source - --- | Construct a committed choice table from a list of alternatives. Use this to efficiently select between long lists of rules. -choice :: (Enum grammar, Eq1 ast, Ix grammar, HasCallStack) => [Assignment ast grammar a] -> Assignment ast grammar a -choice [] = empty -choice alternatives - | null choices = asum alternatives - | otherwise = tracing (Choose (Table.fromListWith (<|>) choices) ((`Then` id) . tracing . Alt . toList <$> nonEmpty atEnd) (mergeHandlers handlers)) `Then` pure - where (choices, atEnd, handlers) = foldMap toChoices alternatives - toChoices :: (Enum grammar, Ix grammar) => Assignment ast grammar a -> ([(grammar, Assignment ast grammar a)], [Assignment ast grammar a], [Error (Either String grammar) -> Assignment ast grammar a]) - toChoices rule = case rule of - Tracing _ (Choose t a h) `Then` continue -> (Table.toPairs (fmap (>>= continue) t), toList ((>>= continue) <$> a), toList ((continue <=<) <$> h)) - Tracing _ (Many child) `Then` _ -> let (c, _, _) = toChoices child in (fmap (rule <$) c, [rule], []) - Tracing _ (Label child _) `Then` _ -> let (c, _, _) = toChoices child in (fmap (rule <$) c, [rule], []) - Tracing _ (Alt as) `Then` continue -> foldMap (toChoices . continue) as - _ -> ([], [rule], []) - - mergeHandlers [] = Nothing - mergeHandlers hs = Just (\ err -> asum (hs <*> [err])) - --- | Match and advance past a node with the given symbol. -token :: (Enum grammar, Ix grammar, HasCallStack) => grammar -> Assignment ast grammar L.Location -token s = symbol s <* advance - - --- | Match the first operand until the second operand matches, returning both results. Like 'manyTill', but returning the terminal value. -manyThrough :: (Alternative m, HasCallStack) => m a -> m b -> m ([a], b) -manyThrough step stop = go - where go = (,) [] <$> stop <|> first . (:) <$> step <*> go - - -nodeError :: CallStack -> [Either String grammar] -> Node grammar -> Error (Either String grammar) -nodeError cs expected n@Node{..} = Error (nodeSpan n) expected (Just (Right nodeSymbol)) cs - - -firstSet :: (Enum grammar, Ix grammar) => Assignment ast grammar a -> [grammar] -firstSet = iterFreer (\ _ (Tracing _ assignment) -> case assignment of - Choose table _ _ -> Table.tableAddresses table - Label child _ -> firstSet child - _ -> []) . ([] <$) - - --- | Run an assignment over an AST exhaustively. -assign :: (Enum grammar, Ix grammar, Symbol grammar, Show grammar, Eq1 ast, Foldable ast, Functor ast) - => Source.Source -- ^ The source for the parse tree. - -> Assignment ast grammar a -- ^ The 'Assignment to run. - -> AST ast grammar -- ^ The root of the ast. - -> Either (Error String) a -- ^ 'Either' an 'Error' or an assigned value. -assign source assignment ast = bimap (fmap (either id show)) fst (runAssignment source assignment (makeState [ast])) -{-# INLINE assign #-} - --- | Run an assignment of nodes in a grammar onto terms in a syntax over an AST exhaustively. -runAssignment :: forall grammar a ast. (Enum grammar, Ix grammar, Symbol grammar, Eq1 ast, Foldable ast, Functor ast) - => Source.Source -- ^ The source for the parse tree. - -> Assignment ast grammar a -- ^ The 'Assignment' to run. - -> State ast grammar -- ^ The current state. - -> Either (Error (Either String grammar)) (a, State ast grammar) -- ^ 'Either' an 'Error' or an assigned value & updated state. -runAssignment source = \ assignment state -> go assignment state >>= requireExhaustive (assignmentCallSite assignment) - -- Note: We explicitly bind source above in order to ensure that the where clause can close over them; they don’t change through the course of the run, so holding one reference is sufficient. On the other hand, we don’t want to accidentally capture the assignment and state in the where clause, since they change at every stepβ€”and capturing when you meant to shadow is an easy mistake to make, & results in hard-to-debug errors. Binding them in a lambda avoids that problem while also being easier to follow than a pointfree definition. - where go :: Assignment ast grammar result -> State ast grammar -> Either (Error (Either String grammar)) (result, State ast grammar) - go assignment = iterFreer run ((pure .) . (,) <$> assignment) - {-# INLINE go #-} - - run :: (x -> State ast grammar -> Either (Error (Either String grammar)) (result, State ast grammar)) - -> Tracing (AssignmentF ast grammar) x - -> State ast grammar - -> Either (Error (Either String grammar)) (result, State ast grammar) - run yield t initialState = state `seq` maybe (anywhere Nothing) atNode (listToMaybe stateNodes) - where atNode (Term (In node f)) = case runTracing t of - Location -> yield (nodeLocation node) state - GetLocals -> yield stateLocals state - PutLocals l -> yield () (state { stateLocals = l }) - CurrentNode -> yield (In node (() <$ f)) state - Source -> yield (Source.sourceBytes (Source.slice (nodeByteRange node) source)) (advanceState state) - Children child -> do - (a, state') <- go child state { stateNodes = toList f, stateCallSites = maybe id (:) (tracingCallSite t) stateCallSites } >>= requireExhaustive (tracingCallSite t) - yield a (advanceState state' { stateNodes = stateNodes, stateCallSites = stateCallSites }) - Choose choices _ handler | Just choice <- Table.lookup (nodeSymbol node) choices -> (go choice state `catchError` maybe throwError (flip go state .) handler) >>= uncurry yield - _ -> anywhere (Just node) - - anywhere node = case runTracing t of - End -> requireExhaustive (tracingCallSite t) ((), state) >>= uncurry yield - Location -> yield (L.Location (Range stateOffset stateOffset) (Span statePos statePos)) state - Many rule -> fix (\ recur state -> (go rule state >>= \ (a, state') -> first (a:) <$> if state == state' then pure ([], state') else recur state') `catchError` const (pure ([], state))) state >>= uncurry yield - Alt (a:as) -> sconcat (flip yield state <$> a:|as) - Label child label -> go child state `catchError` (\ err -> throwError err { errorExpected = [Left label] }) >>= uncurry yield - Fail s -> throwError ((makeError' node) { errorActual = Just (Left s) }) - Choose _ (Just atEnd) _ | Nothing <- node -> go atEnd state >>= uncurry yield - _ -> Left (makeError' node) - - state@State{..} = case (runTracing t, initialState) of - (Choose table _ _, State { stateNodes = Term (In node _) : _ }) | symbolType (nodeSymbol node) /= Regular, symbols@(_:_) <- Table.tableAddresses table, all ((== Regular) . symbolType) symbols -> skipTokens initialState - _ -> initialState - expectedSymbols = firstSet (t `Then` pure) - assignmentStack = maybe emptyCallStack (fromCallSiteList . pure) (tracingCallSite t) - makeError' = maybe - (Error (Span statePos statePos) (fmap Right expectedSymbols) Nothing assignmentStack) - (nodeError assignmentStack (fmap Right expectedSymbols)) - -requireExhaustive :: Symbol grammar => Maybe (String, SrcLoc) -> (result, State ast grammar) -> Either (Error (Either String grammar)) (result, State ast grammar) -requireExhaustive callSite (a, state) = - let state' = skipTokens state - stack = fromCallSiteList (maybe id (:) callSite (stateCallSites state)) - in case stateNodes state' of - [] -> Right (a, state') - Term (In node _) : _ -> Left (nodeError stack [] node) - -skipTokens :: Symbol grammar => State ast grammar -> State ast grammar -skipTokens state = state { stateNodes = dropWhile ((/= Regular) . symbolType . nodeSymbol . termAnnotation) (stateNodes state) } - --- | Advances the state past the current (head) node (if any), dropping it off stateNodes, and updating stateOffset & statePos to its end; or else returns the state unchanged. -advanceState :: State ast grammar -> State ast grammar -advanceState state@State{..} - | Term (In node _) : rest <- stateNodes = State (end (nodeByteRange node)) (spanEnd (nodeSpan node)) stateCallSites rest stateLocals - | otherwise = state - --- | State kept while running 'Assignment's. -data State ast grammar = State - { stateOffset :: {-# UNPACK #-} !Int -- ^ The offset into the Source thus far reached, measured in bytes. - , statePos :: {-# UNPACK #-} !Pos -- ^ The (1-indexed) line/column position in the Source thus far reached. - , stateCallSites :: ![(String, SrcLoc)] -- ^ The symbols & source locations of the calls thus far. - , stateNodes :: ![AST ast grammar] -- ^ The remaining nodes to assign. Note that 'children' rules recur into subterms, and thus this does not necessarily reflect all of the terms remaining to be assigned in the overall algorithm, only those β€œin scope.” - , stateLocals :: ![Text] -- Special state necessary for the Ruby assignment. When we refactor Assignment to use effects we should pull this out into Language.Ruby.Assignment. - } - -deriving instance (Eq grammar, Eq1 ast) => Eq (State ast grammar) -deriving instance (Show grammar, Show1 ast) => Show (State ast grammar) - -makeState :: [AST ast grammar] -> State ast grammar -makeState ns = State 0 (Pos 1 1) [] ns [] - - --- Instances - -instance (Enum grammar, Eq1 ast, Ix grammar) => Alternative (Assignment ast grammar) where - empty :: HasCallStack => Assignment ast grammar a - empty = tracing (Alt []) `Then` pure - - (<|>) :: forall a. HasCallStack => Assignment ast grammar a -> Assignment ast grammar a -> Assignment ast grammar a - Return a <|> _ = Return a - l@(Tracing cs _ `Then` _) <|> r@Return{} = Tracing cs (Alt [l, r]) `Then` id - l@(Tracing callSiteL la `Then` continueL) <|> r@(Tracing callSiteR ra `Then` continueR) = go callSiteL la continueL callSiteR ra continueR - where go :: forall l r . Maybe (String, SrcLoc) -> AssignmentF ast grammar l -> (l -> Assignment ast grammar a) -> Maybe (String, SrcLoc) -> AssignmentF ast grammar r -> (r -> Assignment ast grammar a) -> Assignment ast grammar a - go callSiteL la continueL callSiteR ra continueR = case (la, ra) of - (Fail _, _) -> r - (Alt [], _) -> r - (_, Alt []) -> l - (Alt ls, Alt rs) -> alternate (Alt ((Left <$> ls) <> (Right <$> rs))) - (Alt ls, _) -> rebuild (Alt ((continueL <$> ls) <> pure r)) id - (_, Alt rs) -> rebuild (Alt (pure l <> (continueR <$> rs))) id - _ -> rebuild (Alt [l, r]) id - where alternate :: AssignmentF ast grammar (Either l r) -> Assignment ast grammar a - alternate a = rebuild a (either continueL continueR) - rebuild :: AssignmentF ast grammar x -> (x -> Assignment ast grammar a) -> Assignment ast grammar a - rebuild a c = Tracing (callSiteL <|> callSiteR) a `Then` c - - many :: HasCallStack => Assignment ast grammar a -> Assignment ast grammar [a] - many a = tracing (Many a) `Then` pure - -instance MonadFail (Assignment ast grammar) where - fail :: HasCallStack => String -> Assignment ast grammar a - fail s = tracing (Fail s) `Then` pure - -instance (Enum grammar, Eq1 ast, Ix grammar, Show grammar) => Parsing (Assignment ast grammar) where - try = id - - () :: HasCallStack => Assignment ast grammar a -> String -> Assignment ast grammar a - a s = tracing (Label a s) `Then` pure - - unexpected :: HasCallStack => String -> Assignment ast grammar a - unexpected = fail - - eof :: HasCallStack => Assignment ast grammar () - eof = tracing End `Then` pure - - notFollowedBy :: (HasCallStack, Show a) => Assignment ast grammar a -> Assignment ast grammar () - notFollowedBy a = (a >>= unexpected . show) <|> pure () - -instance (Enum grammar, Eq1 ast, Ix grammar, Show grammar) => MonadError (Error (Either String grammar)) (Assignment ast grammar) where - throwError :: HasCallStack => Error (Either String grammar) -> Assignment ast grammar a - throwError err = fail (show err) - - catchError :: HasCallStack => Assignment ast grammar a -> (Error (Either String grammar) -> Assignment ast grammar a) -> Assignment ast grammar a - catchError rule handler = iterFreer (\ continue (Tracing cs assignment) -> case assignment of - Choose choices atEnd Nothing -> Tracing cs (Choose (fmap (>>= continue) choices) (fmap (>>= continue) atEnd) (Just handler)) `Then` pure - Choose choices atEnd (Just onError) -> Tracing cs (Choose (fmap (>>= continue) choices) (fmap (>>= continue) atEnd) (Just (\ err -> (onError err >>= continue) <|> handler err))) `Then` pure - _ -> Tracing cs assignment `Then` ((`catchError` handler) . continue)) (fmap pure rule) - - --- Freer - -data Freer f a where - Return :: a -> Freer f a - Then :: f x -> (x -> Freer f a) -> Freer f a - -infixl 1 `Then` - -instance Functor (Freer f) where - fmap f = go - where go (Return result) = Return (f result) - go (Then step yield) = Then step (go . yield) - {-# INLINE go #-} - {-# INLINE fmap #-} - -instance Applicative (Freer f) where - pure = Return - {-# INLINE pure #-} - - Return f <*> param = fmap f param - Then action yield <*> param = Then action ((<*> param) . yield) - {-# INLINE (<*>) #-} - - Return _ *> a = a - Then r f *> a = Then r ((*> a) . f) - {-# INLINE (*>) #-} - - Return a <* b = b *> Return a - Then r f <* a = Then r ((<* a) . f) - {-# INLINE (<*) #-} - -instance Monad (Freer f) where - return = pure - {-# INLINE return #-} - - Return a >>= f = f a - Then r f >>= g = Then r (g <=< f) - {-# INLINE (>>=) #-} - - (>>) = (*>) - {-# INLINE (>>) #-} - --- | Tear down a 'Freer' 'Monad' using iteration with an explicit continuation. --- --- This is analogous to 'iter' with a continuation for the interior values, and is therefore suitable for defining interpreters for GADTs/types lacking a 'Functor' instance. -iterFreer :: (forall x. (x -> a) -> f x -> a) -> Freer f a -> a -iterFreer algebra = go - where go (Return result) = result - go (Then action continue) = algebra (go . continue) action - {-# INLINE go #-} -{-# INLINE iterFreer #-} diff --git a/src/Assigning/Assignment/Deterministic.hs b/src/Assigning/Assignment/Deterministic.hs deleted file mode 100644 index 34b1f4b84c..0000000000 --- a/src/Assigning/Assignment/Deterministic.hs +++ /dev/null @@ -1,190 +0,0 @@ -{-# LANGUAGE FunctionalDependencies #-} --- | Deterministic assignment, Γ  la _Deterministic, Error-Correcting Combinator Parsers_, S. Doaitse Swierstra & Luc Duponcheel: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.80.9967&rep=rep1&type=pdf -module Assigning.Assignment.Deterministic -( Assigning(..) -, parseError -, Assignment(..) -, assign -, runAssignment -, State(..) -) where - -import Data.AST -import Data.Error -import qualified Data.IntMap as IntMap -import qualified Data.IntSet as IntSet -import Data.Range -import Data.Location -import Data.Source as Source -import Data.Span hiding (HasSpan (..)) -import qualified Data.Syntax as Syntax -import Data.Term (Term, termIn, termAnnotation, termOut) -import Data.Text.Encoding (decodeUtf8') -import Prologue - -class (Alternative f, Ord symbol, Show symbol) => Assigning symbol f | f -> symbol where - leafNode :: symbol -> f Text - branchNode :: symbol -> f a -> f a - - toTerm :: (Element syntax syntaxes, Element Syntax.Error syntaxes) - => f (syntax (Term (Sum syntaxes) Location)) - -> f (Term (Sum syntaxes) Location) - -parseError :: ( Bounded symbol - , Element Syntax.Error syntaxes - , HasCallStack - , Assigning symbol f - ) - => f (Term (Sum syntaxes) Location) -parseError = toTerm (leafNode maxBound $> Syntax.Error (Syntax.ErrorStack (Syntax.errorSite <$> getCallStack (freezeCallStack callStack))) [] (Just "ParseError") []) - - -data Assignment symbol a = Assignment - { nullable :: Nullable symbol a - , firstSet :: IntSet - , choices :: [(symbol, Cont symbol a)] - } - deriving (Functor) - -type Cont symbol a = Source -> State symbol -> [IntSet] -> Either (Error (Either String symbol)) (State symbol, a) - -combine :: Nullable symbol a -> IntSet -> IntSet -> IntSet -combine (Nullable _) s1 s2 = s1 <> s2 -combine _ s1 _ = s1 - -choose :: (Enum symbol, HasCallStack) - => Nullable symbol a - -> IntSet - -> IntMap (Cont symbol a) - -> Cont symbol a -choose nullable firstSet table src state follow = case stateInput state of - [] -> case nullable of - Nullable f -> Right (state, f state) - _ -> Left (makeError (stateSpan state) (Right . toEnum <$> IntSet.toList firstSet) Nothing) - s:_ -> case fromEnum (astSymbol s) `IntMap.lookup` table of - Just k -> k src state follow - _ -> notFound (astSymbol s) state follow - where notFound s state follow = case nullable of - Nullable f | any (fromEnum s `IntSet.member`) follow -> Right (state, f state) - _ -> Left (makeError (stateSpan state) (Right . toEnum <$> IntSet.toList firstSet) (Just (Right s))) - -instance (Enum symbol, Ord symbol) => Applicative (Assignment symbol) where - pure a = Assignment (pure a) lowerBound [] - {-# INLINABLE pure #-} - - Assignment n1 f1 t1 <*> ~(Assignment n2 f2 t2) = Assignment (n1 <*> n2) (combine n1 f1 f2) (t1 `tseq` t2) - where table2 = IntMap.fromList (map (first fromEnum) t2) - t1 `tseq` t2 - = map (fmap (\ p src state follow -> do - (state', p') <- p src state (f2 : follow) - (state'', q') <- choose n2 f2 table2 src state' follow - let pq = p' q' - pq `seq` pure (state'', pq))) t1 - <> case n1 of - Nullable p -> map (fmap (\ q src state follow -> do - let p' = p state - (state', q') <- p' `seq` q src state follow - let pq = p' q' - pq `seq` pure (state', pq))) t2 - _ -> [] - {-# INLINABLE (<*>) #-} - -instance (Enum symbol, Ord symbol) => Alternative (Assignment symbol) where - empty = Assignment NotNullable lowerBound [] - {-# INLINABLE empty #-} - - Assignment n1 f1 t1 <|> Assignment n2 f2 t2 = Assignment (n1 <|> n2) (f1 <> f2) (t1 <> t2) - {-# INLINABLE (<|>) #-} - -instance (Enum symbol, Ord symbol, Show symbol) => Assigning symbol (Assignment symbol) where - leafNode s = Assignment NotNullable (IntSet.singleton (fromEnum s)) - [ (s, \ src state _ -> case stateInput state of - [] -> Left (makeError (stateSpan state) [Right s] Nothing) - s:_ -> case decodeUtf8' (sourceBytes (Source.slice (astRange s) src)) of - Left err -> Left (makeError (astSpan s) [Left "valid utf-8"] (Just (Left (show err)))) - Right text -> Right (advanceState state, text)) - ] - - branchNode s a = Assignment NotNullable (IntSet.singleton (fromEnum s)) - [ (s, \ src state _ -> case stateInput state of - [] -> Left (makeError (stateSpan state) [Right s] Nothing) - s:_ -> first (const (advanceState state)) <$> runAssignment a src state { stateInput = astChildren s }) - ] - - toTerm a = Assignment - (case nullable a of - Nullable f -> Nullable (\ state -> termIn (stateLocation state) (inject (f state))) - NotNullable -> NotNullable) - (firstSet a) - (map (fmap (\ match src state follow -> case match src state follow of - Left err - | Just _ <- errorActual err -> Right (advanceState state, termIn (stateLocation state) (inject (Syntax.errorSyntax (either id show <$> err) []))) - | otherwise -> Left err - Right (state', syntax) -> Right (state', termIn (stateLocation state) (inject syntax)))) (choices a)) - - -assign :: (Enum symbol, Show symbol) => Source -> Assignment symbol a -> AST [] symbol -> Either (Error String) a -assign src assignment = bimap (fmap (either id show)) snd . runAssignment assignment src . State 0 lowerBound . pure - -runAssignment :: Enum symbol => Assignment symbol a -> Source -> State symbol -> Either (Error (Either String symbol)) (State symbol, a) -runAssignment (Assignment nullable firstSet table) src input - = case choose nullable firstSet (IntMap.fromList (map (first fromEnum) table)) src input lowerBound of - Left err -> Left err - Right (state', a') -> case stateInput state' of - [] -> Right (state', a') - s':_ -> Left (makeError (stateSpan state') [] (Just (Right (astSymbol s')))) - - -data Nullable symbol a - = NotNullable - | Nullable (State symbol -> a) - deriving (Functor) - -instance Applicative (Nullable symbol) where - pure = Nullable . const - - Nullable f <*> Nullable a = Nullable (\ state -> f state (a state)) - _ <*> _ = NotNullable - -instance Alternative (Nullable symbol) where - empty = NotNullable - - Nullable a <|> _ = Nullable a - _ <|> b = b - - -data State symbol = State - { stateBytes :: {-# UNPACK #-} !Int - , statePos :: {-# UNPACK #-} !Pos - , stateInput :: ![AST [] symbol] - } - deriving (Eq, Ord, Show) - -stateRange :: State s -> Range -stateRange state@(State _ _ []) = Range (stateBytes state) (stateBytes state) -stateRange (State _ _ (s:_)) = astRange s - -stateSpan :: State s -> Span -stateSpan state@(State _ _ []) = Span (statePos state) (statePos state) -stateSpan (State _ _ (s:_)) = astSpan s - -stateLocation :: State s -> Location -stateLocation state = Location (stateRange state) (stateSpan state) - -advanceState :: State s -> State s -advanceState state - | s:ss <- stateInput state = State (end (astRange s)) (spanEnd (astSpan s)) ss - | otherwise = state - - -astSymbol :: AST [] symbol -> symbol -astSymbol = nodeSymbol . termAnnotation - -astRange :: AST [] symbol -> Range -astRange = nodeByteRange . termAnnotation - -astSpan :: AST [] symbol -> Span -astSpan = nodeSpan . termAnnotation - -astChildren :: AST [] symbol -> [AST [] symbol] -astChildren = termOut diff --git a/src/Assigning/Assignment/Table.hs b/src/Assigning/Assignment/Table.hs deleted file mode 100644 index 5cb8ca9275..0000000000 --- a/src/Assigning/Assignment/Table.hs +++ /dev/null @@ -1,36 +0,0 @@ -{-# LANGUAGE DerivingVia #-} -module Assigning.Assignment.Table -( Table(tableAddresses) -, singleton -, fromListWith -, toPairs -, lookup -) where - -import Prologue -import Prelude hiding (lookup) -import qualified Data.IntMap as IntMap -import qualified Data.IntSet as IntSet - -data Table i a = Table { tableAddresses :: [i], tableBranches :: IntMap a } - deriving (Eq, Foldable, Functor, Show, Traversable, Generic) - deriving Monoid via GenericMonoid (Table i a) - -singleton :: Enum i => i -> a -> Table i a -singleton i a = Table [i] (IntMap.singleton (fromEnum i) a) - -fromListWith :: Enum i => (a -> a -> a) -> [(i, a)] -> Table i a -fromListWith with assocs = Table (toEnum <$> IntSet.toList (IntSet.fromList (fromEnum . fst <$> assocs))) (IntMap.fromListWith with (first fromEnum <$> assocs)) - -toPairs :: Enum i => Table i a -> [(i, a)] -toPairs Table{..} = first toEnum <$> IntMap.toList tableBranches - - -lookup :: Enum i => i -> Table i a -> Maybe a -lookup i = IntMap.lookup (fromEnum i) . tableBranches - -instance (Enum i, Semigroup a) => Semigroup (Table i a) where - (Table i1 b1) <> (Table i2 b2) = Table (i1 <> i2) (IntMap.unionWith (<>) b1 b2) - -instance (Enum i, Show i) => Show1 (Table i) where - liftShowsPrec spA slA d t = showsBinaryWith showsPrec (const (liftShowList spA slA)) "Table" d (tableAddresses t) (toPairs t) diff --git a/src/Control/Abstract.hs b/src/Control/Abstract.hs deleted file mode 100644 index 8c6f8837e4..0000000000 --- a/src/Control/Abstract.hs +++ /dev/null @@ -1,13 +0,0 @@ -module Control.Abstract ( - module X -) where - -import Control.Abstract.Context as X -import Control.Abstract.Evaluator as X -import Control.Abstract.Heap as X -import Control.Abstract.Hole as X -import Control.Abstract.Modules as X -import Control.Abstract.Primitive as X -import Control.Abstract.Roots as X -import Control.Abstract.ScopeGraph as X -import Control.Abstract.Value as X diff --git a/src/Control/Abstract/Context.hs b/src/Control/Abstract/Context.hs deleted file mode 100644 index 43ec632e49..0000000000 --- a/src/Control/Abstract/Context.hs +++ /dev/null @@ -1,59 +0,0 @@ -module Control.Abstract.Context -( ModuleInfo -, currentModule -, withCurrentModule -, PackageInfo -, currentPackage -, withCurrentPackage -, Span -, currentSpan -, withCurrentSpan -, modifyChildSpan -, withCurrentCallStack -) where - -import Control.Effect -import Control.Effect.Reader -import Control.Effect.State -import Data.Abstract.Module -import Data.Abstract.Package -import Data.Span -import GHC.Stack -import Prologue - --- | Get the currently evaluating 'ModuleInfo'. -currentModule :: (Member (Reader ModuleInfo) sig, Carrier sig m) => m ModuleInfo -currentModule = ask - --- | Run an action with a locally-replaced 'ModuleInfo'. -withCurrentModule :: (Member (Reader ModuleInfo) sig, Carrier sig m) => ModuleInfo -> m a -> m a -withCurrentModule = local . const - --- | Get the currently evaluating 'PackageInfo'. -currentPackage :: (Member (Reader PackageInfo) sig, Carrier sig m) => m PackageInfo -currentPackage = ask - --- | Run an action with a locally-replaced 'PackageInfo'. -withCurrentPackage :: (Member (Reader PackageInfo) sig, Carrier sig m) => PackageInfo -> m a -> m a -withCurrentPackage = local . const - --- | Get the 'Span' of the currently-evaluating term (if any). -currentSpan :: (Member (Reader Span) sig, Carrier sig m) => m Span -currentSpan = ask - --- | Run an action with a locally-replaced 'Span'. -withCurrentSpan :: (Member (Reader Span) sig, Carrier sig m) => Span -> m a -> m a -withCurrentSpan = local . const - -modifyChildSpan :: (Member (State Span) sig, Carrier sig m) => Span -> m a -> m a -modifyChildSpan span m = m <* put span - --- | Run an action with locally-replaced 'ModuleInfo' & 'Span' derived from the passed 'SrcLoc'. -withCurrentSrcLoc :: (Member (Reader ModuleInfo) sig, Member (Reader Span) sig, Carrier sig m) => SrcLoc -> m a -> m a -withCurrentSrcLoc loc = withCurrentModule (moduleInfoFromSrcLoc loc) . withCurrentSpan (spanFromSrcLoc loc) - --- | Run an action with locally replaced 'ModuleInfo' & 'Span' derived from the Haskell call stack. --- --- This is suitable for contextualizing builtins & other functionality intended for use from client code but defined in Haskell source. -withCurrentCallStack :: (Member (Reader ModuleInfo) sig, Member (Reader Span) sig, Carrier sig m) => CallStack -> m a -> m a -withCurrentCallStack = maybe id (withCurrentSrcLoc . snd) . listToMaybe . getCallStack diff --git a/src/Control/Abstract/Evaluator.hs b/src/Control/Abstract/Evaluator.hs deleted file mode 100644 index e70c6d3604..0000000000 --- a/src/Control/Abstract/Evaluator.hs +++ /dev/null @@ -1,110 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, TypeOperators, UndecidableInstances #-} -module Control.Abstract.Evaluator - ( Evaluator(..) - , raiseHandler - , Open - -- * Effects - , Return(..) - , earlyReturn - , catchReturn - , runReturn - , LoopControl(..) - , throwBreak - , throwContinue - , throwAbort - , catchLoopControl - , runLoopControl - , module X - ) where - -import Control.Effect as X -import Control.Effect.Carrier -import Control.Effect.Error as X -import Control.Effect.Fresh as X -import Control.Effect.NonDet as X -import Control.Effect.Reader as X -import Control.Effect.Resumable as X -import Control.Effect.State as X -import Control.Effect.Trace as X -import Control.Monad.IO.Class -import Data.Coerce - --- | An 'Evaluator' is a thin wrapper around a monad with (phantom) type parameters for the address, term, and value types. --- --- These parameters enable us to constrain the types of effects using them s.t. we can avoid both ambiguous types when they aren’t mentioned outside of the context, and lengthy, redundant annotations on the use sites of functions employing these effects. --- --- These effects will typically include the environment, heap, module table, etc. effects necessary for evaluation of modules and terms, but may also include any other effects so long as they’re eventually handled. -newtype Evaluator term address value m a = Evaluator { runEvaluator :: m a } - deriving (Alternative, Applicative, Functor, Monad, MonadIO) - -instance Carrier sig m => Carrier sig (Evaluator term address value m) where - eff = Evaluator . eff . handleCoercible - --- | Raise a handler on monads into a handler on 'Evaluator's over those monads. -raiseHandler :: (m a -> n b) - -> Evaluator term address value m a - -> Evaluator term address value n b -raiseHandler = coerce - - --- | An open-recursive function. -type Open a = a -> a - - --- Effects - --- | An effect for explicitly returning out of a function/method body. -newtype Return value = Return { unReturn :: value } - deriving (Eq, Ord, Show) - -earlyReturn :: ( Member (Error (Return value)) sig - , Carrier sig m - ) - => value - -> Evaluator term address value m value -earlyReturn = throwError . Return - -catchReturn :: (Member (Error (Return value)) sig, Carrier sig m) - => Evaluator term address value m value - -> Evaluator term address value m value -catchReturn = flip catchError (\ (Return value) -> pure value) - -runReturn :: Carrier sig m - => Evaluator term address value (ErrorC (Return value) m) value - -> Evaluator term address value m value -runReturn = raiseHandler $ fmap (either unReturn id) . runError - - --- | Effects for control flow around loops (breaking and continuing). -data LoopControl value - = Break { unLoopControl :: value } - | Continue { unLoopControl :: value } - | Abort - deriving (Eq, Ord, Show) - -throwBreak :: (Member (Error (LoopControl value)) sig, Carrier sig m) - => value - -> Evaluator term address value m value -throwBreak = throwError . Break - -throwContinue :: (Member (Error (LoopControl value)) sig, Carrier sig m) - => value - -> Evaluator term address value m value -throwContinue = throwError . Continue - -throwAbort :: forall term address sig m value a . (Member (Error (LoopControl value)) sig, Carrier sig m) - => Evaluator term address value m a -throwAbort = throwError (Abort @value) - -catchLoopControl :: ( Member (Error (LoopControl value)) sig - , Carrier sig m - ) - => Evaluator term address value m a - -> (LoopControl value -> Evaluator term address value m a) - -> Evaluator term address value m a -catchLoopControl = catchError - -runLoopControl :: Carrier sig m - => Evaluator term address value (ErrorC (LoopControl value) m) value - -> Evaluator term address value m value -runLoopControl = raiseHandler $ fmap (either unLoopControl id) . runError diff --git a/src/Control/Abstract/Heap.hs b/src/Control/Abstract/Heap.hs deleted file mode 100644 index 93be10db82..0000000000 --- a/src/Control/Abstract/Heap.hs +++ /dev/null @@ -1,521 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingStrategies, GADTs, GeneralizedNewtypeDeriving, KindSignatures, RankNTypes, ScopedTypeVariables, TypeOperators, UndecidableInstances #-} -module Control.Abstract.Heap -( Heap -, HeapError(..) -, Slot(..) -, Position(..) -, Live -, getHeap -, putHeap -, putSlotDeclarationScope -, alloc -, dealloc -, maybeLookupDeclaration -, lookupSlot -, lookupDeclarationFrame -, deref -, assign -, newFrame -, CurrentFrame(..) -, currentFrame -, lookupFrame -, withScopeAndFrame -, withLexicalScopeAndFrame -, withChildFrame -, define -, withFrame --- * Garbage collection -, gc --- * Effects -, Allocator(..) -, Deref(..) -, runDeref -, DerefC(..) -, AddressError(..) -, runHeapError -, runAddressError -, runAddressErrorWith -, throwAddressError -, runHeapErrorWith -, throwHeapError -, insertFrameLink -, scopeLookup -) where - -import Control.Abstract.Context (withCurrentCallStack) -import Control.Abstract.Evaluator -import Control.Abstract.Roots -import Control.Abstract.ScopeGraph hiding (ScopeError (..)) -import Control.Abstract.ScopeGraph (ScopeError) -import Control.Applicative (Alternative) -import Control.Effect.Carrier -import Data.Abstract.BaseError -import Data.Abstract.Heap (Heap, Position (..)) -import qualified Data.Abstract.Heap as Heap -import Data.Abstract.Live -import Data.Abstract.Module (ModuleInfo) -import Data.Abstract.Name -import Data.Abstract.ScopeGraph (Kind(..), Path (..), Relation(..), putDeclarationScopeAtPosition) -import qualified Data.Map.Strict as Map -import Data.Span (Span, emptySpan) -import Prologue - - --- | Evaluates an action locally the scope and frame of the given frame address. -withScopeAndFrame :: ( Ord address - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (State (Heap address address value)) sig - , Carrier sig m - ) - => address - -> Evaluator term address value m a - -> Evaluator term address value m a -withScopeAndFrame address action = do - scope <- scopeLookup address - withScope scope (withFrame address action) - --- | Evaluates an action locally the scope and frame of the given frame address. -withLexicalScopeAndFrame :: ( Ord address - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Allocator address) sig - , Member Fresh sig - , Carrier sig m - ) - => Evaluator term address value m a - -> Evaluator term address value m a -withLexicalScopeAndFrame action = do - currentScope' <- currentScope - currentFrame' <- currentFrame - let (scopeEdges, frameEdges) = (Map.singleton Lexical [ currentScope' ], Map.singleton Lexical (Map.singleton currentScope' currentFrame')) - scope <- newScope scopeEdges - frame <- newFrame scope frameEdges - withScopeAndFrame frame action - --- | Lookup a scope address for a given frame address. -scopeLookup :: ( Ord address - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (State (Heap address address value)) sig - , Carrier sig m - ) - => address - -> Evaluator term address value m address -scopeLookup address = maybeM (throwHeapError (LookupAddressError address)) =<< Heap.scopeLookup address <$> getHeap - -getHeap :: (Member (State (Heap address address value)) sig, Carrier sig m) => Evaluator term address value m (Heap address address value) -getHeap = get - --- | Set the heap. -putHeap :: (Member (State (Heap address address value)) sig, Carrier sig m) => Heap address address value -> Evaluator term address value m () -putHeap = put - --- | Update the heap. -modifyHeap :: (Member (State (Heap address address value)) sig, Carrier sig m) => (Heap address address value -> Heap address address value) -> Evaluator term address value m () -modifyHeap = modify - -newtype CurrentFrame address = CurrentFrame { unCurrentFrame :: address } - --- | Retrieve the heap. -currentFrame :: ( Carrier sig m - , Member (Reader (CurrentFrame address)) sig - ) - => Evaluator term address value m address -currentFrame = asks unCurrentFrame - - --- | Inserts a new frame into the heap with the given scope and links. -newFrame :: ( Carrier sig m - , Member (Allocator address) sig - , Member Fresh sig - , Member (State (Heap address address value)) sig - , Ord address - ) - => address - -> Map EdgeLabel (Map address address) - -> Evaluator term address value m address -newFrame scope links = do - name <- gensym - address <- alloc name - modifyHeap (Heap.newFrame scope address links) - pure address - --- | Evaluates the action within the frame of the given frame address. -withFrame :: ( Carrier sig m - , Member (Reader (CurrentFrame address)) sig - ) - => address - -> Evaluator term address value m a -- Not sure about this `sig` here (substituting `sig` for `effects`) - -> Evaluator term address value m a -withFrame address = local (const (CurrentFrame address)) - --- | Define a declaration and assign the value of an action in the current frame. -define :: ( HasCallStack - , Member (Deref value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Ord address - , Carrier sig m - ) - => Declaration - -> Relation - -> AccessControl - -> Evaluator term address value m value - -> Evaluator term address value m () -define declaration rel accessControl def = withCurrentCallStack callStack $ do - -- TODO: This span is still wrong. - declare declaration rel accessControl emptySpan Unknown Nothing - slot <- lookupSlot declaration - value <- def - assign slot value - --- | Associate an empty child scope with a declaration and then locally evaluate the body within an associated frame. -withChildFrame :: ( Member (Allocator address) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member Fresh sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Ord address - , Carrier sig m - ) - => Declaration - -> (address -> Evaluator term address value m a) - -> Evaluator term address value m a -withChildFrame declaration body = do - scope <- newPreludeScope mempty - putDeclarationScope declaration scope - frame <- newFrame scope mempty - withScopeAndFrame frame (body frame) - --- | Dereference the given address in the heap, or fail if the address is uninitialized. -deref :: ( Member (Deref value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (AddressError address value))) sig - , Member (State (Heap address address value)) sig - , Ord address - , Carrier sig m - ) - => Slot address - -> Evaluator term address value m value -deref slot@Slot{..} = do - maybeSlotValue <- gets (Heap.getSlotValue slot) - slotValue <- maybeM (throwAddressError (UnallocatedSlot slot)) maybeSlotValue - eff <- send $ DerefCell slotValue pure - maybeM (throwAddressError $ UninitializedSlot slot) eff - -putSlotDeclarationScope :: ( Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Ord address - , Carrier sig m - ) - => Slot address - -> Maybe address - -> Evaluator term address value m () -putSlotDeclarationScope Slot{..} assocScope = do - scopeAddress <- scopeLookup frameAddress - modify (putDeclarationScopeAtPosition scopeAddress position assocScope) - - -maybeLookupDeclaration :: ( Carrier sig m - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Ord address - ) - => Declaration - -> Evaluator term address value m (Maybe (Slot address)) -maybeLookupDeclaration decl = do - path <- maybeLookupScopePath decl - case path of - Just path -> do - frameAddress <- lookupFrameAddress path - pure (Just (Slot frameAddress (Heap.pathPosition path))) - Nothing -> pure Nothing - -lookupSlot :: ( Carrier sig m - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Ord address - ) - => Declaration - -> Evaluator term address value m (Slot address) -lookupSlot decl = do - path <- lookupScopePath decl - frameAddress <- lookupFrameAddress path - pure (Slot frameAddress (Heap.pathPosition path)) - -lookupDeclarationFrame :: ( Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Ord address - , Carrier sig m - ) - => Declaration - -> Evaluator term address value m address -lookupDeclarationFrame decl = do - path <- lookupScopePath decl - lookupFrameAddress path - -lookupFrame :: ( Member (State (Heap address address value)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Ord address - , Carrier sig m - ) - => address - -> Evaluator term address value m (Heap.Frame address address value) -lookupFrame address = do - heap <- getHeap - maybeM (throwHeapError (LookupFrameError address)) (Heap.frameLookup address heap) - --- | Follow a path through the heap and return the frame address associated with the declaration. -lookupFrameAddress :: ( Member (State (Heap address address value)) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Ord address - , Carrier sig m - ) - => Path address - -> Evaluator term address value m address -lookupFrameAddress path = go path =<< currentFrame - where - go path address = case path of - Hole -> throwHeapError (LookupLinkError path) - DPath _ _ -> pure address - p@(EPath edge nextScopeAddress path') -> do - linkMap <- frameLinks address - let frameAddress = do - scopeMap <- Map.lookup edge linkMap - Map.lookup nextScopeAddress scopeMap - maybe (throwHeapError $ LookupLinkError p) (go path') frameAddress - -frameLinks :: ( Carrier sig m - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (State (Heap address address value)) sig - , Ord address - ) - => address - -> Evaluator term address value m (Map EdgeLabel (Map address address)) -- TODO: Change this to Map scope address -frameLinks address = maybeM (throwHeapError (LookupLinksError address)) . Heap.frameLinks address =<< getHeap - - -insertFrameLink :: ( Carrier sig m - , Member (Reader (CurrentFrame address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (State (Heap address address value)) sig - , Ord address - ) - => EdgeLabel - -> Map address address - -> Evaluator term address value m () -insertFrameLink label linkMap = do - frameAddress <- currentFrame - heap <- getHeap - currentFrame <- maybeM (throwHeapError (LookupFrameError frameAddress)) (Heap.frameLookup frameAddress heap) - let newCurrentFrame = currentFrame - { Heap.links = Map.alter (\val -> val <> Just linkMap) label (Heap.links currentFrame) } - modify (Heap.insertFrame frameAddress newCurrentFrame) - - --- | Write a value to the given frame address in the 'Heap'. -assign :: ( Member (Deref value) sig - , Member (State (Heap address address value)) sig - , Ord address - , Carrier sig m - ) - => Slot address - -> value - -> Evaluator term address value m () -assign addr value = do - heap <- getHeap - cell <- send (AssignCell value (fromMaybe lowerBound (Heap.getSlotValue addr heap)) pure) - putHeap (Heap.setSlot addr cell heap) - -dealloc :: ( Carrier sig m - , Member (State (Heap address address value)) sig - , Ord address - ) - => Slot address - -> Evaluator term address value m () -dealloc addr = modifyHeap (Heap.deleteSlot addr) - - --- Garbage collection - --- | Collect any addresses in the heap not rooted in or reachable from the given 'Live' set. -gc :: ( Member (State (Heap address address value)) sig - , Ord address - , Ord value - , ValueRoots address value - , Carrier sig m - ) - => Live address -- ^ The set of addresses to consider rooted. - -> Evaluator term address value m () -gc roots = modifyHeap (Heap.heapRestrict <*> reachable roots) - --- | Compute the set of addresses reachable from a given root set in a given heap. -reachable :: ( Ord address - , Ord value - , ValueRoots address value - ) - => Live address -- ^ The set of root addresses. - -> Heap address address value -- ^ The heap to trace addresses through. - -> Live address -- ^ The set of addresses reachable from the root set. -reachable roots heap = go mempty roots - where go seen set = case liveSplit set of - Nothing -> seen - Just (a, as) -> go (liveInsert a seen) $ case Heap.heapLookupAll a heap of - Just values -> liveDifference (foldr ((<>) . valueRoots) mempty values <> as) seen - _ -> seen - - --- Effects - -data Deref value (m :: * -> *) k - = DerefCell (Set value) (Maybe value -> k) - | AssignCell value (Set value) (Set value -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -runDeref :: Evaluator term address value (DerefC address value m) a - -> Evaluator term address value m a -runDeref = raiseHandler runDerefC - -newtype DerefC address value m a = DerefC { runDerefC :: m a } - deriving newtype (Alternative, Applicative, Functor, Monad) - - - -data HeapError address resume where - CurrentFrameError :: HeapError address address - LookupAddressError :: address -> HeapError address address - LookupFrameError :: address -> HeapError address (Heap.Frame address address value) - LookupLinksError :: address -> HeapError address (Map EdgeLabel (Map address address)) - LookupLinkError :: Path address -> HeapError address address - -deriving instance Eq address => Eq (HeapError address resume) -deriving instance Show address => Show (HeapError address resume) -instance Show address => Show1 (HeapError address) where - liftShowsPrec _ _ = showsPrec - -instance Eq address => Eq1 (HeapError address) where - liftEq _ CurrentFrameError CurrentFrameError = True - liftEq _ (LookupAddressError a) (LookupAddressError b) = a == b - liftEq _ (LookupLinksError a) (LookupLinksError b) = a == b - liftEq _ (LookupLinkError a) (LookupLinkError b) = a == b - liftEq _ (LookupFrameError a) (LookupFrameError b) = a == b - liftEq _ _ _ = False - -instance NFData address => NFData1 (HeapError address) where - liftRnf _ x = case x of - CurrentFrameError -> () - LookupAddressError a -> rnf a - LookupFrameError a -> a `seq` () - LookupLinksError a -> rnf a - LookupLinkError p -> rnf p - -instance (NFData address, NFData resume) => NFData (HeapError address resume) where - rnf = liftRnf rnf - -throwHeapError :: ( Member (Resumable (BaseError (HeapError address))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Carrier sig m - ) - => HeapError address resume - -> Evaluator term address value m resume -throwHeapError = throwBaseError - -runHeapError :: Evaluator term address value (ResumableC (BaseError (HeapError address)) m) a - -> Evaluator term address value m (Either (SomeError (BaseError (HeapError address))) a) -runHeapError = raiseHandler runResumable - -runHeapErrorWith :: (forall resume. (BaseError (HeapError address)) resume -> Evaluator term address value m resume) - -> Evaluator term address value (ResumableWithC (BaseError (HeapError address)) m) a - -> Evaluator term address value m a -runHeapErrorWith f = raiseHandler $ runResumableWith (runEvaluator . f) - -data AddressError address value resume where - UnallocatedSlot :: Slot address -> AddressError address value (Set value) - UninitializedSlot :: Slot address -> AddressError address value value - -instance (NFData address) => NFData1 (AddressError address value) where - liftRnf _ x = case x of - UnallocatedSlot a -> rnf a - UninitializedSlot a -> rnf a - -instance (NFData address, NFData resume) => NFData (AddressError address value resume) where - rnf = liftRnf rnf - -deriving instance Eq address => Eq (AddressError address value resume) -deriving instance Show address => Show (AddressError address value resume) -instance Show address => Show1 (AddressError address value) where - liftShowsPrec _ _ = showsPrec -instance Eq address => Eq1 (AddressError address value) where - liftEq _ (UninitializedSlot a) (UninitializedSlot b) = a == b - liftEq _ (UnallocatedSlot a) (UnallocatedSlot b) = a == b - liftEq _ _ _ = False - -throwAddressError :: ( Member (Resumable (BaseError (AddressError address body))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Carrier sig m - ) - => AddressError address body resume - -> Evaluator term address value m resume -throwAddressError = throwBaseError - -runAddressError :: Evaluator term address value (ResumableC (BaseError (AddressError address value)) m) a - -> Evaluator term address value m (Either (SomeError (BaseError (AddressError address value))) a) -runAddressError = raiseHandler runResumable - -runAddressErrorWith :: (forall resume . (BaseError (AddressError address value)) resume -> Evaluator term address value m resume) - -> Evaluator term address value (ResumableWithC (BaseError (AddressError address value)) m) a - -> Evaluator term address value m a -runAddressErrorWith f = raiseHandler $ runResumableWith (runEvaluator . f) diff --git a/src/Control/Abstract/Hole.hs b/src/Control/Abstract/Hole.hs deleted file mode 100644 index 8ea724d2d1..0000000000 --- a/src/Control/Abstract/Hole.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Control.Abstract.Hole - ( AbstractHole (..) - ) where - -class AbstractHole a where - hole :: a diff --git a/src/Control/Abstract/Modules.hs b/src/Control/Abstract/Modules.hs deleted file mode 100644 index 33c22cf54e..0000000000 --- a/src/Control/Abstract/Modules.hs +++ /dev/null @@ -1,170 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingStrategies, GADTs, GeneralizedNewtypeDeriving, KindSignatures, RankNTypes, ScopedTypeVariables, TypeOperators, UndecidableInstances #-} -module Control.Abstract.Modules -( ModuleResult -, lookupModule -, resolve -, listModulesInDir -, require -, load -, Modules(..) -, runModules -, LoadError(..) -, runLoadError -, runLoadErrorWith -, throwLoadError -, ResolutionError(..) -, runResolutionError -, runResolutionErrorWith -, throwResolutionError -, ModuleTable -) where - -import Control.Abstract.Evaluator -import Control.Effect.Carrier -import Control.Effect.Sum -import Data.Abstract.BaseError -import Data.Abstract.Module -import Data.Abstract.ModuleTable as ModuleTable -import Data.Language -import qualified Data.Set as Set -import Data.Span -import Prologue -import System.FilePath.Posix (takeDirectory) - --- A scope address, frame address, and value ref. -type ModuleResult address value = ((address, address), value) - --- | Retrieve an evaluated module, if any. @Nothing@ means we’ve never tried to load it, and @Just (env, value)@ indicates the result of a completed load. -lookupModule :: (Member (Modules address value) sig, Carrier sig m) => ModulePath -> Evaluator term address value m (Maybe (ModuleResult address value)) -lookupModule = sendModules . flip Lookup pure - --- | Resolve a list of module paths to a possible module table entry. -resolve :: (Member (Modules address value) sig, Carrier sig m) => [FilePath] -> Evaluator term address value m (Maybe ModulePath) -resolve = sendModules . flip Resolve pure - -listModulesInDir :: (Member (Modules address value) sig, Carrier sig m) => FilePath -> Evaluator term address value m [ModulePath] -listModulesInDir = sendModules . flip List pure - - --- | Require/import another module by name and return its environment and value. --- --- Looks up the module's name in the cache of evaluated modules first, returns if found, otherwise loads/evaluates the module. -require :: (Member (Modules address value) sig, Carrier sig m) => ModulePath -> Evaluator term address value m (ModuleResult address value) -require path = lookupModule path >>= maybeM (load path) - --- | Load another module by name and return its environment and value. --- --- Always loads/evaluates. -load :: (Member (Modules address value) sig, Carrier sig m) => ModulePath -> Evaluator term address value m (ModuleResult address value) -load path = sendModules (Load path pure) - - -data Modules address value (m :: * -> *) k - = Load ModulePath (ModuleResult address value -> k) - | Lookup ModulePath (Maybe (ModuleResult address value) -> k) - | Resolve [FilePath] (Maybe ModulePath -> k) - | List FilePath ([ModulePath] -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - - -sendModules :: ( Member (Modules address value) sig - , Carrier sig m) - => Modules address value (Evaluator term address value m) (Evaluator term address value m return) - -> Evaluator term address value m return -sendModules = send - -runModules :: Set ModulePath - -> Evaluator term address value (ModulesC address value m) a - -> Evaluator term address value m a -runModules paths = raiseHandler (runReader paths . runModulesC) - -newtype ModulesC address value m a = ModulesC { runModulesC :: ReaderC (Set ModulePath) m a } - deriving newtype (Alternative, Applicative, Functor, Monad, MonadIO) - -instance ( Member (Reader (ModuleTable (Module (ModuleResult address value)))) sig - , Member (Resumable (BaseError (LoadError address value))) sig - , Carrier sig m - ) - => Carrier (Modules address value :+: sig) (ModulesC address value m) where - eff (L op) = do - paths <- ModulesC ask - case op of - Load name k -> askModuleTable >>= maybeM (throwLoadError (ModuleNotFoundError name)) . fmap moduleBody . ModuleTable.lookup name >>= k - Lookup path k -> askModuleTable >>= k . fmap moduleBody . ModuleTable.lookup path - Resolve names k -> k (find (`Set.member` paths) names) - List dir k -> k (filter ((dir ==) . takeDirectory) (toList paths)) - eff (R other) = ModulesC (eff (R (handleCoercible other))) - -askModuleTable :: (Member (Reader (ModuleTable (Module (ModuleResult address value)))) sig, Carrier sig m) => m (ModuleTable (Module (ModuleResult address value))) -askModuleTable = ask - - --- | An error thrown when loading a module from the list of provided modules. Indicates we weren't able to find a module with the given name. -data LoadError address value resume where - ModuleNotFoundError :: ModulePath -> LoadError address value (ModuleResult address value) - -deriving instance Eq (LoadError address value resume) -deriving instance Show (LoadError address value resume) -instance Show1 (LoadError address value) where - liftShowsPrec _ _ = showsPrec -instance Eq1 (LoadError address value) where - liftEq _ (ModuleNotFoundError a) (ModuleNotFoundError b) = a == b - -instance NFData1 (LoadError address value) where - liftRnf _ (ModuleNotFoundError p) = rnf p - -runLoadError :: Evaluator term address value (ResumableC (BaseError (LoadError address value)) m) a - -> Evaluator term address value m (Either (SomeError (BaseError (LoadError address value))) a) -runLoadError = raiseHandler runResumable - -runLoadErrorWith :: (forall resume . (BaseError (LoadError address value)) resume -> Evaluator term address value m resume) - -> Evaluator term address value (ResumableWithC (BaseError (LoadError address value)) m) a - -> Evaluator term address value m a -runLoadErrorWith f = raiseHandler $ runResumableWith (runEvaluator . f) - -throwLoadError :: (Member (Resumable (BaseError (LoadError address value))) sig, Carrier sig m) - => LoadError address value resume - -> m resume -throwLoadError err@(ModuleNotFoundError name) = throwResumable $ BaseError (ModuleInfo name Unknown mempty) emptySpan err --- TODO: Might be able to get rest of ModuleInfo from the env ^. - - --- | An error thrown when we can't resolve a module from a qualified name. -data ResolutionError resume where - NotFoundError :: String -- The path that was not found. - -> [String] -- List of paths searched that shows where semantic looked for this module. - -> Language -- Language. - -> ResolutionError ModulePath - - GoImportError :: FilePath -> ResolutionError [ModulePath] - -deriving instance Eq (ResolutionError b) -deriving instance Show (ResolutionError b) -instance Show1 ResolutionError where liftShowsPrec _ _ = showsPrec -instance Eq1 ResolutionError where - liftEq _ (NotFoundError a _ l1) (NotFoundError b _ l2) = a == b && l1 == l2 - liftEq _ (GoImportError a) (GoImportError b) = a == b - liftEq _ _ _ = False -instance NFData1 ResolutionError where - liftRnf _ x = case x of - NotFoundError p ps l -> rnf p `seq` rnf ps `seq` rnf l - GoImportError p -> rnf p - -runResolutionError :: Evaluator term address value (ResumableC (BaseError ResolutionError) m) a - -> Evaluator term address value m (Either (SomeError (BaseError ResolutionError)) a) -runResolutionError = raiseHandler runResumable - -runResolutionErrorWith :: (forall resume . (BaseError ResolutionError) resume -> Evaluator term address value m resume) - -> Evaluator term address value (ResumableWithC (BaseError ResolutionError) m) a - -> Evaluator term address value m a -runResolutionErrorWith f = raiseHandler $ runResumableWith (runEvaluator . f) - -throwResolutionError :: ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Carrier sig m - ) - => ResolutionError resume - -> Evaluator term address value m resume -throwResolutionError = throwBaseError diff --git a/src/Control/Abstract/Primitive.hs b/src/Control/Abstract/Primitive.hs deleted file mode 100644 index cbfc49e670..0000000000 --- a/src/Control/Abstract/Primitive.hs +++ /dev/null @@ -1,114 +0,0 @@ -{-# LANGUAGE TupleSections #-} -module Control.Abstract.Primitive - ( defineClass - , defineNamespace - , defineBuiltIn - ) where - -import Control.Abstract.Context -import Control.Abstract.Evaluator -import Control.Abstract.Heap -import Control.Abstract.ScopeGraph -import Control.Abstract.Value -import Data.Abstract.BaseError -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.Abstract.Name -import Data.Map.Strict as Map -import Data.Span -import Prologue - -defineBuiltIn :: ( HasCallStack - , Member (Deref value) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Function term address value) sig - , Member (Allocator address) sig - , Member Fresh sig - , Ord address - , Carrier sig m - ) - => Declaration - -> Relation - -> AccessControl - -> BuiltIn - -> Evaluator term address value m () -defineBuiltIn declaration rel accessControl value = withCurrentCallStack callStack $ do - currentScope' <- currentScope - let lexicalEdges = Map.singleton Lexical [ currentScope' ] - associatedScope <- newPreludeScope lexicalEdges - -- TODO: This span is still wrong. - declare declaration rel accessControl emptySpan ScopeGraph.Unknown (Just associatedScope) - - withScope associatedScope $ do - param <- gensym - declare (Declaration param) ScopeGraph.Gensym accessControl emptySpan ScopeGraph.Unknown Nothing - - slot <- lookupSlot declaration - value <- builtIn associatedScope value - assign slot value - -defineClass :: ( Carrier sig m - , HasCallStack - , Member (Allocator address) sig - , Member (Deref value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member Fresh sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member (Unit value) sig - , Ord address - ) - => Declaration - -> [Declaration] - -> Evaluator term address value m a - -> Evaluator term address value m () -defineClass declaration superclasses body = void . define declaration Default Public $ do - currentScope' <- currentScope - - superScopes <- for superclasses associatedScope - - let superclassEdges = (Superclass, ) <$> (fmap pure . catMaybes $ superScopes) - current = fmap (Lexical, ) . pure . pure $ currentScope' - edges = Map.fromList (superclassEdges <> current) - childScope <- newPreludeScope edges - putDeclarationScope declaration childScope - - withScope childScope $ do - void body - - unit - -defineNamespace :: ( AbstractValue term address value m - , Carrier sig m - , HasCallStack - , Member (Allocator address) sig - , Member (Deref value) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member Fresh sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Ord address - ) - => Declaration - -> Evaluator term address value m a - -> Evaluator term address value m () -defineNamespace declaration@Declaration{..} body = void . define declaration Default Public $ do - withChildFrame declaration $ \frame -> do - _ <- body - namespace unDeclaration frame diff --git a/src/Control/Abstract/PythonPackage.hs b/src/Control/Abstract/PythonPackage.hs deleted file mode 100644 index dd95149073..0000000000 --- a/src/Control/Abstract/PythonPackage.hs +++ /dev/null @@ -1,59 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, UndecidableInstances #-} -module Control.Abstract.PythonPackage -( runPythonPackaging, Strategy(..) ) where - -import Control.Abstract as Abstract -import Control.Effect.Carrier -import Control.Effect.Sum -import Data.Abstract.Name (name) -import Data.Abstract.Path (stripQuotes) -import Data.Abstract.Value.Concrete (Value (..)) -import qualified Data.Map as Map -import Prologue - -data Strategy = Unknown | Packages [Text] | FindPackages [Text] - deriving (Show, Eq) - -runPythonPackaging :: Evaluator term address (Value term address) (PythonPackagingC term address m) a - -> Evaluator term address (Value term address) m a -runPythonPackaging = raiseHandler runPythonPackagingC - - -newtype PythonPackagingC term address m a = PythonPackagingC { runPythonPackagingC :: m a } - deriving (Applicative, Functor, Monad) - -wrap :: Evaluator term address (Value term address) m a -> PythonPackagingC term address m a -wrap = PythonPackagingC . runEvaluator - -instance ( Carrier sig m - , Member (Function term address (Value term address)) sig - , Member (State Strategy) sig - , Member (Abstract.String (Value term address)) sig - , Member (Abstract.Array (Value term address)) sig - ) - => Carrier sig (PythonPackagingC term address m) where - eff op - | Just e <- prj op = wrap $ case handleCoercible e of - Call callName params k -> Evaluator . k =<< do - case callName of - Closure _ _ name' _ paramNames _ _ _ -> do - let bindings = foldr (uncurry Map.insert) lowerBound (zip paramNames params) - let asStrings = asArray >=> traverse asString - - if Just (name "find_packages") == name' then do - as <- maybe (pure mempty) (fmap (fmap stripQuotes) . asStrings) (Map.lookup (name "exclude") bindings) - put (FindPackages as) - else if Just (name "setup") == name' then do - packageState <- get - if packageState == Control.Abstract.PythonPackage.Unknown then do - as <- maybe (pure mempty) (fmap (fmap stripQuotes) . asStrings) (Map.lookup (name "packages") bindings) - put (Packages as) - else - pure () - else pure () - _ -> pure () - call callName params - Function name params body scope k -> function name params body scope >>= Evaluator . k - BuiltIn n b k -> builtIn n b >>= Evaluator . k - Bind obj value k -> bindThis obj value >>= Evaluator . k - | otherwise = PythonPackagingC . eff $ handleCoercible op diff --git a/src/Control/Abstract/Roots.hs b/src/Control/Abstract/Roots.hs deleted file mode 100644 index 20ea02ed15..0000000000 --- a/src/Control/Abstract/Roots.hs +++ /dev/null @@ -1,22 +0,0 @@ -module Control.Abstract.Roots -( ValueRoots(..) -, Live -, askRoots -, extraRoots -) where - -import Control.Abstract.Evaluator -import Data.Abstract.Live - --- | Value types, e.g. closures, which can root a set of addresses. -class ValueRoots address value where - -- | Compute the set of addresses rooted by a given value. - valueRoots :: value -> Live address - --- | Retrieve the local 'Live' set. -askRoots :: (Member (Reader (Live address)) sig, Carrier sig m) => Evaluator term address value m (Live address) -askRoots = ask - --- | Run a computation with the given 'Live' set added to the local root set. -extraRoots :: (Member (Reader (Live address)) sig, Carrier sig m, Ord address) => Live address -> Evaluator term address value m a -> Evaluator term address value m a -extraRoots roots = local (<> roots) diff --git a/src/Control/Abstract/ScopeGraph.hs b/src/Control/Abstract/ScopeGraph.hs deleted file mode 100644 index 330ff03b52..0000000000 --- a/src/Control/Abstract/ScopeGraph.hs +++ /dev/null @@ -1,400 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingStrategies, GADTs, GeneralizedNewtypeDeriving, KindSignatures, RankNTypes, ScopedTypeVariables, TypeOperators, UndecidableInstances #-} -module Control.Abstract.ScopeGraph - ( lookup - , declare - , declareMaybeName - , reference - , newScope - , newPreludeScope - , Declaration(..) - , ScopeGraph - , ScopeError(..) - , Reference(..) - , Relation(..) - , EdgeLabel(..) - , CurrentScope(..) - , Info(..) - , AccessControl(..) - , currentScope - , insertExportEdge - , insertImportEdge - , insertLexicalEdge - , withScope - , associatedScope - , declarationByName - , declarationsByAccessControl - , declarationsByRelation - , putDeclarationScope - , putDeclarationSpan - , insertImportReference - , lookupScopePath - , maybeLookupScopePath - , lookupDeclarationScope - , lookupScope - , Allocator(..) - , AllocatorC(..) - , runAllocator - , alloc - , Slot(..) - , runScopeErrorWith - , runScopeError - , throwScopeError - , Scope - , ScopeGraph.Path - ) where - -import Control.Abstract.Evaluator hiding (Local) -import Control.Effect.Carrier -import Data.Abstract.BaseError -import Data.Abstract.Module -import Data.Abstract.Name hiding (name) -import Data.Abstract.ScopeGraph (Kind, Declaration(..), EdgeLabel, Reference, Relation(..), Scope (..), ScopeGraph, Slot(..), Info(..), AccessControl(..)) -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.Span -import Prelude hiding (lookup) -import Prologue - -lookup :: ( Ord address - , Member (State (ScopeGraph address)) sig - , Carrier sig m) - => Reference - -> Evaluator term address value m (Maybe address) -lookup ref = ScopeGraph.scopeOfRef ref <$> get - -declare :: ( Carrier sig m - , Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Ord address - ) - => Declaration - -> Relation - -> AccessControl - -> Span - -> Kind - -> Maybe address - -> Evaluator term address value m () -declare decl rel accessControl span kind scope = do - currentAddress <- currentScope - moduleInfo <- ask @ModuleInfo - modify (fst . ScopeGraph.declare decl moduleInfo rel accessControl span kind scope currentAddress) - --- | If the provided name is 'Nothing' we want to reflect that the declaration's name was a generated name (gensym). --- We use the 'Gensym' relation to indicate that. Otherwise, we use the provided 'relation'. -declareMaybeName :: ( Carrier sig m - , Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member Fresh sig - , Ord address - ) - => Maybe Name - -> Relation - -> AccessControl - -> Span - -> Kind - -> Maybe address - -> Evaluator term address value m Name -declareMaybeName maybeName relation ac span kind scope = do - case maybeName of - Just name -> declare (Declaration name) relation ac span kind scope >> pure name - _ -> gensym >>= \name -> declare (Declaration name) Gensym ac span kind scope >> pure name - -putDeclarationScope :: ( Ord address - , Member (Reader (CurrentScope address)) sig - , Member (State (ScopeGraph address)) sig - , Carrier sig m - ) - => Declaration - -> address - -> Evaluator term address value m () -putDeclarationScope decl assocScope = do - currentAddress <- currentScope - modify (ScopeGraph.insertDeclarationScope decl assocScope currentAddress) - -putDeclarationSpan :: forall address sig m term value . - ( Ord address - , Member (State (ScopeGraph address)) sig - , Carrier sig m - ) - => Declaration - -> Span - -> Evaluator term address value m () -putDeclarationSpan decl = modify @(ScopeGraph address) . ScopeGraph.insertDeclarationSpan decl - -reference :: forall address sig m term value . - ( Ord address - , Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Carrier sig m - ) - => Reference - -> Span - -> Kind - -> Declaration - -> Evaluator term address value m () -reference ref span kind decl = do - currentAddress <- currentScope - moduleInfo <- ask @ModuleInfo - modify @(ScopeGraph address) (ScopeGraph.reference ref moduleInfo span kind decl currentAddress) - --- | Combinator to insert an export edge from the current scope to the provided scope address. -insertExportEdge :: (Member (Reader (CurrentScope scopeAddress)) sig, Member (State (ScopeGraph scopeAddress)) sig, Carrier sig m, Ord scopeAddress) - => scopeAddress - -> Evaluator term scopeAddress value m () -insertExportEdge = insertEdge ScopeGraph.Export - --- | Combinator to insert an import edge from the current scope to the provided scope address. -insertImportEdge :: (Member (Reader (CurrentScope scopeAddress)) sig, Member (State (ScopeGraph scopeAddress)) sig, Carrier sig m, Ord scopeAddress) - => scopeAddress - -> Evaluator term scopeAddress value m () -insertImportEdge = insertEdge ScopeGraph.Import - --- | Combinator to insert a lexical edge from the current scope to the provided scope address. -insertLexicalEdge :: (Member (Reader (CurrentScope scopeAddress)) sig, Member (State (ScopeGraph scopeAddress)) sig, Carrier sig m, Ord scopeAddress) - => scopeAddress - -> Evaluator term scopeAddress value m () -insertLexicalEdge = insertEdge ScopeGraph.Lexical - -insertEdge :: ( Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentScope address)) sig - , Carrier sig m - , Ord address) - => EdgeLabel - -> address - -> Evaluator term address value m () -insertEdge label target = do - currentAddress <- currentScope - modify (ScopeGraph.insertEdge label target currentAddress) - --- | Inserts a new scope into the scope graph with the given edges. -newScope :: ( Member (Allocator address) sig - , Member (State (ScopeGraph address)) sig - , Member Fresh sig - , Carrier sig m - , Ord address - ) - => Map EdgeLabel [address] - -> Evaluator term address value m address -newScope edges = do - -- Take the edges and construct a new scope - name <- gensym - address <- alloc name - address <$ modify (ScopeGraph.newScope address edges) - --- | Inserts a new scope into the scope graph with the given edges. -newPreludeScope :: ( Member (Allocator address) sig - , Member (State (ScopeGraph address)) sig - , Member Fresh sig - , Carrier sig m - , Ord address - ) - => Map EdgeLabel [address] - -> Evaluator term address value m address -newPreludeScope edges = do - -- Take the edges and construct a new scope - name <- gensym - address <- alloc name - address <$ modify (ScopeGraph.newPreludeScope address edges) - -newtype CurrentScope address = CurrentScope { unCurrentScope :: address } - -currentScope :: ( Carrier sig m - , Member (Reader (CurrentScope address)) sig - ) - => Evaluator term address value m address -currentScope = asks unCurrentScope - -lookupScope :: ( Member (Resumable (BaseError (ScopeError address))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (State (ScopeGraph address)) sig - , Carrier sig m - , Ord address - ) - => address - -> Evaluator term address value m (Scope address) -lookupScope address = maybeM (throwScopeError LookupScopeError) . ScopeGraph.lookupScope address =<< get - -declarationsByRelation :: ( Member (State (ScopeGraph address)) sig - , Carrier sig m - , Ord address - ) - => address - -> Relation - -> Evaluator term address value m [ Info address ] -declarationsByRelation scope relation = ScopeGraph.declarationsByRelation scope relation <$> get - -declarationByName :: ( Member (Resumable (BaseError (ScopeError address))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (State (ScopeGraph address)) sig - , Carrier sig m - , Ord address - ) - => address - -> Declaration - -> Evaluator term address value m (Info address) -declarationByName scope name = do - scopeGraph <- get - maybeM (throwScopeError $ DeclarationByNameError name) (ScopeGraph.declarationByName scope name scopeGraph) - -declarationsByAccessControl :: ( Member (State (ScopeGraph address)) sig - , Carrier sig m - , Ord address - ) - => address - -> AccessControl - -> Evaluator term address value m [ Info address ] -declarationsByAccessControl scopeAddress accessControl = ScopeGraph.declarationsByAccessControl scopeAddress accessControl <$> get - -insertImportReference :: ( Member (Resumable (BaseError (ScopeError address))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentScope address)) sig - , Carrier sig m - , Ord address - ) - => Reference - -> Span - -> Kind - -> Declaration - -> address - -> Evaluator term address value m () -insertImportReference ref span kind decl scopeAddress = do - scopeGraph <- get - scope <- lookupScope scopeAddress - currentAddress <- currentScope - moduleInfo <- ask @ModuleInfo - newScope <- maybeM (throwScopeError ImportReferenceError) (ScopeGraph.insertImportReference ref moduleInfo span kind decl currentAddress scopeGraph scope) - insertScope scopeAddress newScope - -insertScope :: ( Member (State (ScopeGraph address)) sig - , Carrier sig m - , Ord address - ) - => address - -> Scope address - -> Evaluator term address value m () -insertScope scopeAddress scope = modify (ScopeGraph.insertScope scopeAddress scope) - -maybeLookupScopePath :: ( Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentScope address)) sig - , Carrier sig m - , Ord address - ) - => Declaration - -> Evaluator term address value m (Maybe (ScopeGraph.Path address)) -maybeLookupScopePath Declaration{..} = do - currentAddress <- currentScope - gets (ScopeGraph.lookupScopePath unDeclaration currentAddress) - -lookupScopePath :: ( Member (Resumable (BaseError (ScopeError address))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentScope address)) sig - , Carrier sig m - , Ord address - ) - => Declaration - -> Evaluator term address value m (ScopeGraph.Path address) -lookupScopePath decl@Declaration{..} = do - currentAddress <- currentScope - scopeGraph <- get - maybeM (throwScopeError $ LookupPathError decl) (ScopeGraph.lookupScopePath unDeclaration currentAddress scopeGraph) - -lookupDeclarationScope :: ( Member (Resumable (BaseError (ScopeError address))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentScope address)) sig - , Carrier sig m - , Ord address - ) - => Declaration - -> Evaluator term address value m address -lookupDeclarationScope decl = do - path <- lookupScopePath decl - currentScope' <- currentScope - maybeM (throwScopeError $ LookupDeclarationScopeError decl) (ScopeGraph.pathDeclarationScope currentScope' path) - -associatedScope :: (Ord address, Member (State (ScopeGraph address)) sig, Carrier sig m) => Declaration -> Evaluator term address value m (Maybe address) -associatedScope decl = ScopeGraph.associatedScope decl <$> get - -withScope :: ( Carrier sig m - , Member (Reader (CurrentScope address)) sig - ) - => address - -> Evaluator term address value m a - -> Evaluator term address value m a -withScope scope = local (const (CurrentScope scope)) - -throwScopeError :: ( Member (Resumable (BaseError (ScopeError address))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Carrier sig m - ) - => ScopeError address resume - -> Evaluator term address value m resume -throwScopeError = throwBaseError - -data ScopeError address return where - ScopeError :: Declaration -> Span -> ScopeError address (Slot address) - LookupScopeError :: ScopeError address (Scope address) - ImportReferenceError :: ScopeError address (Scope address) - LookupPathError :: Declaration -> ScopeError address (ScopeGraph.Path address) - LookupDeclarationScopeError :: Declaration -> ScopeError address address - DeclarationByNameError :: Declaration -> ScopeError address (Info address) - CurrentScopeError :: ScopeError address address - -deriving instance Eq (ScopeError address return) -deriving instance Show (ScopeError address return) -instance Show address => Show1 (ScopeError address) where liftShowsPrec _ _ = showsPrec -instance Eq1 (ScopeError address) where - liftEq _ (ScopeError m1 n1) (ScopeError m2 n2) = m1 == m2 && n1 == n2 - liftEq _ LookupScopeError LookupScopeError = True - liftEq _ ImportReferenceError ImportReferenceError = True - liftEq _ (LookupPathError decl1) (LookupPathError decl2) = decl1 == decl2 - liftEq _ (LookupDeclarationScopeError decl1) (LookupDeclarationScopeError decl2) = decl1 == decl2 - liftEq _ CurrentScopeError CurrentScopeError = True - liftEq _ _ _ = False - -instance NFData1 (ScopeError address) where - liftRnf _ x = case x of - DeclarationByNameError n -> rnf n - ScopeError d s -> rnf d `seq` rnf s - LookupScopeError -> () - ImportReferenceError -> () - LookupPathError d -> rnf d - LookupDeclarationScopeError d -> rnf d - CurrentScopeError -> () - -instance NFData return => NFData (ScopeError address return) where - rnf = liftRnf rnf - -alloc :: (Member (Allocator address) sig, Carrier sig m) => Name -> Evaluator term address value m address -alloc = send . flip Alloc pure - -data Allocator address (m :: * -> *) k - = Alloc Name (address -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -runAllocator :: Evaluator term address value (AllocatorC address m) a - -> Evaluator term address value m a -runAllocator = raiseHandler runAllocatorC - -newtype AllocatorC address m a = AllocatorC { runAllocatorC :: m a } - deriving newtype (Alternative, Applicative, Functor, Monad) - -runScopeErrorWith :: (forall resume . BaseError (ScopeError address) resume -> Evaluator term address value m resume) - -> Evaluator term address value (ResumableWithC (BaseError (ScopeError address)) m) a - -> Evaluator term address value m a -runScopeErrorWith f = raiseHandler $ runResumableWith (runEvaluator . f) - -runScopeError :: Evaluator term address value (ResumableC (BaseError (ScopeError address)) m) a - -> Evaluator term address value m (Either (SomeError (BaseError (ScopeError address))) a) -runScopeError = raiseHandler runResumable diff --git a/src/Control/Abstract/Value.hs b/src/Control/Abstract/Value.hs deleted file mode 100644 index 07db76783c..0000000000 --- a/src/Control/Abstract/Value.hs +++ /dev/null @@ -1,454 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingStrategies, GADTs, GeneralizedNewtypeDeriving, KindSignatures, Rank2Types, ScopedTypeVariables, TypeOperators #-} -module Control.Abstract.Value -( AbstractValue(..) -, AbstractIntro(..) -, Comparator(..) --- * Domain effects --- $domainEffects -, function -, BuiltIn(..) -, bindThis -, builtIn -, call -, Function(..) -, runFunction -, FunctionC(..) -, boolean -, asBool -, ifthenelse -, Boolean(..) -, runBoolean -, BooleanC(..) -, while -, doWhile -, forLoop -, While(..) -, runWhile -, WhileC(..) -, unit -, Unit(..) -, runUnit -, UnitC(..) -, string -, asString -, String(..) -, StringC(..) -, runString -, integer -, float -, rational -, liftNumeric -, liftNumeric2 -, Numeric(..) -, NumericC(..) -, object -, scopedEnvironment -, klass -, Object(..) -, ObjectC(..) -, runObject -, runNumeric -, castToInteger -, liftBitwise -, liftBitwise2 -, unsignedRShift -, Bitwise(..) -, BitwiseC(..) -, runBitwise -, array -, asArray -, Array(..) -, ArrayC(..) -, runArray -, hash -, kvPair -, Hash(..) -, runHash -, HashC(..) -) where - -import Control.Abstract.Evaluator -import Control.Abstract.Heap -import Control.Abstract.ScopeGraph (Allocator, CurrentScope, Declaration, ScopeGraph) -import Control.Effect.Carrier -import Data.Abstract.BaseError -import Data.Abstract.Module -import Data.Abstract.Name -import Data.Abstract.Number (Number, SomeNumber) -import Data.Scientific (Scientific) -import Data.Span -import Prelude hiding (String) -import Prologue hiding (TypeError, hash) - --- | This datum is passed into liftComparison to handle the fact that Ruby and PHP --- have built-in generalized-comparison ("spaceship") operators. If you want to --- encapsulate a traditional, boolean-returning operator, wrap it in 'Concrete'; --- if you want the generalized comparator, pass in 'Generalized'. In 'AbstractValue' --- instances, you can then then handle the different cases to return different --- types, if that's what you need. -data Comparator - = Concrete (forall a . Ord a => a -> a -> Bool) - | Generalized - --- Domain effects - --- $domainEffects --- Value effects are effects modelling the /introduction/ & /elimination/ of some specific kind of value. --- --- Modelling each of these as effects has several advantages∷ --- --- * It is strictly more flexible than modelling them as methods in a typeclass, as effect list–indexed typeclasses must be constrained at every list of effects at which they can be applied, whereas effect membership constraints can be deduced recursively (i.e. if @X@ is constrained to be a member of @effects@, it is automatically deducible that it is also a member of @Y \': effects@). --- * It offers us the potential of specializing the handlers on a language-by-language basis without the need for extra type parameters (albeit at the cost of automatic selection). --- * It offers us the potential of fine-grained specialization of the abstract domain, enabling convenient, piecemeal customization of the domain, and even semi-abstract domains. --- * Finally, it should eventually allow us to customize _which_ value effects are available for a given language; e.g. a language without OO features would not require OO value effects. (This would also rely on 'Evaluatable' instances being able to specify membership constraints, which is not currently possible.) --- --- In the concrete domain, introductions & eliminations respectively construct & pattern match against values, while in abstract domains they respectively construct & project finite sets of discrete observations of abstract values. For example, an abstract domain modelling integers as a sign (-, 0, or +) would introduce abstract values by mapping integers to their sign and eliminate them by mapping signs back to some canonical integer, e.g. - -> -1, 0 -> 0, + -> 1. - -function :: (Member (Function term address value) sig, Carrier sig m) => Name -> [Name] -> term -> address -> Evaluator term address value m value -function name params body scope = sendFunction (Function name params body scope pure) - -data BuiltIn - = Print - | Show - deriving (Eq, Ord, Show, Generic, NFData) - -builtIn :: (Member (Function term address value) sig, Carrier sig m) => address -> BuiltIn -> Evaluator term address value m value -builtIn address = sendFunction . flip (BuiltIn address) pure - -call :: (Member (Function term address value) sig, Carrier sig m) => value -> [value] -> Evaluator term address value m value -call fn args = sendFunction (Call fn args pure) - -sendFunction :: (Member (Function term address value) sig, Carrier sig m) => Function term address value (Evaluator term address value m) (Evaluator term address value m a) -> Evaluator term address value m a -sendFunction = send - -bindThis :: (Member (Function term address value) sig, Carrier sig m) => value -> value -> Evaluator term address value m value -bindThis this that = sendFunction (Bind this that pure) - -data Function term address value (m :: * -> *) k - = Function Name [Name] term address (value -> k) -- ^ A function is parameterized by its name, parameter names, body, parent scope, and returns a ValueRef. - | BuiltIn address BuiltIn (value -> k) -- ^ A built-in is parameterized by its parent scope, BuiltIn type, and returns a value. - | Call value [value] (value -> k) -- ^ A Call takes a set of values as parameters and returns a ValueRef. - | Bind value value (value -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - - -runFunction :: (term -> Evaluator term address value (FunctionC term address value m) value) - -> Evaluator term address value (FunctionC term address value m) a - -> Evaluator term address value m a -runFunction eval = raiseHandler (runReader (runEvaluator . eval) . runFunctionC) - -newtype FunctionC term address value m a = FunctionC { runFunctionC :: ReaderC (term -> FunctionC term address value m value) m a } - deriving newtype (Alternative, Applicative, Functor, Monad) - --- | Construct a boolean value in the abstract domain. -boolean :: (Member (Boolean value) sig, Carrier sig m) => Bool -> m value -boolean = send . flip Boolean pure - --- | Extract a 'Bool' from a given value. -asBool :: (Member (Boolean value) sig, Carrier sig m) => value -> m Bool -asBool = send . flip AsBool pure - --- | Eliminate boolean values. TODO: s/boolean/truthy -ifthenelse :: (Member (Boolean value) sig, Carrier sig m) => value -> m a -> m a -> m a -ifthenelse v t e = asBool v >>= \ c -> if c then t else e - -data Boolean value (m :: * -> *) k - = Boolean Bool (value -> k) - | AsBool value (Bool -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -runBoolean :: Evaluator term address value (BooleanC value m) a - -> Evaluator term address value m a -runBoolean = raiseHandler runBooleanC - -newtype BooleanC value m a = BooleanC { runBooleanC :: m a } - deriving stock Functor - deriving newtype (Alternative, Applicative, Monad) - - --- | The fundamental looping primitive, built on top of 'ifthenelse'. -while :: (Member (While value) sig, Carrier sig m) - => Evaluator term address value m value -- ^ Condition - -> Evaluator term address value m value -- ^ Body - -> Evaluator term address value m value -while cond body = send (While cond body pure) - --- | Do-while loop, built on top of while. -doWhile :: (Member (While value) sig, Carrier sig m) - => Evaluator term address value m value -- ^ Body - -> Evaluator term address value m value -- ^ Condition - -> Evaluator term address value m value -doWhile body cond = body *> while cond body - --- | C-style for loops. -forLoop :: ( Carrier sig m - , Member (Allocator address) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (While value) sig - , Member Fresh sig - , Ord address - ) - => Evaluator term address value m value -- ^ Initial statement - -> Evaluator term address value m value -- ^ Condition - -> Evaluator term address value m value -- ^ Increment/stepper - -> Evaluator term address value m value -- ^ Body - -> Evaluator term address value m value -forLoop initial cond step body = initial *> while cond (withLexicalScopeAndFrame body *> step) - -data While value m k - = While (m value) (m value) (value -> k) - deriving (Functor) - -instance HFunctor (While value) where - hmap f (While cond body k) = While (f cond) (f body) k - -runWhile :: Evaluator term address value (WhileC value m) a - -> Evaluator term address value m a -runWhile = raiseHandler runWhileC - -newtype WhileC value m a = WhileC { runWhileC :: m a } - deriving stock Functor - deriving newtype (Alternative, Applicative, Monad) - --- | Construct an abstract unit value. -unit :: (Carrier sig m, Member (Unit value) sig) => Evaluator term address value m value -unit = send (Unit pure) - -newtype Unit value (m :: * -> *) k - = Unit (value -> k) - deriving stock Functor - -instance HFunctor (Unit value) where - hmap _ = coerce - {-# INLINE hmap #-} - -instance Effect (Unit value) where - handle state handler (Unit k) = Unit (handler . (<$ state) . k) - -runUnit :: Evaluator term address value (UnitC value m) a - -> Evaluator term address value m a -runUnit = raiseHandler runUnitC - -newtype UnitC value m a = UnitC { runUnitC :: m a } - deriving stock Functor - deriving newtype (Alternative, Applicative, Monad) - --- | Construct a String value in the abstract domain. -string :: (Member (String value) sig, Carrier sig m) => Text -> m value -string t = send (String t pure) - --- | Extract 'Text' from a given value. -asString :: (Member (String value) sig, Carrier sig m) => value -> m Text -asString v = send (AsString v pure) - -data String value (m :: * -> *) k - = String Text (value -> k) - | AsString value (Text -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -newtype StringC value m a = StringC { runStringC :: m a } - deriving stock Functor - deriving newtype (Alternative, Applicative, Monad) - -runString :: Evaluator term address value (StringC value m) a - -> Evaluator term address value m a -runString = raiseHandler runStringC - - --- | Construct an abstract integral value. -integer :: (Member (Numeric value) sig, Carrier sig m) => Integer -> m value -integer t = send (Integer t pure) - --- | Construct a floating-point value. -float :: (Member (Numeric value) sig, Carrier sig m) => Scientific -> m value -float t = send (Float t pure) - --- | Construct a rational value. -rational :: (Member (Numeric value) sig, Carrier sig m) => Rational -> m value -rational t = send (Rational t pure) - --- | Lift a unary operator over a 'Num' to a function on 'value's. -liftNumeric :: (Member (Numeric value) sig, Carrier sig m) - => (forall a . Num a => a -> a) - -> value - -> m value -liftNumeric t v = send (LiftNumeric t v pure) - --- | Lift a pair of binary operators to a function on 'value's. --- You usually pass the same operator as both arguments, except in the cases where --- Haskell provides different functions for integral and fractional operations, such --- as division, exponentiation, and modulus. -liftNumeric2 :: (Member (Numeric value) sig, Carrier sig m) - => (forall a b. Number a -> Number b -> SomeNumber) - -> value - -> value - -> m value -liftNumeric2 t v1 v2 = send (LiftNumeric2 t v1 v2 pure) - -data Numeric value (m :: * -> *) k - = Integer Integer (value -> k) - | Float Scientific (value -> k) - | Rational Rational (value -> k) - | LiftNumeric (forall a . Num a => a -> a) value (value -> k) - | LiftNumeric2 (forall a b. Number a -> Number b -> SomeNumber) value value (value -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -newtype NumericC value m a = NumericC { runNumericC :: m a } - deriving stock Functor - deriving newtype (Alternative, Applicative, Monad) - -runNumeric :: Evaluator term address value (NumericC value m) a - -> Evaluator term address value m a -runNumeric = raiseHandler runNumericC - - --- | Cast numbers to integers -castToInteger :: (Member (Bitwise value) sig, Carrier sig m) => value -> m value -castToInteger t = send (CastToInteger t pure) - --- | Lift a unary bitwise operator to values. This is usually 'complement'. -liftBitwise :: (Member (Bitwise value) sig, Carrier sig m) - => (forall a . Bits a => a -> a) - -> value - -> m value -liftBitwise t v = send (LiftBitwise t v pure) - --- | Lift a binary bitwise operator to values. The Integral constraint is --- necessary to satisfy implementation details of Haskell left/right shift, --- but it's fine, since these are only ever operating on integral values. -liftBitwise2 :: (Member (Bitwise value) sig, Carrier sig m) - => (forall a . (Integral a, Bits a) => a -> a -> a) - -> value - -> value - -> m value -liftBitwise2 t v1 v2 = send (LiftBitwise2 t v1 v2 pure) - -unsignedRShift :: (Member (Bitwise value) sig, Carrier sig m) - => value - -> value - -> m value -unsignedRShift v1 v2 = send (UnsignedRShift v1 v2 pure) - -data Bitwise value (m :: * -> *) k - = CastToInteger value (value -> k) - | LiftBitwise (forall a . Bits a => a -> a) value (value -> k) - | LiftBitwise2 (forall a . (Integral a, Bits a) => a -> a -> a) value value (value -> k) - | UnsignedRShift value value (value -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -runBitwise :: Evaluator term address value (BitwiseC value m) a - -> Evaluator term address value m a -runBitwise = raiseHandler runBitwiseC - -newtype BitwiseC value m a = BitwiseC { runBitwiseC :: m a } - deriving stock Functor - deriving newtype (Alternative, Applicative, Monad) - -object :: (Member (Object address value) sig, Carrier sig m) => address -> m value -object address = send (Object address pure) - --- | Extract the environment from any scoped object (e.g. classes, namespaces, etc). -scopedEnvironment :: (Member (Object address value) sig, Carrier sig m) => value -> m (Maybe address) -scopedEnvironment value = send (ScopedEnvironment value pure) - --- | Build a class value from a name and environment. --- declaration is the new class's identifier --- address is the environment to capture -klass :: (Member (Object address value) sig, Carrier sig m) => Declaration -> address -> m value -klass d a = send (Klass d a pure) - -data Object address value (m :: * -> *) k - = Object address (value -> k) - | ScopedEnvironment value (Maybe address -> k) - | Klass Declaration address (value -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -newtype ObjectC address value m a = ObjectC { runObjectC :: m a } - deriving stock Functor - deriving newtype (Alternative, Applicative, Monad) - -runObject :: Evaluator term address value (ObjectC address value m) a - -> Evaluator term address value m a -runObject = raiseHandler runObjectC - --- | Construct an array of zero or more values. -array :: (Member (Array value) sig, Carrier sig m) => [value] -> m value -array v = send (Array v pure) - -asArray :: (Member (Array value) sig, Carrier sig m) => value -> m [value] -asArray v = send (AsArray v pure) - -data Array value (m :: * -> *) k - = Array [value] (value -> k) - | AsArray value ([value] -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -newtype ArrayC value m a = ArrayC { runArrayC :: m a } - deriving stock Functor - deriving newtype (Alternative, Applicative, Monad) - -runArray :: Evaluator term address value (ArrayC value m) a - -> Evaluator term address value m a -runArray = raiseHandler runArrayC - --- | Construct a hash out of pairs. -hash :: (Member (Hash value) sig, Carrier sig m) => [(value, value)] -> m value -hash v = send (Hash v pure) - --- | Construct a key-value pair for use in a hash. -kvPair :: (Member (Hash value) sig, Carrier sig m) => value -> value -> m value -kvPair v1 v2 = send (KvPair v1 v2 pure) - -data Hash value (m :: * -> *) k - = Hash [(value, value)] (value -> k) - | KvPair value value (value -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -newtype HashC value m a = HashC { runHashC :: m a } - deriving stock Functor - deriving newtype (Alternative, Applicative, Monad) - -runHash :: Evaluator term address value (HashC value m) a - -> Evaluator term address value m a -runHash = raiseHandler runHashC - -class Show value => AbstractIntro value where - -- | Construct the nil/null datatype. - null :: value - --- | A 'Monad' abstracting the evaluation of (and under) binding constructs (functions, methods, etc). --- --- This allows us to abstract the choice of whether to evaluate under binders for different value types. -class AbstractIntro value => AbstractValue term address value carrier where - -- | Lift a Comparator (usually wrapping a function like == or <=) to a function on values. - liftComparison :: Comparator -> (value -> value -> Evaluator term address value carrier value) - - -- | Construct an N-ary tuple of multiple (possibly-disjoint) values - tuple :: [value] -> Evaluator term address value carrier value - - -- | Extract the contents of a key-value pair as a tuple. - asPair :: value -> Evaluator term address value carrier (value, value) - - -- | @index x i@ computes @x[i]@, with zero-indexing. - index :: value -> value -> Evaluator term address value carrier value - - -- | Build a namespace value from a name and environment stack - -- - -- Namespaces model closures with monoidal environments. - namespace :: Name -- ^ The namespace's identifier - -> address -- ^ The frame of the namespace. - -> Evaluator term address value carrier value diff --git a/src/Control/Effect/Interpose.hs b/src/Control/Effect/Interpose.hs deleted file mode 100644 index b3bd092cbb..0000000000 --- a/src/Control/Effect/Interpose.hs +++ /dev/null @@ -1,56 +0,0 @@ -{-# LANGUAGE ExistentialQuantification, GeneralizedNewtypeDeriving, RankNTypes, StandaloneDeriving, TypeOperators, UndecidableInstances #-} -module Control.Effect.Interpose -( Interpose(..) -, interpose -, runInterpose -, InterposeC(..) -, Listener(..) -) where - -import Control.Applicative -import Control.Effect.Carrier -import Control.Effect.Reader -import Control.Effect.Sum - -data Interpose eff m k - = forall a . Interpose (m a) (forall n x . eff n (n x) -> m x) (a -> k) - -deriving instance Functor (Interpose eff m) - -instance HFunctor (Interpose eff) where - hmap f (Interpose m h k) = Interpose (f m) (f . h) k - --- | Respond to requests for some specific effect with a handler. --- --- The intercepted effects are not re-sent in the surrounding context; thus, the innermost nested 'interpose' listening for an effect will win, and the effect’s own handler will not get the chance to service the request. --- --- Note that since 'Interpose' lacks an 'Effect' instance, only β€œpure” effects, i.e. effects which can be handled inside other effects using 'hmap' alone, can be run within the 'runInterpose' scope. This includes @Reader@, but not e.g. @State@ or @Error@. -interpose :: (Member (Interpose eff) sig, Carrier sig m) - => m a - -> (forall n x . eff n (n x) -> m x) - -> m a -interpose m f = send (Interpose m f pure) - - --- | Run an 'Interpose' effect. -runInterpose :: InterposeC eff m a -> m a -runInterpose = runReader Nothing . runInterposeC - -newtype InterposeC eff m a = InterposeC { runInterposeC :: ReaderC (Maybe (Listener eff (InterposeC eff m))) m a } - deriving (Alternative, Applicative, Functor, Monad) - -newtype Listener eff m = Listener (forall n x . eff n (n x) -> m x) - --- TODO: Document the implementation of this, as it is extremely subtle. - -runListener :: Listener eff (InterposeC eff m) -> eff (InterposeC eff m) (InterposeC eff m a) -> InterposeC eff m a -runListener (Listener listen) = listen - -instance (Carrier sig m, Member eff sig) => Carrier (Interpose eff :+: sig) (InterposeC eff m) where - eff (L (Interpose m h k)) = - InterposeC (local (const (Just (Listener h))) (runInterposeC m)) >>= k - eff (R other) = do - listener <- InterposeC ask - case (listener, prj other) of - (Just listener, Just eff) -> runListener listener eff - _ -> InterposeC (eff (R (handleCoercible other))) diff --git a/src/Control/Effect/REPL.hs b/src/Control/Effect/REPL.hs deleted file mode 100644 index 419fec08ca..0000000000 --- a/src/Control/Effect/REPL.hs +++ /dev/null @@ -1,51 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingStrategies, GeneralizedNewtypeDeriving, KindSignatures, TypeOperators, UndecidableInstances #-} - -module Control.Effect.REPL - ( REPL (..) - , REPLC (..) - , prompt - , output - , runREPL - ) where - -import Prologue - -import Control.Effect -import Control.Effect.Carrier -import Control.Effect.Sum -import Control.Effect.Reader -import System.Console.Haskeline -import qualified Data.Text as T - -data REPL (m :: * -> *) k - = Prompt Text (Maybe Text -> k) - | Output Text k - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -prompt :: (Member REPL sig, Carrier sig m) => Text -> m (Maybe Text) -prompt p = send (Prompt p pure) - -output :: (Member REPL sig, Carrier sig m) => Text -> m () -output s = send (Output s (pure ())) - -runREPL :: Prefs -> Settings IO -> REPLC m a -> m a -runREPL prefs settings = runReader (prefs, settings) . runREPLC - -newtype REPLC m a = REPLC { runREPLC :: ReaderC (Prefs, Settings IO) m a } - deriving newtype (Functor, Applicative, Monad, MonadIO) - -instance (Carrier sig m, MonadIO m) => Carrier (REPL :+: sig) (REPLC m) where - eff (L op) = do - args <- REPLC ask - case op of - Prompt p k -> liftIO (uncurry runInputTWithPrefs args (fmap (fmap T.pack) (getInputLine (cyan <> T.unpack p <> plain)))) >>= k - Output s k -> liftIO (uncurry runInputTWithPrefs args (outputStrLn (T.unpack s))) *> k - eff (R other) = REPLC (eff (R (handleCoercible other))) - - -cyan :: String -cyan = "\ESC[1;36m\STX" - -plain :: String -plain = "\ESC[0m\STX" diff --git a/src/Control/Rewriting.hs b/src/Control/Rewriting.hs deleted file mode 100644 index 730228c846..0000000000 --- a/src/Control/Rewriting.hs +++ /dev/null @@ -1,237 +0,0 @@ -{-# LANGUAGE GADTs, TypeOperators #-} - --- | This module provides 'Rewrite', a monadic DSL that abstracts the --- details of rewriting a given datum into another type, supporting --- failure and retries. A set of /strategic combinators/, as described --- in LΓ€mmel et al.'s /The Essence of Strategic Programming/, is --- provided to promote single-layer rewrites into top-down or --- bottom-up tree transformations. -module Control.Rewriting - ( -- | Core types - Rewrite - , Rule - -- | Combinators - , target - , purely - , ensure - , try - , (>+>) - -- | Reexports from Control.Category - , (>>>) - , (<<<) - , (^>>) - -- | Predicate filtering - , refine - , only - -- | Projecting terms and sums - , narrow - , narrowF - , enter - , create - -- | Useful rewrites - , mhead - , mjust - -- | Running rewrites - , rewrite - , recursively - -- | Strategic rewrite combinators - , applyAll - , applyAny - , topDownAll - , topDownAny - ) where - -import Prelude hiding (id, (.)) -import Prologue hiding (First, project, try) - -import Control.Arrow -import Control.Category -import qualified Data.Functor.Foldable as Foldable - -import Data.History -import Data.Sum -import Data.Term - --- | The fundamental type of rewriting rules. A @Rewrite t a@ maps --- values of type @t@ to values of type @a@, supporting failure and choice. --- If you need to layer monadic effects on top of a 'Rewrite', use a 'Lift' --- effect. -data Rewrite t a where - -- TODO: Choice is inflexible and slow. A Sum over fs can be queried for its index, and we can build a jump table over that. - -- We can copy NonDet to have fair conjunction or disjunction. - Choice :: Rewrite t a -> Rewrite t a -> Rewrite t a - Target :: Rewrite t t - Empty :: Rewrite t a - Comp :: Rewrite b c -> Rewrite a b -> Rewrite a c - Split :: Rewrite b c -> Rewrite b' c' -> Rewrite (b, b') (c, c') - -- We could have implemented this by changing the semantics of how Then is interpreted, but that would make Then and Sequence inconsistent. - Match :: (t -> Maybe u) -> Rewrite u a -> Rewrite t a - Pure :: a -> Rewrite t a - Then :: Rewrite t b -> (b -> Rewrite t a) -> Rewrite t a - --- | A 'Rule' is a 'Rewrite' with identical input and output types. -type Rule t = Rewrite t t - -instance Functor (Rewrite t) where - fmap = liftA - -instance Applicative (Rewrite t) where - pure = Pure - -- We can add a Sequence constructor to optimize this when we need. - (<*>) = ap - -instance Alternative (Rewrite t) where - empty = Empty - (<|>) = Choice - -instance Monad (Rewrite t) where - (>>=) = Then - --- | Rewrites are generally composed left-to-right with '>>>'. -instance Category Rewrite where - id = Target - (.) = Comp - -instance Arrow Rewrite where - (***) = Split - arr f = fmap f target - --- | 'target' extracts the 't' that a given 'Rewrite' is operating upon. --- Similar to a reader monad's 'ask' function. This is an alias for 'id' -target :: Rewrite t t -target = id - --- | 'ensure' succeeds iff the provided predicate function returns --- true when applied to the rewrite's 'target'. If it succeeds, it --- returns the target. -ensure :: (t -> Bool) -> Rewrite t t -ensure f = target >>= \c -> c <$ guard (f c) - --- | Promote a pure function to a 'Rewrite'. An alias for 'arr'. -purely :: (a -> b) -> Rewrite a b -purely = arr - --- | 'refine' takes a modification function and a new 'Rewrite', the --- input parameter of which is the result of the modification --- function. If the modification function returns 'Just' when applied --- to the current 'target', the given rewrite action is executed with --- the result of that 'Just' as the new target; if 'Nothing' is --- returned, the action fails. --- --- This is a low-level combinator useful for matching over --- non-recursive types. When dealing with recursive types such as --- 'Term', you'll generally use the 'enter' and 'narrow' combinators. -refine :: (t -> Maybe u) -> Rewrite u a -> Rewrite t a -refine = Match - --- | An alias for the common pattern of @match f id@. -only :: (t -> Maybe u) -> Rewrite t u -only f = Match f Target - --- | @a >+> b@ performs @a@ and @b@ in sequence, succeeding if one --- or both succeed. -infixr 1 >+> -(>+>) :: Rule t -> Rule t -> Rule t -a >+> b = (a >>> b) <|> a <|> b - --- | Attempt to run a rule, falling back on the identity rule if it fails. -try :: Rule a -> Rule a -try a = a <|> id - --- | The 'enter' combinator is the primary interface for creating --- rewrites that 'project' internal 'Term' values into some --- constituent type. Given a function from a constituent type @f@ --- @need p@ succeeds if the provided term can be projected into an --- @f@, then applies the @p@ function. -enter :: ( f :< fs - , term ~ Term (Sum fs) ann - ) - => (f term -> b) - -> Rewrite term b -enter f = Match (fmap f . projectTerm) target - --- | 'narrow' projects the given 'Term' of 'Sum's into a constituent member --- of that 'Sum', failing if the target cannot be thus projected. -narrow :: (f :< fs) => Rewrite (Term (Sum fs) ann) (f (Term (Sum fs) ann)) -narrow = purely projectTerm >>= foldMapA pure - --- | Like 'narrow', but it returns the result of the projection in a --- 'TermF'. Useful for returning a matched node after ensuring its --- contents are projectable and valid, e.g @narrowF <* a >:: b >>> --- ensure f@, without losing valuable annotation info. -narrowF :: (f :< fs, term ~ Term (Sum fs) ann) - => Rewrite term (TermF f ann term) -narrowF = do - (Term (In ann syn)) <- target - case project syn of - Just fs -> pure (In ann fs) - Nothing -> empty - --- | Packs a 'Term'-containing 'Functor' into a 'Sum' of terms, then marks --- the resulting term as 'Refactored'. -create :: (f :< fs, Apply Functor fs, term ~ Term (Sum fs) History) => f term -> Rule term -create f = remark Refactored <$> (injectTerm <$> fmap annotation id <*> pure f) - --- | Matches the head of the input list. Fails if the list is empty. --- --- @mhead = only listToMaybe@ -mhead :: Rewrite [a] a -mhead = only listToMaybe - --- | Matches 'Just' values. --- --- @mjust = only id@ -mjust :: Rewrite (Maybe a) a -mjust = only id - --- | Run one step of a 'Rewrite' computation. Look at 'recursively' if you want something --- that folds over subterms. -rewrite :: (Alternative m, Monad m) => t -> Rewrite t a -> m a -rewrite t (Choice a b) = rewrite t a <|> rewrite t b -rewrite t Target = pure t -rewrite t (Match f m) = foldMapA (`rewrite` m) (f t) -rewrite t (Comp g f) = rewrite t f >>= \x -> rewrite x g -rewrite _ (Pure a) = pure a -rewrite _ Empty = empty -rewrite t (Then m f) = rewrite t m >>= rewrite t . f -rewrite t (Split f g) = rewrite t id >>= \(a, b) -> (,) <$> rewrite a f <*> rewrite b g - --- | Run a 'Rewrite' over a 'Recursive' data structure, leaf-to-root. Unlike recursion with --- the LΓ€mmel combinators, this allows you to use a 'Rewrite' rather than just a 'Rule', --- allowing for the returned type to change. If you pass in a 'Rule' here, consider whether --- the strategic combinators are actually what you want. -recursively :: (Alternative m, Monad m, Corecursive t, Recursive t, Foldable (Base t)) - => Rewrite t a - -> t - -> m a -recursively m = para (paraRewrite m) - -paraRewrite :: (Alternative m, Monad m, Corecursive t, Foldable (Base t)) => Rewrite t a -> RAlgebra (Base t) t (m a) -paraRewrite m t = rewrite (embedTerm t) m <|> foldMapA snd t - --- * For more information about these combinators, see /The Essence of Strategic Programming/ --- (LΓ€mmel, Visser, and Visser, 2003). - --- | Runs a 'Rule' one level deep in the provided 'Recursive' type, succeeding --- if all children succeed. -applyAll :: (Corecursive t, Recursive t, Traversable (Base t)) - => Rule t -> Rule t -applyAll m = id >>= \t -> Foldable.embed <$> traverse go (Foldable.project t) - where go a = pure a >>> m - --- | Runs a 'Rule' one level deep, succeeding if any children succeed. -applyAny :: (Corecursive t, Recursive t, Traversable (Base t)) - => Rule t -> Rule t -applyAny m = applyAll (m <|> id) - --- | Runs a 'Rule' top-down over a 'Recursive' type, succeeding if --- all subsequent rewrites succeed. -topDownAll :: (Corecursive t, Recursive t, Traversable (Base t)) - => Rule t -> Rule t -topDownAll r = let go = r >>> applyAll go in go - --- | Runs a 'Rule' top-down over a 'Recursive' type, succeeding if --- any rewrites succeed. -topDownAny :: (Corecursive t, Recursive t, Traversable (Base t)) - => Rule t -> Rule t -topDownAny r = let go = r >+> applyAny go in go diff --git a/src/Data/AST.hs b/src/Data/AST.hs deleted file mode 100644 index 30d482cd5f..0000000000 --- a/src/Data/AST.hs +++ /dev/null @@ -1,35 +0,0 @@ -{-# LANGUAGE DataKinds #-} -module Data.AST - ( Node (..) - , nodeSpan - , nodeByteRange - , AST - ) where - -import Data.Location -import Data.Term -import Data.Aeson -import Data.Text (pack) -import Data.JSON.Fields - --- | An AST node labelled with symbols and source location. -type AST syntax grammar = Term syntax (Node grammar) - -data Node grammar = Node - { nodeSymbol :: !grammar - , nodeLocation :: {-# UNPACK #-} !Location - } - deriving (Eq, Ord, Show) - - -instance Show grammar => ToJSONFields (Node grammar) where - toJSONFields Node{..} = - [ "symbol" .= pack (show nodeSymbol) - , "span" .= locationSpan nodeLocation - ] - -nodeSpan :: Node grammar -> Span -nodeSpan = locationSpan . nodeLocation - -nodeByteRange :: Node grammar -> Range -nodeByteRange = locationByteRange . nodeLocation diff --git a/src/Data/Abstract/AccessControls/Class.hs b/src/Data/Abstract/AccessControls/Class.hs deleted file mode 100644 index d7dd1ca800..0000000000 --- a/src/Data/Abstract/AccessControls/Class.hs +++ /dev/null @@ -1,26 +0,0 @@ -module Data.Abstract.AccessControls.Class - ( AccessControls (..) - , AccessControls1 (..) - ) where - -import Data.Abstract.ScopeGraph (AccessControl(..)) - -{-| - The 'AccessControls' typeclass provides a mapping between a syntax and its associated 'AccessControl' type (i.e. public, protected, or private). - - Because not every syntax relates to the idea of access control, the 'termToAccessControl' method defaults to returning a 'Nothing' as the default for all syntax. - - Specialized instances should be defined per syntax when considering its 'AccessControl' is necessary for its evaluation. --} -class AccessControls syntax where - termToAccessControl :: syntax -> Maybe AccessControl - termToAccessControl = const Nothing - -{-| - The 'AccessControls1' typeclass allows lifting of a function mapping a syntax to its 'AccessControl' type for rank 1 types. - - As described in the notes for the 'AccessControls' typeclass, the default for the 'liftTermToAccessControl' method is 'Nothing' for syntax terms whose evaluation does not require consideration of access control. --} -class AccessControls1 syntax where - liftTermToAccessControl :: (a -> Maybe AccessControl) -> syntax a -> Maybe AccessControl - liftTermToAccessControl _ _ = Nothing diff --git a/src/Data/Abstract/AccessControls/Instances.hs b/src/Data/Abstract/AccessControls/Instances.hs deleted file mode 100644 index 17a5f8e296..0000000000 --- a/src/Data/Abstract/AccessControls/Instances.hs +++ /dev/null @@ -1,533 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, UndecidableInstances #-} -{-# OPTIONS_GHC -Wno-orphans -Wno-missing-export-lists #-} -module Data.Abstract.AccessControls.Instances where - -import Data.Sum -import Data.Term -import Data.Abstract.AccessControls.Class - -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Directive as Directive -import qualified Data.Syntax.Expression as Expression -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Statement as Statement -import qualified Data.Syntax.Type as Type -import qualified Language.Go.Syntax as Go -import qualified Language.Go.Type as Go -import qualified Language.Haskell.Syntax as Haskell -import qualified Language.Java.Syntax as Java -import qualified Language.Markdown.Syntax as Markdown -import qualified Language.PHP.Syntax as PHP -import qualified Language.Python.Syntax as Python -import qualified Language.Ruby.Syntax as Ruby -import qualified Language.TSX.Syntax as TSX -import qualified Language.TypeScript.Syntax as TypeScript -import Data.Quieterm - -deriving instance AccessControls1 syntax => AccessControls (Term syntax ann) - -instance (AccessControls recur, AccessControls1 syntax) => AccessControls (TermF syntax ann recur) where - termToAccessControl = liftTermToAccessControl termToAccessControl . termFOut - -instance Apply AccessControls1 fs => AccessControls1 (Sum fs) where - liftTermToAccessControl f = apply @AccessControls1 (liftTermToAccessControl f) - -deriving instance AccessControls1 syntax => AccessControls (Quieterm syntax ann) - -instance AccessControls1 [] -instance AccessControls1 Comment.Comment -instance AccessControls1 Comment.HashBang - -instance AccessControls1 Expression.And -instance AccessControls1 Expression.Await -instance AccessControls1 Expression.BAnd -instance AccessControls1 Expression.BOr -instance AccessControls1 Expression.BXOr -instance AccessControls1 Expression.Call -instance AccessControls1 Expression.Cast -instance AccessControls1 Expression.Comparison -instance AccessControls1 Expression.Complement -instance AccessControls1 Expression.Delete -instance AccessControls1 Expression.DividedBy -instance AccessControls1 Expression.Enumeration -instance AccessControls1 Expression.Equal -instance AccessControls1 Expression.FloorDivision -instance AccessControls1 Expression.GreaterThan -instance AccessControls1 Expression.GreaterThanEqual -instance AccessControls1 Expression.InstanceOf -instance AccessControls1 Expression.LessThan -instance AccessControls1 Expression.LessThanEqual -instance AccessControls1 Expression.LShift -instance AccessControls1 Expression.Matches -instance AccessControls1 Expression.Member -instance AccessControls1 Expression.MemberAccess -instance AccessControls1 Expression.Minus -instance AccessControls1 Expression.Modulo -instance AccessControls1 Expression.Negate -instance AccessControls1 Expression.New -instance AccessControls1 Expression.NonNullExpression -instance AccessControls1 Expression.Not -instance AccessControls1 Expression.NotMatches -instance AccessControls1 Expression.Or -instance AccessControls1 Expression.Plus -instance AccessControls1 Expression.Power -instance AccessControls1 Expression.RShift -instance AccessControls1 Expression.ScopeResolution -instance AccessControls1 Expression.SequenceExpression -instance AccessControls1 Expression.StrictEqual -instance AccessControls1 Expression.Subscript -instance AccessControls1 Expression.Super -instance AccessControls1 Expression.Times -instance AccessControls1 Expression.Typeof -instance AccessControls1 Expression.UnsignedRShift -instance AccessControls1 Expression.Void -instance AccessControls1 Expression.XOr - -instance AccessControls1 Literal.Boolean -instance AccessControls1 Literal.Integer -instance AccessControls1 Literal.Float -instance AccessControls1 Literal.Rational -instance AccessControls1 Literal.Complex -instance AccessControls1 Literal.String -instance AccessControls1 Literal.Character -instance AccessControls1 Literal.InterpolationElement -instance AccessControls1 Literal.TextElement -instance AccessControls1 Literal.EscapeSequence -instance AccessControls1 Literal.Symbol -instance AccessControls1 Literal.SymbolElement -instance AccessControls1 Literal.Regex -instance AccessControls1 Literal.Array -instance AccessControls1 Literal.Hash -instance AccessControls1 Literal.Tuple -instance AccessControls1 Literal.Set -instance AccessControls1 Literal.Pointer -instance AccessControls1 Literal.Reference -instance AccessControls1 Literal.Null -instance AccessControls1 Literal.KeyValue - -instance AccessControls1 Statement.Assignment -instance AccessControls1 Statement.Break -instance AccessControls1 Statement.Catch -instance AccessControls1 Statement.Continue -instance AccessControls1 Statement.DoWhile -instance AccessControls1 Statement.Else -instance AccessControls1 Statement.Finally -instance AccessControls1 Statement.For -instance AccessControls1 Statement.ForEach -instance AccessControls1 Statement.Goto -instance AccessControls1 Statement.If -instance AccessControls1 Statement.Let -instance AccessControls1 Statement.Match -instance AccessControls1 Statement.NoOp -instance AccessControls1 Statement.Pattern -instance AccessControls1 Statement.PostDecrement -instance AccessControls1 Statement.PostIncrement -instance AccessControls1 Statement.PreDecrement -instance AccessControls1 Statement.PreIncrement -instance AccessControls1 Statement.Retry -instance AccessControls1 Statement.Return -instance AccessControls1 Statement.ScopeEntry -instance AccessControls1 Statement.ScopeExit -instance AccessControls1 Statement.StatementBlock -instance AccessControls1 Statement.Statements -instance AccessControls1 Statement.Throw -instance AccessControls1 Statement.Try -instance AccessControls1 Statement.While -instance AccessControls1 Statement.Yield - -instance AccessControls1 Syntax.Context -instance AccessControls1 Syntax.Empty -instance AccessControls1 Syntax.Error -instance AccessControls1 Syntax.Identifier -instance AccessControls1 Syntax.AccessibilityModifier - -instance AccessControls1 Type.Annotation -instance AccessControls1 Type.Array -instance AccessControls1 Type.Bool -instance AccessControls1 Type.Double -instance AccessControls1 Type.Float -instance AccessControls1 Type.Function -instance AccessControls1 Type.Int -instance AccessControls1 Type.Interface -instance AccessControls1 Type.Map -instance AccessControls1 Type.Parenthesized -instance AccessControls1 Type.Pointer -instance AccessControls1 Type.Product -instance AccessControls1 Type.Readonly -instance AccessControls1 Type.Slice -instance AccessControls1 Type.TypeParameters -instance AccessControls1 Type.Void - -instance AccessControls1 Declaration.Class -instance AccessControls1 Declaration.Comprehension -instance AccessControls1 Declaration.Constructor -instance AccessControls1 Declaration.Datatype -instance AccessControls1 Declaration.Decorator -instance AccessControls1 Declaration.Function -instance AccessControls1 Declaration.InterfaceDeclaration -instance AccessControls1 Declaration.Method -instance AccessControls1 Declaration.MethodSignature -instance AccessControls1 Declaration.OptionalParameter -instance AccessControls1 Declaration.PublicFieldDefinition -instance AccessControls1 Declaration.RequiredParameter -instance AccessControls1 Declaration.Type -instance AccessControls1 Declaration.TypeAlias -instance AccessControls1 Declaration.Variable -instance AccessControls1 Declaration.VariableDeclaration - -instance AccessControls1 Directive.File -instance AccessControls1 Directive.Line - -instance AccessControls1 Haskell.UnitConstructor -instance AccessControls1 Haskell.ListConstructor -instance AccessControls1 Haskell.FunctionConstructor -instance AccessControls1 Haskell.RecordDataConstructor -instance AccessControls1 Haskell.AllConstructors -instance AccessControls1 Haskell.GADTConstructor -instance AccessControls1 Haskell.LabeledConstruction -instance AccessControls1 Haskell.InfixDataConstructor -instance AccessControls1 Haskell.TupleConstructor -instance AccessControls1 Haskell.TypeConstructorExport -instance AccessControls1 Haskell.KindParenthesizedConstructor -instance AccessControls1 Haskell.ConstructorSymbol -instance AccessControls1 Haskell.Module -instance AccessControls1 Haskell.Field -instance AccessControls1 Haskell.GADT -instance AccessControls1 Haskell.InfixOperatorPattern -instance AccessControls1 Haskell.NewType -instance AccessControls1 Haskell.ImportDeclaration -instance AccessControls1 Haskell.QualifiedImportDeclaration -instance AccessControls1 Haskell.ImportAlias -instance AccessControls1 Haskell.App -instance AccessControls1 Haskell.InfixOperatorApp -instance AccessControls1 Haskell.ListComprehension -instance AccessControls1 Haskell.Generator -instance AccessControls1 Haskell.ArithmeticSequence -instance AccessControls1 Haskell.RightOperatorSection -instance AccessControls1 Haskell.LeftOperatorSection -instance AccessControls1 Haskell.BindPattern -instance AccessControls1 Haskell.Lambda -instance AccessControls1 Haskell.FixityAlt -instance AccessControls1 Haskell.RecordWildCards -instance AccessControls1 Haskell.Wildcard -instance AccessControls1 Haskell.Let -instance AccessControls1 Haskell.FieldBind -instance AccessControls1 Haskell.Pragma -instance AccessControls1 Haskell.Deriving -instance AccessControls1 Haskell.ContextAlt -instance AccessControls1 Haskell.Class -instance AccessControls1 Haskell.Export -instance AccessControls1 Haskell.ModuleExport -instance AccessControls1 Haskell.QuotedName -instance AccessControls1 Haskell.ScopedTypeVariables -instance AccessControls1 Haskell.DefaultDeclaration -instance AccessControls1 Haskell.VariableOperator -instance AccessControls1 Haskell.ConstructorOperator -instance AccessControls1 Haskell.TypeOperator -instance AccessControls1 Haskell.PromotedTypeOperator -instance AccessControls1 Haskell.VariableSymbol -instance AccessControls1 Haskell.Import -instance AccessControls1 Haskell.HiddenImport -instance AccessControls1 Haskell.TypeApp -instance AccessControls1 Haskell.TupleExpression -instance AccessControls1 Haskell.TuplePattern -instance AccessControls1 Haskell.ConstructorPattern -instance AccessControls1 Haskell.Do -instance AccessControls1 Haskell.PrefixNegation -instance AccessControls1 Haskell.CPPDirective -instance AccessControls1 Haskell.NamedFieldPun -instance AccessControls1 Haskell.NegativeLiteral -instance AccessControls1 Haskell.LambdaCase -instance AccessControls1 Haskell.LabeledUpdate -instance AccessControls1 Haskell.QualifiedTypeClassIdentifier -instance AccessControls1 Haskell.QualifiedTypeConstructorIdentifier -instance AccessControls1 Haskell.QualifiedConstructorIdentifier -instance AccessControls1 Haskell.QualifiedInfixVariableIdentifier -instance AccessControls1 Haskell.QualifiedModuleIdentifier -instance AccessControls1 Haskell.QualifiedVariableIdentifier -instance AccessControls1 Haskell.TypeVariableIdentifier -instance AccessControls1 Haskell.TypeConstructorIdentifier -instance AccessControls1 Haskell.ModuleIdentifier -instance AccessControls1 Haskell.ConstructorIdentifier -instance AccessControls1 Haskell.ImplicitParameterIdentifier -instance AccessControls1 Haskell.InfixConstructorIdentifier -instance AccessControls1 Haskell.InfixVariableIdentifier -instance AccessControls1 Haskell.TypeClassIdentifier -instance AccessControls1 Haskell.VariableIdentifier -instance AccessControls1 Haskell.PrimitiveConstructorIdentifier -instance AccessControls1 Haskell.PrimitiveVariableIdentifier -instance AccessControls1 Haskell.AsPattern -instance AccessControls1 Haskell.FieldPattern -instance AccessControls1 Haskell.ViewPattern -instance AccessControls1 Haskell.PatternGuard -instance AccessControls1 Haskell.StrictPattern -instance AccessControls1 Haskell.ListPattern -instance AccessControls1 Haskell.TypePattern -instance AccessControls1 Haskell.IrrefutablePattern -instance AccessControls1 Haskell.CaseGuardPattern -instance AccessControls1 Haskell.FunctionGuardPattern -instance AccessControls1 Haskell.LabeledPattern -instance AccessControls1 Haskell.Guard -instance AccessControls1 Haskell.QuasiQuotation -instance AccessControls1 Haskell.QuasiQuotationPattern -instance AccessControls1 Haskell.QuasiQuotationType -instance AccessControls1 Haskell.QuasiQuotationDeclaration -instance AccessControls1 Haskell.QuasiQuotationExpression -instance AccessControls1 Haskell.QuasiQuotationExpressionBody -instance AccessControls1 Haskell.QuasiQuotationQuoter -instance AccessControls1 Haskell.Splice -instance AccessControls1 Haskell.StrictType -instance AccessControls1 Haskell.Type -instance AccessControls1 Haskell.TypeSynonym -instance AccessControls1 Haskell.AnnotatedTypeVariable -instance AccessControls1 Haskell.StandaloneDerivingInstance -instance AccessControls1 Haskell.FunctionType -instance AccessControls1 Haskell.TypeSignature -instance AccessControls1 Haskell.ExpressionTypeSignature -instance AccessControls1 Haskell.KindFunctionType -instance AccessControls1 Haskell.Star -instance AccessControls1 Haskell.EqualityConstraint -instance AccessControls1 Haskell.TypeInstance -instance AccessControls1 Haskell.TypeClassInstance -instance AccessControls1 Haskell.TypeClass -instance AccessControls1 Haskell.DefaultSignature -instance AccessControls1 Haskell.TypeFamily -instance AccessControls1 Haskell.StrictTypeVariable -instance AccessControls1 Haskell.KindSignature -instance AccessControls1 Haskell.Kind -instance AccessControls1 Haskell.KindListType -instance AccessControls1 Haskell.Instance -instance AccessControls1 Haskell.KindTupleType -instance AccessControls1 Haskell.FunctionalDependency - - -instance AccessControls1 Java.Import -instance AccessControls1 Java.Package -instance AccessControls1 Java.CatchType -instance AccessControls1 Java.SpreadParameter -instance AccessControls1 Java.StaticInitializer -instance AccessControls1 Java.LambdaBody -instance AccessControls1 Java.ClassBody -instance AccessControls1 Java.ClassLiteral -instance AccessControls1 Java.DefaultValue -instance AccessControls1 Java.Module -instance AccessControls1 Java.EnumDeclaration -instance AccessControls1 Java.Variable -instance AccessControls1 Java.Synchronized -instance AccessControls1 Java.New -instance AccessControls1 Java.Asterisk -instance AccessControls1 Java.Constructor -instance AccessControls1 Java.TypeParameter -instance AccessControls1 Java.Annotation -instance AccessControls1 Java.AnnotationField -instance AccessControls1 Java.GenericType -instance AccessControls1 Java.AnnotatedType -instance AccessControls1 Java.TypeWithModifiers -instance AccessControls1 Java.Wildcard -instance AccessControls1 Java.WildcardBounds -instance AccessControls1 Java.MethodReference -instance AccessControls1 Java.NewKeyword -instance AccessControls1 Java.Lambda -instance AccessControls1 Java.ArrayCreationExpression -instance AccessControls1 Java.DimsExpr -instance AccessControls1 Java.TryWithResources -instance AccessControls1 Java.AssertStatement -instance AccessControls1 Java.AnnotationTypeElement - -instance AccessControls1 Python.Alias -instance AccessControls1 Python.Ellipsis -instance AccessControls1 Python.FutureImport -instance AccessControls1 Python.Import -instance AccessControls1 Python.QualifiedAliasedImport -instance AccessControls1 Python.QualifiedImport -instance AccessControls1 Python.Redirect - -instance AccessControls1 Go.BidirectionalChannel -instance AccessControls1 Go.ReceiveChannel -instance AccessControls1 Go.SendChannel -instance AccessControls1 Go.Import -instance AccessControls1 Go.QualifiedImport -instance AccessControls1 Go.SideEffectImport -instance AccessControls1 Go.Composite -instance AccessControls1 Go.Label -instance AccessControls1 Go.Send -instance AccessControls1 Go.Slice -instance AccessControls1 Go.TypeSwitch -instance AccessControls1 Go.Receive -instance AccessControls1 Go.Field -instance AccessControls1 Go.Package -instance AccessControls1 Go.TypeAssertion -instance AccessControls1 Go.TypeConversion -instance AccessControls1 Go.Variadic -instance AccessControls1 Go.DefaultPattern -instance AccessControls1 Go.Defer -instance AccessControls1 Go.Go -instance AccessControls1 Go.Rune -instance AccessControls1 Go.Select -instance AccessControls1 Go.TypeSwitchGuard -instance AccessControls1 Go.ReceiveOperator - -instance AccessControls1 Markdown.Document -instance AccessControls1 Markdown.Paragraph -instance AccessControls1 Markdown.UnorderedList -instance AccessControls1 Markdown.OrderedList -instance AccessControls1 Markdown.BlockQuote -instance AccessControls1 Markdown.HTMLBlock -instance AccessControls1 Markdown.Table -instance AccessControls1 Markdown.TableRow -instance AccessControls1 Markdown.TableCell -instance AccessControls1 Markdown.Strong -instance AccessControls1 Markdown.Emphasis -instance AccessControls1 Markdown.Text -instance AccessControls1 Markdown.Strikethrough -instance AccessControls1 Markdown.Heading -instance AccessControls1 Markdown.ThematicBreak -instance AccessControls1 Markdown.Link -instance AccessControls1 Markdown.Image -instance AccessControls1 Markdown.Code -instance AccessControls1 Markdown.LineBreak - -instance AccessControls1 PHP.Text -instance AccessControls1 PHP.VariableName -instance AccessControls1 PHP.Require -instance AccessControls1 PHP.RequireOnce -instance AccessControls1 PHP.Include -instance AccessControls1 PHP.IncludeOnce -instance AccessControls1 PHP.ArrayElement -instance AccessControls1 PHP.GlobalDeclaration -instance AccessControls1 PHP.SimpleVariable -instance AccessControls1 PHP.CastType -instance AccessControls1 PHP.ErrorControl -instance AccessControls1 PHP.Clone -instance AccessControls1 PHP.ShellCommand -instance AccessControls1 PHP.Update -instance AccessControls1 PHP.NewVariable -instance AccessControls1 PHP.RelativeScope -instance AccessControls1 PHP.NamespaceName -instance AccessControls1 PHP.ConstDeclaration -instance AccessControls1 PHP.ClassInterfaceClause -instance AccessControls1 PHP.ClassBaseClause -instance AccessControls1 PHP.UseClause -instance AccessControls1 PHP.ReturnType -instance AccessControls1 PHP.TypeDeclaration -instance AccessControls1 PHP.BaseTypeDeclaration -instance AccessControls1 PHP.ScalarType -instance AccessControls1 PHP.EmptyIntrinsic -instance AccessControls1 PHP.ExitIntrinsic -instance AccessControls1 PHP.IssetIntrinsic -instance AccessControls1 PHP.EvalIntrinsic -instance AccessControls1 PHP.PrintIntrinsic -instance AccessControls1 PHP.NamespaceAliasingClause -instance AccessControls1 PHP.NamespaceUseDeclaration -instance AccessControls1 PHP.NamespaceUseClause -instance AccessControls1 PHP.NamespaceUseGroupClause -instance AccessControls1 PHP.TraitUseSpecification -instance AccessControls1 PHP.Static -instance AccessControls1 PHP.ClassModifier -instance AccessControls1 PHP.InterfaceBaseClause -instance AccessControls1 PHP.Echo -instance AccessControls1 PHP.Unset -instance AccessControls1 PHP.DeclareDirective -instance AccessControls1 PHP.LabeledStatement -instance AccessControls1 PHP.QualifiedName -instance AccessControls1 PHP.ClassConstDeclaration -instance AccessControls1 PHP.Namespace -instance AccessControls1 PHP.TraitDeclaration -instance AccessControls1 PHP.AliasAs -instance AccessControls1 PHP.InsteadOf -instance AccessControls1 PHP.TraitUseClause -instance AccessControls1 PHP.DestructorDeclaration -instance AccessControls1 PHP.ConstructorDeclaration -instance AccessControls1 PHP.PropertyDeclaration -instance AccessControls1 PHP.PropertyModifier -instance AccessControls1 PHP.InterfaceDeclaration -instance AccessControls1 PHP.Declare - -instance AccessControls1 Ruby.Assignment -instance AccessControls1 Ruby.Class -instance AccessControls1 Ruby.Send -instance AccessControls1 Ruby.Require -instance AccessControls1 Ruby.Load -instance AccessControls1 Ruby.LowPrecedenceAnd -instance AccessControls1 Ruby.LowPrecedenceOr -instance AccessControls1 Ruby.Module -instance AccessControls1 Ruby.ZSuper - -instance AccessControls1 TSX.JsxElement -instance AccessControls1 TSX.JsxOpeningElement -instance AccessControls1 TSX.JsxSelfClosingElement -instance AccessControls1 TSX.JsxAttribute -instance AccessControls1 TSX.JsxNamespaceName -instance AccessControls1 TSX.JsxText -instance AccessControls1 TSX.JsxExpression -instance AccessControls1 TSX.JsxClosingElement -instance AccessControls1 TSX.JsxFragment - -instance AccessControls1 TypeScript.AnnotatedExpression -instance AccessControls1 TypeScript.JavaScriptRequire -instance AccessControls1 TypeScript.Debugger -instance AccessControls1 TypeScript.Super -instance AccessControls1 TypeScript.Undefined -instance AccessControls1 TypeScript.With -instance AccessControls1 TypeScript.OptionalParameter -instance AccessControls1 TypeScript.RequiredParameter -instance AccessControls1 TypeScript.RestParameter -instance AccessControls1 TypeScript.ImplementsClause -instance AccessControls1 TypeScript.Import -instance AccessControls1 TypeScript.QualifiedAliasedImport -instance AccessControls1 TypeScript.QualifiedExportFrom -instance AccessControls1 TypeScript.LookupType -instance AccessControls1 TypeScript.Union -instance AccessControls1 TypeScript.Intersection -instance AccessControls1 TypeScript.FunctionType -instance AccessControls1 TypeScript.AmbientFunction -instance AccessControls1 TypeScript.ImportRequireClause -instance AccessControls1 TypeScript.Constructor -instance AccessControls1 TypeScript.TypeParameter -instance AccessControls1 TypeScript.TypeAssertion -instance AccessControls1 TypeScript.NestedIdentifier -instance AccessControls1 TypeScript.NestedTypeIdentifier -instance AccessControls1 TypeScript.GenericType -instance AccessControls1 TypeScript.TypePredicate -instance AccessControls1 TypeScript.EnumDeclaration -instance AccessControls1 TypeScript.PropertySignature -instance AccessControls1 TypeScript.CallSignature -instance AccessControls1 TypeScript.ConstructSignature -instance AccessControls1 TypeScript.IndexSignature -instance AccessControls1 TypeScript.AbstractMethodSignature -instance AccessControls1 TypeScript.ForOf -instance AccessControls1 TypeScript.LabeledStatement -instance AccessControls1 TypeScript.InternalModule -instance AccessControls1 TypeScript.ImportAlias -instance AccessControls1 TypeScript.ClassHeritage -instance AccessControls1 TypeScript.AbstractClass -instance AccessControls1 TypeScript.SideEffectImport -instance AccessControls1 TypeScript.QualifiedExport -instance AccessControls1 TypeScript.DefaultExport -instance AccessControls1 TypeScript.ShorthandPropertyIdentifier -instance AccessControls1 TypeScript.ImportClause -instance AccessControls1 TypeScript.Tuple -instance AccessControls1 TypeScript.Annotation -instance AccessControls1 TypeScript.Decorator -instance AccessControls1 TypeScript.ComputedPropertyName -instance AccessControls1 TypeScript.Constraint -instance AccessControls1 TypeScript.DefaultType -instance AccessControls1 TypeScript.ParenthesizedType -instance AccessControls1 TypeScript.PredefinedType -instance AccessControls1 TypeScript.TypeIdentifier -instance AccessControls1 TypeScript.ObjectType -instance AccessControls1 TypeScript.AmbientDeclaration -instance AccessControls1 TypeScript.ExtendsClause -instance AccessControls1 TypeScript.ArrayType -instance AccessControls1 TypeScript.FlowMaybeType -instance AccessControls1 TypeScript.TypeQuery -instance AccessControls1 TypeScript.IndexTypeQuery -instance AccessControls1 TypeScript.TypeArguments -instance AccessControls1 TypeScript.ThisType -instance AccessControls1 TypeScript.ExistentialType -instance AccessControls1 TypeScript.LiteralType -instance AccessControls1 TypeScript.Update -instance AccessControls1 TypeScript.MetaProperty -instance AccessControls1 TypeScript.Module diff --git a/src/Data/Abstract/Address/Hole.hs b/src/Data/Abstract/Address/Hole.hs deleted file mode 100644 index 7d82a1c7ba..0000000000 --- a/src/Data/Abstract/Address/Hole.hs +++ /dev/null @@ -1,43 +0,0 @@ -{-# LANGUAGE TypeOperators, UndecidableInstances #-} -module Data.Abstract.Address.Hole -( Hole(..) -, toMaybe -) where - -import Control.Abstract -import Control.Effect.Carrier -import Control.Effect.Sum -import Prologue - -data Hole context a = Partial context | Total a - deriving (Foldable, Functor, Eq, Ord, Show, Traversable) - -instance Lower context => AbstractHole (Hole context a) where - hole = Partial lowerBound - -toMaybe :: Hole context a -> Maybe a -toMaybe (Partial _) = Nothing -toMaybe (Total a) = Just a - - -promoteA :: AllocatorC address m a -> AllocatorC (Hole context address) m a -promoteA = AllocatorC . runAllocatorC - -instance ( Carrier (Allocator address :+: sig) (AllocatorC address m) - , Carrier sig m - , Monad m - ) - => Carrier (Allocator (Hole context address) :+: sig) (AllocatorC (Hole context address) m) where - eff (R other) = AllocatorC . eff . handleCoercible $ other - eff (L (Alloc name k)) = Total <$> promoteA (eff (L (Alloc name pure))) >>= k - - -promoteD :: DerefC address value m a -> DerefC (Hole context address) value m a -promoteD = DerefC . runDerefC - -instance (Carrier (Deref value :+: sig) (DerefC address value m), Carrier sig m) - => Carrier (Deref value :+: sig) (DerefC (Hole context address) value m) where - eff (R other) = DerefC . eff . handleCoercible $ other - eff (L op) = case op of - DerefCell cell k -> promoteD (eff (L (DerefCell cell pure))) >>= k - AssignCell value cell k -> promoteD (eff (L (AssignCell value cell pure))) >>= k diff --git a/src/Data/Abstract/Address/Monovariant.hs b/src/Data/Abstract/Address/Monovariant.hs deleted file mode 100644 index 5e2fc2337a..0000000000 --- a/src/Data/Abstract/Address/Monovariant.hs +++ /dev/null @@ -1,28 +0,0 @@ -{-# LANGUAGE TypeOperators, UndecidableInstances #-} -module Data.Abstract.Address.Monovariant -( Monovariant(..) -) where - -import Control.Abstract -import Control.Effect.Carrier -import Control.Effect.Sum -import Data.Abstract.Name -import qualified Data.Set as Set -import Prologue - --- | 'Monovariant' models using one address for a particular name. It trackes the set of values that a particular address takes and uses it's name to lookup in the store and only allocation if new. -newtype Monovariant = Monovariant { unMonovariant :: Name } - deriving (Eq, Ord) - -instance Show Monovariant where - showsPrec d = showsUnaryWith showsPrec "Monovariant" d . unMonovariant - - -instance Carrier sig m => Carrier (Allocator Monovariant :+: sig) (AllocatorC Monovariant m) where - eff (L (Alloc name k)) = k (Monovariant name) - eff (R other) = AllocatorC . eff . handleCoercible $ other - -instance (Ord value, Carrier sig m, Alternative m, Monad m) => Carrier (Deref value :+: sig) (DerefC Monovariant value m) where - eff (L (DerefCell cell k)) = traverse (foldMapA pure) (nonEmpty (toList cell)) >>= k - eff (L (AssignCell value cell k)) = k (Set.insert value cell) - eff (R other) = DerefC . eff . handleCoercible $ other diff --git a/src/Data/Abstract/Address/Precise.hs b/src/Data/Abstract/Address/Precise.hs deleted file mode 100644 index 6e8892b0d4..0000000000 --- a/src/Data/Abstract/Address/Precise.hs +++ /dev/null @@ -1,30 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, TypeOperators, UndecidableInstances #-} -module Data.Abstract.Address.Precise -( Precise(..) -) where - -import Control.Abstract -import Control.Abstract.ScopeGraph (AllocatorC(..)) -import Control.Effect.Carrier -import Control.Effect.Sum -import qualified Data.Set as Set -import Prologue - --- | 'Precise' models precise store semantics where only the 'Latest' value is taken. Everything gets it's own address (always makes a new allocation) which makes for a larger store. -newtype Precise = Precise { unPrecise :: Int } - deriving (Eq, Ord, NFData) - -instance Show Precise where - showsPrec d = showsUnaryWith showsPrec "Precise" d . unPrecise - - -instance (Member Fresh sig, Carrier sig m) => Carrier (Allocator Precise :+: sig) (AllocatorC Precise m) where - eff (R other) = AllocatorC . eff . handleCoercible $ other - eff (L (Alloc _ k)) = Precise <$> fresh >>= k - - -instance Carrier sig m => Carrier (Deref value :+: sig) (DerefC Precise value m) where - eff (R other) = DerefC . eff . handleCoercible $ other - eff (L op) = case op of - DerefCell cell k -> k (fst <$> Set.minView cell) - AssignCell value _ k -> k (Set.singleton value) diff --git a/src/Data/Abstract/BaseError.hs b/src/Data/Abstract/BaseError.hs deleted file mode 100644 index 2fc28e4928..0000000000 --- a/src/Data/Abstract/BaseError.hs +++ /dev/null @@ -1,48 +0,0 @@ -{-# LANGUAGE KindSignatures #-} - -module Data.Abstract.BaseError ( - BaseError(..) -, throwBaseError -) -where - -import Control.Abstract.Context -import Control.Abstract.Evaluator -import qualified Data.Abstract.Module as M -import qualified Data.Span as S -import Prologue - -data BaseError (exc :: * -> *) resume = BaseError { baseErrorModuleInfo :: ModuleInfo, baseErrorSpan :: Span, baseErrorException :: exc resume } - -instance (Show (exc resume)) => Show (BaseError exc resume) where - showsPrec _ BaseError{..} = shows baseErrorException <> showString " " <> showString errorLocation - where errorLocation | startErrorLine == endErrorLine = M.modulePath baseErrorModuleInfo <> " " <> startErrorLine <> ":" <> startErrorCol <> "-" <> endErrorCol - | otherwise = M.modulePath baseErrorModuleInfo <> " " <> startErrorLine <> ":" <> startErrorCol <> "-" <> endErrorLine <> ":" <> endErrorCol - startErrorLine = show $ S.posLine (S.spanStart baseErrorSpan) - endErrorLine = show $ S.posLine (S.spanEnd baseErrorSpan) - startErrorCol = show $ S.posColumn (S.spanStart baseErrorSpan) - endErrorCol = show $ S.posColumn (S.spanEnd baseErrorSpan) - -instance (Eq1 exc) => Eq1 (BaseError exc) where - liftEq f (BaseError info1 span1 exc1) (BaseError info2 span2 exc2) = info1 == info2 && span1 == span2 && liftEq f exc1 exc2 - -instance Show1 exc => Show1 (BaseError exc) where - liftShowsPrec sl sp d (BaseError info span exc) = showParen (d > 10) $ showString "BaseError" . showChar ' ' . showsPrec 11 info . showChar ' ' . showsPrec 11 span . showChar ' ' . liftShowsPrec sl sp 11 exc - -instance (NFData1 exc, NFData resume) => NFData (BaseError exc resume) where - rnf = liftRnf rnf - -instance (NFData1 exc) => NFData1 (BaseError exc) where - liftRnf rnf' (BaseError i s e) = rnf i `seq` rnf s `seq` liftRnf rnf' e - -throwBaseError :: ( Member (Resumable (BaseError exc)) sig - , Member (Reader M.ModuleInfo) sig - , Member (Reader S.Span) sig - , Carrier sig m - ) - => exc resume - -> m resume -throwBaseError err = do - moduleInfo <- currentModule - span <- currentSpan - throwResumable $ BaseError moduleInfo span err diff --git a/src/Data/Abstract/Declarations.hs b/src/Data/Abstract/Declarations.hs deleted file mode 100644 index 9c23e0eda0..0000000000 --- a/src/Data/Abstract/Declarations.hs +++ /dev/null @@ -1,38 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, UndecidableInstances #-} -module Data.Abstract.Declarations - ( Declarations (..) - , Declarations1 (..) - ) where - -import Data.Abstract.Name -import Data.Sum -import Data.Term - -class Declarations syntax where - declaredName :: syntax -> Maybe Name - declaredName = const Nothing - - declaredAlias :: syntax -> Maybe Name - declaredAlias = const Nothing - -class Declarations1 syntax where - -- | Lift a function mapping each element to its declared name (if any) through a containing structure. This can be used to define the declared name for a composite piece of syntax in terms of the declared name of one of its components. - -- - -- Note that not all syntax will have a declared name; in general it’s reserved for syntax where the user has provided a single, unambiguous name for whatever term is being introduced. Examples would be (non-anonymous) functions, methods, and classes; but not (generally) literals or blocks of imperative statements. - liftDeclaredName :: (a -> Maybe Name) -> syntax a -> Maybe Name - liftDeclaredName _ _ = Nothing - - liftDeclaredAlias :: (a -> Maybe Name) -> syntax a -> Maybe Name - liftDeclaredAlias _ _ = Nothing - -deriving instance Declarations1 syntax => Declarations (Term syntax ann) - -instance (Declarations recur, Declarations1 syntax) => Declarations (TermF syntax ann recur) where - declaredName = liftDeclaredName declaredName . termFOut - declaredAlias = liftDeclaredAlias declaredAlias . termFOut - -instance Apply Declarations1 fs => Declarations1 (Sum fs) where - liftDeclaredName f = apply @Declarations1 (liftDeclaredName f) - liftDeclaredAlias f = apply @Declarations1 (liftDeclaredAlias f) - -instance Declarations1 [] diff --git a/src/Data/Abstract/Evaluatable.hs b/src/Data/Abstract/Evaluatable.hs deleted file mode 100644 index 01e66a7179..0000000000 --- a/src/Data/Abstract/Evaluatable.hs +++ /dev/null @@ -1,344 +0,0 @@ -{-# LANGUAGE GADTs, KindSignatures, RankNTypes, TypeOperators, UndecidableInstances, InstanceSigs #-} -module Data.Abstract.Evaluatable -( module X -, Evaluatable(..) -, traceResolve --- * Preludes -, HasPrelude(..) --- * Effects -, EvalError(..) -, throwEvalError -, throwNoNameError -, runEvalError -, runEvalErrorWith -, UnspecializedError(..) -, runUnspecialized -, runUnspecializedWith -, throwUnspecializedError -) where - -import Control.Abstract hiding (Load, String) -import qualified Control.Abstract as Abstract -import Control.Abstract.Context as X -import Control.Abstract.Evaluator as X hiding (LoopControl(..), Return(..), catchLoopControl, runLoopControl, catchReturn, runReturn) -import Control.Abstract.Modules as X (Modules, ModuleResult, ResolutionError(..), load, lookupModule, listModulesInDir, require, resolve, throwResolutionError) -import Control.Abstract.Value as X hiding (Bitwise(..), Boolean(..), Function(..), Numeric(..), Object(..), Array(..), Hash(..), String(..), Unit(..), While(..)) -import Data.Abstract.BaseError as X -import Data.Abstract.Declarations as X -import Data.Abstract.FreeVariables as X -import Data.Abstract.Module -import Data.Abstract.Name as X -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.Abstract.ScopeGraph (Relation(..)) -import Data.Abstract.AccessControls.Class as X -import Data.Language -import Data.Scientific (Scientific) -import Data.Semigroup.App -import Data.Semigroup.Foldable -import Data.Span (HasSpan(..), emptySpan) -import Data.Sum hiding (project) -import Data.Term -import Prologue - --- | The 'Evaluatable' class defines the necessary interface for a term to be evaluated. While a default definition of 'eval' is given, instances with computational content must implement 'eval' to perform their small-step operational semantics. -class (Show1 constr, Foldable constr) => Evaluatable constr where - eval :: ( AbstractValue term address value m - , AccessControls term - , Carrier sig m - , Declarations term - , FreeVariables term - , HasSpan term - , Member (Allocator address) sig - , Member (Bitwise value) sig - , Member (Boolean value) sig - , Member (While value) sig - , Member (Deref value) sig - , Member (State (ScopeGraph address)) sig - , Member (Error (LoopControl value)) sig - , Member (Error (Return value)) sig - , Member Fresh sig - , Member (Function term address value) sig - , Member (Modules address value) sig - , Member (Numeric value) sig - , Member (Object address value) sig - , Member (Array value) sig - , Member (Hash value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader PackageInfo) sig - , Member (Reader Span) sig - , Member (State Span) sig - , Member (Abstract.String value) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Resumable (BaseError (AddressError address value))) sig - , Member (Resumable (BaseError (UnspecializedError address value))) sig - , Member (Resumable (BaseError (EvalError term address value))) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Member (State (Heap address address value)) sig - , Member Trace sig - , Member (Unit value) sig - , Ord address - , Show address - ) - => (term -> Evaluator term address value m value) - -> (term -> Evaluator term address value m (Slot address)) - -> (constr term -> Evaluator term address value m value) - eval recur _ expr = do - traverse_ recur expr - throwUnspecializedError $ UnspecializedError ("Eval unspecialized for " <> liftShowsPrec (const (const id)) (const id) 0 expr "") - - ref :: ( AbstractValue term address value m - , Carrier sig m - , Declarations term - , Member (Object address value) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (EvalError term address value))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (UnspecializedError address value))) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Ord address - ) - => (term -> Evaluator term address value m value) - -> (term -> Evaluator term address value m (Slot address)) - -> (constr term -> Evaluator term address value m (Slot address)) - ref _ _ expr = do - throwUnspecializedError $ RefUnspecializedError ("ref unspecialized for " <> liftShowsPrec (const (const id)) (const id) 0 expr "") - - -traceResolve :: (Show a, Show b, Member Trace sig, Carrier sig m) => a -> b -> Evaluator term address value m () -traceResolve name path = trace ("resolved " <> show name <> " -> " <> show path) - - --- Preludes - -class HasPrelude (language :: Language) where - definePrelude :: ( AbstractValue term address value m - , Carrier sig m - , HasCallStack - , Member (Allocator address) sig - , Member (State (ScopeGraph address)) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Deref value) sig - , Member Fresh sig - , Member (Function term address value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (AddressError address value))) sig - , Member (State (Heap address address value)) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member Trace sig - , Member (Unit value) sig - , Member (Object address value) sig - , Ord address - , Show address - ) - => proxy language - -> Evaluator term address value m () - definePrelude _ = pure () - -instance HasPrelude 'Go -instance HasPrelude 'Haskell -instance HasPrelude 'Java -instance HasPrelude 'PHP - -instance HasPrelude 'Python where - definePrelude _ = - defineBuiltIn (Declaration $ X.name "print") Default Public Print - -instance HasPrelude 'Ruby where - definePrelude _ = do - defineSelf - - defineBuiltIn (Declaration $ X.name "puts") Default Public Print - - defineClass (Declaration (X.name "Object")) [] $ do - defineBuiltIn (Declaration $ X.name "inspect") Default Public Show - -instance HasPrelude 'TSX - -instance HasPrelude 'TypeScript where - definePrelude _ = do - defineSelf - defineNamespace (Declaration (X.name "console")) $ defineBuiltIn (Declaration $ X.name "log") Default Public Print - -instance HasPrelude 'JavaScript where - definePrelude _ = do - defineSelf - defineNamespace (Declaration (X.name "console")) $ defineBuiltIn (Declaration $ X.name "log") Default Public Print - -defineSelf :: ( Carrier sig m - , Member (State (ScopeGraph address)) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Deref value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (State (Heap address address value)) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Object address value) sig - , Ord address - ) - => Evaluator term address value m () -defineSelf = do - let self = Declaration X.__self - declare self ScopeGraph.Prelude Public emptySpan ScopeGraph.Unknown Nothing - slot <- lookupSlot self - assign slot =<< object =<< currentFrame - - --- Effects - --- | The type of error thrown when failing to evaluate a term. -data EvalError term address value return where - AccessControlError :: (Name, AccessControl) -> (Name, AccessControl) -> value -> EvalError term address value value - ConstructorError :: Name -> EvalError term address value address - DefaultExportError :: EvalError term address value () - DerefError :: value -> EvalError term address value value - ExportError :: ModulePath -> Name -> EvalError term address value () - FloatFormatError :: Text -> EvalError term address value Scientific - -- ^ Indicates that our evaluator wasn't able to make sense of these literals. - IntegerFormatError :: Text -> EvalError term address value Integer - NoNameError :: term -> EvalError term address value Name - RationalFormatError :: Text -> EvalError term address value Rational - ReferenceError :: value -> term -> EvalError term address value (Slot address) - ScopedEnvError :: value -> EvalError term address value address - -throwNoNameError :: ( Carrier sig m - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (EvalError term address value))) sig - ) - => term - -> Evaluator term address value m Name -throwNoNameError = throwEvalError . NoNameError - -deriving instance (Eq term, Eq value) => Eq (EvalError term address value return) -deriving instance (Show term, Show value) => Show (EvalError term address value return) - -instance (NFData term, NFData value) => NFData1 (EvalError term address value) where - liftRnf _ x = case x of - AccessControlError requester requested v -> rnf requester `seq` rnf requested `seq` rnf v - ConstructorError n -> rnf n - DefaultExportError -> () - DerefError v -> rnf v - ExportError p n -> rnf p `seq` rnf n - FloatFormatError i -> rnf i - IntegerFormatError i -> rnf i - NoNameError term -> rnf term - RationalFormatError i -> rnf i - ReferenceError v n -> rnf v `seq` rnf n - ScopedEnvError v -> rnf v - -instance (NFData term, NFData value, NFData return) => NFData (EvalError term address value return) where - rnf = liftRnf rnf - -instance (Eq term, Eq value) => Eq1 (EvalError term address value) where - liftEq _ (AccessControlError a b c) (AccessControlError a' b' c') = a == a' && b == b' && c == c' - liftEq _ (DerefError v) (DerefError v2) = v == v2 - liftEq _ DefaultExportError DefaultExportError = True - liftEq _ (ExportError a b) (ExportError c d) = a == c && b == d - liftEq _ (FloatFormatError a) (FloatFormatError b) = a == b - liftEq _ (IntegerFormatError a) (IntegerFormatError b) = a == b - liftEq _ (NoNameError t1) (NoNameError t2) = t1 == t2 - liftEq _ (RationalFormatError a) (RationalFormatError b) = a == b - liftEq _ (ReferenceError v n) (ReferenceError v2 n2) = v == v2 && n == n2 - liftEq _ _ _ = False - -instance (Show term, Show value) => Show1 (EvalError term address value) where - liftShowsPrec _ _ = showsPrec - -runEvalError :: Evaluator term address value (ResumableC (BaseError (EvalError term address value)) m) a - -> Evaluator term address value m (Either (SomeError (BaseError (EvalError term address value))) a) -runEvalError = raiseHandler runResumable - -runEvalErrorWith :: (forall resume . (BaseError (EvalError term address value)) resume -> Evaluator term address value m resume) - -> Evaluator term address value (ResumableWithC (BaseError (EvalError term address value)) m) a - -> Evaluator term address value m a -runEvalErrorWith f = raiseHandler $ runResumableWith (runEvaluator . f) - -throwEvalError :: ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (EvalError term address value))) sig - , Carrier sig m - ) - => EvalError term address value resume - -> Evaluator term address value m resume -throwEvalError = throwBaseError - - -data UnspecializedError address value resume where - UnspecializedError :: String -> UnspecializedError address value value - RefUnspecializedError :: String -> UnspecializedError address value (Slot address) - -instance NFData1 (UnspecializedError address value) where - liftRnf _ (UnspecializedError s) = rnf s - liftRnf _ (RefUnspecializedError s) = rnf s - -instance NFData (UnspecializedError address value resume) where - rnf = liftRnf (const ()) - -deriving instance Eq (UnspecializedError address value resume) -deriving instance Show (UnspecializedError address value resume) - - -instance Eq1 (UnspecializedError address value) where - liftEq _ (UnspecializedError a) (UnspecializedError b) = a == b - liftEq _ (RefUnspecializedError a) (RefUnspecializedError b) = a == b - liftEq _ _ _ = False - -instance Show1 (UnspecializedError address value) where - liftShowsPrec _ _ = showsPrec - -runUnspecialized :: Evaluator term address value (ResumableC (BaseError (UnspecializedError address value)) m) a - -> Evaluator term address value m (Either (SomeError (BaseError (UnspecializedError address value))) a) -runUnspecialized = raiseHandler runResumable - -runUnspecializedWith :: (forall resume . BaseError (UnspecializedError address value) resume -> Evaluator term address value m resume) - -> Evaluator term address value (ResumableWithC (BaseError (UnspecializedError address value)) m) a - -> Evaluator term address value m a -runUnspecializedWith f = raiseHandler $ runResumableWith (runEvaluator . f) - - -throwUnspecializedError :: ( Member (Resumable (BaseError (UnspecializedError address value))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Carrier sig m - ) - => UnspecializedError address value resume - -> Evaluator term address value m resume -throwUnspecializedError = throwBaseError - - --- Instances - --- | If we can evaluate any syntax which can occur in a 'Sum', we can evaluate the 'Sum'. -instance (Apply Evaluatable fs, Apply Show1 fs, Apply Foldable fs) => Evaluatable (Sum fs) where - eval eval' ref = apply @Evaluatable (eval eval' ref) - ref eval ref' = apply @Evaluatable (ref eval ref') - --- | Evaluating a 'TermF' ignores its annotation, evaluating the underlying syntax. -instance (Evaluatable s, Show a) => Evaluatable (TermF s a) where - eval eval' ref = eval eval' ref . termFOut - ref eval ref' = ref eval ref' . termFOut - - --- NOTE: Use 'Data.Syntax.Statements' instead of '[]' if you need imperative eval semantics. --- --- | '[]' is treated as an imperative sequence of statements/declarations s.t.: --- --- 1. Each statement’s effects on the store are accumulated; --- 2. Each statement can affect the environment of later statements (e.g. by 'modify'-ing the environment); and --- 3. Only the last statement’s return value is returned. -instance Evaluatable [] where - -- 'nonEmpty' and 'foldMap1' enable us to return the last statement’s result instead of 'unit' for non-empty lists. - eval eval _ = maybe unit (runApp . foldMap1 (App . eval)) . nonEmpty diff --git a/src/Data/Abstract/FreeVariables.hs b/src/Data/Abstract/FreeVariables.hs deleted file mode 100644 index 637936c26e..0000000000 --- a/src/Data/Abstract/FreeVariables.hs +++ /dev/null @@ -1,38 +0,0 @@ -{-# LANGUAGE DefaultSignatures, GeneralizedNewtypeDeriving, UndecidableInstances #-} -module Data.Abstract.FreeVariables - ( FreeVariables (..) - , FreeVariables1 (..) - ) where - -import Data.Abstract.Name -import Data.Sum -import Data.Term -import Prologue - --- | Types which can contain unbound variables. -class FreeVariables term where - -- | The set of free variables in the given value. - freeVariables :: term -> Set Name - - --- | A lifting of 'FreeVariables' to type constructors of kind @* -> *@. --- --- 'Foldable' types requiring no additional semantics to the set of free variables (e.g. types which do not bind any variables) can use (and even derive, with @-XDeriveAnyClass@) the default implementation. -class FreeVariables1 syntax where - -- | Lift a function mapping each element to its set of free variables through a containing structure, collecting the results into a single set. - liftFreeVariables :: (a -> Set Name) -> syntax a -> Set Name - default liftFreeVariables :: (Foldable syntax) => (a -> Set Name) -> syntax a -> Set Name - liftFreeVariables = foldMap - -deriving instance FreeVariables1 syntax => FreeVariables (Term syntax ann) - -instance (FreeVariables recur, FreeVariables1 syntax) => FreeVariables (TermF syntax ann recur) where - freeVariables = liftFreeVariables freeVariables - -instance FreeVariables1 syntax => FreeVariables1 (TermF syntax ann) where - liftFreeVariables f (In _ s) = liftFreeVariables f s - -instance Apply FreeVariables1 fs => FreeVariables1 (Sum fs) where - liftFreeVariables f = apply @FreeVariables1 (liftFreeVariables f) - -instance FreeVariables1 [] diff --git a/src/Data/Abstract/Heap.hs b/src/Data/Abstract/Heap.hs deleted file mode 100644 index 5fa2676221..0000000000 --- a/src/Data/Abstract/Heap.hs +++ /dev/null @@ -1,160 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingStrategies, GeneralizedNewtypeDeriving #-} -module Data.Abstract.Heap - ( Heap(..) - , Frame(..) - , frameLookup - , scopeLookup - , frameSlots - , frameLinks - , getSlotValue - , setSlot - , deleteSlot - , initFrame - , newFrame - , insertFrame - , heapLookup - , heapLookupAll - , heapSize - , heapRestrict - , Position(..) - , pathPosition - , pathDeclaration - , lookupFrameAddress - , lookupDeclaration - , isHeapEmpty - ) where - -import Data.Abstract.Live -import Data.Abstract.ScopeGraph - ( Declaration (..) - , EdgeLabel (..) - , Path (..) - , Position (..) - , ScopeGraph - , Slot (..) - , lookupScopePath - , pathDeclaration - , pathPosition - ) -import qualified Data.IntMap as IntMap -import qualified Data.Map.Strict as Map -import Prelude hiding (lookup) -import Prologue - --- | A Frame describes the vertices of the Heap. Think of it as an instance of a Scope in the ScopeGraph. -data Frame scopeAddress frameAddress value = Frame - { scopeAddress :: scopeAddress - -- ^ The scope address of its corresponding Scope - , links :: Map EdgeLabel (Map scopeAddress frameAddress) - -- ^ A map of edge labels to maps of scope addresses to frame addresses (scope addresses are unique keys in the ScopeGraph - -- and frame addresses are unique keys in the Heap). This map describes the frame’s links to other frames. - -- A frame’s links are always in one-to-one correspondence with its scope’s edges to parent scopes. - , slots :: IntMap (Set value) - -- ^ An IntMap of values that are declared in the frame. - } - deriving (Eq, Ord, Show, Generic, NFData) - --- | A Heap is a Map from frame addresses to frames. -newtype Heap scopeAddress frameAddress value = Heap { unHeap :: Map frameAddress (Frame scopeAddress frameAddress value) } - deriving stock (Eq, Generic, Ord) - deriving newtype (NFData) - -instance Lower (Heap scopeAddress frameAddress value) where - lowerBound = Heap lowerBound - - --- | Look up the frame for an 'address' in a 'Heap', if any. -frameLookup :: Ord address => address -> Heap scope address value -> Maybe (Frame scope address value) -frameLookup address = Map.lookup address . unHeap - --- | Look up the scope address for a given frame address. -scopeLookup :: Ord address => address -> Heap scope address value -> Maybe scope -scopeLookup address = fmap scopeAddress . frameLookup address - -frameSlots :: Ord address => address -> Heap scope address value -> Maybe (IntMap (Set value)) -frameSlots address = fmap slots . frameLookup address - -frameLinks :: Ord address => address -> Heap scope address value -> Maybe (Map EdgeLabel (Map scope address)) -frameLinks address = fmap links . frameLookup address - -getSlotValue :: Ord address => Slot address -> Heap address address value -> Maybe (Set value) -getSlotValue Slot{..} = (IntMap.lookup (unPosition position) =<<) . frameSlots frameAddress - -setSlot :: Ord address => Slot address -> Set value -> Heap scope address value -> Heap scope address value -setSlot Slot{..} value h@(Heap heap) = case frameLookup frameAddress h of - Just frame -> let slotMap = slots frame in - Heap (Map.insert frameAddress (frame { slots = IntMap.insert (unPosition position) value slotMap }) heap) - Nothing -> h - -deleteSlot :: Ord address => Slot address -> Heap scope address value -> Heap scope address value -deleteSlot Slot{..} h@(Heap heap) = case frameLookup frameAddress h of - Just frame -> let slotMap = slots frame in - Heap (Map.insert frameAddress (frame { slots = IntMap.delete (unPosition position) slotMap }) heap) - Nothing -> h - -lookupDeclaration :: Ord address - => Declaration - -> (address, address) - -> ScopeGraph address - -> Heap address address value - -> Maybe (Slot address) -lookupDeclaration Declaration{..} (currentScope, currentFrame) scopeGraph heap = do - path <- lookupScopePath unDeclaration currentScope scopeGraph - frameAddress <- lookupFrameAddress path currentFrame heap - pure (Slot frameAddress (pathPosition path)) - -lookupFrameAddress :: (Ord address, Ord scope) => Path scope -> address -> Heap scope address value -> Maybe address -lookupFrameAddress path currentFrame h = go path currentFrame - where - go path address = case path of - DPath _ _ -> pure address - EPath edge nextScopeAddress path' -> do - linkMap <- frameLinks address h - frameAddress <- do - scopeMap <- Map.lookup edge linkMap - Map.lookup nextScopeAddress scopeMap - go path' frameAddress - Hole -> Nothing - -newFrame :: (Ord address) => scope -> address -> Map EdgeLabel (Map scope address) -> Heap scope address value -> Heap scope address value -newFrame scope address links = insertFrame address (Frame scope links mempty) - -initFrame :: (Ord address) => scope -> address -> Map EdgeLabel (Map scope address) -> IntMap (Set value) -> Heap scope address value -> Heap scope address value -initFrame scope address links slots = fillFrame address slots . newFrame scope address links - -insertFrame :: Ord address => address -> Frame scope address value -> Heap scope address value -> Heap scope address value -insertFrame address frame = Heap . Map.insert address frame . unHeap - -fillFrame :: Ord address => address -> IntMap (Set value) -> Heap scope address value -> Heap scope address value -fillFrame address slots heap = case frameLookup address heap of - Just frame -> insertFrame address (frame { slots = slots }) heap - Nothing -> heap - --- | Look up the cell of values for an address in a 'Heap', if any. -heapLookup :: (Ord address, Ord value) => address -> Heap address address value -> Maybe (Set value) -heapLookup address = fmap (fold . IntMap.elems . slots) . Map.lookup address . unHeap - --- | Look up the list of values stored for a given address, if any. -heapLookupAll :: (Ord address, Ord value) => address -> Heap address address value -> Maybe [value] -heapLookupAll address = fmap toList . heapLookup address - --- | The number of frames in the `Heap`. -heapSize :: Heap scope address value -> Int -heapSize = Map.size . unHeap - --- | Restrict a 'Heap' to only those addresses in the given 'Live' set (in essence garbage collecting the rest). -heapRestrict :: Ord address => Heap address address value -> Live address -> Heap address address value -heapRestrict (Heap m) roots = Heap (Map.filterWithKey (\ address _ -> address `liveMember` roots) m) - --- | Checks whether a heap as no slots and links. -isHeapEmpty :: (Eq address, Eq value) => Heap scope address value -> Bool -isHeapEmpty h@(Heap heap) - = heapSize h == 1 - && (toEmptyFrame <$> Map.elems heap) == [ Frame () mempty mempty ] - where - -- Maps a frame's address param to () so we can check that its slots and links are empty. - toEmptyFrame Frame{..} = Frame () (Map.mapKeysMonotonic (const ()) <$> links) slots - - -instance (Show address, Show value) => Show (Heap address address value) where - showsPrec d = showsUnaryWith showsPrec "Heap" d . Map.toList . unHeap diff --git a/src/Data/Abstract/Live.hs b/src/Data/Abstract/Live.hs deleted file mode 100644 index b7140ecdad..0000000000 --- a/src/Data/Abstract/Live.hs +++ /dev/null @@ -1,54 +0,0 @@ -{-# LANGUAGE DataKinds, GeneralizedNewtypeDeriving, TypeFamilies, TypeOperators #-} -module Data.Abstract.Live - ( Live (..) - , fromAddresses - , liveSingleton - , liveInsert - , liveDelete - , liveDifference - , liveMember - , liveSplit - , liveMap - ) where - -import Data.Set as Set -import Prologue - --- | A set of live addresses (whether roots or reachable). -newtype Live address = Live { unLive :: Set address } - deriving (Eq, Lower, Monoid, Ord, Semigroup) - -fromAddresses :: (Foldable t, Ord address) => t address -> Live address -fromAddresses = Prologue.foldr liveInsert lowerBound - --- | Construct a 'Live' set containing only the given address. -liveSingleton :: address -> Live address -liveSingleton = Live . Set.singleton - --- | Insert an address into a 'Live' set. -liveInsert :: Ord address => address -> Live address -> Live address -liveInsert addr = Live . Set.insert addr . unLive - --- | Delete an address from a 'Live' set, if present. -liveDelete :: Ord address => address -> Live address -> Live address -liveDelete addr = Live . Set.delete addr . unLive - --- | Compute the (asymmetric) difference of two 'Live' sets, i.e. delete every element of the second set from the first set. -liveDifference :: Ord address => Live address -> Live address -> Live address -liveDifference = fmap Live . (Set.difference `on` unLive) - --- | Test whether an address is in a 'Live' set. -liveMember :: Ord address => address -> Live address -> Bool -liveMember addr = Set.member addr . unLive - --- | Decompose a 'Live' set into a pair of one member address and the remaining set, or 'Nothing' if empty. -liveSplit :: Live address -> Maybe (address, Live address) -liveSplit = fmap (fmap Live) . Set.minView . unLive - --- | Map a function over the addresses in a 'Live' set. -liveMap :: Ord b => (a -> b) -> Live a -> Live b -liveMap f = Live . Set.map f . unLive - - -instance Show address => Show (Live address) where - showsPrec d = showsUnaryWith showsPrec "Live" d . Set.toList . unLive diff --git a/src/Data/Abstract/Module.hs b/src/Data/Abstract/Module.hs deleted file mode 100644 index e379358f72..0000000000 --- a/src/Data/Abstract/Module.hs +++ /dev/null @@ -1,53 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingStrategies #-} - -module Data.Abstract.Module -( Module(..) -, moduleForBlob -, ModulePath -, ModuleInfo(..) -, moduleInfoFromSrcLoc -, moduleInfoFromCallStack -) where - -import Data.Blob -import Data.Language -import GHC.Stack -import Prologue -import System.FilePath.Posix - -data Module body = Module { moduleInfo :: ModuleInfo, moduleBody :: body } - deriving stock (Eq, Foldable, Functor, Ord, Traversable, Generic) - deriving anyclass (NFData) - -instance Show body => Show (Module body) where - showsPrec d Module{..} = showsBinaryWith showsPrec showsPrec "Module" d (modulePath moduleInfo) moduleBody - - --- | Construct a 'Module' for a 'Blob' and @term@, relative to some root 'FilePath'. -moduleForBlob :: Maybe FilePath -- ^ The root directory relative to which the module will be resolved, if any. - -> Blob -- ^ The 'Blob' containing the module. - -> term -- ^ The @term@ representing the body of the module. - -> Module term -- ^ A 'Module' named appropriate for the 'Blob', holding the @term@, and constructed relative to the root 'FilePath', if any. -moduleForBlob rootDir b = Module info - where root = fromMaybe (takeDirectory (blobPath b)) rootDir - info = ModuleInfo (makeRelative root (blobPath b)) (blobLanguage b) (blobOid b) - - -type ModulePath = FilePath - -data ModuleInfo = ModuleInfo { modulePath :: ModulePath, moduleLanguage :: Language, moduleOid :: Text } - deriving stock (Eq, Ord, Generic) - deriving anyclass (NFData) - -instance Lower ModuleInfo where - lowerBound = ModuleInfo mempty Unknown mempty - -instance Show ModuleInfo where - showsPrec d = showsUnaryWith showsPrec "ModuleInfo" d . modulePath - -moduleInfoFromSrcLoc :: SrcLoc -> ModuleInfo -moduleInfoFromSrcLoc loc = ModuleInfo (srcLocModule loc) Unknown mempty - --- | Produce 'ModuleInfo' from the top location on the Haskell call stack (i.e. the file where the call to 'moduleInfoFromCallStack' was made). -moduleInfoFromCallStack :: HasCallStack => ModuleInfo -moduleInfoFromCallStack = maybe (ModuleInfo "?" Unknown mempty) (moduleInfoFromSrcLoc . snd) (listToMaybe (getCallStack callStack)) diff --git a/src/Data/Abstract/ModuleTable.hs b/src/Data/Abstract/ModuleTable.hs deleted file mode 100644 index a79843c438..0000000000 --- a/src/Data/Abstract/ModuleTable.hs +++ /dev/null @@ -1,59 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingStrategies, GeneralizedNewtypeDeriving #-} -module Data.Abstract.ModuleTable -( ModulePath -, ModuleTable (..) -, singleton -, lookup -, member -, modulePaths -, modulePathsInDir -, insert -, keys -, fromModules -, toPairs -) where - -import Data.Abstract.Module -import qualified Data.Map as Map -import GHC.Generics (Generic1) -import Prelude hiding (lookup) -import Prologue -import System.FilePath.Posix - -newtype ModuleTable a = ModuleTable { unModuleTable :: Map.Map ModulePath a } - deriving stock (Eq, Foldable, Functor, Generic1, Generic, Ord, Traversable) - deriving newtype (Lower, Monoid, Semigroup) - deriving anyclass (NFData) - -singleton :: ModulePath -> a -> ModuleTable a -singleton name = ModuleTable . Map.singleton name - -modulePaths :: ModuleTable a -> Set ModulePath -modulePaths = Map.keysSet . unModuleTable - -modulePathsInDir :: FilePath -> ModuleTable a -> [ModulePath] -modulePathsInDir k = filter (\e -> k == takeDirectory e) . Map.keys . unModuleTable - -lookup :: ModulePath -> ModuleTable a -> Maybe a -lookup k = Map.lookup k . unModuleTable - -member :: ModulePath -> ModuleTable a -> Bool -member k = Map.member k . unModuleTable - -insert :: ModulePath -> a -> ModuleTable a -> ModuleTable a -insert k v = ModuleTable . Map.insert k v . unModuleTable - -keys :: ModuleTable a -> [ModulePath] -keys = Map.keys . unModuleTable - --- | Construct a 'ModuleTable' from a non-empty list of 'Module's. -fromModules :: [Module term] -> ModuleTable (Module term) -fromModules = ModuleTable . Map.fromList . map toEntry - where toEntry m = (modulePath (moduleInfo m), m) - -toPairs :: ModuleTable a -> [(ModulePath, a)] -toPairs = Map.toList . unModuleTable - - -instance Show a => Show (ModuleTable a) where - showsPrec d = showsUnaryWith showsPrec "ModuleTable" d . toPairs diff --git a/src/Data/Abstract/Name.hs b/src/Data/Abstract/Name.hs deleted file mode 100644 index 66d9bb4b2e..0000000000 --- a/src/Data/Abstract/Name.hs +++ /dev/null @@ -1,63 +0,0 @@ -{-# LANGUAGE DeriveAnyClass #-} -module Data.Abstract.Name -( Name --- * Constructors -, gensym -, name -, nameI -, formatName -, __self -) where - -import Control.Effect -import Control.Effect.Fresh -import Data.Aeson -import qualified Data.Char as Char -import Data.Text (Text) -import qualified Data.Text as Text -import Prologue - --- | The type of variable names. -data Name - = Name Text - | I Int - deriving (Eq, Ord, Generic, NFData) - --- | Generate a fresh (unused) name for use in synthesized variables/closures/etc. -gensym :: (Member Fresh sig, Carrier sig m) => m Name -gensym = I <$> fresh - --- | Construct a 'Name' from a 'Text'. -name :: Text -> Name -name = Name - --- | Construct a 'Name' from an 'Int'. This is suitable for automatic generation, e.g. using a Fresh effect, but should not be used for human-generated names. -nameI :: Int -> Name -nameI = I - --- | Extract a human-readable 'Text' from a 'Name'. --- Sample outputs can be found in @Data.Abstract.Name.Spec@. -formatName :: Name -> Text -formatName (Name name) = name -formatName (I i) = Text.pack $ '_' : (alphabet !! a) : replicate n 'ΚΉ' - where alphabet = ['a'..'z'] - (n, a) = i `divMod` length alphabet - -instance Show Name where - showsPrec _ = prettyShowString . Text.unpack . formatName - where prettyShowString str = showChar '"' . foldr ((.) . prettyChar) id str . showChar '"' - prettyChar c - | c `elem` ['\\', '\"'] = Char.showLitChar c - | Char.isPrint c = showChar c - | otherwise = Char.showLitChar c - -instance Hashable Name where - hashWithSalt salt (Name name) = hashWithSalt salt name - hashWithSalt salt (I i) = salt `hashWithSalt` (1 :: Int) `hashWithSalt` i - -instance ToJSON Name where - toJSON = toJSON . formatName - toEncoding = toEncoding . formatName - -__self :: Name -__self = name "__semantic_self" diff --git a/src/Data/Abstract/Number.hs b/src/Data/Abstract/Number.hs deleted file mode 100644 index a8ce0beb0a..0000000000 --- a/src/Data/Abstract/Number.hs +++ /dev/null @@ -1,110 +0,0 @@ -{-# LANGUAGE GADTs, StandaloneDeriving, Rank2Types #-} - -module Data.Abstract.Number - ( Number (..) - , SomeNumber (..) - , liftReal - , liftIntegralFrac - , liftedExponent - , liftedFloorDiv - ) where - -import Data.Scientific -import qualified Prelude -import Prelude hiding (Integer) -import Prologue - --- | A generalized number type that unifies all interpretable numeric types. --- This is a GADT, so you can specialize the 'a' parameter and be confident --- that, say, a @Number Scientific@ contains a 'Scientific' and not an integer --- in disguise. This unified type is used to provide mathematical operations --- that can change their representation based on an operation's operandsβ€”e.g. --- raising a rational number to a ratio may not produce another rational number. --- This also neatly encapsulates the "coalescing" behavior of adding numbers --- of different type in dynamic languages: operating on a whole and a rational --- produces a rational, operating on a rational and a decimal produces a decimal, --- and so on and so forth. When we add complex numbers, they will in turn subsume --- the other numeric types. -data Number a where - Integer :: !Prelude.Integer -> Number Prelude.Integer - Ratio :: !Prelude.Rational -> Number Prelude.Rational - Decimal :: !Scientific -> Number Scientific - -deriving instance Eq a => Eq (Number a) - -instance NFData (Number a) where - rnf a = case a of - Integer i -> rnf i - Ratio r -> rnf r - Decimal d -> rnf d - -instance Show (Number a) where - show (Integer i) = show i - show (Ratio r) = show r - show (Decimal d) = show d - --- | Every 'Number' can be coerced to a 'Scientific'. Used in the 'Ord' instance. -toScientific :: Number a -> Scientific -toScientific (Integer i) = fromInteger i -toScientific (Ratio r) = fromRational r -toScientific (Decimal s) = s - -instance Eq a => Ord (Number a) where compare = compare `on` toScientific - --- | A box that hides the @a@ parameter to a given 'Number'. Pattern-match --- on it to extract the information contained; because there are only three --- possible constructors, pattern-matching all three cases is possible. -data SomeNumber = forall a . SomeNumber (Number a) - --- | Smart constructors for 'SomeNumber'. -whole :: Prelude.Integer -> SomeNumber -whole = SomeNumber . Integer - -ratio :: Prelude.Rational -> SomeNumber -ratio = SomeNumber . Ratio - -decim :: Scientific -> SomeNumber -decim = SomeNumber . Decimal - --- | In order to provide truly generic math operations, where functions like --- exponentiation handle the fact that they are not closed over the rational --- numbers, we must promote standard Haskell math functions from operations --- on 'Real', 'Integral', and 'Fractional' numbers into functions that operate --- on two 'Number' values and return a temporarily-indeterminate 'SomeNumber' --- value. At the callsite, we can then unwrap the 'SomeNumber' and handle the --- specific cases. --- --- Promote a function on 'Real' values into one operating on 'Number's. --- You pass things like @+@ and @-@ here. -liftReal :: (forall n . Real n => n -> n -> n) - -> (Number a -> Number b -> SomeNumber) -liftReal f = liftIntegralFrac f f - --- | Promote two functions, one on 'Integral' and one on 'Fractional' and 'Real' values, --- to operate on 'Numbers'. Examples of this: 'mod' and 'mod'', 'div' and '/'. -liftIntegralFrac :: (forall n . Integral n => n -> n -> n) - -> (forall f . (Fractional f, Real f) => f -> f -> f) - -> (Number a -> Number b -> SomeNumber) -liftIntegralFrac f _ (Integer i) (Integer j) = whole (f i j) -liftIntegralFrac _ g (Integer i) (Ratio j) = ratio (g (toRational i) j) -liftIntegralFrac _ g (Integer i) (Decimal j) = decim (g (fromIntegral i) j) -liftIntegralFrac _ g (Ratio i) (Ratio j) = ratio (g i j) -liftIntegralFrac _ g (Ratio i) (Integer j) = ratio (g i (fromIntegral j)) -liftIntegralFrac _ g (Ratio i) (Decimal j) = decim (g (fromRational i) j) -liftIntegralFrac _ g (Decimal i) (Integer j) = decim (g i (fromIntegral j)) -liftIntegralFrac _ g (Decimal i) (Ratio j) = decim (g i (fromRational j)) -liftIntegralFrac _ g (Decimal i) (Decimal j) = decim (g i j) - --- | Exponential behavior is too hard to generalize, so here's a manually implemented version. --- TODO: Given a 'Ratio' raised to some 'Integer', we could check to see if it's an integer --- and round it before the exponentiation, giving back a 'Integer'. -liftedExponent :: Number a -> Number b -> SomeNumber -liftedExponent (Integer i) (Integer j) = whole (i ^ j) -liftedExponent (Ratio i) (Integer j) = ratio (i ^^ j) -liftedExponent i j = decim (fromFloatDigits (munge i ** munge j)) - where munge = (toRealFloat . toScientific) :: Number a -> Double - -liftedFloorDiv :: Number a -> Number b -> SomeNumber -liftedFloorDiv (Integer i) (Integer j) = whole (i `div` j) -liftedFloorDiv i j = decim (fromIntegral @Prelude.Integer (floor (fromFloatDigits (munge i / munge j)))) - where munge = (toRealFloat . toScientific) :: Number a -> Double diff --git a/src/Data/Abstract/Package.hs b/src/Data/Abstract/Package.hs deleted file mode 100644 index 6a70931301..0000000000 --- a/src/Data/Abstract/Package.hs +++ /dev/null @@ -1,33 +0,0 @@ -{-# LANGUAGE DeriveAnyClass #-} - -module Data.Abstract.Package - ( Package (..) - , PackageInfo (..) - , PackageName - , Data.Abstract.Package.fromModules - ) where - -import Data.Abstract.Module -import Data.Abstract.ModuleTable as ModuleTable -import qualified Data.Map as Map -import Data.Abstract.Name -import Prologue - -type PackageName = Name - --- | Metadata for a package (name and version). -data PackageInfo = PackageInfo - { packageName :: PackageName - , packageResolutions :: Map.Map FilePath FilePath - } - deriving (Eq, Ord, Show, Generic, NFData) - --- | A package represents the unit of dependency, i.e. something which can depend upon, or be depended upon by, other packages. Packages have modules and may have entry points from which evaluation can proceed. -data Package term = Package - { packageInfo :: PackageInfo - , packageModules :: ModuleTable (Module term) - } - deriving (Eq, Functor, Ord, Show) - -fromModules :: PackageName -> [Module term] -> Map.Map FilePath FilePath -> Package term -fromModules name modules resolutions = Package (PackageInfo name resolutions) (ModuleTable.fromModules modules) diff --git a/src/Data/Abstract/Path.hs b/src/Data/Abstract/Path.hs deleted file mode 100644 index 47b96ec2b6..0000000000 --- a/src/Data/Abstract/Path.hs +++ /dev/null @@ -1,29 +0,0 @@ -module Data.Abstract.Path - ( dropRelativePrefix - , joinPaths - , stripQuotes - ) where - -import Prologue -import qualified Data.Text as T -import System.FilePath.Posix - --- | Join two paths a and b. Handles walking up relative directories in b. e.g. --- --- joinPaths "a/b" "../c" == "a/c" --- joinPaths "a/b" "./c" == "a/b/c" --- --- Walking beyond the beginning of a just stops when you get to the root of a. -joinPaths :: FilePath -> FilePath -> FilePath -joinPaths a b = let bs = splitPath (normalise b) - n = length (filter (== "../") bs) - in normalise $ walkup n a joinPath (drop n bs) - where - walkup 0 str = str - walkup n str = walkup (pred n) (takeDirectory str) - -stripQuotes :: Text -> Text -stripQuotes = T.dropAround (`elem` ("\'\"" :: String)) - -dropRelativePrefix :: Text -> Text -dropRelativePrefix = T.dropWhile (== '/') . T.dropWhile (== '.') diff --git a/src/Data/Abstract/ScopeGraph.hs b/src/Data/Abstract/ScopeGraph.hs deleted file mode 100644 index 0b5d61dd8d..0000000000 --- a/src/Data/Abstract/ScopeGraph.hs +++ /dev/null @@ -1,419 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DuplicateRecordFields, LambdaCase, TupleSections #-} -module Data.Abstract.ScopeGraph - ( Slot(..) - , Info(..) - , associatedScope - , lookupDeclaration - , declarationByName - , declarationsByAccessControl - , declarationsByRelation - , Declaration(..) -- TODO don't export these constructors - , declare - , formatDeclaration - , EdgeLabel(..) - , insertDeclarationScope - , insertDeclarationSpan - , insertImportReference - , newScope - , newPreludeScope - , insertScope - , insertEdge - , Path(..) - , pathDeclaration - , pathOfRef - , pathPosition - , Position(..) - , reference - , Reference(..) -- TODO don't export these constructors - , ReferenceInfo(..) - , Relation(..) - , ScopeGraph(..) - , Kind(..) - , lookupScope - , lookupScopePath - , Scope(..) - , scopeOfRef - , pathDeclarationScope - , putDeclarationScopeAtPosition - , declarationNames - , AccessControl(..) - ) where - -import Prelude hiding (lookup) -import Prologue - -import Control.Lens.Lens -import Data.Aeson -import qualified Data.Map.Strict as Map -import qualified Data.Sequence as Seq -import qualified Data.Set as Set -import Data.Span -import Control.Abstract.Hole -import Data.Abstract.Module -import Data.JSON.Fields -import Data.Abstract.Name - --- A slot is a location in the heap where a value is stored. -data Slot address = Slot { frameAddress :: address, position :: Position } - deriving (Eq, Show, Ord, Generic, NFData) - - -data AccessControl = Public - | Protected - | Private - deriving (Bounded, Enum, Eq, Generic, Hashable, ToJSON, NFData, Show) - -instance ToJSONFields AccessControl where - toJSONFields accessControl = ["accessControl" .= accessControl] - --- | The Ord AccessControl instance represents an order specification of AccessControls. --- AccessControls that are less than or equal to another AccessControl implies access. --- It is helpful to consider `Public <= Private` as saying "Can a Public syntax term access a Private syntax term?" --- In this way, Public AccessControl is the top of the order specification, and Private AccessControl is the bottom. -instance Ord AccessControl where - -- | Private AccessControl represents the least overlap or accessibility with other AccessControls. - -- When asking if the AccessControl "on the left" is less than the AccessControl "on the right", Private AccessControl on the left always implies access to the thing on the right. - (<=) Private _ = True - (<=) _ Private = False - - -- | Protected AccessControl is inbetween Private and Public in the order specification. - -- Protected AccessControl "on the left" has access to Protected or Public AccessControls "on the right". - (<=) Protected Public = True - (<=) Protected Protected = True - - -- | Public AccessControl "on the left" has access only to Public AccessControl "on the right". - (<=) Public Public = True - (<=) Public _ = False - - -data Relation = Default | Instance | Prelude | Gensym - deriving (Bounded, Enum, Eq, Show, Ord, Generic, NFData) - -instance Lower Relation where - lowerBound = Default - -data Info scopeAddress = Info - { infoDeclaration :: Declaration - , infoModule :: ModuleInfo - , infoRelation :: Relation - , infoAccessControl :: AccessControl - , infoSpan :: Span - , infoKind :: Kind - , infoAssociatedScope :: Maybe scopeAddress - } deriving (Eq, Show, Ord, Generic, NFData) - -instance HasSpan (Info scopeAddress) where - span = lens infoSpan (\i s -> i { infoSpan = s }) - {-# INLINE span #-} - -instance Lower (Info scopeAddress) where - lowerBound = Info lowerBound lowerBound lowerBound Public lowerBound lowerBound Nothing - -data ReferenceInfo = ReferenceInfo - { refSpan :: Span - , refKind :: Kind - , refModule :: ModuleInfo - } deriving (Eq, Show, Ord, Generic, NFData) - -instance HasSpan ReferenceInfo where - span = lens refSpan (\r s -> r { refSpan = s }) - {-# INLINE span #-} - -data Kind = AbstractClass - | Assignment - | Call - | Class - | DefaultExport - | Function - | Identifier - | Let - | MemberAccess - | Method - | Module - | New - | Parameter - | PublicField - | QualifiedAliasedImport - | QualifiedExport - | QualifiedImport - | RequiredParameter - | This - | TypeAlias - | TypeIdentifier - | Unknown - | UnqualifiedImport - | VariableDeclaration - deriving (Bounded, Enum, Eq, Show, Ord, Generic, NFData) - -instance Lower Kind where - lowerBound = Unknown - --- Offsets and frame addresses in the heap should be addresses? -data Scope address = - Scope { - edges :: Map EdgeLabel [address] - , references :: Map Reference ([ReferenceInfo], Path address) - , declarations :: Seq (Info address) - } - | PreludeScope { - edges :: Map EdgeLabel [address] - , references :: Map Reference ([ReferenceInfo], Path address) - , declarations :: Seq (Info address) - } - deriving (Eq, Show, Ord, Generic, NFData) - -instance Lower (Scope scopeAddress) where - lowerBound = Scope mempty mempty mempty - -instance AbstractHole (Scope scopeAddress) where - hole = lowerBound - -instance AbstractHole address => AbstractHole (Slot address) where - hole = Slot hole (Position 0) - -instance AbstractHole (Info address) where - hole = lowerBound - -newtype Position = Position { unPosition :: Int } - deriving (Eq, Show, Ord, Generic, NFData) - -newtype ScopeGraph scope = ScopeGraph { unScopeGraph :: Map scope (Scope scope) } - deriving (Eq, Generic, NFData, Ord, Show) - -instance Ord scope => Lower (ScopeGraph scope) where - lowerBound = ScopeGraph mempty - -data Path scope - = Hole - -- | Construct a direct path to a declaration. - | DPath Declaration Position - -- | Construct an edge from a scope to another declaration path. - | EPath EdgeLabel scope (Path scope) - deriving (Eq, Functor, Generic, NFData, Ord, Show) - -instance AbstractHole (Path scope) where - hole = Hole - --- Returns the declaration of a path. -pathDeclaration :: Path scope -> Declaration -pathDeclaration (DPath d _) = d -pathDeclaration (EPath _ _ p) = pathDeclaration p -pathDeclaration Hole = undefined - --- TODO: Store the current scope closer _in_ the DPath? -pathDeclarationScope :: scope -> Path scope -> Maybe scope -pathDeclarationScope _ (EPath _ scope (DPath _ _)) = Just scope -pathDeclarationScope currentScope (EPath _ _ p) = pathDeclarationScope currentScope p -pathDeclarationScope currentScope (DPath _ _) = Just currentScope -pathDeclarationScope _ Hole = Nothing - --- TODO: Possibly return in Maybe since we can have Hole paths -pathPosition :: Path scope -> Position -pathPosition Hole = Position 0 -pathPosition (DPath _ p) = p -pathPosition (EPath _ _ p) = pathPosition p - --- Returns the reference paths of a scope in a scope graph. -pathsOfScope :: Ord scope => scope -> ScopeGraph scope -> Maybe (Map Reference ([ReferenceInfo], Path scope)) -pathsOfScope scope = fmap references . Map.lookup scope . unScopeGraph - --- Returns the declaration data of a scope in a scope graph. -ddataOfScope :: Ord scope => scope -> ScopeGraph scope -> Maybe (Seq (Info scope)) -ddataOfScope scope = fmap declarations . Map.lookup scope . unScopeGraph - --- Returns the edges of a scope in a scope graph. -linksOfScope :: Ord scope => scope -> ScopeGraph scope -> Maybe (Map EdgeLabel [scope]) -linksOfScope scope = fmap edges . Map.lookup scope . unScopeGraph - -declarationsByAccessControl :: Ord scope => scope -> AccessControl -> ScopeGraph scope -> [ Info scope ] -declarationsByAccessControl scope accessControl g = fromMaybe mempty $ do - dataSeq <- ddataOfScope scope g - pure . toList $ Seq.filter (\Info{..} -> accessControl <= infoAccessControl) dataSeq - -declarationsByRelation :: Ord scope => scope -> Relation -> ScopeGraph scope -> [ Info scope ] -declarationsByRelation scope relation g = fromMaybe mempty $ do - dataSeq <- ddataOfScope scope g - pure . toList $ Seq.filter (\Info{..} -> infoRelation == relation) dataSeq - -declarationByName :: Ord scope => scope -> Declaration -> ScopeGraph scope -> Maybe (Info scope) -declarationByName scope name g = do - dataSeq <- ddataOfScope scope g - find (\Info{..} -> infoDeclaration == name) dataSeq - --- Lookup a scope in the scope graph. -lookupScope :: Ord scope => scope -> ScopeGraph scope -> Maybe (Scope scope) -lookupScope scope = Map.lookup scope . unScopeGraph - --- Declare a declaration with a span and an associated scope in the scope graph. --- TODO: Return the whole value in Maybe or Either. -declare :: Ord scope - => Declaration - -> ModuleInfo - -> Relation - -> AccessControl - -> Span - -> Kind - -> Maybe scope - -> scope - -> ScopeGraph scope - -> (ScopeGraph scope, Maybe Position) -declare decl moduleInfo rel accessControl declSpan kind assocScope currentScope g = fromMaybe (g, Nothing) $ do - scope <- lookupScope currentScope g - - dataSeq <- ddataOfScope currentScope g - case Seq.findIndexR (\Info{..} -> decl == infoDeclaration && declSpan == infoSpan && rel == infoRelation) dataSeq of - Just index -> pure (g, Just (Position index)) - Nothing -> do - let newScope = scope { declarations = declarations scope Seq.|> Info decl moduleInfo rel accessControl declSpan kind assocScope } - pure (insertScope currentScope newScope g, Just (Position (length (declarations newScope)))) - --- | Add a reference to a declaration in the scope graph. --- Returns the original scope graph if the declaration could not be found. -reference :: Ord scope => Reference -> ModuleInfo -> Span -> Kind -> Declaration -> scope -> ScopeGraph scope -> ScopeGraph scope -reference ref moduleInfo span kind decl currentAddress g = fromMaybe g $ do - -- Start from the current address - currentScope' <- lookupScope currentAddress g - -- Build a path up to the declaration - flip (insertScope currentAddress) g . flip (insertReference ref moduleInfo span kind) currentScope' <$> findPath (const Nothing) decl currentAddress g - --- | Insert a reference into the given scope by constructing a resolution path to the declaration within the given scope graph. -insertImportReference :: Ord address => Reference -> ModuleInfo -> Span -> Kind -> Declaration -> address -> ScopeGraph address -> Scope address -> Maybe (Scope address) -insertImportReference ref moduleInfo span kind decl currentAddress g scope = flip (insertReference ref moduleInfo span kind) scope . EPath Import currentAddress <$> findPath (const Nothing) decl currentAddress g - -lookupScopePath :: Ord scopeAddress => Name -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Path scopeAddress) -lookupScopePath declaration currentAddress g = findPath (flip (lookupReference declaration) g) (Declaration declaration) currentAddress g - -findPath :: Ord scopeAddress => (scopeAddress -> Maybe (Path scopeAddress)) -> Declaration -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Path scopeAddress) -findPath extra decl currentAddress g = snd <$> getFirst (foldGraph combine currentAddress g) - where combine address path = fmap (address, ) - $ First (pathToDeclaration decl address g) - <> First (extra address) - <> (uncurry (EPath Superclass) <$> path Superclass) - <> (uncurry (EPath Import) <$> path Import) - <> (uncurry (EPath Export) <$> path Export) - <> (uncurry (EPath Lexical) <$> path Lexical) - -foldGraph :: (Ord scopeAddress, Monoid a) => (scopeAddress -> (EdgeLabel -> a) -> a) -> scopeAddress -> ScopeGraph scopeAddress -> a -foldGraph combine address graph = go lowerBound address - where go visited address - | address `Set.notMember` visited - , Just edges <- linksOfScope address graph = combine address (recur edges) - | otherwise = mempty - where visited' = Set.insert address visited - recur edges edge = maybe mempty (foldMap (go visited')) (Map.lookup edge edges) - -pathToDeclaration :: Ord scopeAddress => Declaration -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Path scopeAddress) -pathToDeclaration decl address g = DPath decl . snd <$> lookupDeclaration (unDeclaration decl) address g - -insertReference :: Reference -> ModuleInfo -> Span -> Kind -> Path scopeAddress -> Scope scopeAddress -> Scope scopeAddress -insertReference ref moduleInfo span kind path scope = scope { references = Map.alter (\case - Nothing -> pure ([ ReferenceInfo span kind moduleInfo ], path) - Just (refInfos, path) -> pure (ReferenceInfo span kind moduleInfo : refInfos, path)) ref (references scope) } - -lookupDeclaration :: Ord scopeAddress => Name -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Info scopeAddress, Position) -lookupDeclaration name scope g = do - dataSeq <- ddataOfScope scope g - index <- Seq.findIndexR (\Info{..} -> Declaration name == infoDeclaration) dataSeq - (, Position index) <$> Seq.lookup index dataSeq - -declarationNames :: Ord address => [EdgeLabel] -> Scope address -> ScopeGraph address -> Set Declaration -declarationNames edgeLabels scope scopeGraph = localDeclarations <> edgeNames - where addresses = join (Map.elems $ Map.restrictKeys (edges scope) (Set.fromList edgeLabels)) - edgeNames = flip foldMap addresses $ \address -> maybe mempty (flip (declarationNames edgeLabels) scopeGraph) (lookupScope address scopeGraph) - localDeclarations = Set.fromList . toList . fmap infoDeclaration $ declarations scope - - -putDeclarationScopeAtPosition :: Ord scopeAddress => scopeAddress -> Position -> Maybe scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress -putDeclarationScopeAtPosition scope position assocScope g@(ScopeGraph graph) = fromMaybe g $ do - dataSeq <- ddataOfScope scope g - let seq = Seq.adjust' (\Info{..} -> Info { infoAssociatedScope = assocScope, .. }) (unPosition position) dataSeq - pure $ ScopeGraph (Map.adjust (\s -> s { declarations = seq }) scope graph) - -lookupReference :: Ord scopeAddress => Name -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Path scopeAddress) -lookupReference name scope g = fmap snd . Map.lookup (Reference name) =<< pathsOfScope scope g - -insertEdge :: Ord scopeAddress => EdgeLabel -> scopeAddress -> scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress -insertEdge label target currentAddress g@(ScopeGraph graph) = fromMaybe g $ do - currentScope' <- lookupScope currentAddress g - scopes <- maybeM (Just mempty) (Map.lookup label (edges currentScope')) - let newScope = currentScope' { edges = Map.insert label (target : scopes) (edges currentScope') } - pure (ScopeGraph (Map.insert currentAddress newScope graph)) - - --- | Update the 'Scope' containing a 'Declaration' with an associated scope address. --- Returns an unmodified 'ScopeGraph' if the 'Declaration' cannot be found with the given scope address. -insertDeclarationScope :: Ord scopeAddress => Declaration -> scopeAddress -> scopeAddress -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress -insertDeclarationScope Declaration{..} associatedScopeAddress scopeAddress g = fromMaybe g $ do - declScopeAddress <- pathDeclarationScope scopeAddress =<< lookupScopePath unDeclaration scopeAddress g - scope <- lookupScope declScopeAddress g - (declInfo, position) <- second unPosition <$> lookupDeclaration unDeclaration declScopeAddress g - pure $ insertScope declScopeAddress (scope { declarations = Seq.update position (declInfo { infoAssociatedScope = Just associatedScopeAddress }) (declarations scope) }) g - --- | Insert a declaration span into the declaration in the scope graph. -insertDeclarationSpan :: Ord scopeAddress => Declaration -> Span -> ScopeGraph scopeAddress -> ScopeGraph scopeAddress -insertDeclarationSpan decl@Declaration{..} span g = fromMaybe g $ do - declScopeAddress <- scopeOfDeclaration decl g - (declInfo, position) <- second unPosition <$> lookupDeclaration unDeclaration declScopeAddress g - scope <- lookupScope declScopeAddress g - pure $ insertScope declScopeAddress (scope { declarations = Seq.update position (declInfo { infoSpan = span }) (declarations scope) }) g - --- | Insert a new scope with the given address and edges into the scope graph. -newScope :: Ord address => address -> Map EdgeLabel [address] -> ScopeGraph address -> ScopeGraph address -newScope address edges = insertScope address (Scope edges mempty mempty) - --- | Insert a new scope with the given address and edges into the scope graph. -newPreludeScope :: Ord address => address -> Map EdgeLabel [address] -> ScopeGraph address -> ScopeGraph address -newPreludeScope address edges = insertScope address (PreludeScope edges mempty mempty) - -insertScope :: Ord address => address -> Scope address -> ScopeGraph address -> ScopeGraph address -insertScope address scope = ScopeGraph . Map.insert address scope . unScopeGraph - --- | Returns the scope of a reference in the scope graph. -scopeOfRef :: Ord scope => Reference -> ScopeGraph scope -> Maybe scope -scopeOfRef ref g@(ScopeGraph graph) = go (Map.keys graph) - where - go (s : scopes') = fromMaybe (go scopes') $ do - pathMap <- pathsOfScope s g - _ <- Map.lookup ref pathMap - pure (Just s) - go [] = Nothing - --- | Returns the path of a reference in the scope graph. -pathOfRef :: (Ord scope) => Reference -> ScopeGraph scope -> Maybe (Path scope) -pathOfRef ref graph = do - scope <- scopeOfRef ref graph - pathsMap <- pathsOfScope scope graph - snd <$> Map.lookup ref pathsMap - --- Returns the scope the declaration was declared in. -scopeOfDeclaration :: Ord scope => Declaration -> ScopeGraph scope -> Maybe scope -scopeOfDeclaration Declaration{..} g@(ScopeGraph graph) = go (Map.keys graph) - where - go = foldr (\ scope -> (scope <$ lookupDeclaration unDeclaration scope g <|>)) Nothing - --- | Returns the scope associated with a declaration (the child scope if any exists). -associatedScope :: Ord scope => Declaration -> ScopeGraph scope -> Maybe scope -associatedScope Declaration{..} g@(ScopeGraph graph) = go (Map.keys graph) - where - go = foldr lookupAssociatedScope Nothing - lookupAssociatedScope scope = ((lookupDeclaration unDeclaration scope g >>= infoAssociatedScope . fst) <|>) - -newtype Reference = Reference { unReference :: Name } - deriving (Eq, Ord, Show, Generic, NFData) - -instance Lower Reference where - lowerBound = Reference $ name "" - -newtype Declaration = Declaration { unDeclaration :: Name } - deriving (Eq, Ord, Show, Generic, NFData) - -instance Lower Declaration where - lowerBound = Declaration $ name "" - -formatDeclaration :: Declaration -> Text -formatDeclaration = formatName . unDeclaration - --- | The type of edge from a scope to its parent scopes. --- Either a lexical edge or an import edge in the case of non-lexical edges. -data EdgeLabel = Lexical | Import | Export | Superclass - deriving (Bounded, Enum, Eq, Ord, Show, Generic, NFData) diff --git a/src/Data/Abstract/Value/Abstract.hs b/src/Data/Abstract/Value/Abstract.hs deleted file mode 100644 index 87a463484a..0000000000 --- a/src/Data/Abstract/Value/Abstract.hs +++ /dev/null @@ -1,150 +0,0 @@ -{-# LANGUAGE TypeOperators, UndecidableInstances #-} -module Data.Abstract.Value.Abstract -( Abstract (..) -, runFunction -, runBoolean -, runWhile -) where - -import Control.Abstract as Abstract -import Control.Effect.Carrier -import Control.Effect.Sum -import Data.Abstract.BaseError -import Data.Abstract.Evaluatable -import qualified Data.Map.Strict as Map -import Prologue - -data Abstract = Abstract - deriving (Eq, Ord, Show) - - -instance ( Member (Allocator address) sig - , Member (Deref Abstract) sig - , Member (Error (Return Abstract)) sig - , Member Fresh sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (State Span) sig - , Member (State (ScopeGraph address)) sig - , Member (Resumable (BaseError (EvalError term address Abstract))) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Resumable (BaseError (AddressError address Abstract))) sig - , Member (State (Heap address address Abstract)) sig - , Declarations term - , Ord address - , Show address - , Carrier sig m - ) - => Carrier (Abstract.Function term address Abstract :+: sig) (FunctionC term address Abstract m) where - eff (R other) = FunctionC . eff . R . handleCoercible $ other - eff (L op) = runEvaluator $ do - eval <- Evaluator . FunctionC $ ask - case op of - Function _ params body scope k -> do - currentScope' <- currentScope - currentFrame' <- currentFrame - let frameLinks = Map.singleton Lexical (Map.singleton currentScope' currentFrame') - frame <- newFrame scope frameLinks - res <- withScopeAndFrame frame $ do - for_ params $ \param -> do - slot <- lookupSlot (Declaration param) - assign slot Abstract - catchReturn (Evaluator (eval body)) - Evaluator (k res) - BuiltIn _ _ k -> Evaluator (k Abstract) - Bind _ _ k -> Evaluator (k Abstract) - Call _ _ k -> Evaluator (k Abstract) - - -instance (Carrier sig m, Alternative m) => Carrier (Boolean Abstract :+: sig) (BooleanC Abstract m) where - eff (L (Boolean _ k)) = k Abstract - eff (L (AsBool _ k)) = k True <|> k False - eff (R other) = BooleanC . eff . handleCoercible $ other - - -instance ( Member (Abstract.Boolean Abstract) sig - , Carrier sig m - , Alternative m - ) - => Carrier (While Abstract :+: sig) (WhileC Abstract m) where - eff (R other) = WhileC . eff . handleCoercible $ other - eff (L (Abstract.While cond body k)) = do - cond' <- cond - ifthenelse cond' (body *> empty) (k Abstract) - -instance Carrier sig m - => Carrier (Unit Abstract :+: sig) (UnitC Abstract m) where - eff (R other) = UnitC . eff . handleCoercible $ other - eff (L (Abstract.Unit k)) = k Abstract - -instance Carrier sig m - => Carrier (Abstract.String Abstract :+: sig) (StringC Abstract m) where - eff (R other) = StringC . eff . handleCoercible $ other - eff (L op) = case op of - Abstract.String _ k -> k Abstract - AsString _ k -> k "" - -instance Carrier sig m - => Carrier (Numeric Abstract :+: sig) (NumericC Abstract m) where - eff (R other) = NumericC . eff . handleCoercible $ other - eff (L op) = case op of - Integer _ k -> k Abstract - Float _ k -> k Abstract - Rational _ k -> k Abstract - LiftNumeric _ _ k -> k Abstract - LiftNumeric2 _ _ _ k -> k Abstract - -instance Carrier sig m - => Carrier (Bitwise Abstract :+: sig) (BitwiseC Abstract m) where - eff (R other) = BitwiseC . eff . handleCoercible $ other - eff (L op) = case op of - CastToInteger _ k -> k Abstract - LiftBitwise _ _ k -> k Abstract - LiftBitwise2 _ _ _ k -> k Abstract - UnsignedRShift _ _ k -> k Abstract - -instance Carrier sig m - => Carrier (Object address Abstract :+: sig) (ObjectC address Abstract m) where - eff (R other) = ObjectC . eff . handleCoercible $ other - eff (L op) = case op of - Object _ k -> k Abstract - ScopedEnvironment _ k -> k Nothing - Klass _ _ k -> k Abstract - -instance Carrier sig m - => Carrier (Array Abstract :+: sig) (ArrayC Abstract m) where - eff (R other) = ArrayC . eff . handleCoercible $ other - eff (L op) = case op of - Array _ k -> k Abstract - AsArray _ k -> k [] - -instance Carrier sig m - => Carrier (Hash Abstract :+: sig) (HashC Abstract m) where - eff (R other) = HashC . eff . handleCoercible $ other - eff (L op) = case op of - Hash _ k -> k Abstract - KvPair _ _ k -> k Abstract - - -instance Ord address => ValueRoots address Abstract where - valueRoots = mempty - -instance AbstractHole Abstract where - hole = Abstract - -instance AbstractIntro Abstract where - null = Abstract - -instance Applicative m => AbstractValue term address Abstract m where - tuple _ = pure Abstract - - namespace _ _ = pure Abstract - - asPair _ = pure (Abstract, Abstract) - - index _ _ = pure Abstract - - liftComparison _ _ _ = pure Abstract diff --git a/src/Data/Abstract/Value/Concrete.hs b/src/Data/Abstract/Value/Concrete.hs deleted file mode 100644 index d9f9b6fbe3..0000000000 --- a/src/Data/Abstract/Value/Concrete.hs +++ /dev/null @@ -1,438 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, GADTs, LambdaCase, RankNTypes, TypeOperators, UndecidableInstances, ScopedTypeVariables #-} -module Data.Abstract.Value.Concrete - ( Value (..) - , ValueError (..) - , runValueError - , runValueErrorWith - ) where - -import Control.Abstract.ScopeGraph (Allocator, ScopeError) -import Control.Abstract.Heap (scopeLookup) -import qualified Control.Abstract as Abstract -import Control.Abstract hiding (Boolean(..), Function(..), Numeric(..), Object(..), Array(..), Hash(..), String(..), Unit(..), While(..)) -import Control.Effect.Carrier -import Control.Effect.Interpose -import Control.Effect.Sum -import Data.Abstract.BaseError -import Data.Abstract.Evaluatable (UnspecializedError(..), EvalError(..), Declarations) -import Data.Abstract.FreeVariables -import Data.Abstract.Name -import qualified Data.Abstract.Number as Number -import Data.Bits -import Data.List (genericIndex, genericLength) -import Data.Scientific (Scientific, coefficient, normalize) -import Data.Scientific.Exts -import Data.Text (pack) -import Data.Word -import Prologue -import qualified Data.Map.Strict as Map - -data Value term address - -- TODO: Split Closure up into a separate data type. Scope Frame - = Closure PackageInfo ModuleInfo (Maybe Name) (Maybe (Value term address)) [Name] (Either BuiltIn term) address address - | Unit - | Boolean Bool - | Integer (Number.Number Integer) - | Rational (Number.Number Rational) - | Float (Number.Number Scientific) - | String Text - | Tuple [Value term address] - | Array [Value term address] - | Class Declaration [Value term address] address - | Object address - | Namespace Name address - | KVPair (Value term address) (Value term address) - | Hash [Value term address] - | Null - | Hole - deriving (Eq, Ord, Show, Generic, NFData) - - -instance ValueRoots address (Value term address) where - valueRoots _ = lowerBound - - -instance ( FreeVariables term - , Member (Allocator address) sig - , Member (Deref (Value term address)) sig - , Member Fresh sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader PackageInfo) sig - , Member (Reader Span) sig - , Member (State Span) sig - , Member (State (ScopeGraph address)) sig - , Member (Resumable (BaseError (AddressError address (Value term address)))) sig - , Member (Resumable (BaseError (EvalError term address (Value term address)))) sig - , Member (Resumable (BaseError (ValueError term address))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (State (Heap address address (Value term address))) sig - , Member (Error (Return (Value term address))) sig - , Declarations term - , Member Trace sig - , Ord address - , Carrier sig m - , Show address - , Show term - ) - => Carrier (Abstract.Function term address (Value term address) :+: sig) (Abstract.FunctionC term address (Value term address) m) where - eff (R other) = FunctionC . eff . R . handleCoercible $ other - eff (L op) = runEvaluator $ do - eval <- Evaluator . FunctionC $ ask - let closure maybeName params body scope = do - packageInfo <- currentPackage - moduleInfo <- currentModule - Closure packageInfo moduleInfo maybeName Nothing params body scope <$> currentFrame - - case op of - Abstract.Function name params body scope k -> do - val <- closure (Just name) params (Right body) scope - Evaluator (k val) - Abstract.BuiltIn associatedScope builtIn k -> do - val <- closure Nothing [] (Left builtIn) associatedScope - Evaluator (k val) - Abstract.Bind obj@Object{} (Closure packageInfo moduleInfo name _ names body scope parentFrame) k -> - Evaluator (k (Closure packageInfo moduleInfo name (Just obj) names body scope parentFrame)) - Abstract.Bind _ value k -> Evaluator (k value) - Abstract.Call op params k -> do - boxed <- case op of - Closure _ _ _ _ _ (Left Print) _ _ -> traverse (trace . show) params $> Unit - Closure _ _ _ _ _ (Left Show) _ _ -> pure . String . pack $ show params - Closure packageInfo moduleInfo _ maybeSelf names (Right body) associatedScope parentFrame -> do - -- Evaluate the bindings and body with the closure’s package/module info in scope in order to - -- charge them to the closure's origin. - withCurrentPackage packageInfo . withCurrentModule moduleInfo $ do - parentScope <- scopeLookup parentFrame - let frameEdges = Map.singleton Lexical (Map.singleton parentScope parentFrame) - frameAddress <- newFrame associatedScope frameEdges - withScopeAndFrame frameAddress $ do - case maybeSelf of - Just object -> do - maybeSlot <- maybeLookupDeclaration (Declaration __self) - maybe (pure ()) (`assign` object) maybeSlot - Nothing -> pure () - for_ (zip names params) $ \(name, param) -> do - slot <- lookupSlot (Declaration name) - assign slot param - catchReturn (Evaluator (eval body)) - _ -> throwValueError (CallError op) - Evaluator (k boxed) - -instance ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (ValueError term address))) sig - , Carrier sig m - , Monad m - ) - => Carrier (Abstract.Boolean (Value term address) :+: sig) (BooleanC (Value term address) m) where - eff (R other) = BooleanC . eff . handleCoercible $ other - eff (L op) = case op of - Abstract.Boolean b k -> k $! Boolean b - Abstract.AsBool (Boolean b) k -> k b - Abstract.AsBool other k -> throwBaseError (BoolError other) >>= k - -instance ( Carrier sig m - , Member (Abstract.Boolean (Value term address)) sig - , Member (Error (LoopControl (Value term address))) sig - , Member (Interpose (Resumable (BaseError (UnspecializedError address (Value term address))))) sig - ) - => Carrier (Abstract.While (Value term address) :+: sig) (WhileC (Value term address) m) where - eff (R other) = WhileC . eff . handleCoercible $ other - eff (L (Abstract.While cond body k)) = do - - let loop x = catchError x $ \case - Break value -> pure value - Abort -> pure Unit - -- FIXME: Figure out how to deal with this. Ruby treats this as the result - -- of the current block iteration, while PHP specifies a breakout level - -- and TypeScript appears to take a label. - Continue _ -> loop x - - interpose @(Resumable (BaseError (UnspecializedError address (Value term address)))) (loop (do - cond' <- cond - - -- `interpose` is used to handle 'UnspecializedError's and abort out of the - -- loop, otherwise under concrete semantics we run the risk of the - -- conditional always being true and getting stuck in an infinite loop. - ifthenelse cond' (body *> throwError (Continue @(Value term address) Unit)) (pure Unit))) - (\case - Resumable (BaseError _ _ (UnspecializedError _)) _ -> throwError (Abort @(Value term address)) - Resumable (BaseError _ _ (RefUnspecializedError _)) _ -> throwError (Abort @(Value term address))) >>= k - - - - -- Abstract.While cond body k -> interpose @(Resumable (BaseError (UnspecializedError address (Value term address)))) (runEvaluator (loop (\continue -> do cond' <- Evaluator (runWhileC cond) - - -- -- `interpose` is used to handle 'UnspecializedError's and abort out of the - -- -- loop, otherwise under concrete semantics we run the risk of the - -- -- conditional always being true and getting stuck in an infinite loop. - - -- ifthenelse cond' (Evaluator (runWhileC body) *> continue) (pure Unit)))) - -- ( - -- >>= runWhileC . k) - -- where - -- loop x = catchLoopControl (fix x) $ \case - -- Break value -> pure value - -- Abort -> pure Unit - -- -- FIXME: Figure out how to deal with this. Ruby treats this as the result - -- -- of the current block iteration, while PHP specifies a breakout level - -- -- and TypeScript appears to take a label. - -- Continue _ -> loop x - - -- case op of - -- Abstract.While cond body k -> interpose @(Resumable (BaseError (UnspecializedError address (Value term address)))) (runEvaluator (loop (\continue -> do - -- cond' <- Evaluator (runWhileC cond) - - -- -- `interpose` is used to handle 'UnspecializedError's and abort out of the - -- -- loop, otherwise under concrete semantics we run the risk of the - -- -- conditional always being true and getting stuck in an infinite loop. - - -- ifthenelse cond' (Evaluator (runWhileC body) *> continue) (pure Unit) - -- case _ of - -- Resumable (BaseError _ _ (UnspecializedError _)) _ -> throwError (Abort @(Value term address)) >>= k - -- Resumable (BaseError _ _ (RefUnspecializedError _)) _ -> throwError (Abort @(Value term address))) >>= k - - -instance Carrier sig m - => Carrier (Abstract.Unit (Value term address) :+: sig) (UnitC (Value term address) m) where - eff (R other) = UnitC . eff . handleCoercible $ other - eff (L (Abstract.Unit k )) = k Unit - -instance ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (ValueError term address))) sig - , Carrier sig m - , Monad m - ) - => Carrier (Abstract.String (Value term address) :+: sig) (StringC (Value term address) m) where - eff (R other) = StringC . eff . handleCoercible $ other - eff (L op) = case op of - Abstract.String t k -> k (String t) - Abstract.AsString (String t) k -> k t - Abstract.AsString other k -> throwBaseError (StringError other) >>= k - -instance ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (ValueError term address))) sig - , Carrier sig m - , Monad m - ) - => Carrier (Abstract.Numeric (Value term address) :+: sig) (NumericC (Value term address) m) where - eff (R other) = NumericC . eff . handleCoercible $ other - eff (L op) = case op of - Abstract.Integer t k -> k (Integer (Number.Integer t)) - Abstract.Float t k -> k (Float (Number.Decimal t)) - Abstract.Rational t k -> k (Rational (Number.Ratio t)) - Abstract.LiftNumeric f arg k -> k =<< case arg of - Integer (Number.Integer i) -> pure $ Integer (Number.Integer (f i)) - Float (Number.Decimal d) -> pure $ Float (Number.Decimal (f d)) - Rational (Number.Ratio r) -> pure $ Rational (Number.Ratio (f r)) - other -> throwBaseError (NumericError other) - Abstract.LiftNumeric2 f left right k -> k =<< case (left, right) of - (Integer i, Integer j) -> attemptUnsafeArithmetic (f i j) & specialize - (Integer i, Rational j) -> attemptUnsafeArithmetic (f i j) & specialize - (Integer i, Float j) -> attemptUnsafeArithmetic (f i j) & specialize - (Rational i, Integer j) -> attemptUnsafeArithmetic (f i j) & specialize - (Rational i, Rational j) -> attemptUnsafeArithmetic (f i j) & specialize - (Rational i, Float j) -> attemptUnsafeArithmetic (f i j) & specialize - (Float i, Integer j) -> attemptUnsafeArithmetic (f i j) & specialize - (Float i, Rational j) -> attemptUnsafeArithmetic (f i j) & specialize - (Float i, Float j) -> attemptUnsafeArithmetic (f i j) & specialize - _ -> throwBaseError (Numeric2Error left right) - --- Dispatch whatever's contained inside a 'Number.SomeNumber' to its appropriate 'MonadValue' ctor -specialize :: ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (ValueError term address))) sig - , Carrier sig m - ) - => Either ArithException Number.SomeNumber - -> m (Value term address) -specialize (Left exc) = throwBaseError (ArithmeticError exc) -specialize (Right (Number.SomeNumber (Number.Integer t))) = pure (Integer (Number.Integer t)) -specialize (Right (Number.SomeNumber (Number.Decimal t))) = pure (Float (Number.Decimal t)) -specialize (Right (Number.SomeNumber (Number.Ratio t))) = pure (Rational (Number.Ratio t)) - - -instance ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (ValueError term address))) sig - , Carrier sig m - , Monad m - ) - => Carrier (Abstract.Bitwise (Value term address) :+: sig) (BitwiseC (Value term address) m) where - eff (R other) = BitwiseC . eff . handleCoercible $ other - eff (L op) = case op of - CastToInteger (Integer (Number.Integer i)) k -> k (Integer (Number.Integer i)) - CastToInteger (Float (Number.Decimal i)) k -> k (Integer (Number.Integer (coefficient (normalize i)))) - CastToInteger i k -> throwBaseError (NumericError i) >>= k - LiftBitwise operator (Integer (Number.Integer i)) k -> k . Integer . Number.Integer . operator $ i - LiftBitwise _ other k -> throwBaseError (BitwiseError other) >>= k - LiftBitwise2 operator (Integer (Number.Integer i)) (Integer (Number.Integer j)) k -> k . Integer . Number.Integer $ operator i j - LiftBitwise2 _ left right k -> throwBaseError (Bitwise2Error left right) >>= k - UnsignedRShift (Integer (Number.Integer i)) (Integer (Number.Integer j)) k | i >= 0 -> k . Integer . Number.Integer $ ourShift (fromIntegral i) (fromIntegral j) - UnsignedRShift left right k -> throwBaseError (Bitwise2Error left right) >>= k - -ourShift :: Word64 -> Int -> Integer -ourShift a b = toInteger (shiftR a b) - - -instance Carrier sig m => Carrier (Abstract.Object address (Value term address) :+: sig) (ObjectC address (Value term address) m) where - eff (R other) = ObjectC . eff . handleCoercible $ other - eff (L op) = case op of - Abstract.Object address k -> k (Object address) - Abstract.ScopedEnvironment (Object address) k -> k (Just address) - Abstract.ScopedEnvironment (Class _ _ address) k -> k (Just address) - Abstract.ScopedEnvironment (Namespace _ address) k -> k (Just address) - Abstract.ScopedEnvironment _ k -> k Nothing - Abstract.Klass n frame k -> k (Class n mempty frame) - -instance ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (ValueError term address))) sig - , Carrier sig m - , Monad m - ) - => Carrier (Abstract.Array (Value term address) :+: sig) (ArrayC (Value term address) m) where - eff (R other) = ArrayC . eff . handleCoercible $ other - eff (L op) = case op of - Abstract.Array t k -> k (Array t) - Abstract.AsArray (Array addresses) k -> k addresses - Abstract.AsArray val k -> throwBaseError (ArrayError val) >>= k - -instance ( Carrier sig m ) => Carrier (Abstract.Hash (Value term address) :+: sig) (HashC (Value term address) m) where - eff (R other) = HashC . eff . handleCoercible $ other - eff (L op) = case op of - Abstract.Hash t k -> k ((Hash . map (uncurry KVPair)) t) - Abstract.KvPair t v k -> k (KVPair t v) - - -instance AbstractHole (Value term address) where - hole = Hole - -instance (Show address, Show term) => AbstractIntro (Value term address) where - null = Null - --- | Construct a 'Value' wrapping the value arguments (if any). -instance ( Member (Abstract.Boolean (Value term address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (ValueError term address))) sig - , Show address - , Show term - , Carrier sig m - ) - => AbstractValue term address (Value term address) m where - asPair val - | KVPair k v <- val = pure (k, v) - | otherwise = throwValueError $ KeyValueError val - - tuple = pure . Tuple - - namespace name = pure . Namespace name - - index = go where - tryIdx list ii - | ii > genericLength list = throwValueError (BoundsError list ii) - | otherwise = pure (genericIndex list ii) - go arr idx - | (Array arr, Integer (Number.Integer i)) <- (arr, idx) = tryIdx arr i - | (Tuple tup, Integer (Number.Integer i)) <- (arr, idx) = tryIdx tup i - | otherwise = throwValueError (IndexError arr idx) - - liftComparison comparator left right - | (Integer (Number.Integer i), Integer (Number.Integer j)) <- pair = go i j - | (Integer (Number.Integer i), Float (Number.Decimal j)) <- pair = go (fromIntegral i) j - | (Float (Number.Decimal i), Integer (Number.Integer j)) <- pair = go i (fromIntegral j) - | (Float (Number.Decimal i), Float (Number.Decimal j)) <- pair = go i j - | (String i, String j) <- pair = go i j - | (Boolean i, Boolean j) <- pair = go i j - | (Unit, Unit) <- pair = boolean True - | otherwise = throwValueError (ComparisonError left right) - where - -- Explicit type signature is necessary here because we're passing all sorts of things - -- to these comparison functions. - go :: Ord a => a -> a -> Evaluator term address (Value term address) m (Value term address) - go l r = case comparator of - Concrete f -> boolean (f l r) - Generalized -> pure $ Integer (Number.Integer (orderingToInt (compare l r))) - - -- Map from [LT, EQ, GT] to [-1, 0, 1] - orderingToInt :: Ordering -> Prelude.Integer - orderingToInt = toInteger . pred . fromEnum - - pair = (left, right) - --- | The type of exceptions that can be thrown when constructing values in 'Value'’s 'MonadValue' instance. -data ValueError term address resume where - StringError :: Value term address -> ValueError term address Text - BoolError :: Value term address -> ValueError term address Bool - IndexError :: Value term address -> Value term address -> ValueError term address (Value term address) - CallError :: Value term address -> ValueError term address (Value term address) - NumericError :: Value term address -> ValueError term address (Value term address) - Numeric2Error :: Value term address -> Value term address -> ValueError term address (Value term address) - ComparisonError :: Value term address -> Value term address -> ValueError term address (Value term address) - BitwiseError :: Value term address -> ValueError term address (Value term address) - Bitwise2Error :: Value term address -> Value term address -> ValueError term address (Value term address) - KeyValueError :: Value term address -> ValueError term address (Value term address, Value term address) - ArrayError :: Value term address -> ValueError term address [Value term address] - -- Indicates that we encountered an arithmetic exception inside Haskell-native number crunching. - ArithmeticError :: ArithException -> ValueError term address (Value term address) - -- Out-of-bounds error - BoundsError :: [Value term address] -> Prelude.Integer -> ValueError term address (Value term address) - -instance (NFData term, NFData address) => NFData1 (ValueError term address) where - liftRnf _ x = case x of - StringError i -> rnf i - BoolError i -> rnf i - IndexError i j -> rnf i `seq` rnf j - CallError i -> rnf i - NumericError i -> rnf i - Numeric2Error i j -> rnf i `seq` rnf j - ComparisonError i j -> rnf i `seq` rnf j - BitwiseError i -> rnf i - Bitwise2Error i j -> rnf i `seq` rnf j - KeyValueError i -> rnf i - ArrayError i -> rnf i - ArithmeticError i -> i `seq` () - BoundsError i j -> rnf i `seq` rnf j - -instance (NFData term, NFData address, NFData resume) => NFData (ValueError term address resume) where - rnf = liftRnf rnf - -instance (Eq address, Eq term) => Eq1 (ValueError term address) where - liftEq _ (StringError a) (StringError b) = a == b - liftEq _ (CallError a) (CallError b) = a == b - liftEq _ (BoolError a) (BoolError c) = a == c - liftEq _ (IndexError a b) (IndexError c d) = (a == c) && (b == d) - liftEq _ (Numeric2Error a b) (Numeric2Error c d) = (a == c) && (b == d) - liftEq _ (ComparisonError a b) (ComparisonError c d) = (a == c) && (b == d) - liftEq _ (Bitwise2Error a b) (Bitwise2Error c d) = (a == c) && (b == d) - liftEq _ (BitwiseError a) (BitwiseError b) = a == b - liftEq _ (KeyValueError a) (KeyValueError b) = a == b - liftEq _ (BoundsError a b) (BoundsError c d) = (a == c) && (b == d) - liftEq _ _ _ = False - -deriving instance (Show address, Show term) => Show (ValueError term address resume) -instance (Show address, Show term) => Show1 (ValueError term address) where - liftShowsPrec _ _ = showsPrec - -runValueError :: Evaluator term address (Value term address) (ResumableC (BaseError (ValueError term address)) m) a - -> Evaluator term address (Value term address) m (Either (SomeError (BaseError (ValueError term address))) a) -runValueError = Evaluator . runResumable . runEvaluator - -runValueErrorWith :: (forall resume . BaseError (ValueError term address) resume -> Evaluator term address (Value term address) m resume) - -> Evaluator term address (Value term address) (ResumableWithC (BaseError (ValueError term address)) m) a - -> Evaluator term address (Value term address) m a -runValueErrorWith f = Evaluator . runResumableWith (runEvaluator . f) . runEvaluator - -throwValueError :: ( Member (Resumable (BaseError (ValueError term address))) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Carrier sig m - ) - => ValueError term address resume - -> Evaluator term address (Value term address) m resume -throwValueError = throwBaseError diff --git a/src/Data/Abstract/Value/Type.hs b/src/Data/Abstract/Value/Type.hs deleted file mode 100644 index 727c67b5b0..0000000000 --- a/src/Data/Abstract/Value/Type.hs +++ /dev/null @@ -1,433 +0,0 @@ -{-# LANGUAGE GADTs, LambdaCase, RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-} -module Data.Abstract.Value.Type - ( Type (..) - , TypeError (..) - , TypeMap - , runTypes - , runTypesWith - , unify - , runFunction - , runBoolean - , runWhile - ) where - -import Control.Abstract.ScopeGraph -import qualified Control.Abstract as Abstract -import Control.Abstract hiding (Boolean(..), Function(..), Numeric(..), Object(..), Array(..), Hash(..), String(..), Unit(..), While(..)) -import Control.Effect.Carrier -import Control.Effect.Sum -import Data.Abstract.BaseError -import Data.Semigroup.Foldable (foldMap1) -import qualified Data.Map as Map -import Prologue hiding (TypeError) -import Data.Abstract.Evaluatable - -type TName = Int - --- | A datatype representing primitive types and combinations thereof. -data Type - = Int -- ^ Primitive int type. - | Bool -- ^ Primitive boolean type. - | String -- ^ Primitive string type. - | Unit -- ^ The unit type. - | Float -- ^ Floating-point type. - | Rational -- ^ Rational type. - | Type :-> Type -- ^ Binary function types. - | Var TName -- ^ A type variable. - | Type :* Type -- ^ Binary products. - | Type :+ Type -- ^ Binary sums. - | Void -- ^ Uninhabited void type. - | Array Type -- ^ Arrays. - | Hash [(Type, Type)] -- ^ Heterogenous key-value maps. - | Object -- ^ Objects. Once we have some notion of inheritance we'll need to store a superclass. - | Null -- ^ The null type. Unlike 'Unit', this unifies with any other type. - | Hole -- ^ The hole type. - deriving (Eq, Ord, Show) - -infixl 6 :+ -infixl 7 :* -infixr 0 :-> - -newtype Product = Product { getProduct :: Type } - -instance Semigroup Product where - Product a <> Product b = Product (a :* b) - -instance Monoid Product where - mempty = Product Unit - mappend = (<>) - -oneOrMoreProduct :: NonEmpty Type -> Type -oneOrMoreProduct = getProduct . foldMap1 Product - -zeroOrMoreProduct :: [Type] -> Type -zeroOrMoreProduct = maybe Unit oneOrMoreProduct . nonEmpty - --- TODO: Γ€ la carte representation of types. - --- | Errors representing failures in typechecking. Note that we should in general constrain allowable types by 'unify'ing, and thus throwing 'UnificationError's when constraints aren’t met, in order to allow uniform resumption with one or the other parameter type. -data TypeError resume where - UnificationError :: Type -> Type -> TypeError Type - InfiniteType :: Type -> Type -> TypeError Type - -deriving instance Eq (TypeError resume) -deriving instance Ord (TypeError resume) -deriving instance Show (TypeError resume) - -instance Eq1 TypeError where - liftEq _ (UnificationError a1 b1) (UnificationError a2 b2) = a1 == a2 && b1 == b2 - liftEq _ (InfiniteType a1 b1) (InfiniteType a2 b2) = a1 == a2 && b1 == b2 - liftEq _ _ _ = False - -instance Ord1 TypeError where - liftCompare _ (UnificationError a1 b1) (UnificationError a2 b2) = compare a1 a2 <> compare b1 b2 - liftCompare _ (InfiniteType a1 b1) (InfiniteType a2 b2) = compare a1 a2 <> compare b1 b2 - liftCompare _ (InfiniteType _ _) (UnificationError _ _) = LT - liftCompare _ (UnificationError _ _) (InfiniteType _ _) = GT - -instance Show1 TypeError where liftShowsPrec _ _ = showsPrec - -runTypeError :: Evaluator term address value (ResumableC (BaseError TypeError) m) a - -> Evaluator term address value m (Either (SomeError (BaseError TypeError)) a) -runTypeError = raiseHandler runResumable - -runTypeErrorWith :: (forall resume . (BaseError TypeError) resume -> Evaluator term address value m resume) - -> Evaluator term address value (ResumableWithC (BaseError TypeError) m) a - -> Evaluator term address value m a -runTypeErrorWith f = raiseHandler $ runResumableWith (runEvaluator . f) - - -throwTypeError :: ( Member (Resumable (BaseError TypeError)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Carrier sig m - ) - => TypeError resume - -> m resume -throwTypeError = throwBaseError - -runTypeMap :: Carrier sig m - => Evaluator term address Type (StateC TypeMap m) a - -> Evaluator term address Type m a -runTypeMap = raiseHandler $ fmap snd . runState emptyTypeMap - -runTypes :: Carrier sig m - => Evaluator term address Type (ResumableC (BaseError TypeError) - (StateC TypeMap m)) a - -> Evaluator term address Type m (Either (SomeError (BaseError TypeError)) a) -runTypes = runTypeMap . runTypeError - -runTypesWith :: Carrier sig m - => (forall resume . (BaseError TypeError) resume -> Evaluator term address Type (StateC TypeMap m) resume) - -> Evaluator term address Type (ResumableWithC (BaseError TypeError) - (StateC TypeMap - m)) a - -> Evaluator term address Type m a -runTypesWith with = runTypeMap . runTypeErrorWith with - --- TODO: change my name? -newtype TypeMap = TypeMap { unTypeMap :: Map.Map TName Type } - -emptyTypeMap :: TypeMap -emptyTypeMap = TypeMap Map.empty - -modifyTypeMap :: ( Member (State TypeMap) sig - , Carrier sig m - ) - => (Map.Map TName Type -> Map.Map TName Type) - -> m () -modifyTypeMap f = modify (TypeMap . f . unTypeMap) - --- | Prunes substituted type variables -prune :: ( Member (State TypeMap) sig - , Carrier sig m - ) - => Type - -> m Type -prune (Var id) = gets (Map.lookup id . unTypeMap) >>= \case - Just ty -> do - pruned <- prune ty - modifyTypeMap (Map.insert id pruned) - pure pruned - Nothing -> pure (Var id) -prune ty = pure ty - --- | Checks whether a type variable name occurs within another type. This --- function is used in 'substitute' to prevent unification of infinite types -occur :: ( Member (State TypeMap) sig - , Carrier sig m - ) - => TName - -> Type - -> m Bool -occur id = prune >=> \case - Int -> pure False - Bool -> pure False - String -> pure False - Unit -> pure False - Float -> pure False - Rational -> pure False - Void -> pure False - Object -> pure False - Null -> pure False - Hole -> pure False - a :-> b -> eitherM (occur id) (a, b) - a :* b -> eitherM (occur id) (a, b) - a :+ b -> eitherM (occur id) (a, b) - Array ty -> occur id ty - Hash kvs -> or <$> traverse (eitherM (occur id)) kvs - Var vid -> pure (vid == id) - where - eitherM :: Applicative m => (a -> m Bool) -> (a, a) -> m Bool - eitherM f (a, b) = (||) <$> f a <*> f b - --- | Substitutes a type variable name for another type -substitute :: ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError TypeError)) sig - , Member (State TypeMap) sig - , Carrier sig m - ) - => TName - -> Type - -> m Type -substitute id ty = do - infiniteType <- occur id ty - ty <- if infiniteType - then throwTypeError (InfiniteType (Var id) ty) - else pure ty - modifyTypeMap (Map.insert id ty) - pure ty - --- | Unify two 'Type's. -unify :: ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError TypeError)) sig - , Member (State TypeMap) sig - , Carrier sig m - ) - => Type - -> Type - -> m Type -unify a b = do - a' <- prune a - b' <- prune b - case (a', b') of - (a1 :-> b1, a2 :-> b2) -> (:->) <$> unify a1 a2 <*> unify b1 b2 - (a, Null) -> pure a - (Null, b) -> pure b - (Var id, ty) -> substitute id ty - (ty, Var id) -> substitute id ty - (Array t1, Array t2) -> Array <$> unify t1 t2 - -- FIXME: unifying with sums should distribute nondeterministically. - -- FIXME: ordering shouldn’t be significant for undiscriminated sums. - (a1 :+ b1, a2 :+ b2) -> (:+) <$> unify a1 a2 <*> unify b1 b2 - (a1 :* b1, a2 :* b2) -> (:*) <$> unify a1 a2 <*> unify b1 b2 - (t1, t2) | t1 == t2 -> pure t2 - _ -> throwTypeError (UnificationError a b) - -instance Ord address => ValueRoots address Type where - valueRoots _ = mempty - - -instance ( Member (Allocator address) sig - , Member (Deref Type) sig - , Member (Error (Return Type)) sig - , Member Fresh sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (State Span) sig - , Member (Resumable (BaseError (EvalError term address Type))) sig - , Member (Resumable (BaseError TypeError)) sig - , Member (Resumable (BaseError (AddressError address Type))) sig - , Member (State (Heap address address Type)) sig - , Member (State (ScopeGraph address)) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (State TypeMap) sig - , Declarations term - , Ord address - , Show address - , Carrier sig m - ) - => Carrier (Abstract.Function term address Type :+: sig) (FunctionC term address Type m) where - eff (R other) = FunctionC (eff (R (handleCoercible other))) - eff (L op) = runEvaluator $ do - eval <- Evaluator . FunctionC $ ask - case op of - Abstract.Function _ params body scope k -> do - currentScope' <- currentScope - currentFrame' <- currentFrame - let frameLinks = Map.singleton Lexical (Map.singleton currentScope' currentFrame') - frame <- newFrame scope frameLinks - res <- withScopeAndFrame frame $ do - tvars <- foldr (\ param rest -> do - tvar <- Var <$> fresh - slot <- lookupSlot (Declaration param) - assign slot tvar - (tvar :) <$> rest) (pure []) params - -- TODO: We may still want to represent this as a closure and not a function type - (zeroOrMoreProduct tvars :->) <$> catchReturn (Evaluator (eval body)) - Evaluator (k res) - - Abstract.BuiltIn _ Print k -> Evaluator $ k (String :-> Unit) - Abstract.BuiltIn _ Show k -> Evaluator $ k (Object :-> String) - Abstract.Bind _ value k -> Evaluator $ k value - Abstract.Call op paramTypes k -> do - tvar <- fresh - let needed = zeroOrMoreProduct paramTypes :-> Var tvar - unified <- op `unify` needed - boxed <- case unified of - _ :-> ret -> pure ret - actual -> throwTypeError (UnificationError needed actual) - Evaluator (k boxed) - - - -instance ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError TypeError)) sig - , Member (State TypeMap) sig - , Carrier sig m - , Alternative m - ) - => Carrier (Abstract.Boolean Type :+: sig) (BooleanC Type m) where - eff (R other) = BooleanC . eff . handleCoercible $ other - eff (L (Abstract.Boolean _ k)) = k Bool - eff (L (Abstract.AsBool t k)) = unify t Bool *> (k True <|> k False) - - - -instance ( Member (Abstract.Boolean Type) sig - , Carrier sig m - , Alternative m - ) - => Carrier (Abstract.While Type :+: sig) (WhileC Type m) where - eff (R other) = WhileC . eff . handleCoercible $ other - eff (L (Abstract.While cond body k)) = do - cond' <- cond - ifthenelse cond' (body *> empty) (k Unit) - - -instance Carrier sig m - => Carrier (Abstract.Unit Type :+: sig) (UnitC Type m) where - eff (R other) = UnitC . eff . handleCoercible $ other - eff (L (Abstract.Unit k)) = k Unit - -instance ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError TypeError)) sig - , Member (State TypeMap) sig - , Carrier sig m - , Alternative m - ) - => Carrier (Abstract.String Type :+: sig) (StringC Type m) where - eff (R other) = StringC . eff . handleCoercible $ other - eff (L (Abstract.String _ k)) = k String - eff (L (Abstract.AsString t k)) = unify t String *> k "" - -instance ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError TypeError)) sig - , Member (State TypeMap) sig - , Carrier sig m - , Monad m - ) - => Carrier (Abstract.Numeric Type :+: sig) (NumericC Type m) where - eff (R other) = NumericC . eff . handleCoercible $ other - eff (L op) = case op of - Abstract.Integer _ k -> k Int - Abstract.Float _ k -> k Float - Abstract.Rational _ k -> k Rational - Abstract.LiftNumeric _ t k -> unify (Int :+ Float :+ Rational) t >>= k - Abstract.LiftNumeric2 _ left right k -> case (left, right) of - (Float, Int) -> k Float - (Int, Float) -> k Float - _ -> unify left right >>= k - -instance ( Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError TypeError)) sig - , Member (State TypeMap) sig - , Carrier sig m - , Monad m - ) - => Carrier (Abstract.Bitwise Type :+: sig) (BitwiseC Type m) where - eff (R other) = BitwiseC . eff . handleCoercible $ other - eff (L op) = case op of - CastToInteger t k -> unify t (Int :+ Float :+ Rational) *> k Int - LiftBitwise _ t k -> unify t Int >>= k - LiftBitwise2 _ t1 t2 k -> unify Int t1 >>= unify t2 >>= k - UnsignedRShift t1 t2 k -> unify Int t2 *> unify Int t1 >>= k - -instance ( Carrier sig m ) => Carrier (Abstract.Object address Type :+: sig) (ObjectC address Type m) where - eff (R other) = ObjectC . eff . handleCoercible $ other - eff (L op) = case op of - Abstract.Object _ k -> k Object - Abstract.ScopedEnvironment _ k -> k Nothing - Abstract.Klass _ _ k -> k Object - -instance ( Member Fresh sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError TypeError)) sig - , Member (State TypeMap) sig - , Carrier sig m - , Monad m - ) - => Carrier (Abstract.Array Type :+: sig) (ArrayC Type m) where - eff (R other) = ArrayC . eff . handleCoercible $ other - eff (L (Abstract.Array fieldTypes k)) = do - var <- fresh - fieldType <- foldr (\ t1 -> (unify t1 =<<)) (pure (Var var)) fieldTypes - k (Array fieldType) - eff (L (Abstract.AsArray t k)) = do - field <- fresh - unify t (Array (Var field)) >> k mempty - -instance ( Carrier sig m ) => Carrier (Abstract.Hash Type :+: sig) (HashC Type m) where - eff (R other) = HashC . eff . handleCoercible $ other - eff (L (Abstract.Hash t k)) = k (Hash t) - eff (L (Abstract.KvPair t1 t2 k)) = k (t1 :* t2) - - -instance AbstractHole Type where - hole = Hole - -instance AbstractIntro Type where - null = Null - --- | Discard the value arguments (if any), constructing a 'Type' instead. -instance ( Member Fresh sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError TypeError)) sig - , Member (State TypeMap) sig - , Carrier sig m - ) - => AbstractValue term address Type m where - tuple fields = pure $ zeroOrMoreProduct fields - - namespace _ _ = pure Unit - - asPair t = do - t1 <- fresh - t2 <- fresh - unify t (Var t1 :* Var t2) $> (Var t1, Var t2) - - index arr sub = do - _ <- unify sub Int - field <- fresh - _ <- unify (Array (Var field)) arr - pure (Var field) - - liftComparison (Concrete _) left right = case (left, right) of - (Float, Int) -> pure Bool - (Int, Float) -> pure Bool - _ -> unify left right $> Bool - liftComparison Generalized left right = case (left, right) of - (Float, Int) -> pure Int - (Int, Float) -> pure Int - _ -> unify left right $> Bool diff --git a/src/Data/Algebra.hs b/src/Data/Algebra.hs deleted file mode 100644 index 738a4d61c4..0000000000 --- a/src/Data/Algebra.hs +++ /dev/null @@ -1,48 +0,0 @@ -{-# LANGUAGE RankNTypes #-} -module Data.Algebra - ( FAlgebra - , RAlgebra - , Subterm(..) - , SubtermAlgebra - , embedTerm - , foldSubterms - ) where - -import Data.Functor.Classes.Generic as X -import Data.Functor.Foldable ( Base - , Corecursive(embed) - , Recursive(project) - ) -import GHC.Generics - --- | An F-algebra on some 'Recursive' type @t@. --- --- An F-algebra is an evaluator for a functor (@f@) populated with the results (@a@s) of evaluating each child of the functor to a result (@a@), applied at each node starting from the leaves and working towards the root. @a@ is called the carrier type of the algebra because it carries the (results of the) functions used to compute the functor’s structure and enforce the laws of that algebra. -type FAlgebra f a = f a -> a - --- | An R-algebra on some 'Recursive' type @t@. --- --- An R-algebra is an evaluator for a functor (@f@) populated with pairs of the children (@t@) and the results (@a@s) of evaluating each child of the functor to a result (@a@), applied at each node starting from the leaves and working towards the root. --- --- See also 'FAlgebra'. -type RAlgebra f t a = f (t, a) -> a - --- | A subterm and its computed value, used in 'SubtermAlgebra'. -data Subterm t a = Subterm { subterm :: !t, subtermRef :: !a } - deriving (Eq, Foldable, Functor, Generic1, Ord, Show, Traversable) - -instance Eq t => Eq1 (Subterm t) where liftEq = genericLiftEq -instance Ord t => Ord1 (Subterm t) where liftCompare = genericLiftCompare -instance Show t => Show1 (Subterm t) where liftShowsPrec = genericLiftShowsPrec - --- | Like an R-algebra, but using 'Subterm' to label the fields instead of an anonymous pair. -type SubtermAlgebra f t a = f (Subterm t a) -> a - - --- | Fold a 'Recursive' structure using a 'SubtermAlgebra'. Like 'para', but with named fields for subterms and values. -foldSubterms :: Recursive t => SubtermAlgebra (Base t) t a -> t -> a -foldSubterms algebra = go where go = algebra . fmap (Subterm <*> go) . project - --- | Extract a term from the carrier tuple associated with a paramorphism. See also 'embedSubterm'. -embedTerm :: Corecursive t => Base t (t, a) -> t -embedTerm e = embed (fst <$> e) diff --git a/src/Data/Blob.hs b/src/Data/Blob.hs deleted file mode 100644 index 6c49d89411..0000000000 --- a/src/Data/Blob.hs +++ /dev/null @@ -1,155 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, ExplicitNamespaces, PatternSynonyms #-} -module Data.Blob -( File(..) -, fileForPath -, Blob(..) -, Blobs(..) -, blobLanguage -, blobPath -, makeBlob -, decodeBlobs -, nullBlob -, sourceBlob -, noLanguageForBlob -, type BlobPair -, pattern Diffing -, pattern Inserting -, pattern Deleting -, maybeBlobPair -, decodeBlobPairs -, languageForBlobPair -, languageTagForBlobPair -, pathForBlobPair -, pathKeyForBlobPair -) where - -import Prologue - -import Control.Effect -import Control.Effect.Error -import Data.Aeson -import qualified Data.ByteString.Lazy as BL -import Data.JSON.Fields -import Data.Language -import Data.Source as Source - --- | A 'FilePath' paired with its corresponding 'Language'. --- Unpacked to have the same size overhead as (FilePath, Language). -data File = File - { filePath :: FilePath - , fileLanguage :: Language - } deriving (Show, Eq, Generic) - -fileForPath :: FilePath -> File -fileForPath p = File p (languageForFilePath p) - --- | The source, path information, and language of a file read from disk. -data Blob = Blob - { blobSource :: Source -- ^ The UTF-8 encoded source text of the blob. - , blobFile :: File -- ^ Path/language information for this blob. - , blobOid :: Text -- ^ Git OID for this blob, mempty if blob is not from a git db. - } deriving (Show, Eq, Generic) - -blobLanguage :: Blob -> Language -blobLanguage = fileLanguage . blobFile - -blobPath :: Blob -> FilePath -blobPath = filePath . blobFile - -makeBlob :: Source -> FilePath -> Language -> Text -> Blob -makeBlob s p l = Blob s (File p l) -{-# INLINE makeBlob #-} - -newtype Blobs a = Blobs { blobs :: [a] } - deriving (Generic, FromJSON) - -instance FromJSON Blob where - parseJSON = withObject "Blob" $ \b -> inferringLanguage - <$> b .: "content" - <*> b .: "path" - <*> b .: "language" - -nullBlob :: Blob -> Bool -nullBlob Blob{..} = nullSource blobSource - -sourceBlob :: FilePath -> Language -> Source -> Blob -sourceBlob filepath language source = makeBlob source filepath language mempty - -inferringLanguage :: Source -> FilePath -> Language -> Blob -inferringLanguage src pth lang - | knownLanguage lang = makeBlob src pth lang mempty - | otherwise = makeBlob src pth (languageForFilePath pth) mempty - -decodeBlobs :: BL.ByteString -> Either String [Blob] -decodeBlobs = fmap blobs <$> eitherDecode - --- | An exception indicating that we’ve tried to diff or parse a blob of unknown language. -newtype NoLanguageForBlob = NoLanguageForBlob FilePath - deriving (Eq, Exception, Ord, Show, Typeable) - -noLanguageForBlob :: (Member (Error SomeException) sig, Carrier sig m) => FilePath -> m a -noLanguageForBlob blobPath = throwError (SomeException (NoLanguageForBlob blobPath)) - --- | Represents a blobs suitable for diffing which can be either a blob to --- delete, a blob to insert, or a pair of blobs to diff. -type BlobPair = Join These Blob - -instance FromJSON BlobPair where - parseJSON = withObject "BlobPair" $ \o -> do - before <- o .:? "before" - after <- o .:? "after" - case (before, after) of - (Just b, Just a) -> pure $ Diffing b a - (Just b, Nothing) -> pure $ Deleting b - (Nothing, Just a) -> pure $ Inserting a - _ -> Prelude.fail "Expected object with 'before' and/or 'after' keys only" - -pattern Diffing :: Blob -> Blob -> BlobPair -pattern Diffing a b = Join (These a b) - -pattern Inserting :: Blob -> BlobPair -pattern Inserting a = Join (That a) - -pattern Deleting :: Blob -> BlobPair -pattern Deleting b = Join (This b) - -{-# COMPLETE Diffing, Inserting, Deleting #-} - -maybeBlobPair :: MonadFail m => Maybe Blob -> Maybe Blob -> m BlobPair -maybeBlobPair a b = case (a, b) of - (Just a, Nothing) -> pure (Deleting a) - (Nothing, Just b) -> pure (Inserting b) - (Just a, Just b) -> pure (Diffing a b) - _ -> Prologue.fail "expected file pair with content on at least one side" - -languageForBlobPair :: BlobPair -> Language -languageForBlobPair (Deleting b) = blobLanguage b -languageForBlobPair (Inserting b) = blobLanguage b -languageForBlobPair (Diffing a b) - | blobLanguage a == Unknown || blobLanguage b == Unknown - = Unknown - | otherwise - = blobLanguage b - -pathForBlobPair :: BlobPair -> FilePath -pathForBlobPair x = blobPath $ case x of - (Inserting b) -> b - (Deleting b) -> b - (Diffing _ b) -> b - -languageTagForBlobPair :: BlobPair -> [(String, String)] -languageTagForBlobPair pair = showLanguage (languageForBlobPair pair) - where showLanguage = pure . (,) "language" . show - -pathKeyForBlobPair :: BlobPair -> FilePath -pathKeyForBlobPair blobs = case bimap blobPath blobPath (runJoin blobs) of - This before -> before - That after -> after - These before after | before == after -> after - | otherwise -> before <> " -> " <> after - -instance ToJSONFields Blob where - toJSONFields p = [ "path" .= blobPath p, "language" .= blobLanguage p] - -decodeBlobPairs :: BL.ByteString -> Either String [BlobPair] -decodeBlobPairs = fmap blobs <$> eitherDecode diff --git a/src/Data/Blob/IO.hs b/src/Data/Blob/IO.hs deleted file mode 100644 index 3465e463ea..0000000000 --- a/src/Data/Blob/IO.hs +++ /dev/null @@ -1,62 +0,0 @@ -{-# LANGUAGE RankNTypes #-} - --- | These are primitive file IO methods for use in ghci and as internal functions. --- Instead of using these, consider if you can use the Files DSL instead. -module Data.Blob.IO - ( readBlobFromFile - , readBlobFromFile' - , readBlobsFromDir - , readBlobsFromGitRepo - , readFilePair - ) where - -import Prologue - -import Data.Blob -import Data.Language -import Semantic.IO -import Data.Source -import qualified Semantic.Git as Git -import qualified Control.Concurrent.Async as Async -import qualified Data.ByteString as B - --- | Read a utf8-encoded file to a 'Blob'. -readBlobFromFile :: forall m. MonadIO m => File -> m (Maybe Blob) -readBlobFromFile (File "/dev/null" _) = pure Nothing -readBlobFromFile (File path language) = do - raw <- liftIO $ B.readFile path - pure . Just . sourceBlob path language . fromUTF8 $ raw - --- | Read a utf8-encoded file to a 'Blob', raising an IOError if it can't be found. -readBlobFromFile' :: MonadIO m => File -> m Blob -readBlobFromFile' file = do - maybeFile <- readBlobFromFile file - maybeM (Prelude.fail ("cannot read '" <> show file <> "', file not found or language not supported.")) maybeFile - --- | Read all blobs in the directory with Language.supportedExts -readBlobsFromDir :: MonadIO m => FilePath -> m [Blob] -readBlobsFromDir path = liftIO . fmap catMaybes $ - findFilesInDir path supportedExts mempty >>= Async.mapConcurrently (readBlobFromFile . fileForPath) - --- | Read all blobs from the Git repo with Language.supportedExts -readBlobsFromGitRepo :: MonadIO m => FilePath -> Git.OID -> [FilePath] -> m [Blob] -readBlobsFromGitRepo path oid excludePaths = liftIO . fmap catMaybes $ - Git.lsTree path oid >>= Async.mapConcurrently (blobFromTreeEntry path) - where - -- Only read tree entries that are normal mode, non-minified blobs in a language we can parse. - blobFromTreeEntry :: FilePath -> Git.TreeEntry -> IO (Maybe Blob) - blobFromTreeEntry gitDir (Git.TreeEntry Git.NormalMode Git.BlobObject oid path) - | lang <- languageForFilePath path - , lang `elem` codeNavLanguages - , not (pathIsMinified path) - , path `notElem` excludePaths - = Just . sourceBlob' path lang oid . fromText <$> Git.catFile gitDir oid - blobFromTreeEntry _ _ = pure Nothing - - sourceBlob' filepath language (Git.OID oid) source = makeBlob source filepath language oid - -readFilePair :: MonadIO m => File -> File -> m BlobPair -readFilePair a b = do - before <- readBlobFromFile a - after <- readBlobFromFile b - liftIO $ maybeBlobPair before after diff --git a/src/Data/Diff.hs b/src/Data/Diff.hs deleted file mode 100644 index 94c0d39994..0000000000 --- a/src/Data/Diff.hs +++ /dev/null @@ -1,199 +0,0 @@ -{-# LANGUAGE DataKinds, RankNTypes, TypeFamilies, TypeOperators, ScopedTypeVariables, UndecidableInstances #-} -module Data.Diff -( Diff(..) -, DiffF(..) -, replacing -, replaceF -, inserting -, insertF -, deleting -, deleteF -, merge -, mergeF -, merging -, diffPatches -) where - -import Data.Aeson -import Data.Bifoldable -import Data.Bifunctor -import Data.Bitraversable -import Data.Functor.Classes -import Data.Functor.Foldable -import Data.JSON.Fields -import Data.Patch -import Data.Term -import Text.Show - --- | A recursive structure indicating the changed & unchanged portions of a labelled tree. -newtype Diff syntax ann1 ann2 = Diff { unDiff :: DiffF syntax ann1 ann2 (Diff syntax ann1 ann2) } - --- | A single entry within a recursive 'Diff'. -data DiffF syntax ann1 ann2 recur - -- | A changed node, represented as 'Insert'ed, 'Delete'd, or 'Replace'd 'TermF's, consisting of syntax labelled with an annotation. - = Patch (Patch (TermF syntax ann1 recur) - (TermF syntax ann2 recur)) - -- | An unchanged node, consisting of syntax labelled with both the original annotations. - | Merge (TermF syntax (ann1, ann2) recur) - --- | Constructs a 'Diff' replacing one 'Term' with another recursively. -replacing :: Functor syntax => Term syntax ann1 -> Term syntax ann2 -> Diff syntax ann1 ann2 -replacing (Term (In a1 r1)) (Term (In a2 r2)) = replaceF (In a1 (deleting <$> r1)) (In a2 (inserting <$> r2)) - --- | Constructs a 'Diff' replacing one 'TermF' populated by further 'Diff's with another. -replaceF :: TermF syntax ann1 (Diff syntax ann1 ann2) -> TermF syntax ann2 (Diff syntax ann1 ann2) -> Diff syntax ann1 ann2 -replaceF t1 t2 = Diff (Patch (Replace t1 t2)) - --- | Constructs a 'Diff' inserting a 'Term' recursively. -inserting :: Functor syntax => Term syntax ann2 -> Diff syntax ann1 ann2 -inserting = cata insertF - --- | Constructs a 'Diff' inserting a single 'TermF' populated by further 'Diff's. -insertF :: TermF syntax ann2 (Diff syntax ann1 ann2) -> Diff syntax ann1 ann2 -insertF = Diff . Patch . Insert - --- | Constructs a 'Diff' deleting a 'Term' recursively. -deleting :: Functor syntax => Term syntax ann1 -> Diff syntax ann1 ann2 -deleting = cata deleteF - --- | Constructs a 'Diff' deleting a single 'TermF' populated by further 'Diff's. -deleteF :: TermF syntax ann1 (Diff syntax ann1 ann2) -> Diff syntax ann1 ann2 -deleteF = Diff . Patch . Delete - --- | Constructs a 'Diff' merging two annotations for a single syntax functor populated by further 'Diff's. -merge :: (ann1, ann2) -> syntax (Diff syntax ann1 ann2) -> Diff syntax ann1 ann2 -merge = fmap mergeF . In - --- | Constructs a 'Diff' merging a single 'TermF' populated by further 'Diff's. -mergeF :: TermF syntax (ann1, ann2) (Diff syntax ann1 ann2) -> Diff syntax ann1 ann2 -mergeF = Diff . Merge - --- | Constructs a 'Diff' merging a 'Term' recursively. --- --- Note that since this simply duplicates the 'Term'’s annotations, it is only really useful in tests or other contexts where preserving annotations from both sides is unnecessary. -merging :: Functor syntax => Term syntax ann -> Diff syntax ann ann -merging = cata (\ (In ann syntax) -> mergeF (In (ann, ann) syntax)) - - -diffPatches :: (Foldable syntax, Functor syntax) => Diff syntax ann1 ann2 -> [Patch (TermF syntax ann1 (Diff syntax ann1 ann2)) (TermF syntax ann2 (Diff syntax ann1 ann2))] -diffPatches = para $ \ diff -> case diff of - Patch patch -> bimap (fmap fst) (fmap fst) patch : bifoldMap (foldMap snd) (foldMap snd) patch - Merge merge -> foldMap snd merge - - -type instance Base (Diff syntax ann1 ann2) = DiffF syntax ann1 ann2 - -instance Functor syntax => Recursive (Diff syntax ann1 ann2) where project = unDiff -instance Functor syntax => Corecursive (Diff syntax ann1 ann2) where embed = Diff - - -instance Eq1 syntax => Eq2 (Diff syntax) where - liftEq2 eq1 eq2 = go where go (Diff d1) (Diff d2) = liftEq3 eq1 eq2 go d1 d2 - -instance (Eq1 syntax, Eq ann1, Eq ann2) => Eq (Diff syntax ann1 ann2) where - (==) = eq2 - -instance Eq1 syntax => Eq3 (DiffF syntax) where - liftEq3 eq1 eq2 eqRecur d1 d2 = case (d1, d2) of - (Patch p1, Patch p2) -> liftEq2 (liftEq2 eq1 eqRecur) (liftEq2 eq2 eqRecur) p1 p2 - (Merge t1, Merge t2) -> liftEq2 (liftEq2 eq1 eq2) eqRecur t1 t2 - _ -> False - -instance (Eq1 syntax, Eq ann1, Eq ann2) => Eq1 (DiffF syntax ann1 ann2) where - liftEq = liftEq3 (==) (==) - -instance (Eq1 syntax, Eq ann1, Eq ann2, Eq recur) => Eq (DiffF syntax ann1 ann2 recur) where - (==) = eq3 - - -instance Show1 syntax => Show2 (Diff syntax) where - liftShowsPrec2 sp1 sl1 sp2 sl2 = go where go d = showsUnaryWith (liftShowsPrec3 sp1 sl1 sp2 sl2 go (showListWith (go 0))) "Diff" d . unDiff - -instance (Show1 syntax, Show ann1, Show ann2) => Show (Diff syntax ann1 ann2) where - showsPrec = showsPrec2 - -instance Show1 syntax => Show3 (DiffF syntax) where - liftShowsPrec3 sp1 sl1 sp2 sl2 spRecur slRecur d diff = case diff of - Patch patch -> showsUnaryWith (liftShowsPrec2 (liftShowsPrec2 sp1 sl1 spRecur slRecur) (liftShowList2 sp1 sl1 spRecur slRecur) (liftShowsPrec2 sp2 sl2 spRecur slRecur) (liftShowList2 sp2 sl2 spRecur slRecur)) "Patch" d patch - Merge term -> showsUnaryWith (liftShowsPrec2 spBoth slBoth spRecur slRecur) "Merge" d term - where spBoth = liftShowsPrec2 sp1 sl1 sp2 sl2 - slBoth = liftShowList2 sp1 sl1 sp2 sl2 - -instance (Show1 syntax, Show ann1, Show ann2) => Show1 (DiffF syntax ann1 ann2) where - liftShowsPrec = liftShowsPrec3 showsPrec showList showsPrec showList - -instance (Show1 syntax, Show ann1, Show ann2, Show recur) => Show (DiffF syntax ann1 ann2 recur) where - showsPrec = showsPrec3 - -instance Functor syntax => Bifunctor (Diff syntax) where - bimap f g = go where go = Diff . trimap f g go . unDiff - -instance Foldable syntax => Bifoldable (Diff syntax) where - bifoldMap f g = go where go = trifoldMap f g go . unDiff - -instance Traversable syntax => Bitraversable (Diff syntax) where - bitraverse f g = go where go = fmap Diff . tritraverse f g go . unDiff - - -instance Functor syntax => Functor (DiffF syntax ann1 ann2) where - fmap = trimap id id - -instance Functor syntax => Trifunctor (DiffF syntax) where - trimap f g h (Patch patch) = Patch (bimap (bimap f h) (bimap g h) patch) - trimap f g h (Merge term) = Merge (bimap (bimap f g) h term) - -instance Foldable syntax => Foldable (DiffF syntax ann1 ann2) where - foldMap = trifoldMap (const mempty) (const mempty) - -instance Foldable syntax => Trifoldable (DiffF syntax) where - trifoldMap f g h (Patch patch) = bifoldMap (bifoldMap f h) (bifoldMap g h) patch - trifoldMap f g h (Merge term) = bifoldMap (bifoldMap f g) h term - -instance Traversable syntax => Traversable (DiffF syntax ann1 ann2) where - traverse = tritraverse pure pure - -instance Traversable syntax => Tritraversable (DiffF syntax) where - tritraverse f g h (Patch patch) = Patch <$> bitraverse (bitraverse f h) (bitraverse g h) patch - tritraverse f g h (Merge term) = Merge <$> bitraverse (bitraverse f g) h term - - -instance (ToJSONFields1 syntax, ToJSONFields ann1, ToJSONFields ann2) => ToJSON (Diff syntax ann1 ann2) where - toJSON = object . toJSONFields - toEncoding = pairs . mconcat . toJSONFields - -instance (ToJSONFields1 syntax, ToJSONFields ann1, ToJSONFields ann2) => ToJSONFields (Diff syntax ann1 ann2) where - toJSONFields = toJSONFields . unDiff - -instance (ToJSONFields1 syntax, ToJSONFields ann1, ToJSONFields ann2) => ToJSONFields1 (DiffF syntax ann1 ann2) where - toJSONFields1 (Patch patch) = [ "patch" .= JSONFields patch ] - toJSONFields1 (Merge term) = [ "merge" .= JSONFields term ] - -instance (ToJSONFields1 syntax, ToJSONFields ann1, ToJSONFields ann2, ToJSON recur) => ToJSONFields (DiffF syntax ann1 ann2 recur) where - toJSONFields = toJSONFields1 - -instance (ToJSONFields1 syntax, ToJSONFields ann1, ToJSONFields ann2, ToJSON recur) => ToJSON (DiffF syntax ann1 ann2 recur) where - toJSON = object . toJSONFields - toEncoding = pairs . mconcat . toJSONFields - - -class Eq3 f where - liftEq3 :: (a1 -> a2 -> Bool) -> (b1 -> b2 -> Bool) -> (c1 -> c2 -> Bool) -> f a1 b1 c1 -> f a2 b2 c2 -> Bool - -eq3 :: (Eq3 f, Eq a, Eq b, Eq c) => f a b c -> f a b c -> Bool -eq3 = liftEq3 (==) (==) (==) - - -class Show3 f where - liftShowsPrec3 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> (Int -> c -> ShowS) -> ([c] -> ShowS) -> Int -> f a b c -> ShowS - -showsPrec3 :: (Show3 f, Show a, Show b, Show c) => Int -> f a b c -> ShowS -showsPrec3 = liftShowsPrec3 showsPrec showList showsPrec showList showsPrec showList - -class Trifunctor f where - trimap :: (a -> a') -> (b -> b') -> (c -> c') -> f a b c -> f a' b' c' - -class Trifoldable f where - trifoldMap :: Monoid m => (a -> m) -> (b -> m) -> (c -> m) -> f a b c -> m - -class Tritraversable f where - tritraverse :: Applicative g => (a -> g a') -> (b -> g b') -> (c -> g c') -> f a b c -> g (f a' b' c') diff --git a/src/Data/Error.hs b/src/Data/Error.hs deleted file mode 100644 index 35e0769a07..0000000000 --- a/src/Data/Error.hs +++ /dev/null @@ -1,103 +0,0 @@ -{-# LANGUAGE GADTs, RankNTypes #-} -module Data.Error - ( Error (..) - , formatError - , makeError - , showExpectation - , showExcerpt - , withSGRCode - -- * Flags affecting 'Error' values - , LogPrintSource (..) - , Colourize (..) - ) where - -import Prologue - -import Data.ByteString.Char8 (unpack) -import Data.Ix (inRange) -import Data.List (intersperse, isSuffixOf) -import System.Console.ANSI - -import Data.Blob -import Data.Flag as Flag -import Data.Source -import Data.Span - -data LogPrintSource = LogPrintSource -data Colourize = Colourize - --- | Rather than using the Error constructor directly, you probably --- want to call 'makeError', which takes care of inserting the call --- stack for you. -data Error grammar = Error - { errorSpan :: Span - , errorExpected :: [grammar] - , errorActual :: Maybe grammar - , errorCallStack :: CallStack - } deriving (Show, Functor, Typeable) - --- | This instance does not take into account the call stack. -instance Eq grammar => Eq (Error grammar) where - (Error s e a _) == (Error s' e' a' _) = (s == s') && (e == e') && (a == a') - -instance Exception (Error String) - -makeError :: HasCallStack => Span -> [grammar] -> Maybe grammar -> Error grammar -makeError s e a = withFrozenCallStack (Error s e a callStack) - --- | Format an 'Error', optionally with reference to the source where it occurred. -formatError :: Flag LogPrintSource -> Flag Colourize -> Blob -> Error String -> String -formatError includeSource colourize blob@Blob{..} Error{..} - = ($ "") - $ withSGRCode colourize [SetConsoleIntensity BoldIntensity] (showSpan path errorSpan . showString ": ") - . withSGRCode colourize [SetColor Foreground Vivid Red] (showString "error") . showString ": " . showExpectation colourize errorExpected errorActual . showChar '\n' - . (if Flag.toBool LogPrintSource includeSource then showExcerpt colourize errorSpan blob else id) - . showCallStack colourize callStack . showChar '\n' - where - path = Just $ if Flag.toBool LogPrintSource includeSource then blobPath blob else "" - -showExcerpt :: Flag Colourize -> Span -> Blob -> ShowS -showExcerpt colourize Span{..} Blob{..} - = showString context . (if "\n" `isSuffixOf` context then id else showChar '\n') - . showString (replicate (caretPaddingWidth + lineNumberDigits) ' ') . withSGRCode colourize [SetColor Foreground Vivid Green] (showString caret) . showChar '\n' - where context = fold contextLines - contextLines = [ showLineNumber i <> ": " <> unpack (sourceBytes l) - | (i, l) <- zip [1..] (sourceLines blobSource) - , inRange (posLine spanStart - 2, posLine spanStart) i - ] - showLineNumber n = let s = show n in replicate (lineNumberDigits - length s) ' ' <> s - lineNumberDigits = succ (floor (logBase 10 (fromIntegral (posLine spanStart) :: Double))) - caretPaddingWidth = succ (posColumn spanStart) - caret | posLine spanStart == posLine spanEnd = replicate (max 1 (posColumn spanEnd - posColumn spanStart)) '^' - | otherwise = "^..." - -withSGRCode :: Flag Colourize -> [SGR] -> ShowS -> ShowS -withSGRCode useColour code content - | Flag.toBool Colourize useColour = showString (setSGRCode code) . content . showString (setSGRCode []) - | otherwise = content - -showExpectation :: Flag Colourize -> [String] -> Maybe String -> ShowS -showExpectation colourize = go - where go [] Nothing = showString "no rule to match at " . showActual "end of branch" - go expected Nothing = showString "expected " . showSymbols colourize expected . showString " at " . showActual "end of branch" - go expected (Just actual) = showString "expected " . showSymbols colourize expected . showString ", but got " . showActual actual - showActual = withSGRCode colourize [SetColor Foreground Vivid Green] . showString - -showSymbols :: Flag Colourize -> [String] -> ShowS -showSymbols colourize = go - where go [] = showString "end of input nodes" - go [symbol] = showSymbol symbol - go [a, b] = showSymbol a . showString " or " . showSymbol b - go [a, b, c] = showSymbol a . showString ", " . showSymbol b . showString ", or " . showSymbol c - go (h:t) = showSymbol h . showString ", " . go t - showSymbol = withSGRCode colourize [SetColor Foreground Vivid Red] . showString - -showSpan :: Maybe FilePath -> Span -> ShowS -showSpan path Span{..} = maybe (showParen True (showString "interactive")) showString path . showChar ':' . (if spanStart == spanEnd then showPos spanStart else showPos spanStart . showChar '-' . showPos spanEnd) - where showPos Pos{..} = shows posLine . showChar ':' . shows posColumn - -showCallStack :: Flag Colourize -> CallStack -> ShowS -showCallStack colourize callStack = foldr (.) id (intersperse (showChar '\n') (uncurry (showCallSite colourize) <$> getCallStack callStack)) - -showCallSite :: Flag Colourize -> String -> SrcLoc -> ShowS -showCallSite colourize symbol loc@SrcLoc{..} = showString symbol . showChar ' ' . withSGRCode colourize [SetConsoleIntensity BoldIntensity] (showParen True (showSpan (Just srcLocFile) (spanFromSrcLoc loc))) diff --git a/src/Data/Functor/Both.hs b/src/Data/Functor/Both.hs deleted file mode 100644 index 09658aea38..0000000000 --- a/src/Data/Functor/Both.hs +++ /dev/null @@ -1,23 +0,0 @@ -{-# LANGUAGE DerivingVia #-} - -module Data.Functor.Both -( Both (..) -, runBothWith -) where - -import Data.Functor.Classes -import Data.Functor.Classes.Generic -import Data.Monoid.Generic -import GHC.Generics - --- | A computation over both sides of a pair. -data Both a = Both a a - deriving (Eq, Show, Ord, Functor, Foldable, Traversable, Generic1, Generic) - deriving Semigroup via GenericSemigroup (Both a) - deriving Monoid via GenericMonoid (Both a) - deriving (Eq1, Show1, Ord1) via Generically Both - --- | Apply a function to `Both` sides of a computation. --- The eliminator/catamorphism over 'Both'. -runBothWith :: (a -> a -> b) -> Both a -> b -runBothWith f (Both a b) = f a b diff --git a/src/Data/Functor/Classes/Generic.hs b/src/Data/Functor/Classes/Generic.hs deleted file mode 100644 index 26b5f8316a..0000000000 --- a/src/Data/Functor/Classes/Generic.hs +++ /dev/null @@ -1,190 +0,0 @@ -{-# LANGUAGE TypeOperators, RankNTypes, UndecidableInstances #-} -module Data.Functor.Classes.Generic -( Eq1(..) -, genericLiftEq -, Ord1(..) -, genericLiftCompare -, Show1(..) -, GShow1Options(..) -, defaultGShow1Options -, genericLiftShowsPrec -, genericLiftShowsPrecWithOptions -, Generically (..) -) where - -import Data.Functor.Classes -import Data.List (intersperse) -import GHC.Generics -import Text.Show (showListWith) - --- | Generically-derivable lifting of the 'Eq' class to unary type constructors. -class GEq1 f where - -- | Lift an equality test through the type constructor. - -- - -- The function will usually be applied to an equality function, but the more general type ensures that the implementation uses it to compare elements of the first container with elements of the second. - gliftEq :: (a -> b -> Bool) -> f a -> f b -> Bool - --- | A suitable implementation of Eq1’s liftEq for Generic1 types. -genericLiftEq :: (Generic1 f, GEq1 (Rep1 f)) => (a -> b -> Bool) -> f a -> f b -> Bool -genericLiftEq f a b = gliftEq f (from1 a) (from1 b) - - --- | Generically-derivable lifting of the 'Ord' class to unary type constructors. -class GOrd1 f where - -- | Lift a comparison function through the type constructor. - -- - -- The function will usually be applied to a comparison function, but the more general type ensures that the implementation uses it to compare elements of the first container with elements of the second. - gliftCompare :: (a -> b -> Ordering) -> f a -> f b -> Ordering - --- | A suitable implementation of Ord1’s liftCompare for Generic1 types. -genericLiftCompare :: (Generic1 f, GOrd1 (Rep1 f)) => (a -> b -> Ordering) -> f a -> f b -> Ordering -genericLiftCompare f a b = gliftCompare f (from1 a) (from1 b) - - --- | Generically-derivable lifting of the 'Show' class to unary type constructors. -class GShow1 f where - -- | showsPrec function for an application of the type constructor based on showsPrec and showList functions for the argument type. - gliftShowsPrec :: GShow1Options -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS - -newtype GShow1Options = GShow1Options { optionsUseRecordSyntax :: Bool } - -defaultGShow1Options :: GShow1Options -defaultGShow1Options = GShow1Options { optionsUseRecordSyntax = False } - -class GShow1 f => GShow1Body f where - -- | showsPrec function for the body of an application of the type constructor based on showsPrec and showList functions for the argument type. - gliftShowsPrecBody :: GShow1Options -> Fixity -> Bool -> String -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS - - gliftShowsPrecAll :: GShow1Options -> Bool -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> [ShowS] - gliftShowsPrecAll opts _ sp sl d a = [gliftShowsPrec opts sp sl d a] - --- | showList function for an application of the type constructor based on showsPrec and showList functions for the argument type. The default implementation using standard list syntax is correct for most types. -gliftShowList :: GShow1 f => GShow1Options -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> [f a] -> ShowS -gliftShowList opts sp sl = showListWith (gliftShowsPrec opts sp sl 0) - --- | A suitable implementation of Show1’s liftShowsPrec for Generic1 types. -genericLiftShowsPrec :: (Generic1 f, GShow1 (Rep1 f)) => (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS -genericLiftShowsPrec sp sl d = gliftShowsPrec defaultGShow1Options sp sl d . from1 - --- | A suitable implementation of Show1’s liftShowsPrec for Generic1 types. -genericLiftShowsPrecWithOptions :: (Generic1 f, GShow1 (Rep1 f)) => GShow1Options -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS -genericLiftShowsPrecWithOptions options sp sl d = gliftShowsPrec options sp sl d . from1 - - --- Generics - -instance GEq1 U1 where - gliftEq _ _ _ = True - -instance GEq1 Par1 where - gliftEq f (Par1 a) (Par1 b) = f a b - -instance Eq c => GEq1 (K1 i c) where - gliftEq _ (K1 a) (K1 b) = a == b - -instance Eq1 f => GEq1 (Rec1 f) where - gliftEq f (Rec1 a) (Rec1 b) = liftEq f a b - -instance GEq1 f => GEq1 (M1 i c f) where - gliftEq f (M1 a) (M1 b) = gliftEq f a b - -instance (GEq1 f, GEq1 g) => GEq1 (f :+: g) where - gliftEq f a b = case (a, b) of - (L1 a, L1 b) -> gliftEq f a b - (R1 a, R1 b) -> gliftEq f a b - _ -> False - -instance (GEq1 f, GEq1 g) => GEq1 (f :*: g) where - gliftEq f (a1 :*: b1) (a2 :*: b2) = gliftEq f a1 a2 && gliftEq f b1 b2 - -instance (Eq1 f, GEq1 g) => GEq1 (f :.: g) where - gliftEq f (Comp1 a) (Comp1 b) = liftEq (gliftEq f) a b - - -instance GOrd1 U1 where - gliftCompare _ _ _ = EQ - -instance GOrd1 Par1 where - gliftCompare f (Par1 a) (Par1 b) = f a b - -instance Ord c => GOrd1 (K1 i c) where - gliftCompare _ (K1 a) (K1 b) = compare a b - -instance Ord1 f => GOrd1 (Rec1 f) where - gliftCompare f (Rec1 a) (Rec1 b) = liftCompare f a b - -instance GOrd1 f => GOrd1 (M1 i c f) where - gliftCompare f (M1 a) (M1 b) = gliftCompare f a b - -instance (GOrd1 f, GOrd1 g) => GOrd1 (f :+: g) where - gliftCompare f a b = case (a, b) of - (L1 a, L1 b) -> gliftCompare f a b - (R1 a, R1 b) -> gliftCompare f a b - (L1 _, R1 _) -> LT - (R1 _, L1 _) -> GT - -instance (GOrd1 f, GOrd1 g) => GOrd1 (f :*: g) where - gliftCompare f (a1 :*: b1) (a2 :*: b2) = gliftCompare f a1 a2 <> gliftCompare f b1 b2 - -instance (Ord1 f, GOrd1 g) => GOrd1 (f :.: g) where - gliftCompare f (Comp1 a) (Comp1 b) = liftCompare (gliftCompare f) a b - - -instance GShow1 U1 where - gliftShowsPrec _ _ _ _ _ = id - -instance GShow1 Par1 where - gliftShowsPrec _ sp _ d (Par1 a) = sp d a - -instance Show c => GShow1 (K1 i c) where - gliftShowsPrec _ _ _ d (K1 a) = showsPrec d a - -instance Show1 f => GShow1 (Rec1 f) where - gliftShowsPrec _ sp sl d (Rec1 a) = liftShowsPrec sp sl d a - -instance GShow1 f => GShow1 (M1 D c f) where - gliftShowsPrec opts sp sl d (M1 a) = gliftShowsPrec opts sp sl d a - -instance (Constructor c, GShow1Body f) => GShow1 (M1 C c f) where - gliftShowsPrec opts sp sl d m = gliftShowsPrecBody opts (conFixity m) (conIsRecord m && optionsUseRecordSyntax opts) (conName m) sp sl d (unM1 m) - -instance GShow1Body U1 where - gliftShowsPrecBody _ _ _ conName _ _ _ _ = showString conName - -instance (Selector s, GShow1 f) => GShow1Body (M1 S s f) where - gliftShowsPrecBody opts _ conIsRecord conName sp sl d m = showParen (d > 10) $ showString conName . showChar ' ' . showBraces conIsRecord (foldr (.) id (gliftShowsPrecAll opts conIsRecord sp sl 11 m)) - - gliftShowsPrecAll opts conIsRecord sp sl d m = [ (if conIsRecord && not (null (selName m)) then showString (selName m) . showString " = " else id) . gliftShowsPrec opts sp sl (if conIsRecord then 0 else d) (unM1 m) ] - -instance (GShow1Body f, GShow1Body g) => GShow1Body (f :*: g) where - gliftShowsPrecBody opts conFixity conIsRecord conName sp sl d (a :*: b) = case conFixity of - Prefix -> showParen (d > 10) $ showString conName . showChar ' ' . if conIsRecord - then showBraces True (foldr (.) id (intersperse (showString ", ") (gliftShowsPrecAll opts conIsRecord sp sl 11 (a :*: b)))) - else foldr (.) id (intersperse (showString " ") (gliftShowsPrecAll opts conIsRecord sp sl 11 (a :*: b))) - Infix _ prec -> showParen (d > prec) $ gliftShowsPrec opts sp sl (succ prec) a . showChar ' ' . showString conName . showChar ' ' . gliftShowsPrec opts sp sl (succ prec) b - - gliftShowsPrecAll opts conIsRecord sp sl d (a :*: b) = gliftShowsPrecAll opts conIsRecord sp sl d a <> gliftShowsPrecAll opts conIsRecord sp sl d b - -instance GShow1 f => GShow1 (M1 S c f) where - gliftShowsPrec opts sp sl d (M1 a) = gliftShowsPrec opts sp sl d a - -instance (GShow1 f, GShow1 g) => GShow1 (f :+: g) where - gliftShowsPrec opts sp sl d (L1 l) = gliftShowsPrec opts sp sl d l - gliftShowsPrec opts sp sl d (R1 r) = gliftShowsPrec opts sp sl d r - -instance (GShow1 f, GShow1 g) => GShow1 (f :*: g) where - gliftShowsPrec opts sp sl d (a :*: b) = gliftShowsPrec opts sp sl d a . showChar ' ' . gliftShowsPrec opts sp sl d b - -instance (Show1 f, GShow1 g) => GShow1 (f :.: g) where - gliftShowsPrec opts sp sl d (Comp1 a) = liftShowsPrec (gliftShowsPrec opts sp sl) (gliftShowList opts sp sl) d a - -showBraces :: Bool -> ShowS -> ShowS -showBraces should rest = if should then showChar '{' . rest . showChar '}' else rest - --- | Used with the `DerivingVia` extension to provide fast derivations for --- 'Eq1', 'Show1', and 'Ord1'. -newtype Generically f a = Generically { unGenerically :: f a } - -instance (Generic1 f, GEq1 (Rep1 f)) => Eq1 (Generically f) where liftEq eq (Generically a1) (Generically a2) = genericLiftEq eq a1 a2 -instance (Generic1 f, GEq1 (Rep1 f), GOrd1 (Rep1 f)) => Ord1 (Generically f) where liftCompare compare (Generically a1) (Generically a2) = genericLiftCompare compare a1 a2 -instance (Generic1 f, GShow1 (Rep1 f)) => Show1 (Generically f) where liftShowsPrec d sp sl = genericLiftShowsPrec d sp sl . unGenerically diff --git a/src/Data/Graph.hs b/src/Data/Graph.hs deleted file mode 100644 index 2944bffeb5..0000000000 --- a/src/Data/Graph.hs +++ /dev/null @@ -1,115 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, TypeFamilies, UndecidableInstances #-} -module Data.Graph -( Graph(..) -, overlay -, connect -, vertex -, Lower(..) -, simplify -, topologicalSort -, VertexTag(..) -, Edge(..) -, vertexList -, edgeList -) where - -import Prologue - -import qualified Algebra.Graph as G -import qualified Algebra.Graph.AdjacencyMap as A -import Algebra.Graph.Class (connect, overlay, vertex) -import qualified Algebra.Graph.Class as Class -import qualified Algebra.Graph.ToGraph as Class -import Control.Effect -import Control.Effect.State -import Data.Aeson -import qualified Data.Set as Set -import Semantic.Api.V1.CodeAnalysisPB - --- | An algebraic graph with 'Ord', 'Semigroup', and 'Monoid' instances. -newtype Graph vertex = Graph { unGraph :: G.Graph vertex } - deriving (Alternative, Applicative, Eq, Functor, Monad, Show, Class.Graph, NFData) - -instance Ord t => Class.ToGraph (Graph t) where - type ToVertex (Graph t) = t - toGraph = Class.toGraph . unGraph - -simplify :: Ord vertex => Graph vertex -> Graph vertex -simplify (Graph graph) = Graph (G.simplify graph) - - --- | Sort a graph’s vertices topologically. Specced in @Data.Graph.Spec@. -topologicalSort :: forall v . Ord v => Graph v -> [v] -topologicalSort = go . Class.toAdjacencyMap . G.transpose . unGraph - where go :: A.AdjacencyMap v -> [v] - go graph - = visitedOrder . fst - . run - . runState (Visited lowerBound []) - . traverse_ visit - . A.vertexList - $ graph - where visit :: (Member (State (Visited v)) sig, Carrier sig m) => v -> m () - visit v = do - isMarked <- Set.member v . visitedVertices <$> get - if isMarked then - pure () - else do - modify (extendVisited (Set.insert v)) - traverse_ visit (Set.toList (A.postSet v graph)) - modify (extendOrder (v :)) - -data Visited v = Visited { visitedVertices :: !(Set v), visitedOrder :: [v] } - -extendVisited :: (Set v -> Set v) -> Visited v -> Visited v -extendVisited f (Visited a b) = Visited (f a) b - -extendOrder :: ([v] -> [v]) -> Visited v -> Visited v -extendOrder f (Visited a b) = Visited a (f b) - -vertexList :: Ord v => Graph v -> [v] -vertexList = G.vertexList . unGraph - -edgeList :: Ord v => Graph v -> [Edge v] -edgeList = fmap Edge . G.edgeList . unGraph - --- Instances - -instance Lower (Graph vertex) where - lowerBound = Class.empty - -instance Semigroup (Graph vertex) where - (<>) = overlay - -instance Monoid (Graph vertex) where - mempty = Class.empty - mappend = (<>) - -instance Ord vertex => Ord (Graph vertex) where - compare (Graph G.Empty) (Graph G.Empty) = EQ - compare (Graph G.Empty) _ = LT - compare _ (Graph G.Empty) = GT - compare (Graph (G.Vertex a)) (Graph (G.Vertex b)) = compare a b - compare (Graph (G.Vertex _)) _ = LT - compare _ (Graph (G.Vertex _)) = GT - compare (Graph (G.Overlay a1 a2)) (Graph (G.Overlay b1 b2)) = (compare `on` Graph) a1 b1 <> (compare `on` Graph) a2 b2 - compare (Graph (G.Overlay _ _)) _ = LT - compare _ (Graph (G.Overlay _ _)) = GT - compare (Graph (G.Connect a1 a2)) (Graph (G.Connect b1 b2)) = (compare `on` Graph) a1 b1 <> (compare `on` Graph) a2 b2 - - -class VertexTag vertex where - uniqueTag :: vertex -> Int - -instance VertexTag DiffTreeVertex where uniqueTag = fromIntegral . diffVertexId -instance VertexTag TermVertex where uniqueTag = fromIntegral . vertexId - -instance (Ord vertex, ToJSON vertex, VertexTag vertex) => ToJSON (Graph vertex) where - toJSON (Graph graph) = object ["vertices" .= G.vertexList graph, "edges" .= (Edge <$> G.edgeList graph)] - toEncoding (Graph graph) = pairs ("vertices" .= G.vertexList graph <> "edges" .= (Edge <$> G.edgeList graph)) - -newtype Edge vertex = Edge (vertex, vertex) - -instance (ToJSON vertex, VertexTag vertex) => ToJSON (Edge vertex) where - toJSON (Edge (a, b)) = object ["source" .= uniqueTag a, "target" .= uniqueTag b] - toEncoding (Edge (a, b)) = pairs ("source" .= uniqueTag a <> "target" .= uniqueTag b) diff --git a/src/Data/Graph/ControlFlowVertex.hs b/src/Data/Graph/ControlFlowVertex.hs deleted file mode 100644 index 7f2c852219..0000000000 --- a/src/Data/Graph/ControlFlowVertex.hs +++ /dev/null @@ -1,154 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-} -module Data.Graph.ControlFlowVertex -( ControlFlowVertex (..) -, packageVertex -, moduleVertex -, unknownModuleVertex -, variableVertex -, methodVertex -, functionVertex -, vertexIdentifier -, showSpan -, VertexDeclaration (..) -, VertexDeclaration' (..) -, VertexDeclarationStrategy -, VertexDeclarationWithStrategy -) where - -import Data.Abstract.Declarations -import Data.Abstract.Module (ModuleInfo (..)) -import Data.Abstract.Name -import Data.Abstract.Package (PackageInfo (..)) -import Data.Aeson -import Data.Graph (VertexTag (..)) -import qualified Data.Graph as G -import Data.Location -import Data.Span -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Expression as Expression -import Data.Term -import qualified Data.Text as T -import Prologue - --- | A vertex of representing some node in a control flow graph. -data ControlFlowVertex - = Package { vertexName :: Text } - | Module { vertexName :: Text } - | UnknownModule { vertexName :: Text } - | Variable { vertexName :: Text, vertexModuleName :: Text, vertexSpan :: Span } - | Method { vertexName :: Text, vertexModuleName :: Text, vertexSpan :: Span } - | Function { vertexName :: Text, vertexModuleName :: Text, vertexSpan :: Span } - deriving (Eq, Ord, Show, Generic, Hashable, NFData) - -packageVertex :: PackageInfo -> ControlFlowVertex -packageVertex (PackageInfo name _) = Package (formatName name) - -moduleVertex :: ModuleInfo -> ControlFlowVertex -moduleVertex = Module . T.pack . modulePath - -unknownModuleVertex :: ModuleInfo -> ControlFlowVertex -unknownModuleVertex = UnknownModule . T.pack . modulePath - -variableVertex :: Text -> ModuleInfo -> Span -> ControlFlowVertex -variableVertex name ModuleInfo{..} = Variable name (T.pack modulePath) - -methodVertex :: Text -> ModuleInfo -> Span -> ControlFlowVertex -methodVertex name ModuleInfo{..} = Method name (T.pack modulePath) - -functionVertex :: Text -> ModuleInfo -> Span -> ControlFlowVertex -functionVertex name ModuleInfo{..} = Function name (T.pack modulePath) - -vertexIdentifier :: ControlFlowVertex -> Text -vertexIdentifier v@Package{..} = vertexName <> " (" <> vertexToType v <> ")" -vertexIdentifier v@Module{..} = vertexName <> " (" <> vertexToType v <> ")" -vertexIdentifier v@UnknownModule{..} = vertexName <> " (" <> vertexToType v <> ")" -vertexIdentifier v = vertexModuleName v <> "::" <> vertexName v <> " (" <> vertexToType v <> " " <> showSpan (vertexSpan v) <> ")" - -showSpan :: Span -> Text -showSpan (Span (Pos a b) (Pos c d)) = T.pack $ - "[" <> show a <> ", " <> show b <> "]" - <> " - " - <> "[" <> show c <> ", " <> show d <> "]" - -vertexToType :: ControlFlowVertex -> Text -vertexToType Package{} = "Package" -vertexToType Module{} = "Module" -vertexToType UnknownModule{} = "Unknown Module" -vertexToType Variable{} = "Variable" -vertexToType Method{} = "Method" -vertexToType Function{} = "Function" - - --- Instances - -instance Lower ControlFlowVertex where lowerBound = Package "" -instance VertexTag ControlFlowVertex where uniqueTag = hash . vertexIdentifier - -instance ToJSON ControlFlowVertex where - toJSON v = object [ "name" .= vertexIdentifier v, "type" .= vertexToType v ] - --- TODO: This is potentially valuable just to get name's out of declarable things. --- Typeclasses to create 'ControlFlowVertex's from 'Term's. Also extracts --- 'Name's for terms with symbolic names like Identifiers and Declarations. - -class VertexDeclaration syntax where - toVertex :: (Declarations1 syntax, Foldable syntax) - => Location - -> ModuleInfo - -> syntax (Term syntax Location) - -> Maybe (ControlFlowVertex, Name) - -instance (VertexDeclaration' syntax syntax) => VertexDeclaration syntax where - toVertex = toVertex' - -class VertexDeclaration' whole syntax where - toVertex' :: (Declarations1 whole, Foldable whole) - => Location - -> ModuleInfo - -> syntax (Term whole Location) - -> Maybe (ControlFlowVertex, Name) - -instance (VertexDeclarationStrategy syntax ~ strategy, VertexDeclarationWithStrategy strategy whole syntax) => VertexDeclaration' whole syntax where - toVertex' = toVertexWithStrategy (Proxy :: Proxy strategy) - -data Strategy = Default | Custom - -type family VertexDeclarationStrategy syntax where - VertexDeclarationStrategy Syntax.Identifier = 'Custom - VertexDeclarationStrategy Declaration.Function = 'Custom - VertexDeclarationStrategy Declaration.Method = 'Custom - VertexDeclarationStrategy Expression.MemberAccess = 'Custom - VertexDeclarationStrategy (Sum _) = 'Custom - VertexDeclarationStrategy syntax = 'Default - -class VertexDeclarationWithStrategy (strategy :: Strategy) whole syntax where - toVertexWithStrategy :: (Declarations1 whole, Foldable whole) - => proxy strategy - -> Location - -> ModuleInfo - -> syntax (Term whole Location) - -> Maybe (ControlFlowVertex, Name) - --- | The 'Default' strategy produces 'Nothing'. -instance VertexDeclarationWithStrategy 'Default whole syntax where - toVertexWithStrategy _ _ _ _ = Nothing - -instance Apply (VertexDeclaration' whole) fs => VertexDeclarationWithStrategy 'Custom whole (Sum fs) where - toVertexWithStrategy _ ann info = apply @(VertexDeclaration' whole) (toVertex' ann info) - -instance VertexDeclarationWithStrategy 'Custom whole Syntax.Identifier where - toVertexWithStrategy _ ann info (Syntax.Identifier name) = Just (variableVertex (formatName name) info (locationSpan ann), name) - -instance VertexDeclarationWithStrategy 'Custom whole Declaration.Function where - toVertexWithStrategy _ ann info term@Declaration.Function{} = (\n -> (functionVertex (formatName n) info (locationSpan ann), n)) <$> liftDeclaredName declaredName term - -instance VertexDeclarationWithStrategy 'Custom whole Declaration.Method where - toVertexWithStrategy _ ann info term@Declaration.Method{} = (\n -> (methodVertex (formatName n) info (locationSpan ann), n)) <$> liftDeclaredName declaredName term - -instance VertexDeclarationWithStrategy 'Custom whole whole => VertexDeclarationWithStrategy 'Custom whole Expression.MemberAccess where - toVertexWithStrategy proxy ann info (Expression.MemberAccess (Term (In lhsAnn lhs)) (Term (In rhsAnn rhs))) = - case (toVertexWithStrategy proxy lhsAnn info lhs, toVertexWithStrategy proxy rhsAnn info rhs) of - (Just (Variable n _ _, _), Just (_, name)) -> Just (variableVertex (n <> "." <> formatName name) info (locationSpan ann), name) - (_, Just (_, name)) -> Just (variableVertex (formatName name) info (locationSpan ann), name) - _ -> Nothing diff --git a/src/Data/History.hs b/src/Data/History.hs deleted file mode 100644 index c2c052cbce..0000000000 --- a/src/Data/History.hs +++ /dev/null @@ -1,36 +0,0 @@ -{-# LANGUAGE TypeOperators, GADTs #-} - -module Data.History - ( History (..) - , mark - , remark - ) where - -import Data.Location - --- | 'History' values, when attached to a given 'Term', describe the ways in --- which that term was modified during a refactoring pass, if any. -data History - = Refactored Range - -- ^ A 'Refactored' node was changed by a refactor but still has - -- (possibly-inaccurate) position information. - | Unmodified Range - -- ^ An 'Unmodified' node was not changed, but may have 'Refactored' children. - deriving (Show, Eq) - --- | Convert a 'Term' annotated with a 'Range' to one annotated with a 'History'. -mark :: Functor f - => (Range -> History) - -> f Location - -> f History -mark f = fmap (f . locationByteRange) - --- | Change the 'History' annotation on a 'Term'. -remark :: Functor f - => (Range -> History) - -> f History - -> f History -remark f = fmap go where - go h = case h of - Refactored l -> f l - Unmodified l -> f l diff --git a/src/Data/ImportPath.hs b/src/Data/ImportPath.hs deleted file mode 100644 index 22f9201a26..0000000000 --- a/src/Data/ImportPath.hs +++ /dev/null @@ -1,29 +0,0 @@ -{-# LANGUAGE DeriveAnyClass #-} -module Data.ImportPath (IsRelative(..), ImportPath(..), importPath, toName, defaultAlias) where - -import Prologue - -import Data.Abstract.Name -import Data.Abstract.Path (stripQuotes) -import Data.Aeson -import qualified Data.Text as T -import System.FilePath.Posix - -data IsRelative = Unknown | Relative | NonRelative - deriving (Bounded, Enum, Eq, Generic, Hashable, Ord, Show, ToJSON, NFData) - -data ImportPath = ImportPath { unPath :: FilePath, pathIsRelative :: IsRelative } - deriving (Eq, Generic, Hashable, Ord, Show, ToJSON, NFData) - --- TODO: fix the duplication present in this and Python -importPath :: Text -> ImportPath -importPath str = let path = stripQuotes str in ImportPath (T.unpack path) (pathType path) - where - pathType xs | not (T.null xs), T.head xs == '.' = Relative -- head call here is safe - | otherwise = NonRelative - -defaultAlias :: ImportPath -> Name -defaultAlias = name . T.pack . takeFileName . unPath - -toName :: ImportPath -> Name -toName = name . T.pack . unPath diff --git a/src/Data/JSON/Fields.hs b/src/Data/JSON/Fields.hs deleted file mode 100644 index 2014a3d4c3..0000000000 --- a/src/Data/JSON/Fields.hs +++ /dev/null @@ -1,146 +0,0 @@ -{-# LANGUAGE DefaultSignatures, MultiParamTypeClasses, TypeOperators, UndecidableInstances, GADTs #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Data.JSON.Fields - ( JSONFields (..) - , JSONFields1 (..) - , ToJSONFields (..) - , ToJSONFields1 (..) - , (.=) - ) where - -import Data.Aeson -import qualified Data.Map as Map -import Data.Sum (Apply (..), Sum) -import qualified Data.Text as Text -import GHC.Generics -import Prologue - -class ToJSONFields a where - toJSONFields :: KeyValue kv => a -> [kv] - -class ToJSONFields1 f where - toJSONFields1 :: (KeyValue kv, ToJSON a) => f a -> [kv] - default toJSONFields1 :: (KeyValue kv, ToJSON a, GToJSONFields1 (Rep1 f), GConstructorName1 (Rep1 f), Generic1 f) => f a -> [kv] - toJSONFields1 s = let r = from1 s in - "term" .= gconstructorName1 r : Map.foldrWithKey m [] (gtoJSONFields1 r) - where - m _ [] acc = acc - m k [v] acc = (k .= v) : acc - m k vs acc = (k .= vs) : acc - -instance ToJSONFields a => ToJSONFields (Join (,) a) where - toJSONFields (Join (a, b)) = [ "before" .= object (toJSONFields a), "after" .= object (toJSONFields b) ] - -instance ToJSONFields a => ToJSONFields (Maybe a) where - toJSONFields = maybe [] toJSONFields - -instance ToJSON a => ToJSONFields [a] where - toJSONFields list = [ "children" .= list ] - -instance ToJSONFields1 [] where - toJSONFields1 list = [ "children" .= list ] - -instance Apply ToJSONFields1 fs => ToJSONFields1 (Sum fs) where - toJSONFields1 = apply @ToJSONFields1 toJSONFields1 - -instance (ToJSONFields a, ToJSONFields b) => ToJSONFields (a, b) where - toJSONFields (a, b) = [ "before" .= JSONFields a, "after" .= JSONFields b ] - - -newtype JSONFields a = JSONFields { unJSONFields :: a } - -instance ToJSONFields a => ToJSONFields (JSONFields a) where - toJSONFields = toJSONFields . unJSONFields - -instance ToJSONFields a => ToJSON (JSONFields a) where - toJSON = object . toJSONFields . unJSONFields - toEncoding = pairs . mconcat . toJSONFields . unJSONFields - - -newtype JSONFields1 f a = JSONFields1 { unJSONFields1 :: f a } - -instance ToJSONFields1 f => ToJSONFields1 (JSONFields1 f) where - toJSONFields1 = toJSONFields1 . unJSONFields1 - -instance (ToJSON a, ToJSONFields1 f) => ToJSONFields (JSONFields1 f a) where - toJSONFields = toJSONFields1 . unJSONFields1 - -instance (ToJSON a, ToJSONFields1 f) => ToJSON (JSONFields1 f a) where - toJSON = object . toJSONFields1 . unJSONFields1 - toEncoding = pairs . mconcat . toJSONFields1 . unJSONFields1 - - --- | A typeclass to retrieve the name of a data constructor. -class GConstructorName1 f where - gconstructorName1 :: f a -> String - -instance Apply GConstructorName1 fs => GConstructorName1 (Sum fs) where - gconstructorName1 = apply @GConstructorName1 gconstructorName1 - -instance GConstructorName1 f => GConstructorName1 (M1 D c f) where - gconstructorName1 = gconstructorName1 . unM1 - -instance Constructor c => GConstructorName1 (M1 C c f) where - gconstructorName1 = conName - -instance (GConstructorName1 f, GConstructorName1 g) => GConstructorName1 (f :+: g) where - gconstructorName1 (L1 l) = gconstructorName1 l - gconstructorName1 (R1 r) = gconstructorName1 r - - --- | A typeclass to calculate a list of 'KeyValue's describing the record selector names and associated values on a datatype. -class GToJSONFields1 f where - -- FIXME: Not ideal to allocate a Map each time here, but not an obvious way - -- to deal with product types without record selectors that all end up as an - -- array under a "children" property. - gtoJSONFields1 :: (ToJSON a) => f a -> Map.Map Text [SomeJSON] - -instance GToJSONFields1 f => GToJSONFields1 (M1 D c f) where - gtoJSONFields1 = gtoJSONFields1 . unM1 - -instance GToJSONFields1 f => GToJSONFields1 (M1 C c f) where - gtoJSONFields1 = gtoJSONFields1 . unM1 - -instance GToJSONFields1 U1 where - gtoJSONFields1 _ = mempty - -instance (Selector c, GSelectorJSONValue1 f) => GToJSONFields1 (M1 S c f) where - gtoJSONFields1 m1 = Map.fromList [gselectorJSONValue1 keyName (unM1 m1)] - where keyName = case selName m1 of - "" -> Nothing - n -> Just (Text.pack n) - -instance (GToJSONFields1 f, GToJSONFields1 g) => GToJSONFields1 (f :+: g) where - gtoJSONFields1 (L1 l) = gtoJSONFields1 l - gtoJSONFields1 (R1 r) = gtoJSONFields1 r - -instance (GToJSONFields1 f, GToJSONFields1 g) => GToJSONFields1 (f :*: g) where - gtoJSONFields1 (x :*: y) = Map.unionWith (<>) (gtoJSONFields1 x) (gtoJSONFields1 y) - --- | A typeclass to retrieve the JSON 'Value' of a record selector. -class GSelectorJSONValue1 f where - gselectorJSONValue1 :: (ToJSON a) => Maybe Text -> f a -> (Text, [SomeJSON]) - -instance GSelectorJSONValue1 Par1 where - gselectorJSONValue1 k x = (fromMaybe "children" k, [SomeJSON (unPar1 x)]) - -instance ToJSON1 f => GSelectorJSONValue1 (Rec1 f) where - gselectorJSONValue1 k x = (fromMaybe "children" k, [SomeJSON (SomeJSON1 (unRec1 x))]) - -instance ToJSON k => GSelectorJSONValue1 (K1 r k) where - gselectorJSONValue1 k x = (fromMaybe "value" k, [SomeJSON (unK1 x)]) - --- | An existential type wrapping an JSON-compatible data type. -data SomeJSON where - SomeJSON :: ToJSON a => a -> SomeJSON - -instance ToJSON SomeJSON where - toJSON (SomeJSON a) = toJSON a - toEncoding (SomeJSON a) = toEncoding a - -data SomeJSON1 where - SomeJSON1 :: (ToJSON1 f, ToJSON a) => f a -> SomeJSON1 - -instance ToJSON SomeJSON1 where - toJSON (SomeJSON1 fa) = toJSON1 fa - toEncoding (SomeJSON1 fa) = toEncoding1 fa diff --git a/src/Data/Language.hs b/src/Data/Language.hs deleted file mode 100644 index d4ff8fe6f7..0000000000 --- a/src/Data/Language.hs +++ /dev/null @@ -1,164 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DeriveGeneric, KindSignatures, LambdaCase #-} -module Data.Language - ( Language (..) - , SLanguage (..) - , extensionsForLanguage - , parseLanguage - , knownLanguage - , languageForFilePath - , pathIsMinified - , languageForType - , supportedExts - , codeNavLanguages - ) where - -import Data.Aeson -import Data.Char (toUpper) -import Data.String -import qualified Data.Text as T -import Prologue -import Proto3.Suite -import System.FilePath.Posix - --- | The various languages we support. --- Please do not reorder any of the field names: the current implementation of 'Primitive' --- delegates to the auto-generated 'Enum' instance. -data Language - = Unknown - | Go - | Haskell - | Java - | JavaScript - | JSON - | JSX - | Markdown - | Python - | Ruby - | TypeScript - | PHP - | TSX - deriving (Eq, Generic, Ord, Read, Show, Bounded, Hashable, ToJSON, Named, Enum, MessageField, NFData) - -class SLanguage (lang :: Language) where - reflect :: proxy lang -> Language - -instance SLanguage 'Unknown where - reflect _ = Unknown - -instance SLanguage 'Go where - reflect _ = Go - -instance SLanguage 'Haskell where - reflect _ = Haskell - -instance SLanguage 'Java where - reflect _ = Java - -instance SLanguage 'JavaScript where - reflect _ = JavaScript - -instance SLanguage 'JSON where - reflect _ = JSON - -instance SLanguage 'JSX where - reflect _ = JSX - -instance SLanguage 'Markdown where - reflect _ = Markdown - -instance SLanguage 'Python where - reflect _ = Python - -instance SLanguage 'Ruby where - reflect _ = Ruby - -instance SLanguage 'TypeScript where - reflect _ = TypeScript - -instance SLanguage 'PHP where - reflect _ = PHP - - --- This ensures that the protobuf file is generated with ALL_CAPS_NAMES. -instance Finite Language where - enumerate _ = fmap go [Unknown ..] where - go x = (fromString (fmap toUpper (show x)), fromEnum x) - -instance FromJSON Language where - parseJSON = withText "Language" $ \l -> - pure $ fromMaybe Unknown (parseLanguage l) - -parseLanguage :: Text -> Maybe Language -parseLanguage l = case T.toLower l of - "go" -> Just Go - "haskell" -> Just Haskell - "java" -> Just Java - "javascript" -> Just JavaScript - "json" -> Just JSON - "jsx" -> Just JSX - "markdown" -> Just Markdown - "python" -> Just Python - "ruby" -> Just Ruby - "typescript" -> Just TypeScript - "php" -> Just PHP - _ -> Nothing - --- | Predicate failing on 'Unknown' and passing in all other cases. -knownLanguage :: Language -> Bool -knownLanguage = (/= Unknown) - --- | Defaults to 'Unknown'. -instance HasDefault Language where def = Unknown - --- | Piggybacks on top of the 'Enumerated' instance, as the generated code would. --- This instance will get easier when we have DerivingVia. -instance Primitive Language where - primType _ = primType (Proxy @(Enumerated Language)) - encodePrimitive f = encodePrimitive f . Enumerated . Right - decodePrimitive = decodePrimitive >>= \case - (Enumerated (Right r)) -> pure r - other -> Prelude.fail ("Language decodeMessageField: unexpected value" <> show other) - --- | Returns a Language based on the file extension (including the "."). -languageForType :: String -> Language -languageForType mediaType = case mediaType of - ".java" -> Java - ".json" -> JSON - ".hs" -> Haskell - ".md" -> Markdown - ".rb" -> Ruby - ".go" -> Go - ".js" -> JavaScript - ".ts" -> TypeScript - ".tsx" -> TSX - ".jsx" -> JSX - ".py" -> Python - ".php" -> PHP - ".phpt" -> PHP - _ -> Unknown - -extensionsForLanguage :: Language -> [String] -extensionsForLanguage language = case language of - Go -> [".go"] - Haskell -> [".hs"] - JavaScript -> [".js"] - PHP -> [".php"] - Python -> [".py"] - Ruby -> [".rb"] - TypeScript -> [".ts"] - TSX -> [".tsx", ".d.tsx"] - JSX -> [".jsx"] - _ -> [] - --- | Return a language based on a FilePath's extension, or Nothing if extension is not found or not supported. -languageForFilePath :: FilePath -> Language -languageForFilePath = languageForType . takeExtension - -supportedExts :: [String] -supportedExts = [".go", ".py", ".rb", ".js", ".ts"] - -codeNavLanguages :: [Language] -codeNavLanguages = [Go, Ruby, Python, JavaScript, TypeScript] - -pathIsMinified :: FilePath -> Bool -pathIsMinified = isExtensionOf ".min.js" diff --git a/src/Data/Location.hs b/src/Data/Location.hs deleted file mode 100644 index ba8f6857e0..0000000000 --- a/src/Data/Location.hs +++ /dev/null @@ -1,29 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia #-} - -module Data.Location - ( Location(..) - , Span(..) - , Range(..) - ) where - -import Prologue - -import Control.Lens.Lens -import Data.JSON.Fields -import Data.Range -import Data.Span - -data Location - = Location - { locationByteRange :: {-# UNPACK #-} Range - , locationSpan :: {-# UNPACK #-} Span - } - deriving (Eq, Ord, Show, Generic, NFData) - deriving Semigroup via GenericSemigroup Location - -instance HasSpan Location where - span = lens locationSpan (\l s -> l { locationSpan = s }) - {-# INLINE span #-} - -instance ToJSONFields Location where - toJSONFields Location{..} = toJSONFields locationByteRange <> toJSONFields locationSpan diff --git a/src/Data/Map/Monoidal.hs b/src/Data/Map/Monoidal.hs deleted file mode 100644 index 4cebe79cae..0000000000 --- a/src/Data/Map/Monoidal.hs +++ /dev/null @@ -1,68 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} --- | This module defines a 'Map' type whose 'Monoid' and 'Reducer' instances merge values using the 'Semigroup' instance for the underlying type. -module Data.Map.Monoidal -( Map -, empty -, lookup -, singleton -, size -, insert -, delete -, filterWithKey -, pairs -, elems -, keys -, module Reducer -) where - -import Data.Aeson (ToJSON) -import qualified Data.Map as Map -import Data.Semigroup.Reducer as Reducer -import Prelude hiding (lookup) -import Prologue hiding (Map, empty) - -newtype Map key value = Map { unMap :: Map.Map key value } - deriving (Eq, Eq1, Eq2, Foldable, Functor, Ord, Ord1, Ord2, Show, Show1, Show2, ToJSON, Traversable, NFData, Lower) - - -singleton :: key -> value -> Map key value -singleton k v = Map (Map.singleton k v) - -empty :: Map k a -empty = Map Map.empty - -lookup :: Ord key => key -> Map key value -> Maybe value -lookup key = Map.lookup key . unMap - -size :: Map key value -> Int -size = Map.size . unMap - -insert :: Ord key => key -> value -> Map key value -> Map key value -insert key value = Map . Map.insert key value . unMap - -delete :: Ord key => key -> Map key value -> Map key value -delete key = Map . Map.delete key . unMap - -filterWithKey :: (key -> value -> Bool) -> Map key value -> Map key value -filterWithKey f = Map . Map.filterWithKey f . unMap - -keys :: Map key value -> [key] -keys = map fst . pairs - -pairs :: Map key value -> [(key, value)] -pairs = Map.toList . unMap - -elems :: Map key value -> [value] -elems = Map.elems . unMap - - -instance (Ord key, Semigroup value) => Semigroup (Map key value) where - Map a <> Map b = Map (Map.unionWith (<>) a b) - -instance (Ord key, Semigroup value) => Monoid (Map key value) where - mempty = empty - -instance (Ord key, Reducer a value) => Reducer (key, a) (Map key value) where - unit (key, a) = Map (Map.singleton key (unit a)) - cons (key, a) (Map m) = Map (Map.insertWith (<>) key (unit a) m) - snoc (Map m) (key, a) = Map (Map.insertWith (flip (<>)) key (unit a) m) diff --git a/src/Data/Patch.hs b/src/Data/Patch.hs deleted file mode 100644 index 952de6abf9..0000000000 --- a/src/Data/Patch.hs +++ /dev/null @@ -1,76 +0,0 @@ -{-# OPTIONS_GHC -funbox-strict-fields #-} -module Data.Patch -( Patch(..) -, after -, before -, patch -) where - -import Prologue -import Data.Aeson -import Data.Align -import Data.JSON.Fields - --- | An operation to replace, insert, or delete an item. -data Patch a b - = Delete a - | Insert b - | Replace a b - deriving (Eq, Foldable, Functor, Generic, Generic1, Ord, Show, Traversable) - - --- | Return the item from the after side of the patch. -after :: Patch before after -> Maybe after -after = patch (const Nothing) Just (\ _ b -> Just b) - --- | Return the item from the before side of the patch. -before :: Patch before after -> Maybe before -before = patch Just (const Nothing) (\ a _ -> Just a) - --- | Return both sides of a patch. -patch :: (before -> result) -> (after -> result) -> (before -> after -> result) -> Patch before after -> result -patch ifDelete _ _ (Delete a) = ifDelete a -patch _ ifInsert _ (Insert b) = ifInsert b -patch _ _ ifReplace (Replace a b) = ifReplace a b - - --- Instances - -instance Bifunctor Patch where - bimap f _ (Delete a) = Delete (f a) - bimap _ g (Insert b) = Insert (g b) - bimap f g (Replace a b) = Replace (f a) (g b) - -instance Bifoldable Patch where - bifoldMap f _ (Delete a) = f a - bifoldMap _ g (Insert b) = g b - bifoldMap f g (Replace a b) = f a `mappend` g b - -instance Bitraversable Patch where - bitraverse f _ (Delete a) = Delete <$> f a - bitraverse _ g (Insert b) = Insert <$> g b - bitraverse f g (Replace a b) = Replace <$> f a <*> g b - -instance Bicrosswalk Patch where - bicrosswalk f _ (Delete a) = Delete <$> f a - bicrosswalk _ g (Insert b) = Insert <$> g b - bicrosswalk f g (Replace a b) = alignWith (these Delete Insert Replace) (f a) (g b) - -instance Eq2 Patch where - liftEq2 eqBefore eqAfter p1 p2 = case (p1, p2) of - (Delete a1, Delete a2) -> eqBefore a1 a2 - (Insert b1, Insert b2) -> eqAfter b1 b2 - (Replace a1 b1, Replace a2 b2) -> eqBefore a1 a2 && eqAfter b1 b2 - _ -> False - -instance Show2 Patch where - liftShowsPrec2 spBefore _ spAfter _ d p = case p of - Delete a -> showsUnaryWith spBefore "Delete" d a - Insert b -> showsUnaryWith spAfter "Insert" d b - Replace a b -> showsBinaryWith spBefore spAfter "Replace" d a b - - -instance (ToJSONFields a, ToJSONFields b) => ToJSONFields (Patch a b) where - toJSONFields (Insert a) = [ "insert" .= object (toJSONFields a) ] - toJSONFields (Delete a) = [ "delete" .= object (toJSONFields a) ] - toJSONFields (Replace a b) = [ "replace" .= [object (toJSONFields a), object (toJSONFields b)] ] diff --git a/src/Data/Project.hs b/src/Data/Project.hs deleted file mode 100644 index fefcf839d5..0000000000 --- a/src/Data/Project.hs +++ /dev/null @@ -1,71 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, KindSignatures, MultiWayIf #-} - -module Data.Project - ( Project (..) - , ProjectException (..) - , projectExtensions - , projectName - , projectFiles - , readFile - , readProjectFromPaths - ) where - -import Prelude hiding (readFile) -import Prologue - -import Control.Effect -import Control.Effect.Error -import Data.Blob -import Data.Blob.IO -import Data.Language -import qualified Data.Text as T -import System.FilePath.Posix -import Semantic.IO - --- | A 'Project' contains all the information that semantic needs --- to execute an analysis, diffing, or graphing pass. -data Project = Project - { projectRootDir :: FilePath - , projectBlobs :: [Blob] - , projectLanguage :: Language - , projectExcludeDirs :: [FilePath] - } deriving (Eq, Show, Generic) - -projectName :: Project -> Text -projectName = T.pack . dropExtensions . takeFileName . projectRootDir - -projectExtensions :: Project -> [String] -projectExtensions = extensionsForLanguage . projectLanguage - -projectFiles :: Project -> [File] -projectFiles = fmap blobFile . projectBlobs - -newtype ProjectException - = FileNotFound FilePath - deriving (Show, Eq, Typeable, Exception) - -readFile :: (Member (Error SomeException) sig, Carrier sig m) - => Project - -> File - -> m (Maybe Blob) -readFile Project{..} f = - let p = filePath f - candidate = find (\b -> blobPath b == p) projectBlobs - in if - | p == "/dev/null" -> pure Nothing - | isJust candidate -> pure candidate - | otherwise -> throwError (SomeException (FileNotFound p)) - -readProjectFromPaths :: MonadIO m => Maybe FilePath -> FilePath -> Language -> [FilePath] -> m Project -readProjectFromPaths maybeRoot path lang excludeDirs = do - isDir <- isDirectory path - let rootDir = if isDir - then fromMaybe path maybeRoot - else fromMaybe (takeDirectory path) maybeRoot - - paths <- liftIO $ findFilesInDir rootDir exts excludeDirs - blobs <- liftIO $ traverse (readBlobFromFile' . toFile) paths - pure $ Project rootDir blobs lang excludeDirs - where - toFile path = File path lang - exts = extensionsForLanguage lang diff --git a/src/Data/Quieterm.hs b/src/Data/Quieterm.hs deleted file mode 100644 index 496556696a..0000000000 --- a/src/Data/Quieterm.hs +++ /dev/null @@ -1,55 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, RankNTypes, TypeFamilies #-} -module Data.Quieterm -( Quieterm(..) -, quieterm -) where - -import Prelude hiding (span) - -import Control.Lens -import Control.DeepSeq -import Data.Abstract.Declarations (Declarations) -import Data.Abstract.FreeVariables (FreeVariables) -import Data.Functor.Classes -import Data.Functor.Foldable -import Data.Span -import Data.Term -import Text.Show (showListWith) - -newtype Quieterm syntax ann = Quieterm { unQuieterm :: TermF syntax ann (Quieterm syntax ann) } - deriving (Declarations, FreeVariables) - -type instance Base (Quieterm syntax ann) = TermF syntax ann -instance Functor syntax => Recursive (Quieterm syntax ann) where project = unQuieterm -instance Functor syntax => Corecursive (Quieterm syntax ann) where embed = Quieterm - -instance Eq1 syntax => Eq1 (Quieterm syntax) where - liftEq eqA = go where go t1 t2 = liftEq2 eqA go (unQuieterm t1) (unQuieterm t2) - -instance (Eq1 syntax, Eq ann) => Eq (Quieterm syntax ann) where - (==) = eq1 - -instance Ord1 syntax => Ord1 (Quieterm syntax) where - liftCompare comp = go where go t1 t2 = liftCompare2 comp go (unQuieterm t1) (unQuieterm t2) - -instance (Ord1 syntax, Ord ann) => Ord (Quieterm syntax ann) where - compare = compare1 - -instance Show1 syntax => Show1 (Quieterm syntax) where - liftShowsPrec _ _ = go where go d = liftShowsPrec go (showListWith (go 0)) d . termFOut . unQuieterm - -instance Show1 syntax => Show (Quieterm syntax ann) where - showsPrec = liftShowsPrec (const (const id)) (const id) - -instance NFData1 f => NFData1 (Quieterm f) where - liftRnf rnf = go where go x = liftRnf2 rnf go (unQuieterm x) - -instance (NFData1 f, NFData a) => NFData (Quieterm f a) where - rnf = liftRnf rnf - -instance HasSpan ann => HasSpan (Quieterm syntax ann) where - span = lens (view span . unQuieterm) (\(Quieterm i) s -> Quieterm (set span s i)) - {-# INLINE span #-} - -quieterm :: (Recursive term, Base term ~ TermF syntax ann) => term -> Quieterm syntax ann -quieterm = cata Quieterm diff --git a/src/Data/Range.hs b/src/Data/Range.hs deleted file mode 100644 index 3a62092453..0000000000 --- a/src/Data/Range.hs +++ /dev/null @@ -1,55 +0,0 @@ -{-# LANGUAGE DeriveAnyClass #-} -module Data.Range -( Range(..) -, emptyRange -, rangeLength -, offsetRange -, intersectsRange -, subtractRange -) where - -import Prologue - -import Data.Aeson -import Data.JSON.Fields - --- | A half-open interval of integers, defined by start & end indices. -data Range = Range { start :: {-# UNPACK #-} !Int, end :: {-# UNPACK #-} !Int } - deriving (Eq, Generic, NFData) - -emptyRange :: Range -emptyRange = Range 0 0 - --- | Return the length of the range. -rangeLength :: Range -> Int -rangeLength range = end range - start range - --- | Offset a range by a constant delta. -offsetRange :: Range -> Int -> Range -offsetRange a b = Range (start a + b) (end a + b) - --- | Test two ranges for intersection. -intersectsRange :: Range -> Range -> Bool -intersectsRange range1 range2 = start range1 < end range2 && start range2 < end range1 - -subtractRange :: Range -> Range -> Range -subtractRange range1 range2 = Range (start range1) (end range1 - rangeLength (Range (start range2) (max (end range1) (end range2)))) - - --- Instances - --- | The associativity of this instance is specced in @Data.Range.Spec@. -instance Semigroup Range where - Range start1 end1 <> Range start2 end2 = Range (min start1 start2) (max end1 end2) - -instance Ord Range where - a <= b = start a <= start b - -instance Show Range where - showsPrec _ Range{..} = showChar '[' . shows start . showString " .. " . shows end . showChar ']' - -instance ToJSONFields Range where - toJSONFields Range{..} = ["sourceRange" .= [ start, end ]] - -instance Lower Range where - lowerBound = Range 0 0 diff --git a/src/Data/Reprinting/Errors.hs b/src/Data/Reprinting/Errors.hs deleted file mode 100644 index 6f686710d0..0000000000 --- a/src/Data/Reprinting/Errors.hs +++ /dev/null @@ -1,13 +0,0 @@ -module Data.Reprinting.Errors ( TranslationError (..) ) where - -import Data.Reprinting.Token -import Data.Reprinting.Scope - --- | Represents failure occurring in a 'Concrete' machine during the translation --- phases of the reprinting pipeline. -data TranslationError - = UnbalancedPair Scope [Scope] - -- ^ Thrown if an unbalanced 'Enter'/'Exit' pair is encountered. - | NoTranslation Element [Scope] - -- ^ Thrown if no translation found for a given element. - deriving (Eq, Show) diff --git a/src/Data/Reprinting/Fragment.hs b/src/Data/Reprinting/Fragment.hs deleted file mode 100644 index c92a0c8334..0000000000 --- a/src/Data/Reprinting/Fragment.hs +++ /dev/null @@ -1,37 +0,0 @@ -{-# LANGUAGE RankNTypes #-} - -module Data.Reprinting.Fragment - ( Fragment(..) - , copy - , insert - , defer - ) where - -import Data.Machine -import Data.Text (Text) - -import Data.Reprinting.Scope -import Data.Reprinting.Token - --- | An intermediate representation of concrete syntax in the reprinting pipeline. -data Fragment - = Verbatim Text - -- ^ Verbatim copy of original 'Text' (un-refactored). - | New Element [Scope] Text - -- ^ New 'Text' to be inserted, along with original 'Element' and `Scope` - -- allowing later steps to re-write. - | Defer Element [Scope] - -- ^ To be handled further down the pipeline. - deriving (Eq, Show) - --- | Copy along some original, un-refactored 'Text'. -copy :: Text -> Plan k Fragment () -copy = yield . Verbatim - --- | Insert some new 'Text'. -insert :: Element -> [Scope] -> Text -> Plan k Fragment () -insert el c = yield . New el c - --- | Defer processing an element to a later stage. -defer :: Element -> [Scope] -> Plan k Fragment () -defer el = yield . Defer el diff --git a/src/Data/Reprinting/Operator.hs b/src/Data/Reprinting/Operator.hs deleted file mode 100644 index 78d160c93b..0000000000 --- a/src/Data/Reprinting/Operator.hs +++ /dev/null @@ -1,40 +0,0 @@ -module Data.Reprinting.Operator - ( Operator (..) - , Direction (..) - ) where - -data Direction - = Less - | Greater - deriving (Show, Eq) - --- | A sum type representing every concievable infix operator a --- language can define. These are handled by instances of 'Concrete' --- and given appropriate precedence. -data Operator - = Add - | Multiply - | Subtract - | Divide - | Modulus - | Raise - | FloorDivide - | RegexMatch - | RegexNotMatch - | LogicalOr - | LogicalAnd - | LogicalNot - | LogicalXor - | BinaryOr - | BinaryAnd - | BinaryXor - | BinaryComplement - | NumericNegate - | LeftShift - | RightShift - | Eql - | StrictEql - | Compare Direction - | CompareEql Direction - | Spaceship - deriving (Show, Eq) diff --git a/src/Data/Reprinting/Scope.hs b/src/Data/Reprinting/Scope.hs deleted file mode 100644 index e21b439a62..0000000000 --- a/src/Data/Reprinting/Scope.hs +++ /dev/null @@ -1,52 +0,0 @@ -module Data.Reprinting.Scope - ( Scope (..) - , precedenceOf - , imperativeDepth - ) where - -import Data.Reprinting.Operator - - --- | A 'Scope' represents a scope in which other tokens can be --- interpreted. For example, in the 'Imperative' context a 'Sep' --- could be a semicolon or newline, whereas in a 'List' context a --- 'Sep' is probably going to be a comma. --- TODO: look into sharing control-flow constructs with 'Flow' -data Scope - = List -- ^ List literals (usually comma-separated, in square brackets) - | Hash -- ^ Hashes (key-value pairs, in curly brackets) - | Pair -- ^ Colon-separated key-value pairs - | Slice -- ^ Range-selection context, as in Go or Python - | Method -- ^ Member-function declaration - | Atom -- ^ Quoted symbols, e.g. Ruby Symbol - | Function -- ^ Function declaration - | Namespace -- ^ Namespace/module context - | Call -- ^ Function call (usually comma-separated arguments) - | Params -- ^ Function parameters (ibid.) - | Return -- ^ Zero or more values - | Loop -- ^ @for@, @while@, @foreach@ loops - | If -- ^ Conditionals - | Case -- ^ @case@ or @switch@ context - | InfixL Operator Int -- ^ Left-associative operators, with context - | Prefix Operator -- ^ Prefix operators - | Indexing -- ^ Single-element array/list indexing - | Imperative -- ^ ALGOL-style top-to-bottom int - | Interpolation -- ^ String interpolation - | Catch -- ^ @try@ - | Finally -- ^ @except@ - | BeginBlock -- ^ Ruby-specific: @BEGIN@ - | EndBlock -- ^ Ruby-specific: @END@ - | Class -- ^ Class definition - deriving (Show, Eq) - -precedenceOf :: [Scope] -> Int -precedenceOf cs = case filter isInfix cs of - (InfixL _ n:_) -> n - _ -> 0 - where isInfix (InfixL _ _) = True - isInfix _ = False - - --- | Depth of imperative scope. -imperativeDepth :: [Scope] -> Int -imperativeDepth = length . filter (== Imperative) diff --git a/src/Data/Reprinting/Splice.hs b/src/Data/Reprinting/Splice.hs deleted file mode 100644 index 56230f14a5..0000000000 --- a/src/Data/Reprinting/Splice.hs +++ /dev/null @@ -1,66 +0,0 @@ -{-# LANGUAGE RankNTypes #-} - -module Data.Reprinting.Splice - ( Fragment(..) - , copy - , insert - , defer - , Splice(..) - , emit - , emitIf - , layout - , indent - , layouts - , space - , Whitespace(..) - , Indentation(..) - ) where - -import Prologue hiding (Element) - -import Data.Machine - -import Data.Reprinting.Fragment - --- | The final representation of concrete syntax in the reprinting pipeline. -data Splice - = Emit Text - | Layout Whitespace - deriving (Eq, Show) - --- | Emit some 'Text' as a 'Splice'. -emit :: Text -> Plan k Splice () -emit = yield . Emit - --- | Emit the provided 'Text' if the given predicate is true. -emitIf :: Bool -> Text -> Plan k Splice () -emitIf p = when p . emit - --- | Construct a layout 'Splice'. -layout :: Whitespace -> Plan k Splice () -layout = yield . Layout - --- | @indent w n@ emits @w@ 'Spaces' @n@ times. -indent :: Int -> Int -> Plan k Splice () -indent width times - | times > 0 = replicateM_ times (layout (Indent width Spaces)) - | otherwise = pure () - --- | Construct multiple layouts. -layouts :: [Whitespace] -> Plan k Splice () -layouts = traverse_ (yield . Layout) - --- | Single space. -space :: Plan k Splice () -space = yield (Layout Space) - --- | Indentation, spacing, and other whitespace. -data Whitespace - = HardWrap - | SoftWrap - | Space - | Indent Int Indentation - deriving (Eq, Show) - -data Indentation = Tabs | Spaces - deriving (Eq, Show) diff --git a/src/Data/Reprinting/Token.hs b/src/Data/Reprinting/Token.hs deleted file mode 100644 index a41fbc5fa6..0000000000 --- a/src/Data/Reprinting/Token.hs +++ /dev/null @@ -1,78 +0,0 @@ -module Data.Reprinting.Token - ( Token (..) - , isChunk - , isControl - , Element (..) - , Control (..) - , Flow (..) - ) where - -import Data.Text (Text) -import Data.Source (Source) -import Data.Reprinting.Scope - --- | 'Token' encapsulates 'Element' and 'Control' tokens, as well as sliced --- portions of the original 'Source' for a given AST. -data Token - = Chunk Source -- ^ Verbatim 'Source' from AST, unmodified. - | Element Element -- ^ Content token to be rendered. - | Control Control -- ^ AST's context. - deriving (Show, Eq) - -isChunk :: Token -> Bool -isChunk (Chunk _) = True -isChunk _ = False - -isControl :: Token -> Bool -isControl (Control _) = True -isControl _ = False - --- | 'Element' tokens describe atomic pieces of source code to be --- output to a rendered document. These tokens are language-agnostic --- and are interpreted into language-specific representations at a --- later point in the reprinting pipeline. -data Element - = Run Text -- ^ A literal chunk of text. - | Truth Bool -- ^ A boolean value. - | Glyph Text -- ^ A glyph like 'a' or #a. - | Nullity -- ^ @null@ or @nil@ or some other zero value. - | Sep -- ^ Some sort of delimiter, interpreted in some 'Context'. - | Sym -- ^ Some sort of symbol, interpreted in some 'Context'. - | Open -- ^ The beginning of some 'Context', such as an @[@ or @{@. - | Close -- ^ The opposite of 'Open'. - | Access -- ^ Member/method access - | Resolve -- ^ Namespace/package resolution - | Assign -- ^ Variable binding - | Self -- ^ @self@ or @this@ - | Superclass -- ^ @super@ - | Flow Flow -- ^ Control-flow token (@if@, @else@, @for@...) - | Extends -- ^ Subclassing indicator (syntax varies) - deriving (Eq, Show) - --- | Helper datum to corral control-flow entities like @while@, @for@, --- etc. Usually corresponds to a keyword in a given language. -data Flow - = Break - | Continue - | Else - | For - | Foreach - | In -- ^ Usually associated with 'Foreach' loops - | Rescue -- ^ AKA @catch@ in most languages - | Retry - | Switch -- ^ AKA @case@ - | Then -- ^ The true-branch of @if@-statements - | Try - | While - | Yield - deriving (Eq, Show) - --- | 'Control' tokens describe information about some AST's context. --- Though these are ultimately rendered as whitespace (or nothing) on --- the page, they are needed to provide information as to how deeply --- subsequent entries in the pipeline should indent. -data Control - = Enter Scope - | Exit Scope - | Log String - deriving (Eq, Show) diff --git a/src/Data/Scientific/Exts.hs b/src/Data/Scientific/Exts.hs deleted file mode 100644 index ee67e1b9ea..0000000000 --- a/src/Data/Scientific/Exts.hs +++ /dev/null @@ -1,73 +0,0 @@ -module Data.Scientific.Exts - ( module Data.Scientific - , attemptUnsafeArithmetic - , parseScientific - ) where - -import Control.Applicative -import Control.Exception as Exc (evaluate, try) -import Control.Monad hiding (fail) -import Data.Attoparsec.Text -import Data.Text hiding (takeWhile) -import Data.Char (isDigit) -import Data.Scientific -import Prelude hiding (fail, filter, null, takeWhile) -import Prologue hiding (null) -import System.IO.Unsafe -import Numeric.Exts - -parseScientific :: Text -> Either String Scientific -parseScientific = parseOnly parser - --- | This is a very flexible and forgiving parser for Scientific values. --- Unlike 'scientificP' or Scientific's 'Read' instance, this handles the myriad --- array of floating-point syntaxes across languages: --- * omitted whole parts, e.g. @.5@ --- * omitted decimal parts, e.g. @5.@ --- * numbers with trailing imaginary/length specifiers, @1.7j, 20L@ --- * numeric parts, in whole or decimal or exponent parts, with @_@ characters --- * hexadecimal, octal, and binary literals (TypeScript needs this because all numbers are floats) --- You may either omit the whole or the leading part, not both; this parser also rejects the empty string. --- It does /not/ handle hexadecimal floating-point numbers yet, as no language we parse supports them. --- This will need to be changed when we support Java. --- Please note there are extant parser bugs where complex literals (e.g. @123j@) are parsed --- as floating-point rather than complex quantities. This parser discards all suffixes. --- This parser is unit-tested in Data.Scientific.Spec. - -parser :: Parser Scientific -parser = signed (choice [hex, oct, bin, dec]) where - - -- Compared to the binary parser, this is positively breezy. - dec = do - let notUnder = filter (/= '_') - let decOrUnder c = isDigit c || (c == '_') - - -- Try getting the whole part of a floating literal. - leadings <- notUnder <$> takeWhile decOrUnder - - -- Try reading a dot. - void (optional (char '.')) - - -- The trailing part... - trailings <- notUnder <$> takeWhile decOrUnder - - -- ...and the exponent. - exponent <- notUnder <$> takeWhile (inClass "eE_0123456789+-") - - lengths - - -- Ensure we don't read an empty string, or one consisting only of a dot and/or an exponent. - when (null trailings && null leadings) (fail "Does not accept a single dot") - - -- Replace empty parts with a zero. - let leads = if null leadings then "0" else leadings - let trail = if null trailings then "0" else trailings - - attempt (unpack (leads <> "." <> trail <> exponent)) - --- | Attempt to evaluate the given term into WHNF. If doing so raises an 'ArithException', such as --- 'ZeroDivisionError' or 'RatioZeroDenominator', 'Left' will be returned. --- Hooray for uncatchable exceptions that bubble up from third-party code. -attemptUnsafeArithmetic :: a -> Either ArithException a -attemptUnsafeArithmetic = unsafePerformIO . Exc.try . evaluate -{-# NOINLINE attemptUnsafeArithmetic #-} diff --git a/src/Data/Source.hs b/src/Data/Source.hs deleted file mode 100644 index 81beb343da..0000000000 --- a/src/Data/Source.hs +++ /dev/null @@ -1,161 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -module Data.Source -( Source -, sourceBytes -, fromUTF8 --- Measurement -, sourceLength -, nullSource -, totalRange -, totalSpan --- En/decoding -, fromText -, toText --- Slicing -, slice -, dropSource --- Splitting -, sourceLines -, sourceLineRanges -, sourceLineRangesWithin --- Conversion -, spanToRange -, spanToRangeInLineRanges -, sourceLineRangesByLineNumber -, rangeToSpan -, newlineIndices -) where - -import Prologue - -import Data.Aeson (FromJSON (..), withText) -import Data.Array -import qualified Data.ByteString as B -import Data.Char (ord) -import Data.List (span) -import Data.Range -import Data.Span hiding (HasSpan (..)) -import Data.String (IsString (..)) -import qualified Data.Text as T -import qualified Data.Text.Encoding as T - - --- | The contents of a source file. This is represented as a UTF-8 --- 'ByteString' under the hood. Construct these with 'fromUTF8'; obviously, --- passing 'fromUTF8' non-UTF8 bytes will cause crashes. -newtype Source = Source { sourceBytes :: B.ByteString } - deriving (Eq, Semigroup, Monoid, IsString, Show, Generic) - -fromUTF8 :: B.ByteString -> Source -fromUTF8 = Source - -instance FromJSON Source where - parseJSON = withText "Source" (pure . fromText) - --- Measurement - -sourceLength :: Source -> Int -sourceLength = B.length . sourceBytes - -nullSource :: Source -> Bool -nullSource = B.null . sourceBytes - --- | Return a 'Range' that covers the entire text. -totalRange :: Source -> Range -totalRange = Range 0 . B.length . sourceBytes - --- | Return a 'Span' that covers the entire text. -totalSpan :: Source -> Span -totalSpan source = Span (Pos 1 1) (Pos (length ranges) (succ (end lastRange - start lastRange))) - where ranges = sourceLineRanges source - lastRange = fromMaybe emptyRange (getLast (foldMap (Last . Just) ranges)) - - --- En/decoding - --- | Return a 'Source' from a 'Text'. -fromText :: T.Text -> Source -fromText = Source . T.encodeUtf8 - --- | Return the Text contained in the 'Source'. -toText :: Source -> T.Text -toText = T.decodeUtf8 . sourceBytes - - --- | Return a 'Source' that contains a slice of the given 'Source'. -slice :: Range -> Source -> Source -slice range = take . drop - where drop = dropSource (start range) - take = takeSource (rangeLength range) - -dropSource :: Int -> Source -> Source -dropSource i = Source . drop . sourceBytes - where drop = B.drop i - -takeSource :: Int -> Source -> Source -takeSource i = Source . take . sourceBytes - where take = B.take i - - --- Splitting - --- | Split the contents of the source after newlines. -sourceLines :: Source -> [Source] -sourceLines source = (`slice` source) <$> sourceLineRanges source - --- | Compute the 'Range's of each line in a 'Source'. -sourceLineRanges :: Source -> [Range] -sourceLineRanges source = sourceLineRangesWithin (totalRange source) source - --- | Compute the 'Range's of each line in a 'Range' of a 'Source'. -sourceLineRangesWithin :: Range -> Source -> [Range] -sourceLineRangesWithin range = uncurry (zipWith Range) - . ((start range:) &&& (<> [ end range ])) - . fmap (+ succ (start range)) - . newlineIndices - . sourceBytes - . slice range - --- | Return all indices of newlines ('\n', '\r', and '\r\n') in the 'ByteString'. -newlineIndices :: B.ByteString -> [Int] -newlineIndices = go 0 - where go n bs | B.null bs = [] - | otherwise = case (searchCR bs, searchLF bs) of - (Nothing, Nothing) -> [] - (Just i, Nothing) -> recur n i bs - (Nothing, Just i) -> recur n i bs - (Just crI, Just lfI) - | succ crI == lfI -> recur n lfI bs - | otherwise -> recur n (min crI lfI) bs - recur n i bs = let j = n + i in j : go (succ j) (B.drop (succ i) bs) - searchLF = B.elemIndex (toEnum (ord '\n')) - searchCR = B.elemIndex (toEnum (ord '\r')) - -{-# INLINE newlineIndices #-} - - --- Conversion - --- | Compute the byte 'Range' corresponding to a given 'Span' in a 'Source'. -spanToRange :: Source -> Span -> Range -spanToRange = spanToRangeInLineRanges . sourceLineRangesByLineNumber - -spanToRangeInLineRanges :: Array Int Range -> Span -> Range -spanToRangeInLineRanges lineRanges Span{..} = Range - (start (lineRanges ! posLine spanStart) + pred (posColumn spanStart)) - (start (lineRanges ! posLine spanEnd) + pred (posColumn spanEnd)) - -sourceLineRangesByLineNumber :: Source -> Array Int Range -sourceLineRangesByLineNumber source = listArray (1, length lineRanges) lineRanges - where lineRanges = sourceLineRanges source - --- | Compute the 'Span' corresponding to a given byte 'Range' in a 'Source'. -rangeToSpan :: Source -> Range -> Span -rangeToSpan source (Range rangeStart rangeEnd) = Span startPos endPos - where startPos = Pos (firstLine + 1) (rangeStart - start firstRange + 1) - endPos = Pos (firstLine + length lineRanges) (rangeEnd - start lastRange + 1) - firstLine = length before - (before, rest) = span ((< rangeStart) . end) (sourceLineRanges source) - (lineRanges, _) = span ((<= rangeEnd) . start) rest - firstRange = fromMaybe emptyRange (getFirst (foldMap (First . Just) lineRanges)) - lastRange = fromMaybe firstRange (getLast (foldMap (Last . Just) lineRanges)) diff --git a/src/Data/Span.hs b/src/Data/Span.hs deleted file mode 100644 index 65a6e3fea0..0000000000 --- a/src/Data/Span.hs +++ /dev/null @@ -1,109 +0,0 @@ -{-# LANGUAGE DeriveAnyClass #-} -{-# OPTIONS_GHC -funbox-strict-fields #-} --- | Source position and span information --- --- Mostly taken from purescript's SourcePos definition. -module Data.Span -( Span(..) -, HasSpan(..) -, Pos(..) -, line -, column -, spanFromSrcLoc -, emptySpan -) where - -import Prelude hiding (span) -import Prologue - -import Control.Lens.Lens -import Data.Aeson ((.:), (.=)) -import qualified Data.Aeson as A -import Proto3.Suite - -import Data.JSON.Fields - --- | Source position information (1 indexed) -data Pos = Pos - { posLine :: !Int - , posColumn :: !Int - } deriving (Eq, Ord, Generic, Hashable, NFData) - -line, column :: Lens' Pos Int -line = lens posLine (\p l -> p { posLine = l }) -column = lens posColumn (\p l -> p { posColumn = l }) - --- | A Span of position information -data Span = Span - { spanStart :: Pos - , spanEnd :: Pos - } deriving (Eq, Ord, Generic, Hashable, Named, NFData) - --- | "Classy-fields" interface for data types that have spans. -class HasSpan a where - span :: Lens' a Span - - start :: Lens' a Pos - start = span.start - {-# INLINE start #-} - - end :: Lens' a Pos - end = span.end - {-# INLINE end #-} - -instance HasSpan Span where - span = id - {-# INLINE span #-} - - start = lens spanStart (\s t -> s { spanStart = t }) - {-# INLINE start #-} - - end = lens spanEnd (\s t -> s { spanEnd = t }) - {-# INLINE end #-} - --- Instances - -instance Show Pos where - showsPrec _ Pos{..} = showChar '[' . shows posLine . showString ", " . shows posColumn . showChar ']' - -instance A.ToJSON Pos where - toJSON Pos{..} = - A.toJSON [posLine, posColumn] - -instance A.FromJSON Pos where - parseJSON arr = do - [line, col] <- A.parseJSON arr - pure $ Pos line col - -instance Lower Pos where - lowerBound = Pos 1 1 - -instance Show Span where - showsPrec _ Span{..} = shows spanStart . showString ".." . shows spanEnd - -spanFromSrcLoc :: SrcLoc -> Span -spanFromSrcLoc = Span . (Pos . srcLocStartLine <*> srcLocStartCol) <*> (Pos . srcLocEndLine <*> srcLocEndCol) - -emptySpan :: Span -emptySpan = Span (Pos 1 1) (Pos 1 1) - -instance Semigroup Span where - Span start1 end1 <> Span start2 end2 = Span (min start1 start2) (max end1 end2) - -instance A.ToJSON Span where - toJSON Span{..} = - A.object [ "start" .= spanStart - , "end" .= spanEnd - ] - -instance A.FromJSON Span where - parseJSON = A.withObject "Span" $ \o -> - Span <$> - o .: "start" <*> - o .: "end" - -instance ToJSONFields Span where - toJSONFields sourceSpan = [ "sourceSpan" .= sourceSpan ] - -instance Lower Span where - lowerBound = emptySpan diff --git a/src/Data/Syntax.hs b/src/Data/Syntax.hs deleted file mode 100644 index 3aecf713aa..0000000000 --- a/src/Data/Syntax.hs +++ /dev/null @@ -1,245 +0,0 @@ -{-# LANGUAGE AllowAmbiguousTypes, DeriveAnyClass, DerivingVia, GADTs, TypeOperators, MultiParamTypeClasses, UndecidableInstances, ScopedTypeVariables, KindSignatures, RankNTypes, ConstraintKinds, GeneralizedNewtypeDeriving #-} -{-# OPTIONS_GHC -Wno-missing-export-lists -Wno-redundant-constraints #-} -- For HasCallStack -module Data.Syntax where - -import Data.Abstract.Evaluatable hiding (Empty, Error) -import Data.Aeson as Aeson (ToJSON(..), object) -import Data.JSON.Fields -import Data.Range -import Data.Location -import qualified Data.Set as Set -import Data.Sum -import Data.Term -import qualified Data.Reprinting.Token as Token -import GHC.Types (Constraint) -import GHC.TypeLits -import Diffing.Algorithm -import Prelude -import Prologue -import Reprinting.Tokenize hiding (Element) -import qualified Assigning.Assignment as Assignment -import qualified Data.Error as Error -import Control.Abstract.ScopeGraph (reference, Reference(..), Declaration(..)) -import Control.Abstract.Heap (deref, lookupSlot) -import qualified Data.Abstract.ScopeGraph as ScopeGraph - --- Combinators - --- | Lift syntax and an annotation into a term, injecting the syntax into a union & ensuring the annotation encompasses all children. -makeTerm :: (HasCallStack, Element syntax syntaxes, Semigroup ann, Apply Foldable syntaxes) => ann -> syntax (Term (Sum syntaxes) ann) -> Term (Sum syntaxes) ann -makeTerm ann = makeTerm' ann . inject - --- | Lift a union and an annotation into a term, ensuring the annotation encompasses all children. -makeTerm' :: (HasCallStack, Semigroup ann, Foldable syntax) => ann -> syntax (Term syntax ann) -> Term syntax ann -makeTerm' ann syntax = termIn (sconcat (ann :| (termAnnotation <$> toList syntax))) syntax - --- | Lift syntax and an annotation into a term, injecting the syntax into a union & ensuring the annotation encompasses all children. Removes extra structure if term is a list of a single item. -makeTerm'' :: (HasCallStack, Element syntax syntaxes, Semigroup ann, Apply Foldable syntaxes, Foldable syntax) => ann -> syntax (Term (Sum syntaxes) ann) -> Term (Sum syntaxes) ann -makeTerm'' ann children = case toList children of - [x] -> x - _ -> makeTerm' ann (inject children) - --- | Lift non-empty syntax into a term, injecting the syntax into a union & appending all subterms’.annotations to make the new term’s annotation. -makeTerm1 :: (HasCallStack, Element syntax syntaxes, Semigroup ann, Apply Foldable syntaxes) => syntax (Term (Sum syntaxes) ann) -> Term (Sum syntaxes) ann -makeTerm1 = makeTerm1' . inject - --- | Lift a non-empty union into a term, appending all subterms’ annotations to make the new term’s annotation. -makeTerm1' :: (HasCallStack, Semigroup ann, Foldable syntax) => syntax (Term syntax ann) -> Term syntax ann -makeTerm1' syntax = case toList syntax of - a : _ -> makeTerm' (termAnnotation a) syntax - _ -> error "makeTerm1': empty structure" - --- | Construct an empty term at the current position. -emptyTerm :: (HasCallStack, Empty :< syntaxes, Apply Foldable syntaxes) => Assignment.Assignment ast grammar (Term (Sum syntaxes) Location) -emptyTerm = makeTerm . startLocation <$> Assignment.location <*> pure Empty - where startLocation Location{..} = Location (Range (start locationByteRange) (start locationByteRange)) (Span (spanStart locationSpan) (spanStart locationSpan)) - --- | Catch assignment errors into an error term. -handleError :: (HasCallStack, Error :< syntaxes, Enum grammar, Eq1 ast, Ix grammar, Show grammar, Apply Foldable syntaxes) => Assignment.Assignment ast grammar (Term (Sum syntaxes) Location) -> Assignment.Assignment ast grammar (Term (Sum syntaxes) Location) -handleError = flip Assignment.catchError (\ err -> makeTerm <$> Assignment.location <*> pure (errorSyntax (either id show <$> err) []) <* Assignment.source) - --- | Catch parse errors into an error term. -parseError :: (HasCallStack, Error :< syntaxes, Bounded grammar, Enum grammar, Ix grammar, Apply Foldable syntaxes) => Assignment.Assignment ast grammar (Term (Sum syntaxes) Location) -parseError = makeTerm <$> Assignment.token maxBound <*> pure (Error (ErrorStack $ errorSite <$> getCallStack (freezeCallStack callStack)) [] (Just "ParseError") []) - --- | Match context terms before a subject term, wrapping both up in a Context term if any context terms matched, or otherwise returning the subject term. -contextualize :: (HasCallStack, Context :< syntaxes, Alternative m, Semigroup ann, Apply Foldable syntaxes) - => m (Term (Sum syntaxes) ann) - -> m (Term (Sum syntaxes) ann) - -> m (Term (Sum syntaxes) ann) -contextualize context rule = make <$> Assignment.manyThrough context rule - where make (cs, node) = case nonEmpty cs of - Just cs -> makeTerm1 (Context cs node) - _ -> node - --- | Match context terms after a subject term and before a delimiter, returning the delimiter paired with a Context term if any context terms matched, or the subject term otherwise. -postContextualizeThrough :: (HasCallStack, Context :< syntaxes, Alternative m, Semigroup ann, Apply Foldable syntaxes) - => m (Term (Sum syntaxes) ann) - -> m (Term (Sum syntaxes) ann) - -> m delimiter - -> m (Term (Sum syntaxes) ann, delimiter) -postContextualizeThrough context rule end = make <$> rule <*> Assignment.manyThrough context end - where make node (cs, end) = case nonEmpty cs of - Just cs -> (makeTerm1 (Context cs node), end) - _ -> (node, end) - --- | Match context terms after a subject term, wrapping both up in a Context term if any context terms matched, or otherwise returning the subject term. -postContextualize :: (HasCallStack, Context :< syntaxes, Alternative m, Semigroup ann, Apply Foldable syntaxes) - => m (Term (Sum syntaxes) ann) - -> m (Term (Sum syntaxes) ann) - -> m (Term (Sum syntaxes) ann) -postContextualize context rule = make <$> rule <*> many context - where make node cs = case nonEmpty cs of - Just cs -> makeTerm1 (Context cs node) - _ -> node - --- | Match infix terms separated by any of a list of operators, with optional context terms following each operand. -infixContext :: (Context :< syntaxes, Assignment.Parsing m, Semigroup ann, HasCallStack, Apply Foldable syntaxes) - => m (Term (Sum syntaxes) ann) - -> m (Term (Sum syntaxes) ann) - -> m (Term (Sum syntaxes) ann) - -> [m (Term (Sum syntaxes) ann -> Term (Sum syntaxes) ann -> Sum syntaxes (Term (Sum syntaxes) ann))] - -> m (Sum syntaxes (Term (Sum syntaxes) ann)) -infixContext context left right operators = uncurry (&) <$> postContextualizeThrough context left (asum operators) <*> postContextualize context right - -class Generate (c :: (* -> *) -> Constraint) (all :: [* -> *]) (fs :: [* -> *]) where - generate :: Monoid b => (forall f proxy. (Element f all, c f) => proxy f -> Integer -> b) -> b - -instance Generate c all '[] where - generate _ = mempty - -instance (Element f all, c f, Generate c all fs) => Generate c all (f ': fs) where - generate each = each (Proxy @f) (natVal (Proxy @(ElemIndex f all))) `mappend` generate @c @all @fs each - - --- Common - --- | An identifier of some other construct, whether a containing declaration (e.g. a class name) or a reference (e.g. a variable). -newtype Identifier a = Identifier { name :: Name } - deriving newtype (Eq, Ord, Show) - deriving stock (Foldable, Functor, Generic1, Traversable) - deriving anyclass (Diffable, Hashable1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Identifier - - -instance Evaluatable Identifier where - eval eval ref' term@(Identifier name) = do - -- TODO: Set the span up correctly in ref so we can move the `reference` call there. - span <- ask @Span - reference (Reference name) span ScopeGraph.Identifier (Declaration name) - deref =<< ref eval ref' term - - ref _ _ (Identifier name) = lookupSlot (Declaration name) - - -instance Tokenize Identifier where - tokenize = yield . Token.Run . formatName . Data.Syntax.name - -instance FreeVariables1 Identifier where - liftFreeVariables _ (Identifier x) = Set.singleton x - -instance Declarations1 Identifier where - liftDeclaredName _ (Identifier x) = pure x - liftDeclaredAlias _ (Identifier x) = pure x - --- | An accessibility modifier, e.g. private, public, protected, etc. -newtype AccessibilityModifier a = AccessibilityModifier { contents :: Text } - deriving newtype (Eq, Ord, Show) - deriving stock (Foldable, Functor, Generic1, Traversable) - deriving anyclass (Declarations1, Diffable, FreeVariables1, Hashable1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically AccessibilityModifier - --- TODO: Implement Eval instance for AccessibilityModifier -instance Evaluatable AccessibilityModifier - --- | Empty syntax, with essentially no-op semantics. --- --- This can be used to represent an implicit no-op, e.g. the alternative in an 'if' statement without an 'else'. -data Empty a = Empty - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Empty - -instance Evaluatable Empty where - eval _ _ _ = unit - -instance Tokenize Empty where - tokenize = ignore - --- | Syntax representing a parsing or assignment error. -data Error a = Error { errorCallStack :: ErrorStack, errorExpected :: [String], errorActual :: Maybe String, errorChildren :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Error - -instance Evaluatable Error - -instance Tokenize Error where - -- TODO: Considering producing comments like "ERROR: due to.." instead of ignoring. - tokenize = ignore - -errorSyntax :: Error.Error String -> [a] -> Error a -errorSyntax Error.Error{..} = Error (ErrorStack $ errorSite <$> getCallStack callStack) errorExpected errorActual - -unError :: Span -> Error a -> Error.Error String -unError span Error{..} = Error.Error span errorExpected errorActual stack - where stack = fromCallSiteList $ unErrorSite <$> unErrorStack errorCallStack - -data ErrorSite = ErrorSite { errorMessage :: String, errorLocation :: SrcLoc } - deriving (Eq, Show, Generic, NFData) - -errorSite :: (String, SrcLoc) -> ErrorSite -errorSite = uncurry ErrorSite - -unErrorSite :: ErrorSite -> (String, SrcLoc) -unErrorSite ErrorSite{..} = (errorMessage, errorLocation) - -newtype ErrorStack = ErrorStack { unErrorStack :: [ErrorSite] } - deriving stock (Eq, Show, Generic) - deriving anyclass (NFData) - -instance ToJSON ErrorStack where - toJSON (ErrorStack es) = toJSON (jSite <$> es) where - jSite (ErrorSite site SrcLoc{..}) = Aeson.object - [ "site" .= site - , "package" .= srcLocPackage - , "module" .= srcLocModule - , "file" .= srcLocFile - , "startLine" .= srcLocStartLine - , "startColumn" .= srcLocStartCol - , "endColumn" .= srcLocEndCol - ] - -instance Hashable ErrorStack where - hashWithSalt = hashUsing (map (second ((,,,,,,) <$> srcLocPackage <*> srcLocModule <*> srcLocFile <*> srcLocStartLine <*> srcLocStartCol <*> srcLocEndLine <*> srcLocEndCol) . unErrorSite) . unErrorStack) - -instance Ord ErrorStack where - compare = liftCompare (liftCompare compareSrcLoc) `on` (fmap unErrorSite . unErrorStack) - where compareSrcLoc s1 s2 = mconcat - [ (compare `on` srcLocPackage) s1 s2 - , (compare `on` srcLocModule) s1 s2 - , (compare `on` srcLocFile) s1 s2 - , (compare `on` srcLocStartLine) s1 s2 - , (compare `on` srcLocStartCol) s1 s2 - , (compare `on` srcLocEndLine) s1 s2 - , (compare `on` srcLocEndCol) s1 s2 - ] - - -data Context a = Context { contextTerms :: NonEmpty a, contextSubject :: a } - deriving (Eq, Foldable, FreeVariables1, Functor, Generic1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Context - -instance Diffable Context where - subalgorithmFor blur focus (Context n s) = Context <$> traverse blur n <*> focus s - - equivalentBySubterm = Just . contextSubject - -instance Hashable1 Context where liftHashWithSalt = foldl - -instance Evaluatable Context where - eval eval _ Context{..} = eval contextSubject - -instance Tokenize Context where - tokenize Context{..} = sequenceA_ (sepTrailing contextTerms) *> contextSubject - -instance Declarations1 Context where - liftDeclaredName declaredName = declaredName . contextSubject diff --git a/src/Data/Syntax/Comment.hs b/src/Data/Syntax/Comment.hs deleted file mode 100644 index f7f68307f8..0000000000 --- a/src/Data/Syntax/Comment.hs +++ /dev/null @@ -1,34 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, MultiParamTypeClasses #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Data.Syntax.Comment where - -import Prologue - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import Diffing.Algorithm -import Reprinting.Tokenize as Token - --- | An unnested comment (line or block). -newtype Comment a = Comment { commentContent :: Text } - deriving (Diffable, Eq, Foldable, Functor, Generic1, Hashable1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Comment - -instance Evaluatable Comment where - eval _ _ _ = unit - -instance Tokenize Comment where - tokenize = yield . Run . commentContent - --- TODO: nested comment types --- TODO: documentation comment types --- TODO: literate programming comment types? alternatively, consider those as markup --- TODO: Differentiate between line/block comments? - --- | HashBang line (e.g. `#!/usr/bin/env node`) -newtype HashBang a = HashBang { value :: Text } - deriving (Diffable, Eq, Foldable, Functor, Generic1, Hashable1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically HashBang - --- TODO: Implement Eval instance for HashBang -instance Evaluatable HashBang diff --git a/src/Data/Syntax/Declaration.hs b/src/Data/Syntax/Declaration.hs deleted file mode 100644 index ac6682fb9d..0000000000 --- a/src/Data/Syntax/Declaration.hs +++ /dev/null @@ -1,330 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, MultiParamTypeClasses, ScopedTypeVariables, TupleSections, UndecidableInstances #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Data.Syntax.Declaration where - -import Prelude hiding (span) -import Prologue - -import Control.Lens.Getter -import qualified Data.Map.Strict as Map -import qualified Data.Set as Set - -import Control.Abstract hiding (AccessControl (..), Function) -import Data.Abstract.Evaluatable -import Data.Abstract.Name (__self) -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.JSON.Fields -import qualified Data.Reprinting.Scope as Scope -import Data.Span -import Diffing.Algorithm -import Reprinting.Tokenize hiding (Superclass) - -data Function a = Function { functionContext :: ![a], functionName :: !a, functionParameters :: ![a], functionBody :: !a } - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Function - -instance Diffable Function where - equivalentBySubterm = Just . functionName - --- TODO: Filter the closed-over environment by the free variables in the term. --- TODO: How should we represent function types, where applicable? - -instance Evaluatable Function where - eval _ _ Function{..} = do - current <- ask @Span - (name, associatedScope) <- declareFunction (declaredName functionName) ScopeGraph.Public current ScopeGraph.Function - - params <- withScope associatedScope . for functionParameters $ \paramNode -> declareMaybeName (declaredName paramNode) Default ScopeGraph.Public (paramNode^.span) ScopeGraph.Parameter Nothing - - addr <- lookupSlot (Declaration name) - v <- function name params functionBody associatedScope - v <$ assign addr v - -declareFunction :: ( Carrier sig m - , Member (State (ScopeGraph address)) sig - , Member (Allocator address) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member Fresh sig - , Ord address - ) - => Maybe Name - -> ScopeGraph.AccessControl - -> Span - -> ScopeGraph.Kind - -> Evaluator term address value m (Name, address) -declareFunction name accessControl span kind = do - currentScope' <- currentScope - let lexicalEdges = Map.singleton Lexical [ currentScope' ] - associatedScope <- newScope lexicalEdges - name' <- declareMaybeName name Default accessControl span kind (Just associatedScope) - pure (name', associatedScope) - -instance Tokenize Function where - tokenize Function{..} = within' Scope.Function $ do - functionName - within' Scope.Params $ sequenceA_ (sep functionParameters) - functionBody - -instance Declarations1 Function where - liftDeclaredName declaredName = declaredName . functionName - -instance FreeVariables1 Function where - liftFreeVariables freeVariables f@Function{..} = foldMap freeVariables f `Set.difference` foldMap freeVariables functionParameters - -data Method a = Method - { methodContext :: [a] - , methodReceiver :: a - , methodName :: a - , methodParameters :: [a] - , methodBody :: a - , methodAccessControl :: ScopeGraph.AccessControl - } - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Method - -instance Diffable Method where - equivalentBySubterm = Just . methodName - --- Evaluating a Method creates a closure and makes that value available in the --- local environment. -instance Evaluatable Method where - eval _ _ Method{..} = do - current <- ask @Span - (name, associatedScope) <- declareFunction (declaredName methodName) methodAccessControl current ScopeGraph.Method - - params <- withScope associatedScope $ do - -- TODO: Should we give `self` a special Relation? - declare (Declaration __self) ScopeGraph.Prelude ScopeGraph.Public emptySpan ScopeGraph.Unknown Nothing - for methodParameters $ \paramNode -> declareMaybeName (declaredName paramNode) Default ScopeGraph.Public (paramNode^.span) ScopeGraph.Parameter Nothing - - addr <- lookupSlot (Declaration name) - v <- function name params methodBody associatedScope - v <$ assign addr v - -instance Tokenize Data.Syntax.Declaration.Method where - tokenize Method{..} = within' Scope.Method $ do - methodName - within' Scope.Params $ sequenceA_ (sep methodParameters) - methodBody - -instance Declarations1 Method where - liftDeclaredName declaredName = declaredName . methodName - -instance FreeVariables1 Method where - liftFreeVariables freeVariables m@Method{..} = foldMap freeVariables m `Set.difference` foldMap freeVariables methodParameters - - --- | A method signature in TypeScript or a method spec in Go. -data MethodSignature a = MethodSignature - { methodSignatureContext :: [a] - , methodSignatureName :: a - , methodSignatureParameters :: [a] - , methodSignatureAccessControl :: ScopeGraph.AccessControl - } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically MethodSignature - --- TODO: Implement Eval instance for MethodSignature -instance Evaluatable MethodSignature - - -newtype RequiredParameter a = RequiredParameter { requiredParameter :: a } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically RequiredParameter - -instance Declarations1 RequiredParameter where - liftDeclaredName declaredName = declaredName . requiredParameter - --- TODO: Implement Eval instance for RequiredParameter -instance Evaluatable RequiredParameter where - eval _ _ RequiredParameter{..} = do - span <- ask @Span - _ <- declareMaybeName (declaredName requiredParameter) Default ScopeGraph.Public span ScopeGraph.RequiredParameter Nothing - unit - - -newtype OptionalParameter a = OptionalParameter { optionalParameter :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically OptionalParameter - --- TODO: Implement Eval instance for OptionalParameter -instance Evaluatable OptionalParameter - - --- TODO: Should we replace this with Function and differentiate by context? --- TODO: How should we distinguish class/instance methods? --- TODO: It would be really nice to have a more meaningful type contained in here than [a] --- | A declaration of possibly many variables such as var foo = 5, bar = 6 in JavaScript. -newtype VariableDeclaration a = VariableDeclaration { variableDeclarations :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically VariableDeclaration - -instance Evaluatable VariableDeclaration where - eval _ _ (VariableDeclaration []) = unit - eval eval _ (VariableDeclaration decs) = do - for_ decs $ \declaration -> do - _ <- declareMaybeName (declaredName declaration) Default ScopeGraph.Public (declaration^.span) ScopeGraph.VariableDeclaration Nothing - eval declaration - unit - -instance Declarations a => Declarations (VariableDeclaration a) where - declaredName (VariableDeclaration vars) = case vars of - [var] -> declaredName var - _ -> Nothing - - --- | A TypeScript/Java style interface declaration to implement. - -data InterfaceDeclaration a = InterfaceDeclaration { interfaceDeclarationContext :: ![a], interfaceDeclarationIdentifier :: !a, interfaceDeclarationSuperInterfaces :: ![a], interfaceDeclarationBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically InterfaceDeclaration - --- TODO: Implement Eval instance for InterfaceDeclaration -instance Evaluatable InterfaceDeclaration - -instance Declarations a => Declarations (InterfaceDeclaration a) where - declaredName InterfaceDeclaration{..} = declaredName interfaceDeclarationIdentifier - - --- | A public field definition such as a field definition in a JavaScript class. -data PublicFieldDefinition a = PublicFieldDefinition - { publicFieldContext :: [a] - , publicFieldPropertyName :: a - , publicFieldValue :: a - , publicFieldAccessControl :: ScopeGraph.AccessControl - } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PublicFieldDefinition - --- TODO: Implement Eval instance for PublicFieldDefinition -instance Evaluatable PublicFieldDefinition where - eval eval _ PublicFieldDefinition{..} = do - span <- ask @Span - name <- declareMaybeName (declaredName publicFieldPropertyName) Instance publicFieldAccessControl span ScopeGraph.PublicField Nothing - slot <- lookupSlot (Declaration name) - value <- eval publicFieldValue - assign slot value - unit - -data Variable a = Variable { variableName :: !a, variableType :: !a, variableValue :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Variable - --- TODO: Implement Eval instance for Variable -instance Evaluatable Variable - -data Class a = Class { classContext :: ![a], classIdentifier :: !a, classSuperclasses :: ![a], classBody :: !a } - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, FreeVariables1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Class - -instance Declarations a => Declarations (Class a) where - declaredName (Class _ name _ _) = declaredName name - -instance Diffable Class where - equivalentBySubterm = Just . classIdentifier - -instance Evaluatable Class where - eval eval _ Class{..} = do - span <- ask @Span - currentScope' <- currentScope - - superScopes <- for classSuperclasses $ \superclass -> do - name <- case declaredName superclass of - Just name -> pure name - Nothing -> gensym - scope <- associatedScope (Declaration name) - slot <- lookupSlot (Declaration name) - superclassFrame <- scopedEnvironment =<< deref slot - pure $ case (scope, superclassFrame) of - (Just scope, Just frame) -> Just (scope, frame) - _ -> Nothing - - let superclassEdges = (Superclass, ) . pure . fst <$> catMaybes superScopes - current = (Lexical, ) <$> pure (pure currentScope') - edges = Map.fromList (superclassEdges <> current) - classScope <- newScope edges - name <- declareMaybeName (declaredName classIdentifier) Default ScopeGraph.Public span ScopeGraph.Class (Just classScope) - - let frameEdges = Map.singleton Superclass (Map.fromList (catMaybes superScopes)) - classFrame <- newFrame classScope frameEdges - - classSlot <- lookupSlot (Declaration name) - assign classSlot =<< klass (Declaration name) classFrame - - withScopeAndFrame classFrame $ do - void $ eval classBody - - unit - -instance Declarations1 Class where - liftDeclaredName declaredName = declaredName . classIdentifier - --- | A decorator in Python -data Decorator a = Decorator { decoratorIdentifier :: !a, decoratorParamaters :: ![a], decoratorBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Decorator - --- TODO: Implement Eval instance for Decorator -instance Evaluatable Decorator - --- TODO: Generics, constraints. - - --- | An ADT, i.e. a disjoint sum of products, like 'data' in Haskell, or 'enum' in Rust or Swift. -data Datatype a = Datatype { datatypeContext :: a, datatypeName :: a, datatypeConstructors :: [a], datatypeDeriving :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Datatype - --- TODO: Implement Eval instance for Datatype -instance Evaluatable Data.Syntax.Declaration.Datatype - - --- | A single constructor in a datatype, or equally a 'struct' in C, Rust, or Swift. -data Constructor a = Constructor { constructorContext :: [a], constructorName :: a, constructorFields :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Constructor - --- TODO: Implement Eval instance for Constructor -instance Evaluatable Data.Syntax.Declaration.Constructor - - --- | Comprehension (e.g. ((a for b in c if a()) in Python) -data Comprehension a = Comprehension { comprehensionValue :: !a, comprehensionBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Comprehension - --- TODO: Implement Eval instance for Comprehension -instance Evaluatable Comprehension - - --- | A declared type (e.g. `a []int` in Go). -data Type a = Type { typeName :: !a, typeKind :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Type - --- TODO: Implement Eval instance for Type -instance Evaluatable Type - - --- | Type alias declarations in Javascript/Haskell, etc. -data TypeAlias a = TypeAlias { typeAliasContext :: ![a], typeAliasIdentifier :: !a, typeAliasKind :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeAlias - -instance Evaluatable TypeAlias where - eval _ _ TypeAlias{..} = do - -- This use of `throwNoNameError` is good -- we aren't declaring something new so `declareMaybeName` is not useful here. - kindName <- maybeM (throwNoNameError typeAliasKind) (declaredName typeAliasKind) - span <- ask @Span - assocScope <- associatedScope (Declaration kindName) - name <- declareMaybeName (declaredName typeAliasIdentifier) Default ScopeGraph.Public span ScopeGraph.TypeAlias assocScope - - slot <- lookupSlot (Declaration name) - kindSlot <- lookupSlot (Declaration kindName) - assign slot =<< deref kindSlot - - unit - -instance Declarations a => Declarations (TypeAlias a) where - declaredName TypeAlias{..} = declaredName typeAliasIdentifier diff --git a/src/Data/Syntax/Directive.hs b/src/Data/Syntax/Directive.hs deleted file mode 100644 index 11378d2207..0000000000 --- a/src/Data/Syntax/Directive.hs +++ /dev/null @@ -1,38 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, MultiParamTypeClasses, ScopedTypeVariables, UndecidableInstances #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Data.Syntax.Directive where - -import Prologue - -import Data.Abstract.Evaluatable -import Data.Abstract.Module (ModuleInfo (..)) -import Data.JSON.Fields -import Data.Span -import qualified Data.Text as T -import Diffing.Algorithm -import Reprinting.Tokenize - --- A file directive like the Ruby constant `__FILE__`. -data File a = File - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically File - -instance Evaluatable File where - eval _ _ File = currentModule >>= string . T.pack . modulePath - --- We may need a separate token class for these given additional languages -instance Tokenize File where - tokenize _ = yield . Run $ "__FILE__" - - --- A line directive like the Ruby constant `__LINE__`. -data Line a = Line - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Line - -instance Evaluatable Line where - eval _ _ Line = currentSpan >>= integer . fromIntegral . posLine . spanStart - --- PT TODO: proper token for this -instance Tokenize Line where - tokenize _ = yield . Run $ "__FILE__" diff --git a/src/Data/Syntax/Expression.hs b/src/Data/Syntax/Expression.hs deleted file mode 100644 index 9079ea9ca5..0000000000 --- a/src/Data/Syntax/Expression.hs +++ /dev/null @@ -1,604 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields, MultiParamTypeClasses, ScopedTypeVariables, UndecidableInstances #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Data.Syntax.Expression where - -import Prelude hiding (null) -import Prologue hiding (This, index, null) - -import Control.Abstract hiding (Bitwise (..), Call, Member) -import Data.Abstract.Evaluatable as Abstract hiding (Member) -import Data.Abstract.Name as Name -import Data.Abstract.Number (liftIntegralFrac, liftReal, liftedExponent, liftedFloorDiv) -import Data.Fixed -import Data.JSON.Fields -import Data.List (intersperse) -import qualified Data.List.NonEmpty as NonEmpty -import qualified Data.Map.Strict as Map -import qualified Data.Reprinting.Scope as Scope -import qualified Data.Reprinting.Token as Token -import Diffing.Algorithm hiding (Delete) -import Reprinting.Tokenize hiding (Superclass) -import qualified Data.Abstract.ScopeGraph as ScopeGraph - --- | Typical prefix function application, like `f(x)` in many languages, or `f x` in Haskell. -data Call a = Call { callContext :: ![a], callFunction :: !a, callParams :: ![a], callBlock :: !a } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Call - -instance Declarations1 Call where - liftDeclaredName declaredName Call{..} = declaredName callFunction - -instance Evaluatable Call where - eval eval _ Call{..} = do - op <- eval callFunction - args <- traverse eval callParams - call op args - -instance Tokenize Call where - tokenize Call{..} = within Scope.Call $ do - -- TODO: callContext - callFunction - within' Scope.Params $ sequenceA_ (sep callParams) - callBlock - -data LessThan a = LessThan { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LessThan - -instance Evaluatable LessThan where - eval eval _ t = traverse eval t >>= go where - go (LessThan a b) = liftComparison (Concrete (<)) a b - -instance Tokenize LessThan where - tokenize LessThan{..} = within' (Scope.InfixL (Compare Less) 4) $ lhs *> yield Token.Sym <* rhs - -data LessThanEqual a = LessThanEqual { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LessThanEqual - -instance Evaluatable LessThanEqual where - eval eval _ t = traverse eval t >>= go where - go (LessThanEqual a b) = liftComparison (Concrete (<=)) a b - -instance Tokenize LessThanEqual where - tokenize LessThanEqual{..} = within' (Scope.InfixL (CompareEql Less) 4) $ lhs *> yield Token.Sym <* rhs - -data GreaterThan a = GreaterThan { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically GreaterThan - -instance Evaluatable GreaterThan where - eval eval _ t = traverse eval t >>= go where - go (GreaterThan a b) = liftComparison (Concrete (>)) a b - -instance Tokenize GreaterThan where - tokenize GreaterThan{..} = within' (Scope.InfixL (Compare Greater) 4) $ lhs *> yield Token.Sym <* rhs - -data GreaterThanEqual a = GreaterThanEqual { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically GreaterThanEqual - -instance Evaluatable GreaterThanEqual where - eval eval _ t = traverse eval t >>= go where - go (GreaterThanEqual a b) = liftComparison (Concrete (>=)) a b - -instance Tokenize GreaterThanEqual where - tokenize GreaterThanEqual{..} = within' (Scope.InfixL (CompareEql Greater) 4) $ lhs *> yield Token.Sym <* rhs - -data Equal a = Equal { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Equal - -instance Evaluatable Equal where - eval eval _ t = traverse eval t >>= go where - -- TODO: in PHP and JavaScript, the equals operator performs type coercion. - -- We need some mechanism to customize this behavior per-language. - go (Equal a b) = liftComparison (Concrete (==)) a b - -instance Tokenize Equal where - tokenize Equal{..} = within' (Scope.InfixL Eql 4) $ lhs *> yield Token.Sym <* rhs - -data StrictEqual a = StrictEqual { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically StrictEqual - -instance Evaluatable StrictEqual where - eval eval _ t = traverse eval t >>= go where - -- TODO: in PHP and JavaScript, the equals operator performs type coercion. - -- We need some mechanism to customize this behavior per-language. - go (StrictEqual a b) = liftComparison (Concrete (==)) a b - -instance Tokenize StrictEqual where - tokenize StrictEqual{..} = within' (Scope.InfixL StrictEql 4) $ lhs *> yield Token.Sym <* rhs - -data Comparison a = Comparison { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Comparison - -instance Evaluatable Comparison where - eval eval _ t = traverse eval t >>= go where - go (Comparison a b) = liftComparison (Concrete (==)) a b - -instance Tokenize Comparison where - tokenize Comparison{..} = within' (Scope.InfixL Spaceship 4) $ lhs *> yield Token.Sym <* rhs - -data Plus a = Plus { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Plus - -instance Evaluatable Plus where - eval eval _ t = traverse eval t >>= go where - go (Plus a b) = liftNumeric2 add a b where add = liftReal (+) - -instance Tokenize Plus where - tokenize Plus{..} = within' (Scope.InfixL Add 6) $ lhs *> yield Token.Sym <* rhs - -data Minus a = Minus { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Minus - -instance Evaluatable Minus where - eval eval _ t = traverse eval t >>= go where - go (Minus a b) = liftNumeric2 (liftReal (-)) a b - -instance Tokenize Minus where - tokenize Minus{..} = within' (Scope.InfixL Subtract 6) $ lhs *> yield Token.Sym <* rhs - -data Times a = Times { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Times - -instance Evaluatable Times where - eval eval _ t = traverse eval t >>= go where - go (Times a b) = liftNumeric2 (liftReal (*)) a b - -instance Tokenize Times where - tokenize Times{..} = within' (Scope.InfixL Multiply 7) $ lhs *> yield Token.Sym <* rhs - -data DividedBy a = DividedBy { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically DividedBy - -instance Evaluatable DividedBy where - eval eval _ t = traverse eval t >>= go where - go (DividedBy a b) = liftNumeric2 (liftIntegralFrac div (/)) a b - -instance Tokenize DividedBy where - tokenize DividedBy{..} = within' (Scope.InfixL Divide 7) $ lhs *> yield Token.Sym <* rhs - -data Modulo a = Modulo { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Modulo - -instance Evaluatable Modulo where - eval evalΒ _ t = traverse eval t >>= go where - go (Modulo a b) = liftNumeric2 (liftIntegralFrac mod mod') a b - -instance Tokenize Modulo where - tokenize Modulo{..} = within' (Scope.InfixL Modulus 7) $ lhs *> yield Token.Sym <* rhs - -data Power a = Power { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Power - -instance Evaluatable Power where - eval eval _ t = traverse eval t >>= go where - go (Power a b) = liftNumeric2 liftedExponent a b - -instance Tokenize Power where - tokenize Power{..} = within' (Scope.InfixL Raise 9) $ lhs *> yield Token.Sym <* rhs - -newtype Negate a = Negate { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Negate - -instance Evaluatable Negate where - eval eval _ t = traverse eval t >>= go where - go (Negate a) = liftNumeric negate a - -instance Tokenize Negate where - tokenize Negate{..} = within' (Scope.Prefix NumericNegate) $ yield Token.Sym <* value - -data FloorDivision a = FloorDivision { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically FloorDivision - -instance Evaluatable FloorDivision where - eval eval _ t = traverse eval t >>= go where - go (FloorDivision a b) = liftNumeric2 liftedFloorDiv a b - -instance Tokenize FloorDivision where - tokenize FloorDivision{..} = within' (Scope.InfixL FloorDivide 7) $ lhs *> yield Token.Sym <* rhs - --- | Regex matching operators (Ruby's =~ and ~!) -data Matches a = Matches { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Matches - -instance Evaluatable Matches - -instance Tokenize Matches where - tokenize Matches{..} = within' (Scope.InfixL RegexMatch 1) $ lhs *> yield Token.Sym <* rhs - -data NotMatches a = NotMatches { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NotMatches - -instance Evaluatable NotMatches - -instance Tokenize NotMatches where - tokenize NotMatches{..} = within' (Scope.InfixL RegexNotMatch 1) $ lhs *> yield Token.Sym <* rhs - -data Or a = Or { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Or - -instance Evaluatable Or where - eval eval _ (Or a b) = do - a' <- eval a - ifthenelse a' (pure a') (eval b) - -instance Tokenize Or where - tokenize Or{..} = within' (Scope.InfixL LogicalOr 2) $ lhs *> yield Token.Sym <* rhs - -data And a = And { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically And - -instance Evaluatable And where - eval eval _ (And a b) = do - a' <- eval a - ifthenelse a' (eval b) (pure a') - -instance Tokenize And where - tokenize And{..} = within' (Scope.InfixL LogicalAnd 2) $ lhs *> yield Token.Sym <* rhs - -newtype Not a = Not { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Not - -instance Evaluatable Not where - eval eval _ (Not a) = eval a >>= asBool >>= boolean . not - -instance Tokenize Not where - tokenize Not{..} = within' (Scope.Prefix LogicalNot) $ yield Token.Sym <* value - -data XOr a = XOr { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically XOr - -instance Evaluatable XOr where - -- N.B. we have to use Monad rather than Applicative/Traversable on 'And' and 'Or' so that we don't evaluate both operands - eval eval _ (XOr a b) = liftA2 (/=) (eval a >>= asBool) (eval b >>= asBool) >>= boolean - -instance Tokenize XOr where - tokenize XOr{..} = within' (Scope.InfixL LogicalXor 2) $ lhs *> yield Token.Sym <* rhs - --- | Javascript delete operator -newtype Delete a = Delete { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Delete - -instance Evaluatable Delete where - eval _ ref (Delete a) = ref a >>= dealloc >> unit - --- | A sequence expression such as Javascript or C's comma operator. -data SequenceExpression a = SequenceExpression { firstExpression :: !a, secondExpression :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically SequenceExpression - -instance Evaluatable SequenceExpression where - eval eval _ (SequenceExpression a b) = - eval a >> eval b - --- | Javascript void operator -newtype Void a = Void { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Void - -instance Evaluatable Void where - eval eval _ (Void a) = - eval a >> pure null - --- | Javascript typeof operator -newtype Typeof a = Typeof { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Typeof - --- TODO: Implement Eval instance for Typeof -instance Evaluatable Typeof - --- | Bitwise operators. -data BOr a = BOr { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically BOr - -instance Evaluatable BOr where - eval eval _ (BOr a b) = do - a' <- eval a >>= castToInteger - b' <- eval b >>= castToInteger - liftBitwise2 (.|.) a' b' - -instance Tokenize BOr where - tokenize BOr{..} = within' (Scope.InfixL BinaryOr 4) $ lhs *> yield Token.Sym <* rhs - -data BAnd a = BAnd { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically BAnd - -instance Evaluatable BAnd where - eval eval _ (BAnd a b) = do - a' <- eval a >>= castToInteger - b' <- eval b >>= castToInteger - liftBitwise2 (.&.) a' b' - -instance Tokenize BAnd where - tokenize BAnd{..} = within' (Scope.InfixL BinaryAnd 5) $ lhs *> yield Token.Sym <* rhs - -data BXOr a = BXOr { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically BXOr - -instance Evaluatable BXOr where - eval eval _ (BXOr a b) = do - a' <- eval a >>= castToInteger - b' <- eval b >>= castToInteger - liftBitwise2 xor a' b' - -instance Tokenize BXOr where - tokenize BXOr{..} = within' (Scope.InfixL BinaryXor 5) $ lhs *> yield Token.Sym <* rhs - -data LShift a = LShift { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LShift - -instance Evaluatable LShift where - eval eval _ (LShift a b) = do - a' <- eval a >>= castToInteger - b' <- eval b >>= castToInteger - liftBitwise2 shiftL' a' b' - where - shiftL' a b = shiftL a (fromIntegral (toInteger b)) - -instance Tokenize LShift where - tokenize LShift{..} = within' (Scope.InfixL LeftShift 4) $ lhs *> yield Token.Sym <* rhs - -data RShift a = RShift { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically RShift - -instance Evaluatable RShift where - eval eval _ (RShift a b) = do - a' <- eval a >>= castToInteger - b' <- eval b >>= castToInteger - liftBitwise2 shiftR' a' b' - where - shiftR' a b = shiftR a (fromIntegral (toInteger b)) - -instance Tokenize RShift where - tokenize RShift{..} = within' (Scope.InfixL RightShift 4) $ lhs *> yield Token.Sym <* rhs - -data UnsignedRShift a = UnsignedRShift { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically UnsignedRShift - -instance Evaluatable UnsignedRShift where - eval eval _ (UnsignedRShift a b) = do - a' <- eval a >>= castToInteger - b' <- eval b >>= castToInteger - unsignedRShift a' b' - -newtype Complement a = Complement { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Complement - -instance Evaluatable Complement where - eval eval _ (Complement a) = do - a' <- eval a >>= castToInteger - liftBitwise complement a' - -instance Tokenize Complement where - tokenize Complement{..} = within' (Scope.Prefix BinaryComplement) $ yield Token.Sym <* value - --- | Member Access (e.g. a.b) -data MemberAccess a = MemberAccess { lhs :: a, rhs :: a } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically MemberAccess - -instance Declarations1 MemberAccess where - liftDeclaredName declaredName MemberAccess{..} = declaredName rhs - -instance Evaluatable MemberAccess where - eval eval ref MemberAccess{..} = do - lhsValue <- eval lhs - lhsFrame <- Abstract.scopedEnvironment lhsValue - - rhsSlot <- case lhsFrame of - Just lhsFrame -> - -- FIXME: The span is not set up correctly when calling `ref` so we have to eval - -- it first - withScopeAndFrame lhsFrame (eval rhs >> ref rhs) - -- Throw a ReferenceError since we're attempting to reference a name within a value that is not an Object. - Nothing -> throwEvalError (ReferenceError lhsValue rhs) - - rhsValue <- deref rhsSlot - rhsScope <- scopeLookup (frameAddress rhsSlot) - - let lhsAccessControl = fromMaybe Public (termToAccessControl lhs) - infos <- declarationsByAccessControl rhsScope lhsAccessControl - - -- This means we always throw an 'AccessControlError' whenever we have a rhs term whose 'declaredName' is 'Nothing'. - rhsName <- maybeM (throwNoNameError rhs) (declaredName rhs) - rhsValue' <- case find (\Info{..} -> Declaration rhsName == infoDeclaration) infos of - Just _ -> pure rhsValue - Nothing -> do - let lhsName = fromMaybe (name "") (declaredName lhs) - info <- declarationByName rhsScope (Declaration rhsName) - throwEvalError $ AccessControlError (lhsName, lhsAccessControl) (rhsName, infoAccessControl info) rhsValue - - bindThis lhsValue rhsValue' - - - ref eval ref' MemberAccess{..} = do - lhsValue <- eval lhs - lhsFrame <- Abstract.scopedEnvironment lhsValue - case lhsFrame of - Just lhsFrame -> withScopeAndFrame lhsFrame (ref' rhs) - -- Throw a ReferenceError since we're attempting to reference a name within a value that is not an Object. - Nothing -> throwEvalError (ReferenceError lhsValue rhs) - - -instance Tokenize MemberAccess where - tokenize MemberAccess{..} = lhs *> yield Access <* rhs - --- | Subscript (e.g a[1]) -data Subscript a = Subscript { lhs :: a, rhs :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Subscript - --- TODO: Finish Eval instance for Subscript --- TODO return a special LvalSubscript instance here -instance Evaluatable Subscript where - eval eval _ (Subscript l [r]) = join (index <$> eval l <*> eval r) - eval _ _ (Subscript _ _) = throwUnspecializedError (UnspecializedError "Eval unspecialized for subscript with slices") - -instance Tokenize Subscript where - tokenize Subscript{..} = lhs *> within' Scope.Indexing (sequenceA_ (intersperse (yield Token.Sep) rhs)) - -data Member a = Member { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Member - -instance Evaluatable Member where - -instance Tokenize Member where - tokenize Member{..} = lhs *> yield Token.Access <* rhs - --- | Enumeration (e.g. a[1:10:1] in Python (start at index 1, stop at index 10, step 1 element from start to stop)) -data Enumeration a = Enumeration { enumerationStart :: !a, enumerationEnd :: !a, enumerationStep :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Enumeration - --- TODO: Implement Eval instance for Enumeration -instance Evaluatable Enumeration - -instance Tokenize Enumeration where - tokenize Enumeration{..} = within Scope.Slice $ enumerationStart *> enumerationEnd *> enumerationStep - --- | InstanceOf (e.g. a instanceof b in JavaScript -data InstanceOf a = InstanceOf { instanceOfSubject :: !a, instanceOfObject :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically InstanceOf - --- TODO: Implement Eval instance for InstanceOf -instance Evaluatable InstanceOf - - --- | ScopeResolution (e.g. import a.b in Python or a::b in C++) -newtype ScopeResolution a = ScopeResolution { scopes :: NonEmpty a } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ScopeResolution - -instance Hashable1 ScopeResolution where liftHashWithSalt = foldl - -instance Evaluatable ScopeResolution - -instance Tokenize ScopeResolution where - tokenize (ScopeResolution (a :| rest)) = - a *> for_ rest (yield Token.Resolve *>) - -instance Declarations1 ScopeResolution where - liftDeclaredName declaredName = declaredName . NonEmpty.last . scopes - --- | A non-null expression such as Typescript or Swift's ! expression. -newtype NonNullExpression a = NonNullExpression { nonNullExpression :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NonNullExpression - --- TODO: Implement Eval instance for NonNullExpression -instance Evaluatable NonNullExpression - - --- | An await expression in Javascript or C#. -newtype Await a = Await { awaitSubject :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Await --- TODO: Improve this to model asynchrony or capture some data suggesting async calls are not a problem. --- We are currently dealing with an asynchronous construct synchronously. -instance Evaluatable Await where - eval evalΒ _ (Await a) = eval a - --- | An object constructor call in Javascript, Java, etc. -data New a = New { newSubject :: a , newTypeParameters :: a, newArguments :: [a] } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically New - -instance Declarations1 New where - liftDeclaredName declaredName New{..} = declaredName newSubject - --- TODO: Implement Eval instance for New -instance Evaluatable New where - eval eval _ New{..} = do - name <- maybeM (throwNoNameError newSubject) (declaredName newSubject) - assocScope <- maybeM (throwEvalError $ ConstructorError name) =<< associatedScope (Declaration name) - objectScope <- newScope (Map.singleton Superclass [ assocScope ]) - slot <- lookupSlot (Declaration name) - classVal <- deref slot - classFrame <- maybeM (throwEvalError $ ScopedEnvError classVal) =<< scopedEnvironment classVal - - objectFrame <- newFrame objectScope (Map.singleton Superclass $ Map.singleton assocScope classFrame) - objectVal <- object objectFrame - - classScope <- scopeLookup classFrame - instanceMembers <- declarationsByRelation classScope Instance - - void . withScopeAndFrame objectFrame $ do - for_ instanceMembers $ \Info{..} -> do - declare infoDeclaration Default infoAccessControl infoSpan infoKind infoAssociatedScope - - -- TODO: This is a typescript specific name and we should allow languages to customize it. - let constructorName = Name.name "constructor" - maybeConstructor <- maybeLookupDeclaration (Declaration constructorName) - case maybeConstructor of - Just slot -> do - span <- ask @Span - reference (Reference constructorName) span ScopeGraph.New (Declaration constructorName) - constructor <- deref slot - args <- traverse eval newArguments - boundConstructor <- bindThis objectVal constructor - call boundConstructor args - Nothing -> pure objectVal - - pure objectVal - --- | A cast expression to a specified type. -data Cast a = Cast { castSubject :: !a, castType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Cast - -instance Evaluatable Cast - -data Super a = Super - deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Super - -instance Evaluatable Super - -instance Tokenize Super where - tokenize _ = yield Token.Superclass - -data This a = This - deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically This - -instance Tokenize This where - tokenize _ = yield Self - -instance Evaluatable This where - eval _ _ This = do - span <- ask @Span - reference (Reference __self) span ScopeGraph.This (Declaration __self) - deref =<< lookupSlot (Declaration __self) - -instance AccessControls1 This where - liftTermToAccessControl _ _ = Just Private diff --git a/src/Data/Syntax/Literal.hs b/src/Data/Syntax/Literal.hs deleted file mode 100644 index 8ed5611346..0000000000 --- a/src/Data/Syntax/Literal.hs +++ /dev/null @@ -1,268 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields, ScopedTypeVariables #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Data.Syntax.Literal where - -import Prelude hiding (Float, null) -import Prologue hiding (Set, hash, null) - -import Data.Abstract.Evaluatable as Eval -import Data.JSON.Fields -import qualified Data.Reprinting.Scope as Scope -import Data.Scientific.Exts -import qualified Data.Text as T -import Diffing.Algorithm -import Numeric.Exts -import Reprinting.Tokenize as Tok -import Text.Read (readMaybe) - --- Boolean - -newtype Boolean a = Boolean { booleanContent :: Bool } - deriving stock (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1) - deriving anyclass (Hashable1, Diffable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Boolean - -true :: Boolean a -true = Boolean True - -false :: Boolean a -false = Boolean False - -instance Evaluatable Boolean where - eval _ _ (Boolean x) = boolean x - -instance Tokenize Boolean where - tokenize = yield . Truth . booleanContent - --- | A literal integer of unspecified width. No particular base is implied. -newtype Integer a = Integer { integerContent :: Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Data.Syntax.Literal.Integer - -instance Evaluatable Data.Syntax.Literal.Integer where - -- TODO: We should use something more robust than shelling out to readMaybe. - eval _ _ (Data.Syntax.Literal.Integer x) = - either (const (throwEvalError (IntegerFormatError x))) pure (parseInteger x) >>= integer - -instance Tokenize Data.Syntax.Literal.Integer where - tokenize = yield . Run . integerContent - --- | A literal float of unspecified width. - -newtype Float a = Float { floatContent :: Text } - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Data.Syntax.Literal.Float - - -instance Evaluatable Data.Syntax.Literal.Float where - eval _ _ (Float s) = - either (const (throwEvalError (FloatFormatError s))) pure (parseScientific s) >>= float - -instance Tokenize Data.Syntax.Literal.Float where - tokenize = yield . Run . floatContent - --- Rational literals e.g. `2/3r` -newtype Rational a = Rational { value :: Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Data.Syntax.Literal.Rational - -instance Evaluatable Data.Syntax.Literal.Rational where - eval _ _ (Rational r) = - let - trimmed = T.takeWhile (/= 'r') r - parsed = readMaybe @Prelude.Integer (T.unpack trimmed) - in maybe (throwEvalError (RationalFormatError r)) (pure . toRational) parsed >>= rational - -instance Tokenize Data.Syntax.Literal.Rational where - tokenize (Rational t) = yield . Run $ t - --- Complex literals e.g. `3 + 2i` -newtype Complex a = Complex { value :: Text } - deriving (Diffable, Eq, Foldable, Functor, Generic1, Hashable1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Complex - --- TODO: Implement Eval instance for Complex -instance Evaluatable Complex - -instance Tokenize Complex where - tokenize (Complex v) = yield . Run $ v - --- Strings, symbols - -newtype String a = String { stringElements :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Data.Syntax.Literal.String - --- TODO: Should string literal bodies include escapes too? - --- TODO: Implement Eval instance for String -instance Evaluatable Data.Syntax.Literal.String - -instance Tokenize Data.Syntax.Literal.String where - tokenize = sequenceA_ - -newtype Character a = Character { characterContent :: Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Character - -instance Evaluatable Data.Syntax.Literal.Character - -instance Tokenize Character where - tokenize = yield . Glyph . characterContent - --- | An interpolation element within a string literal. -newtype InterpolationElement a = InterpolationElement { interpolationBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically InterpolationElement - --- TODO: Implement Eval instance for InterpolationElement -instance Evaluatable InterpolationElement - -instance Tokenize InterpolationElement where - tokenize = sequenceA_ - --- | A sequence of textual contents within a string literal. -newtype TextElement a = TextElement { textElementContent :: Text } - deriving (Diffable, Eq, Foldable, Functor, Generic1, Hashable1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Ord1, Show1) via Generically TextElement - -instance Evaluatable TextElement where - eval _ _ (TextElement x) = string x - -instance Tokenize TextElement where - tokenize = yield . Run . textElementContent - -isTripleQuoted :: TextElement a -> Bool -isTripleQuoted (TextElement t) = - let trip = "\"\"\"" - in T.take 3 t == trip && T.takeEnd 3 t == trip - -quoted :: Text -> TextElement a -quoted t = TextElement ("\"" <> t <> "\"") - --- | A sequence of textual contents within a string literal. -newtype EscapeSequence a = EscapeSequence { value :: Text } - deriving (Diffable, Eq, Foldable, Functor, Generic1, Hashable1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Ord1, Show1) via Generically EscapeSequence - --- TODO: Implement Eval instance for EscapeSequence -instance Evaluatable EscapeSequence - -instance Tokenize EscapeSequence where - tokenize (EscapeSequence e) = yield . Run $ e - -data Null a = Null - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Null - -instance Evaluatable Null where eval _ _ _ = pure null - -instance Tokenize Null where - tokenize _ = yield Nullity - -newtype Symbol a = Symbol { symbolElements :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Symbol - --- TODO: Implement Eval instance for Symbol -instance Evaluatable Symbol - -instance Tokenize Symbol where - tokenize s = within Scope.Atom (yield Sym *> sequenceA_ s) - -newtype SymbolElement a = SymbolElement { symbolContent :: Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically SymbolElement - -instance Evaluatable SymbolElement where - eval _ _ (SymbolElement s) = string s - -instance Tokenize SymbolElement where - tokenize = yield . Run . symbolContent - -newtype Regex a = Regex { regexContent :: Text } - deriving (Diffable, Eq, Foldable, Functor, Generic1, Hashable1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Regex - --- TODO: Heredoc-style string literals? - --- TODO: Implement Eval instance for Regex -instance Evaluatable Regex where - eval _ _ (Regex x) = string x - -instance Tokenize Regex where - tokenize = yield . Run . regexContent - --- Collections - -newtype Array a = Array { arrayElements :: [a] } - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Array - -instance Evaluatable Array where - eval eval _ Array{..} = array =<< traverse eval arrayElements - -instance Tokenize Array where - tokenize = list . arrayElements - -newtype Hash a = Hash { hashElements :: [a] } - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Hash - -instance Evaluatable Hash where - eval eval _ t = do - elements <- traverse (eval >=> asPair) (hashElements t) - Eval.hash elements - -instance Tokenize Hash where - tokenize = Tok.hash . hashElements - -data KeyValue a = KeyValue { key :: !a, value :: !a } - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Ord1, Show1) via Generically KeyValue - -instance Evaluatable KeyValue where - eval eval _ KeyValue{..} = do - k <- eval key - v <- eval value - kvPair k v - -instance Tokenize KeyValue where - tokenize (KeyValue k v) = pair k v - -newtype Tuple a = Tuple { tupleContents :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Tuple - -instance Evaluatable Tuple where - eval eval _ (Tuple cs) = tuple =<< traverse eval cs - -newtype Set a = Set { setElements :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Set - --- TODO: Implement Eval instance for Set -instance Evaluatable Set - - --- Pointers - --- | A declared pointer (e.g. var pointer *int in Go) -newtype Pointer a = Pointer { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Pointer - --- TODO: Implement Eval instance for Pointer -instance Evaluatable Pointer - - --- | A reference to a pointer's address (e.g. &pointer in Go) -newtype Reference a = Reference { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Ord1, Show1) via Generically Reference - --- TODO: Implement Eval instance for Reference -instance Evaluatable Reference - --- TODO: Object literals as distinct from hash literals? Or coalesce object/hash literals into β€œkey-value literals”? --- TODO: Function literals (lambdas, procs, anonymous functions, what have you). diff --git a/src/Data/Syntax/Statement.hs b/src/Data/Syntax/Statement.hs deleted file mode 100644 index 6df0a32195..0000000000 --- a/src/Data/Syntax/Statement.hs +++ /dev/null @@ -1,377 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, ScopedTypeVariables, UndecidableInstances, ViewPatterns, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Data.Syntax.Statement where - -import Prologue - -import Control.Abstract hiding (Break, Continue, Return, While) -import Data.Abstract.Evaluatable as Abstract -import Data.Aeson (ToJSON1 (..)) -import Data.JSON.Fields -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import qualified Data.Map.Strict as Map -import qualified Data.Reprinting.Scope as Scope -import qualified Data.Reprinting.Token as Token -import Data.Semigroup.App -import Data.Semigroup.Foldable -import Diffing.Algorithm -import Reprinting.Tokenize (Tokenize (..), imperative, within', yield) - --- | Imperative sequence of statements/declarations s.t.: --- --- 1. Each statement’s effects on the store are accumulated; --- 2. Each statement can affect the environment of later statements (e.g. by 'modify'-ing the environment); and --- 3. Only the last statement’s return value is returned. --- TODO: Separate top-level statement nodes into non-lexical Statement and lexical StatementBlock nodes -newtype Statements a = Statements { statements :: [a] } - deriving (Diffable, Eq, Foldable, Functor, Generic1, Hashable1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Statements - -instance ToJSON1 Statements - -instance Evaluatable Statements where - eval eval _ (Statements xs) = - maybe unit (runApp . foldMap1 (App . eval)) (nonEmpty xs) - -instance Tokenize Statements where - tokenize = imperative - -newtype StatementBlock a = StatementBlock { statements :: [a] } - deriving (Diffable, Eq, Foldable, Functor, Generic1, Hashable1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically StatementBlock - -instance ToJSON1 StatementBlock - -instance Evaluatable StatementBlock where - eval eval _ (StatementBlock xs) = - maybe unit (runApp . foldMap1 (App . eval)) (nonEmpty xs) - -instance Tokenize StatementBlock where - tokenize = imperative - --- | Conditional. This must have an else block, which can be filled with some default value when omitted in the source, e.g. 'pure ()' for C-style if-without-else or 'pure Nothing' for Ruby-style, in both cases assuming some appropriate Applicative context into which the If will be lifted. -data If a = If { ifCondition :: !a, ifThenBody :: !a, ifElseBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically If - -instance Evaluatable If where - eval eval _ (If cond if' else') = do - bool <- eval cond - ifthenelse bool (eval if') (eval else') - -instance Tokenize If where - tokenize If{..} = within' Scope.If $ do - ifCondition - yield (Token.Flow Token.Then) - ifThenBody - yield (Token.Flow Token.Else) - ifElseBody - --- | Else statement. The else condition is any term, that upon successful completion, continues evaluation to the elseBody, e.g. `for ... else` in Python. -data Else a = Else { elseCondition :: !a, elseBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Else - --- TODO: Implement Eval instance for Else -instance Evaluatable Else - -instance Tokenize Else where - tokenize Else{..} = within' Scope.If (yield (Token.Flow Token.Else) *> elseCondition *> yield Token.Sep *> elseBody) - --- TODO: Alternative definition would flatten if/else if/else chains: data If a = If ![(a, a)] !(Maybe a) - --- | Goto statement (e.g. `goto a` in Go). -newtype Goto a = Goto { gotoLocation :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Goto - --- TODO: Implement Eval instance for Goto -instance Evaluatable Goto - --- | A pattern-matching or computed jump control-flow statement, like 'switch' in C or JavaScript, or 'case' in Ruby or Haskell. -data Match a = Match { matchSubject :: !a, matchPatterns :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Match - --- TODO: Implement Eval instance for Match -instance Evaluatable Match - -instance Tokenize Match where - tokenize Match{..} = do - yield (Token.Flow Token.Switch) - matchSubject - yield (Token.Flow Token.In) -- This may need further refinement - matchPatterns - --- | A pattern in a pattern-matching or computed jump control-flow statement, like 'case' in C or JavaScript, 'when' in Ruby, or the left-hand side of '->' in the body of Haskell 'case' expressions. -data Pattern a = Pattern { value :: !a, patternBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Pattern - --- TODO: Implement Eval instance for Pattern -instance Evaluatable Pattern - -instance Tokenize Pattern where - tokenize Pattern{..} = within' Scope.Case (value *> patternBody) - --- | A let statement or local binding, like 'a as b' or 'let a = b'. -data Let a = Let { letVariable :: !a, letValue :: !a, letBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Let - -instance Evaluatable Let where - eval eval _ Let{..} = do - -- This use of 'throwNoNameError' is okay until we have a better way of mapping gensym names to terms in the scope graph. - valueName <- maybeM (throwNoNameError letValue) (declaredName letValue) - assocScope <- associatedScope (Declaration valueName) - - _ <- withLexicalScopeAndFrame $ do - letSpan <- ask @Span - name <- declareMaybeName (declaredName letVariable) Default Public letSpan ScopeGraph.Let assocScope - letVal <- eval letValue - slot <- lookupSlot (Declaration name) - assign slot letVal - eval letBody - unit - - --- Assignment - --- | Assignment to a variable or other lvalue. -data Assignment a = Assignment { assignmentContext :: ![a], assignmentTarget :: !a, assignmentValue :: !a } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Assignment - -instance Declarations1 Assignment where - liftDeclaredName declaredName Assignment{..} = declaredName assignmentTarget - -instance Evaluatable Assignment where - eval eval ref Assignment{..} = do - lhs <- ref assignmentTarget - rhs <- eval assignmentValue - - case declaredName assignmentValue of - Just rhsName -> do - assocScope <- associatedScope (Declaration rhsName) - case assocScope of - Just assocScope' -> do - objectScope <- newScope (Map.singleton Import [ assocScope' ]) - putSlotDeclarationScope lhs (Just objectScope) -- TODO: not sure if this is right - Nothing -> - pure () - Nothing -> - pure () - assign lhs rhs - pure rhs - -instance Tokenize Assignment where - -- Should we be using 'assignmentContext' in here? - tokenize Assignment{..} = assignmentTarget *> yield Token.Assign <* assignmentValue - --- | Post increment operator (e.g. 1++ in Go, or i++ in C). -newtype PostIncrement a = PostIncrement { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PostIncrement - --- TODO: Implement Eval instance for PostIncrement -instance Evaluatable PostIncrement - - --- | Post decrement operator (e.g. 1-- in Go, or i-- in C). -newtype PostDecrement a = PostDecrement { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PostDecrement - --- TODO: Implement Eval instance for PostDecrement -instance Evaluatable PostDecrement - --- | Pre increment operator (e.g. ++1 in C or Java). -newtype PreIncrement a = PreIncrement { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PreIncrement - --- TODO: Implement Eval instance for PreIncrement -instance Evaluatable PreIncrement - - --- | Pre decrement operator (e.g. --1 in C or Java). -newtype PreDecrement a = PreDecrement { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PreDecrement - --- TODO: Implement Eval instance for PreDecrement -instance Evaluatable PreDecrement - - --- Returns - -newtype Return a = Return { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Return - -instance Evaluatable Return where - eval eval _ (Return x) = eval x >>= earlyReturn - -instance Tokenize Return where - tokenize (Return x) = within' Scope.Return x - -newtype Yield a = Yield { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Yield - --- TODO: Implement Eval instance for Yield -instance Evaluatable Yield - -instance Tokenize Yield where - tokenize (Yield y) = yield (Token.Flow Token.Yield) *> y - - -newtype Break a = Break { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Break - -instance Evaluatable Break where - eval eval _ (Break x) = eval x >>= throwBreak - -instance Tokenize Break where - tokenize (Break b) = yield (Token.Flow Token.Break) *> b - -newtype Continue a = Continue { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Continue - -instance Evaluatable Continue where - eval eval _ (Continue x) = eval x >>= throwContinue - -instance Tokenize Continue where - tokenize (Continue c) = yield (Token.Flow Token.Continue) *> c - -newtype Retry a = Retry { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Retry - --- TODO: Implement Eval instance for Retry -instance Evaluatable Retry - -instance Tokenize Retry where - tokenize (Retry r) = yield (Token.Flow Token.Retry) *> r - -newtype NoOp a = NoOp { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NoOp - -instance Evaluatable NoOp where - eval _ _ _ = unit - --- Loops - -data For a = For { forBefore :: !a, forCondition :: !a, forStep :: !a, forBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically For - -instance Evaluatable For where - eval eval _ (fmap eval -> For before cond step body) = forLoop before cond step body - -data ForEach a = ForEach { forEachBinding :: !a, forEachSubject :: !a, forEachBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ForEach - --- TODO: Implement Eval instance for ForEach -instance Evaluatable ForEach - -instance Tokenize ForEach where - tokenize ForEach{..} = within' Scope.Loop $ do - yield (Token.Flow Token.Foreach) - forEachBinding - yield (Token.Flow Token.In) - forEachSubject - forEachBody - -data While a = While { whileCondition :: !a, whileBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically While - -instance Evaluatable While where - eval eval _ While{..} = while (eval whileCondition) (eval whileBody) - -instance Tokenize While where - tokenize While{..} = within' Scope.Loop $ do - yield (Token.Flow Token.While) - whileCondition - whileBody - -data DoWhile a = DoWhile { doWhileCondition :: !a, doWhileBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically DoWhile - -instance Evaluatable DoWhile where - eval eval _ DoWhile{..} = doWhile (eval doWhileBody) (eval doWhileCondition) - --- Exception handling - -newtype Throw a = Throw { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Throw - --- TODO: Implement Eval instance for Throw -instance Evaluatable Throw - - -data Try a = Try { tryBody :: !a, tryCatch :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Try - --- TODO: Implement Eval instance for Try -instance Evaluatable Try - -instance Tokenize Try where - tokenize Try{..} = do - yield (Token.Flow Token.Try) - tryBody - yield (Token.Flow Token.Rescue) - sequenceA_ tryCatch - -data Catch a = Catch { catchException :: !a, catchBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Catch - --- TODO: Implement Eval instance for Catch -instance Evaluatable Catch - -instance Tokenize Catch where - tokenize Data.Syntax.Statement.Catch{..} = within' Scope.Catch $ catchException *> catchBody - -newtype Finally a = Finally { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Finally - --- TODO: Implement Eval instance for Finally -instance Evaluatable Finally - -instance Tokenize Finally where - tokenize (Finally f) = within' Scope.Finally f - --- Scoping - --- | ScopeEntry (e.g. `BEGIN {}` block in Ruby or Perl). -newtype ScopeEntry a = ScopeEntry { terms :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ScopeEntry - --- TODO: Implement Eval instance for ScopeEntry -instance Evaluatable ScopeEntry - -instance Tokenize ScopeEntry where - tokenize (ScopeEntry t) = within' Scope.BeginBlock (sequenceA_ t) - - --- | ScopeExit (e.g. `END {}` block in Ruby or Perl). -newtype ScopeExit a = ScopeExit { terms :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ScopeExit - --- TODO: Implement Eval instance for ScopeExit -instance Evaluatable ScopeExit - -instance Tokenize ScopeExit where - tokenize (ScopeExit t) = within' Scope.EndBlock (sequenceA_ t) diff --git a/src/Data/Syntax/Type.hs b/src/Data/Syntax/Type.hs deleted file mode 100644 index 96d5603ea7..0000000000 --- a/src/Data/Syntax/Type.hs +++ /dev/null @@ -1,135 +0,0 @@ -{-# LANGUAGE DataKinds, DeriveAnyClass, DerivingVia, DuplicateRecordFields, DeriveGeneric, MultiParamTypeClasses, UndecidableInstances #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Data.Syntax.Type where - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import Diffing.Algorithm -import Prelude hiding (Bool, Float, Int, Double) -import Prologue hiding (Map) -import Reprinting.Tokenize - -data Array a = Array { arraySize :: Maybe a, arrayElementType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Array - --- TODO: Implement Eval instance for Array -instance Evaluatable Array - - --- TODO: What about type variables? re: FreeVariables1 -data Annotation a = Annotation { annotationSubject :: a, annotationType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Annotation - --- TODO: Specialize Evaluatable for Type to unify the inferred type of the subject with the specified type -instance Evaluatable Annotation where - eval eval _ Annotation{..} = eval annotationSubject - -instance Tokenize Annotation where - -- FIXME: This ignores annotationType. - -- TODO: Not sure what this should look like yet - tokenize Annotation{..} = annotationSubject - - -data Function a = Function { functionParameters :: [a], functionReturn :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Function - --- TODO: Implement Eval instance for Function -instance Evaluatable Function - - -newtype Interface a = Interface { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Interface - --- TODO: Implement Eval instance for Interface -instance Evaluatable Interface - -data Map a = Map { mapKeyType :: a, mapElementType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Map - --- TODO: Implement Eval instance for Map -instance Evaluatable Map - -newtype Parenthesized a = Parenthesized { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Parenthesized - --- TODO: Implement Eval instance for Parenthesized -instance Evaluatable Parenthesized - -newtype Pointer a = Pointer { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Pointer - --- TODO: Implement Eval instance for Pointer -instance Evaluatable Pointer - -newtype Product a = Product { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Product - --- TODO: Implement Eval instance for Product -instance Evaluatable Product - - -data Readonly a = Readonly - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Readonly - --- TODO: Implement Eval instance for Readonly -instance Evaluatable Readonly - -newtype Slice a = Slice { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Slice - --- TODO: Implement Eval instance for Slice -instance Evaluatable Slice - -newtype TypeParameters a = TypeParameters { terms :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeParameters - --- TODO: Implement Eval instance for TypeParameters -instance Evaluatable TypeParameters - --- data instead of newtype because no payload -data Void a = Void - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Void - --- TODO: Implement Eval instance for Void -instance Evaluatable Void - --- data instead of newtype because no payload -data Int a = Int - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Int - --- TODO: Implement Eval instance for Int -instance Evaluatable Int - -data Float a = Float - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Float - --- TODO: Implement Eval instance for Float -instance Evaluatable Float - -data Double a = Double - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Double - --- TODO: Implement Eval instance for Double -instance Evaluatable Double - -data Bool a = Bool - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Bool - --- TODO: Implement Eval instance for Float -instance Evaluatable Bool diff --git a/src/Data/Tag.hs b/src/Data/Tag.hs deleted file mode 100644 index c5be4de1ed..0000000000 --- a/src/Data/Tag.hs +++ /dev/null @@ -1,28 +0,0 @@ -{-# LANGUAGE DeriveAnyClass #-} - -module Data.Tag - ( Tag (..) - ) where - -import Prelude hiding (span) -import Prologue - -import Data.Aeson -import Control.Lens.Lens - -import Data.Span - --- | These selectors aren't prefixed with @tag@ for reasons of JSON --- backwards compatibility. -data Tag = Tag - { name :: Text - , kind :: Text - , span :: Span - , context :: [Text] - , line :: Maybe Text - , docs :: Maybe Text - } deriving (Eq, Show, Generic, ToJSON) - -instance HasSpan Tag where - span = lens Data.Tag.span (\t s -> t { Data.Tag.span = s }) - {-# INLINE span #-} diff --git a/src/Data/Term.hs b/src/Data/Term.hs deleted file mode 100644 index 7d5a7ef4de..0000000000 --- a/src/Data/Term.hs +++ /dev/null @@ -1,174 +0,0 @@ -{-# LANGUAGE FunctionalDependencies, RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators #-} -module Data.Term -( Term(..) -, termIn -, termAnnotation -, termOut -, injectTerm -, projectTerm -, guardTerm -, TermF(..) -, termSize -, hoistTerm -, hoistTermF -, Annotated (..) -) where - -import Prelude hiding (span) -import Prologue - -import Control.Lens.Lens -import Data.Aeson -import Data.JSON.Fields -import Data.Span -import qualified Data.Sum as Sum -import Text.Show - --- | A Term with an abstract syntax tree and an annotation. -newtype Term syntax ann = Term { unTerm :: TermF syntax ann (Term syntax ann) } - -termAnnotation :: Term syntax ann -> ann -termAnnotation = termFAnnotation . unTerm - -termOut :: Term syntax ann -> syntax (Term syntax ann) -termOut = termFOut . unTerm - -projectTerm :: forall f syntax ann . (f :< syntax) => Term (Sum syntax) ann -> Maybe (f (Term (Sum syntax) ann)) -projectTerm = Sum.project . termOut - -guardTerm :: forall m f syntax ann . (f :< syntax, Alternative m) - => Term (Sum syntax) ann - -> m (f (Term (Sum syntax) ann)) -guardTerm = Sum.projectGuard . termOut - -data TermF syntax ann recur = In { termFAnnotation :: ann, termFOut :: syntax recur } - deriving (Eq, Ord, Foldable, Functor, Show, Traversable, Generic1) - -annotationLens :: Lens' (TermF syntax ann recur) ann -annotationLens = lens termFAnnotation (\t a -> t { termFAnnotation = a }) -{-# INLINE annotationLens #-} - -instance HasSpan ann => HasSpan (TermF syntax ann recur) where - span = annotationLens.span - {-# INLINE span #-} - -instance HasSpan ann => HasSpan (Term syntax ann) where - span = inner.span where inner = lens unTerm (\t i -> t { unTerm = i }) - {-# INLINE span #-} - --- | A convenience typeclass to get the annotation out of a 'Term' or 'TermF'. --- Useful in term-rewriting algebras. -class Annotated t ann | t -> ann where - annotation :: t -> ann - -instance Annotated (TermF syntax ann recur) ann where - annotation = termFAnnotation - -instance Annotated (Term syntax ann) ann where - annotation = termAnnotation - - --- | Return the node count of a term. -termSize :: (Foldable f, Functor f) => Term f annotation -> Int -termSize = cata size where - size (In _ syntax) = 1 + sum syntax - --- | Build a Term from its annotation and syntax. -termIn :: ann -> syntax (Term syntax ann) -> Term syntax ann -termIn = (Term .) . In - -injectTerm :: (f :< syntax) => ann -> f (Term (Sum syntax) ann) -> Term (Sum syntax) ann -injectTerm a = termIn a . Sum.inject - - -hoistTerm :: Functor f => (forall a. f a -> g a) -> Term f a -> Term g a -hoistTerm f = go where go (Term r) = Term (hoistTermF f (fmap go r)) - -hoistTermF :: (forall a. f a -> g a) -> TermF f a b -> TermF g a b -hoistTermF f = go where go (In a r) = In a (f r) - - -type instance Base (Term f a) = TermF f a - -instance Functor f => Recursive (Term f a) where project = unTerm -instance Functor f => Corecursive (Term f a) where embed = Term - -instance Functor f => Functor (Term f) where - fmap f = go where go = Term . bimap f go . unTerm - -instance Foldable f => Foldable (Term f) where - foldMap f = go where go = bifoldMap f go . unTerm - -instance Traversable f => Traversable (Term f) where - traverse f = go where go = fmap Term . bitraverse f go . unTerm - -instance Eq1 f => Eq1 (Term f) where - liftEq eqA = go where go t1 t2 = liftEq2 eqA go (unTerm t1) (unTerm t2) - -instance (Eq1 f, Eq a) => Eq (Term f a) where - (==) = eq1 - -instance Show1 f => Show1 (Term f) where - liftShowsPrec spA _ = go where go d (Term (In a f)) = showsBinaryWith spA (liftShowsPrec go (showListWith (go 0))) "Term" d a f - -instance (Show1 f, Show a) => Show (Term f a) where - showsPrec = showsPrec1 - -instance Ord1 f => Ord1 (Term f) where - liftCompare comp = go where go t1 t2 = liftCompare2 comp go (unTerm t1) (unTerm t2) - -instance (Ord1 f, Ord a) => Ord (Term f a) where - compare = compare1 - -instance NFData1 f => NFData1 (Term f) where - liftRnf rnf = go where go x = liftRnf2 rnf go (unTerm x) - -instance (NFData1 f, NFData a) => NFData (Term f a) where - rnf = liftRnf rnf - - -instance Functor f => Bifunctor (TermF f) where - bimap f g (In a r) = In (f a) (fmap g r) - -instance Foldable f => Bifoldable (TermF f) where - bifoldMap f g (In a r) = f a `mappend` foldMap g r - -instance Traversable f => Bitraversable (TermF f) where - bitraverse f g (In a r) = In <$> f a <*> traverse g r - - -instance Eq1 f => Eq2 (TermF f) where - liftEq2 eqA eqB (In a1 f1) (In a2 f2) = eqA a1 a2 && liftEq eqB f1 f2 - - -instance (Eq1 f, Eq a) => Eq1 (TermF f a) where - liftEq = liftEq2 (==) - -instance Show1 f => Show2 (TermF f) where - liftShowsPrec2 spA _ spB slB d (In a f) = showsBinaryWith spA (liftShowsPrec spB slB) "In" d a f - -instance (Show1 f, Show a) => Show1 (TermF f a) where - liftShowsPrec = liftShowsPrec2 showsPrec showList - -instance Ord1 f => Ord2 (TermF f) where - liftCompare2 compA compB (In a1 f1) (In a2 f2) = compA a1 a2 <> liftCompare compB f1 f2 - -instance (Ord1 f, Ord a) => Ord1 (TermF f a) where - liftCompare = liftCompare2 compare - -instance NFData1 f => NFData2 (TermF f) where - liftRnf2 rnf1 rnf2 (In a1 f1) = rnf1 a1 `seq` liftRnf rnf2 f1 - -instance (ToJSONFields a, ToJSONFields1 f) => ToJSON (Term f a) where - toJSON = object . toJSONFields - toEncoding = pairs . mconcat . toJSONFields - -instance (ToJSONFields a, ToJSONFields1 f) => ToJSONFields (Term f a) where - toJSONFields = toJSONFields . unTerm - -instance (ToJSON b, ToJSONFields a, ToJSONFields1 f) => ToJSONFields (TermF f a b) where - toJSONFields (In a f) = toJSONFields1 f <> toJSONFields a - -instance (ToJSON b, ToJSONFields a, ToJSONFields1 f) => ToJSON (TermF f a b) where - toJSON = object . toJSONFields - toEncoding = pairs . mconcat . toJSONFields diff --git a/src/Diffing/Algorithm.hs b/src/Diffing/Algorithm.hs deleted file mode 100644 index cb60957f35..0000000000 --- a/src/Diffing/Algorithm.hs +++ /dev/null @@ -1,293 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DefaultSignatures, DerivingStrategies, GeneralizedNewtypeDeriving, KindSignatures, TypeOperators, UndecidableInstances #-} -module Diffing.Algorithm - ( Diff (..) - , Algorithm(..) - , Diffable (..) - , Equivalence (..) - , diff - , diffThese - , diffMaybe - , linearly - , byReplacing - , comparableTerms - , equivalentTerms - , algorithmForTerms - ) where - -import Control.Effect hiding ((:+:)) -import Control.Effect.Carrier -import qualified Data.Diff as Diff -import Data.Sum -import Data.Term -import GHC.Generics -import Prologue - --- | A single step in a diffing algorithm, parameterized by the types of terms, diffs, and the result of the applicable algorithm. -data Diff term1 term2 diff (m :: * -> *) k - -- | Diff two terms with the choice of algorithm left to the interpreter’s discretion. - = Diff term1 term2 (diff -> k) - -- | Diff two terms recursively in O(n) time, resulting in a single diff node. - | Linear term1 term2 (diff -> k) - -- | Diff two lists of terms by each element’s similarity in O(nΒ³ log n), resulting in a list of diffs. - | RWS [term1] [term2] ([diff] -> k) - -- | Delete a term. - | Delete term1 (diff -> k) - -- | Insert a term. - | Insert term2 (diff -> k) - -- | Replace one term with another. - | Replace term1 term2 (diff -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -newtype Algorithm term1 term2 diff m a = Algorithm { runAlgorithm :: m a } - deriving newtype (Applicative, Alternative, Functor, Monad) - -instance Carrier sig m => Carrier sig (Algorithm term1 term2 diff m) where - eff = Algorithm . eff . handleCoercible - - --- DSL - --- | Diff two terms without specifying the algorithm to be used. -diff :: (Carrier sig m, Member (Diff term1 term2 diff) sig) => term1 -> term2 -> m diff -diff a1 a2 = send (Diff a1 a2 pure) - --- | Diff a These of terms without specifying the algorithm to be used. -diffThese :: (Carrier sig m, Member (Diff term1 term2 diff) sig) => These term1 term2 -> Algorithm term1 term2 diff m diff -diffThese = these byDeleting byInserting diff - --- | Diff a pair of optional terms without specifying the algorithm to be used. -diffMaybe :: (Carrier sig m, Member (Diff term1 term2 diff) sig) => Maybe term1 -> Maybe term2 -> Algorithm term1 term2 diff m (Maybe diff) -diffMaybe (Just a1) (Just a2) = Just <$> diff a1 a2 -diffMaybe (Just a1) _ = Just <$> byDeleting a1 -diffMaybe _ (Just a2) = Just <$> byInserting a2 -diffMaybe _ _ = pure Nothing - --- | Diff two terms linearly. -linearly :: (Carrier sig m, Member (Diff term1 term2 diff) sig) => term1 -> term2 -> Algorithm term1 term2 diff m diff -linearly f1 f2 = send (Linear f1 f2 pure) - --- | Diff two terms using RWS. -byRWS :: (Carrier sig m, Member (Diff term1 term2 diff) sig) => [term1] -> [term2] -> Algorithm term1 term2 diff m [diff] -byRWS as1 as2 = send (RWS as1 as2 pure) - --- | Delete a term. -byDeleting :: (Carrier sig m, Member (Diff term1 term2 diff) sig) => term1 -> Algorithm term1 term2 diff m diff -byDeleting a1 = sendDiff (Delete a1 pure) - --- | Insert a term. -byInserting :: (Carrier sig m, Member (Diff term1 term2 diff) sig) => term2 -> Algorithm term1 term2 diff m diff -byInserting a2 = sendDiff (Insert a2 pure) - --- | Replace one term with another. -byReplacing :: (Carrier sig m, Member (Diff term1 term2 diff) sig) => term1 -> term2 -> Algorithm term1 term2 diff m diff -byReplacing a1 a2 = send (Replace a1 a2 pure) - -sendDiff :: (Carrier sig m, Member (Diff term1 term2 diff) sig) => Diff term1 term2 diff m (m a) -> Algorithm term1 term2 diff m a -sendDiff = Algorithm . send - - --- | Diff two terms based on their 'Diffable' instances, performing substructural comparisons iff the initial comparison fails. -algorithmForTerms :: (Carrier sig m, Diffable syntax, Member (Diff (Term syntax ann1) (Term syntax ann2) (Diff.Diff syntax ann1 ann2)) sig, Member NonDet sig, Alternative m) - => Term syntax ann1 - -> Term syntax ann2 - -> Algorithm (Term syntax ann1) (Term syntax ann2) (Diff.Diff syntax ann1 ann2) m (Diff.Diff syntax ann1 ann2) -algorithmForTerms t1@(Term (In ann1 f1)) t2@(Term (In ann2 f2)) - = mergeFor t1 t2 - <|> Diff.deleteF . In ann1 <$> subalgorithmFor byDeleting (`mergeFor` t2) f1 - <|> Diff.insertF . In ann2 <$> subalgorithmFor byInserting (mergeFor t1) f2 - where mergeFor (Term (In ann1 f1)) (Term (In ann2 f2)) = Diff.merge (ann1, ann2) <$> algorithmFor f1 f2 - --- | An O(1) relation on terms indicating their non-recursive comparability (i.e. are they of the same β€œkind” in a way that warrants comparison), defined in terms of the comparability of their respective syntax. -comparableTerms :: Diffable syntax - => TermF syntax ann1 term1 - -> TermF syntax ann2 term2 - -> Bool -comparableTerms (In _ syntax1) (In _ syntax2) = comparableTo syntax1 syntax2 - --- | An O(n) relation on terms indicating their recursive equivalence (i.e. are they _notionally_ β€œthe same,” as distinct from literal equality), defined at each node in terms of the equivalence of their respective syntax, computed first on a nominated subterm (if any), falling back to substructural equivalence (e.g. equivalence of one term against the subject of the other, annotating term), and finally to equality. -equivalentTerms :: (Diffable syntax, Eq1 syntax) - => Term syntax ann1 - -> Term syntax ann2 - -> Bool -equivalentTerms term1@(Term (In _ syntax1)) term2@(Term (In _ syntax2)) - = fromMaybe False (equivalentTerms <$> equivalentBySubterm syntax1 <*> equivalentBySubterm syntax2) - || runEquivalence (subalgorithmFor pure (Equivalence . flip equivalentTerms term2) syntax1) - || runEquivalence (subalgorithmFor pure (Equivalence . equivalentTerms term1) syntax2) - || liftEq equivalentTerms syntax1 syntax2 - --- | A constant 'Alternative' functor used by 'equivalentTerms' to compute the substructural equivalence of syntax. -newtype Equivalence a = Equivalence { runEquivalence :: Bool } - deriving (Eq, Functor) - -instance Applicative Equivalence where - pure _ = Equivalence True - Equivalence a <*> Equivalence b = Equivalence (a && b) - -instance Alternative Equivalence where - empty = Equivalence False - Equivalence a <|> Equivalence b = Equivalence (a || b) - --- | A type class for determining what algorithm to use for diffing two terms. -class Diffable f where - -- | Construct an algorithm to diff a pair of @f@s populated with disjoint terms. - algorithmFor :: (Alternative m, Carrier sig m, Member (Diff term1 term2 diff) sig, Member NonDet sig) - => f term1 - -> f term2 - -> Algorithm term1 term2 diff m (f diff) - default - algorithmFor :: (Alternative m, Carrier sig m, Generic1 f, GDiffable (Rep1 f), Member (Diff term1 term2 diff) sig, Member NonDet sig) - => f term1 - -> f term2 - -> Algorithm term1 term2 diff m (f diff) - algorithmFor = genericAlgorithmFor - - tryAlignWith :: Alternative g => (These a1 a2 -> g b) -> f a1 -> f a2 -> g (f b) - default tryAlignWith :: (Alternative g, Generic1 f, GDiffable (Rep1 f)) => (These a1 a2 -> g b) -> f a1 -> f a2 -> g (f b) - tryAlignWith f a b = to1 <$> gtryAlignWith f (from1 a) (from1 b) - - -- | Construct an algorithm to diff against positions inside an @f@. - -- - -- This is very like 'traverse', with two key differences: - -- - -- 1. The traversal distributes through an 'Alternative' functor, not just an 'Applicative'. - -- 2. The traversal is mediated by two different functions, one for positions which should be ignored for substructural diffing, the other for positions which should be diffed substructurally. - -- - -- These two functions allow us to say e.g. that comparisons against 'Data.Syntax.Context' should also be made against its subject, but not against any of the comments, resulting in the insertion of both comments and context when documenting an existing function. - -- - -- By default, 'subalgorithmFor' produces 'empty', rejecting substructural comparisons. This is important for performance, as alternations with 'empty' are eliminated at construction time. - -- ^ The 'Alternative' instance will in general be 'Diff', but left opaque to make it harder to shoot oneself in the foot. - subalgorithmFor :: Alternative g - => (a -> g b) -- ^ A β€œblur” function to traverse positions which should not be diffed against. - -> (a -> g b) -- ^ A β€œfocus” function to traverse positions which should be diffed against. - -> f a -- ^ The syntax to diff inside of. - -> g (f b) -- ^ The resulting algorithm (or other 'Alternative' context), producing the traversed syntax. - subalgorithmFor _ _ _ = empty - - -- | Syntax having a human-provided identifier, such as function/method definitions, can use equivalence of identifiers as a proxy for their overall equivalence, improving the quality & efficiency of the diff as a whole. - -- - -- This can also be used for annotation nodes to ensure that their subjects’ equivalence is weighed appropriately. - -- - -- Other syntax should use the default definition, and thus have equivalence computed piece-wise. - equivalentBySubterm :: f a -> Maybe a - equivalentBySubterm _ = Nothing - - -- | A relation on syntax values indicating their In general this should be true iff both values have the same constructor (this is the relation computed by the default, generic definition). - -- - -- For syntax with constant fields which serve as a classifier, this method can be overloaded to consider equality on that classifier in addition to/instead of the constructors themselves, and thus limit the comparisons accordingly. - comparableTo :: f term1 -> f term2 -> Bool - default comparableTo :: (Generic1 f, GDiffable (Rep1 f)) => f term1 -> f term2 -> Bool - comparableTo = genericComparableTo - -genericAlgorithmFor :: (Alternative m, Carrier sig m, Generic1 f, GDiffable (Rep1 f), Member (Diff term1 term2 diff) sig, Member NonDet sig) - => f term1 - -> f term2 - -> Algorithm term1 term2 diff m (f diff) -genericAlgorithmFor a1 a2 = to1 <$> galgorithmFor (from1 a1) (from1 a2) - -genericComparableTo :: (Generic1 f, GDiffable (Rep1 f)) => f term1 -> f term2 -> Bool -genericComparableTo a1 a2 = gcomparableTo (from1 a1) (from1 a2) - - --- | 'Diffable' for 'Sum's of syntax functors is defined in general by straightforward lifting of each method into the functors in the 'Sum'. -instance Apply Diffable fs => Diffable (Sum fs) where - algorithmFor u1 u2 = fromMaybe empty (apply2' @Diffable (\ inj f1 f2 -> inj <$> algorithmFor f1 f2) u1 u2) - - tryAlignWith f u1 u2 = fromMaybe empty (apply2' @Diffable (\ inj t1 t2 -> inj <$> tryAlignWith f t1 t2) u1 u2) - - subalgorithmFor blur focus = apply' @Diffable (\ inj f -> inj <$> subalgorithmFor blur focus f) - - equivalentBySubterm = apply @Diffable equivalentBySubterm - - -- | Comparability on 'Sum's is defined first by comparability of their contained functors (when they’re the same), falling back to using 'subalgorithmFor' to opt substructurally-diffable syntax into comparisons (e.g. to allow annotating nodes to be compared against the kind of nodes they annotate). - comparableTo u1 u2 = fromMaybe False (apply2 @Diffable comparableTo u1 u2 <|> True <$ subalgorithmFor pure pure u1 <|> True <$ subalgorithmFor pure pure u2) - --- | Diff two 'Maybe's. -instance Diffable Maybe where - algorithmFor = diffMaybe - - tryAlignWith f (Just a1) (Just a2) = Just <$> f (These a1 a2) - tryAlignWith f (Just a1) Nothing = Just <$> f (This a1) - tryAlignWith f Nothing (Just a2) = Just <$> f (That a2) - tryAlignWith _ Nothing Nothing = pure Nothing - --- | Diff two lists using RWS. -instance Diffable [] where - algorithmFor = byRWS - - tryAlignWith f (a1:as1) (a2:as2) = (:) <$> f (These a1 a2) <*> tryAlignWith f as1 as2 - tryAlignWith f [] as2 = traverse (f . That) as2 - tryAlignWith f as1 [] = traverse (f . This) as1 - --- | Diff two non-empty lists using RWS. -instance Diffable NonEmpty where - algorithmFor (a1:|as1) (a2:|as2) = nonEmpty <$> byRWS (a1:as1) (a2:as2) >>= maybeM empty - - tryAlignWith f (a1:|as1) (a2:|as2) = (:|) <$> f (These a1 a2) <*> tryAlignWith f as1 as2 - --- | A generic type class for diffing two terms defined by the Generic1 interface. -class GDiffable f where - galgorithmFor :: (Alternative m, Carrier sig m, Member (Diff term1 term2 diff) sig, Member NonDet sig) => f term1 -> f term2 -> Algorithm term1 term2 diff m (f diff) - - gtryAlignWith :: Alternative g => (These a1 a2 -> g b) -> f a1 -> f a2 -> g (f b) - - gcomparableTo :: f term1 -> f term2 -> Bool - gcomparableTo _ _ = True - --- | Diff two constructors (M1 is the Generic1 newtype for meta-information (possibly related to type constructors, record selectors, and data types)) -instance GDiffable f => GDiffable (M1 i c f) where - galgorithmFor (M1 a1) (M1 a2) = M1 <$> galgorithmFor a1 a2 - - gtryAlignWith f (M1 a) (M1 b) = M1 <$> gtryAlignWith f a b - - gcomparableTo (M1 a1) (M1 a2) = gcomparableTo a1 a2 - --- | Diff the fields of a product type. --- i.e. data Foo a b = Foo a b (the 'Foo a b' is captured by 'a :*: b'). -instance (GDiffable f, GDiffable g) => GDiffable (f :*: g) where - galgorithmFor (a1 :*: b1) (a2 :*: b2) = (:*:) <$> galgorithmFor a1 a2 <*> galgorithmFor b1 b2 - - gtryAlignWith f (a1 :*: b1) (a2 :*: b2) = (:*:) <$> gtryAlignWith f a1 a2 <*> gtryAlignWith f b1 b2 - --- | Diff the constructors of a sum type. --- i.e. data Foo a = Foo a | Bar a (the 'Foo a' is captured by L1 and 'Bar a' is R1). -instance (GDiffable f, GDiffable g) => GDiffable (f :+: g) where - galgorithmFor (L1 a1) (L1 a2) = L1 <$> galgorithmFor a1 a2 - galgorithmFor (R1 b1) (R1 b2) = R1 <$> galgorithmFor b1 b2 - galgorithmFor _ _ = empty - - gtryAlignWith f a b = case (a, b) of - (L1 a, L1 b) -> L1 <$> gtryAlignWith f a b - (R1 a, R1 b) -> R1 <$> gtryAlignWith f a b - _ -> empty - - gcomparableTo (L1 _) (L1 _) = True - gcomparableTo (R1 _) (R1 _) = True - gcomparableTo _ _ = False - --- | Diff two parameters (Par1 is the Generic1 newtype representing a type parameter). --- i.e. data Foo a = Foo a (the 'a' is captured by Par1). -instance GDiffable Par1 where - galgorithmFor (Par1 a1) (Par1 a2) = Par1 <$> diff a1 a2 - - gtryAlignWith f (Par1 a) (Par1 b) = Par1 <$> f (These a b) - --- | Diff two constant parameters (K1 is the Generic1 newtype representing type parameter constants). --- i.e. data Foo = Foo Int (the 'Int' is a constant parameter). -instance Eq c => GDiffable (K1 i c) where - galgorithmFor (K1 a1) (K1 a2) = guard (a1 == a2) $> K1 a1 - - gtryAlignWith _ (K1 a) (K1 b) = guard (a == b) $> K1 b - --- | Diff two terms whose constructors contain 0 type parameters. --- i.e. data Foo = Foo. -instance GDiffable U1 where - galgorithmFor _ _ = pure U1 - - gtryAlignWith _ _ _ = pure U1 - --- | Diff two 'Diffable' containers of parameters. -instance Diffable f => GDiffable (Rec1 f) where - galgorithmFor a1 a2 = Rec1 <$> algorithmFor (unRec1 a1) (unRec1 a2) - - gtryAlignWith f (Rec1 a) (Rec1 b) = Rec1 <$> tryAlignWith f a b diff --git a/src/Diffing/Algorithm/RWS.hs b/src/Diffing/Algorithm/RWS.hs deleted file mode 100644 index ca6966cf88..0000000000 --- a/src/Diffing/Algorithm/RWS.hs +++ /dev/null @@ -1,173 +0,0 @@ -{-# LANGUAGE GADTs, DataKinds, DeriveAnyClass, RankNTypes, TypeOperators #-} -{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} -- FIXME -module Diffing.Algorithm.RWS -( rws -, Options(..) -, defaultOptions -, ComparabilityRelation -, FeatureVector -, defaultFeatureVectorDecorator -, featureVectorDecorator -, pqGramDecorator -, Gram(..) -, canCompareTerms -, equalTerms -) where - -import Control.Monad.State.Strict -import Data.Diff (DiffF(..), deleting, inserting, merge, replacing) -import qualified Data.KdMap.Static as KdMap -import Data.List (sortOn) -import Data.Term as Term -import Diffing.Algorithm -import Diffing.Algorithm.RWS.FeatureVector -import Diffing.Algorithm.SES -import Prologue - --- | A relation on 'Term's, guaranteed constant-time in the size of the 'Term' by parametricity. --- --- This is used both to determine whether two root terms can be compared in O(1), and, recursively, to determine whether two nodes are equal in O(n); thus, comparability is defined s.t. two terms are equal if they are recursively comparable subterm-wise. -type ComparabilityRelation syntax ann1 ann2 = forall a b. TermF syntax ann1 a -> TermF syntax ann2 b -> Bool - -rws :: (Foldable syntax, Functor syntax, Diffable syntax) - => ComparabilityRelation syntax (FeatureVector, ann) (FeatureVector, ann) - -> (Term syntax (FeatureVector, ann) -> Term syntax (FeatureVector, ann) -> Bool) - -> [Term syntax (FeatureVector, ann)] - -> [Term syntax (FeatureVector, ann)] - -> EditScript (Term syntax (FeatureVector, ann)) (Term syntax (FeatureVector, ann)) -rws _ _ as [] = This <$> as -rws _ _ [] bs = That <$> bs -rws canCompare _ [a] [b] = if canCompareTerms canCompare a b then [These a b] else [That b, This a] -rws canCompare equivalent as bs - = ses equivalent as bs - & mapContiguous [] [] - where Options{..} = defaultOptions - - -- Map contiguous sequences of unmapped terms separated by SES-mapped equivalencies. - mapContiguous as bs [] = mapSimilar (reverse as) (reverse bs) - mapContiguous as bs (first : rest) = case first of - This a -> mapContiguous (a : as) bs rest - That b -> mapContiguous as (b : bs) rest - These _ _ -> mapSimilar (reverse as) (reverse bs) <> (first : mapContiguous [] [] rest) - - -- Map comparable, mutually similar terms, inserting & deleting surrounding terms. - mapSimilar as' bs' = go as bs - where go as [] = This . snd <$> as - go [] bs = That . snd <$> bs - go [a] [b] | canCompareTerms canCompare (snd a) (snd b) = [These (snd a) (snd b)] - | otherwise = [That (snd b), This (snd a)] - go as@((i, _) : _) ((j, b) : restB) = - fromMaybe (That b : go as restB) $ do - -- Look up the most similar term to b near i. - (i', a) <- mostSimilarMatching (\ i' a -> inRange (i, i + optionsLookaheadPlaces) i' && canCompareTerms canCompare a b) kdMapA b - -- Look up the most similar term to a near j. - (j', _) <- mostSimilarMatching (\ j' b -> inRange (j, j + optionsLookaheadPlaces) j' && canCompareTerms canCompare a b) kdMapB a - -- Fail out if there’s a better match for a nearby. - guard (j == j') - -- Delete any elements of as before the selected element. - let (deleted, _ : restA) = span ((< i') . fst) as - pure $! (This . snd <$> deleted) <> (These a b : go restA restB) - (as, bs) = (zip [0..] as', zip [0..] bs') - (kdMapA, kdMapB) = (toKdMap as, toKdMap bs) - - -- Find the most similar term matching a predicate, if any. - -- - -- RWS can produce false positives in the case of e.g. hash collisions. Therefore, we find the _l_ nearest candidates, filter out any which don’t match the predicate, and select the minimum of the remaining by (a constant-time approximation of) edit distance. - -- - -- cf Β§4.2 of RWS-Diff - mostSimilarMatching isEligible tree term = listToMaybe (sortOn (editDistanceUpTo optionsNodeComparisons term . snd) candidates) - where candidates = filter (uncurry isEligible) (snd <$> KdMap.kNearest tree optionsMaxSimilarTerms (fst (termAnnotation term))) - -data Options = Options - { optionsLookaheadPlaces :: {-# UNPACK #-} !Int -- ^ How many places ahead should we look for similar terms? - , optionsMaxSimilarTerms :: {-# UNPACK #-} !Int -- ^ The maximum number of similar terms to consider. - , optionsNodeComparisons :: {-# UNPACK #-} !Int -- ^ The number of nodes to compare when selecting the most similar term. - } - -defaultOptions :: Options -defaultOptions = Options - { optionsLookaheadPlaces = 0 - , optionsMaxSimilarTerms = 2 - , optionsNodeComparisons = 10 - } - -defaultP, defaultQ :: Int -defaultP = 0 -defaultQ = 3 - - -toKdMap :: [(Int, Term syntax (FeatureVector, ann))] -> KdMap.KdMap Double FeatureVector (Int, Term syntax (FeatureVector, ann)) -toKdMap = KdMap.build unFV . fmap (fst . termAnnotation . snd &&& id) - --- | A `Gram` is a fixed-size view of some portion of a tree, consisting of a `stem` of _p_ labels for parent nodes, and a `base` of _q_ labels of sibling nodes. Collectively, the bag of `Gram`s for each node of a tree (e.g. as computed by `pqGrams`) form a summary of the tree. -data Gram label = Gram { stem :: [Maybe label], base :: [Maybe label] } - deriving (Eq, Generic, Hashable, Show) - --- | Annotates a term with a feature vector at each node, using the default values for the p, q, and d parameters. -defaultFeatureVectorDecorator :: (Hashable1 syntax, Traversable syntax) - => Term syntax ann - -> Term syntax (FeatureVector, ann) -defaultFeatureVectorDecorator = featureVectorDecorator . pqGramDecorator defaultP defaultQ - --- | Annotates a term with a feature vector at each node, parameterized by stem length, base width, and feature vector dimensions. -featureVectorDecorator :: (Foldable syntax, Functor syntax, Hashable label) => Term syntax (Gram label, ann) -> Term syntax (FeatureVector, ann) -featureVectorDecorator = cata (\ (In (label, ann) functor) -> - termIn (foldl' addSubtermVector (unitVector (hash label)) functor, ann) functor) - where addSubtermVector v term = addVectors v (fst (termAnnotation term)) - --- | Annotates a term with the corresponding p,q-gram at each node. -pqGramDecorator :: Traversable syntax - => Int -- ^ 'p'; the desired stem length for the grams. - -> Int -- ^ 'q'; the desired base length for the grams. - -> Term syntax ann -- ^ The term to decorate. - -> Term syntax (Gram (Label syntax), ann) -- ^ The decorated term. -pqGramDecorator p q = cata algebra - where - algebra term = let label = Label (termFOut term) in - termIn (gram label, termFAnnotation term) (assignParentAndSiblingLabels (termFOut term) label) - gram label = Gram (padToSize p []) (padToSize q (pure (Just label))) - assignParentAndSiblingLabels functor label = (`evalState` (replicate (q `div` 2) Nothing <> siblingLabels functor)) (for functor (assignLabels label)) - - assignLabels :: label - -> Term syntax (Gram label, ann) - -> State [Maybe label] (Term syntax (Gram label, ann)) - assignLabels label (Term.Term (In (gram, rest) functor)) = do - labels <- get - put (drop 1 labels) - pure $! termIn (gram { stem = padToSize p (Just label : stem gram), base = padToSize q labels }, rest) functor - siblingLabels :: Traversable syntax => syntax (Term syntax (Gram label, ann)) -> [Maybe label] - siblingLabels = foldMap (base . fst . termAnnotation) - padToSize n list = take n (list <> repeat empty) - --- | Test the comparability of two root 'Term's in O(1). -canCompareTerms :: ComparabilityRelation syntax ann1 ann2 -> Term syntax ann1 -> Term syntax ann2 -> Bool -canCompareTerms canCompare t1 t2 = canCompare (unTerm t1) (unTerm t2) - --- | Recursively test the equality of two 'Term's in O(n). -equalTerms :: Eq1 syntax => ComparabilityRelation syntax ann1 ann2 -> Term syntax ann1 -> Term syntax ann2 -> Bool -equalTerms canCompare = go - where go a b = canCompareTerms canCompare a b && liftEq go (termOut a) (termOut b) - - --- | Return an edit distance between two terms, up to a certain depth. --- --- Computes a constant-time approximation to the edit distance of a diff. This is done by comparing at most _m_ nodes, & assuming the rest are zero-cost. -editDistanceUpTo :: (Diffable syntax, Foldable syntax, Functor syntax) => Int -> Term syntax ann1 -> Term syntax ann2 -> Int -editDistanceUpTo m a b = diffCost m (approximateDiff a b) - where diffCost = flip . cata $ \ diff m -> case diff of - _ | m <= 0 -> 0 - Merge body -> sum (fmap ($ pred m) body) - body -> succ (sum (fmap ($ pred m) body)) - approximateDiff a b = maybe (replacing a b) (merge (termAnnotation a, termAnnotation b)) (tryAlignWith (Just . these deleting inserting approximateDiff) (termOut a) (termOut b)) - - -data Label syntax where - Label :: syntax a -> Label syntax - -instance Hashable1 syntax => Hashable (Label syntax) where hashWithSalt salt (Label syntax) = liftHashWithSalt const salt syntax - -instance Eq1 syntax => Eq (Label syntax) where Label a == Label b = liftEq (const (const True)) a b - -instance Ord1 syntax => Ord (Label syntax) where Label a `compare` Label b = liftCompare (const (const EQ)) a b - -instance Show1 syntax => Show (Label syntax) where showsPrec d (Label syntax) = liftShowsPrec (const (const id)) (const id) d syntax diff --git a/src/Diffing/Algorithm/RWS/FeatureVector.hs b/src/Diffing/Algorithm/RWS/FeatureVector.hs deleted file mode 100644 index 71237af7ea..0000000000 --- a/src/Diffing/Algorithm/RWS/FeatureVector.hs +++ /dev/null @@ -1,55 +0,0 @@ -{-# LANGUAGE BangPatterns, MagicHash #-} -module Diffing.Algorithm.RWS.FeatureVector -( FeatureVector -, unFV -, unitVector -, addVectors -) where - -import GHC.Prim -import GHC.Types -import System.Random.Mersenne.Pure64 - --- | A 15-dimensional feature vector represented with machine doubles. --- --- 15 dimensions ought to be enough for anyone. cf Β§5.2 of RWS-Diff: β€œWe obtained best results with 10 ≀ d ≀ 20.” -data FeatureVector = FV !Double# !Double# !Double# !Double# !Double# - !Double# !Double# !Double# !Double# !Double# - !Double# !Double# !Double# !Double# !Double# - -unFV :: FeatureVector -> [Double] -unFV (FV d00 d01 d02 d03 d04 d05 d06 d07 d08 d09 d10 d11 d12 d13 d14) - = [ D# d00, D# d01, D# d02, D# d03, D# d04 - , D# d05, D# d06, D# d07, D# d08, D# d09 - , D# d10, D# d11, D# d12, D# d13, D# d14 ] - --- | Computes a unit vector of the specified dimension from a hash. -unitVector :: Int -> FeatureVector -unitVector !hash = - let !(D# d00, r00) = randomDouble (pureMT (fromIntegral hash)) - !(D# d01, r01) = randomDouble r00 - !(D# d02, r02) = randomDouble r01 - !(D# d03, r03) = randomDouble r02 - !(D# d04, r04) = randomDouble r03 - !(D# d05, r05) = randomDouble r04 - !(D# d06, r06) = randomDouble r05 - !(D# d07, r07) = randomDouble r06 - !(D# d08, r08) = randomDouble r07 - !(D# d09, r09) = randomDouble r08 - !(D# d10, r10) = randomDouble r09 - !(D# d11, r11) = randomDouble r10 - !(D# d12, r12) = randomDouble r11 - !(D# d13, r13) = randomDouble r12 - !(D# d14, _) = randomDouble r13 - !(D# one) = 1 - !invMagnitude = one /## sqrtDouble# (d00 *## d00 +## d01 *## d01 +## d02 *## d02 +## d03 *## d03 +## d04 *## d04 +## d05 *## d05 +## d06 *## d06 +## d07 *## d07 +## d08 *## d08 +## d09 *## d09 +## d10 *## d10 +## d11 *## d11 +## d12 *## d12 +## d13 *## d13 +## d14 *## d14) - in FV (invMagnitude *## d00) (invMagnitude *## d01) (invMagnitude *## d02) (invMagnitude *## d03) (invMagnitude *## d04) - (invMagnitude *## d05) (invMagnitude *## d06) (invMagnitude *## d07) (invMagnitude *## d08) (invMagnitude *## d09) - (invMagnitude *## d10) (invMagnitude *## d11) (invMagnitude *## d12) (invMagnitude *## d13) (invMagnitude *## d14) - -addVectors :: FeatureVector -> FeatureVector -> FeatureVector -addVectors (FV a00 a01 a02 a03 a04 a05 a06 a07 a08 a09 a10 a11 a12 a13 a14) - (FV b00 b01 b02 b03 b04 b05 b06 b07 b08 b09 b10 b11 b12 b13 b14) - = FV (a00 +## b00) (a01 +## b01) (a02 +## b02) (a03 +## b03) (a04 +## b04) - (a05 +## b05) (a06 +## b06) (a07 +## b07) (a08 +## b08) (a09 +## b09) - (a10 +## b10) (a11 +## b11) (a12 +## b12) (a13 +## b13) (a14 +## b14) diff --git a/src/Diffing/Algorithm/SES.hs b/src/Diffing/Algorithm/SES.hs deleted file mode 100644 index bcbe59b41e..0000000000 --- a/src/Diffing/Algorithm/SES.hs +++ /dev/null @@ -1,70 +0,0 @@ -{-# LANGUAGE BangPatterns, GADTs, MultiParamTypeClasses, ScopedTypeVariables #-} -module Diffing.Algorithm.SES -( EditScript -, ses -) where - -import Data.Array ((!)) -import qualified Data.Array as Array -import Data.Foldable (find, toList) -import Data.Ix -import Data.These - --- | An edit script, i.e. a sequence of changes/copies of elements. -type EditScript a b = [These a b] - -data Endpoint a b = Endpoint { x :: {-# UNPACK #-} !Int, _y :: {-# UNPACK #-} !Int, _script :: EditScript a b } - deriving (Eq, Show) - - --- | Compute the shortest edit script using Myers’ algorithm. -ses :: (Foldable t, Foldable u) => (a -> b -> Bool) -> t a -> u b -> EditScript a b -ses eq as' bs' - | null bs = This <$> toList as - | null as = That <$> toList bs - | otherwise = reverse (searchUpToD 0 (Array.array (1, 1) [(1, Endpoint 0 (-1) [])])) - where (as, bs) = (Array.listArray (0, pred n) (toList as'), Array.listArray (0, pred m) (toList bs')) - (!n, !m) = (length as', length bs') - - -- Search an edit graph for the shortest edit script up to a given proposed edit distance, building on the results of previous searches. - searchUpToD !d !v = - let !endpoints = slideFrom . searchAlongK <$> [ k | k <- [-d, -d + 2 .. d], inRange (-m, n) k ] in - case find isComplete endpoints of - Just (Endpoint _ _ script) -> script - _ -> searchUpToD (succ d) (Array.array (-d, d) ((\ e@(Endpoint x y _) -> (x - y, e)) <$> endpoints)) - where isComplete (Endpoint x y _) = x >= n && y >= m - - -- Search an edit graph for the shortest edit script along a specific diagonal, moving onto a given diagonal from one of its in-bounds adjacent diagonals (if any). - searchAlongK !k - | k == -d = moveDownFrom (v ! succ k) - | k == d = moveRightFrom (v ! pred k) - | k == -m = moveDownFrom (v ! succ k) - | k == n = moveRightFrom (v ! pred k) - | otherwise = - let left = v ! pred k - up = v ! succ k in - if x left < x up then - moveDownFrom up - else - moveRightFrom left - - -- | Move downward from a given vertex, inserting the element for the corresponding row. - moveDownFrom (Endpoint x y script) = Endpoint x (succ y) $ maybe script ((: script) . That) (bs !? y) - {-# INLINE moveDownFrom #-} - - -- | Move rightward from a given vertex, deleting the element for the corresponding column. - moveRightFrom (Endpoint x y script) = Endpoint (succ x) y $ maybe script ((: script) . This) (as !? x) - {-# INLINE moveRightFrom #-} - - -- | Slide down any diagonal edges from a given vertex. - slideFrom (Endpoint x y script) - | Just a <- as !? x - , Just b <- bs !? y - , a `eq` b = slideFrom (Endpoint (succ x) (succ y) (These a b : script)) - | otherwise = Endpoint x y script - - -(!?) :: Ix i => Array.Array i a -> i -> Maybe a -(!?) v i | inRange (Array.bounds v) i, !a <- v ! i = Just a - | otherwise = Nothing -{-# INLINE (!?) #-} diff --git a/src/Diffing/Interpreter.hs b/src/Diffing/Interpreter.hs deleted file mode 100644 index bd46e142d5..0000000000 --- a/src/Diffing/Interpreter.hs +++ /dev/null @@ -1,71 +0,0 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, TypeOperators, UndecidableInstances #-} -module Diffing.Interpreter -( diffTerms -, diffTermPair -, stripDiff -) where - -import Control.Effect -import Control.Effect.Carrier -import Control.Effect.Cull -import Control.Effect.NonDet -import Control.Effect.Sum -import qualified Data.Diff as Diff -import Data.Term -import Diffing.Algorithm -import Diffing.Algorithm.RWS -import Prologue - --- | Diff two Γ  la carte terms recursively. -diffTerms :: (Diffable syntax, Eq1 syntax, Hashable1 syntax, Traversable syntax) - => Term syntax ann - -> Term syntax ann - -> Diff.Diff syntax ann ann -diffTerms t1 t2 = stripDiff (fromMaybe (Diff.replacing t1' t2') (run (runNonDetOnce (runDiff (algorithmForTerms t1' t2'))))) - where (t1', t2') = ( defaultFeatureVectorDecorator t1 - , defaultFeatureVectorDecorator t2) - --- | Strips the head annotation off a diff annotated with non-empty records. -stripDiff :: Functor syntax - => Diff.Diff syntax (FeatureVector, ann) (FeatureVector, ann) - -> Diff.Diff syntax ann ann -stripDiff = bimap snd snd - --- | Diff a 'These' of terms. -diffTermPair :: (Diffable syntax, Eq1 syntax, Hashable1 syntax, Traversable syntax) => These (Term syntax ann) (Term syntax ann) -> Diff.Diff syntax ann ann -diffTermPair = these Diff.deleting Diff.inserting diffTerms - - --- | Run an 'Algorithm' to completion in an 'Alternative' context using the supplied comparability & equivalence relations. -runDiff :: Algorithm - (Term syntax (FeatureVector, ann)) - (Term syntax (FeatureVector, ann)) - (Diff.Diff syntax (FeatureVector, ann) (FeatureVector, ann)) - (DiffC (Term syntax (FeatureVector, ann)) (Term syntax (FeatureVector, ann)) (Diff.Diff syntax (FeatureVector, ann) (FeatureVector, ann)) m) - result - -> m result -runDiff = runDiffC . runAlgorithm - - -newtype DiffC term1 term2 diff m a = DiffC { runDiffC :: m a } - deriving (Alternative, Applicative, Functor, Monad, MonadIO) - -instance ( Alternative m - , Carrier sig m - , Diffable syntax - , Eq1 syntax - , Member NonDet sig - , Monad m - , Traversable syntax - ) - => Carrier - (Diff (Term syntax (FeatureVector, ann)) (Term syntax (FeatureVector, ann)) (Diff.Diff syntax (FeatureVector, ann) (FeatureVector, ann)) :+: sig) - (DiffC (Term syntax (FeatureVector, ann)) (Term syntax (FeatureVector, ann)) (Diff.Diff syntax (FeatureVector, ann) (FeatureVector, ann)) m) where - eff (L op) = case op of - Diff t1 t2 k -> runDiff (algorithmForTerms t1 t2) <|> pure (Diff.replacing t1 t2) >>= k - Linear (Term (In ann1 f1)) (Term (In ann2 f2)) k -> Diff.merge (ann1, ann2) <$> tryAlignWith (runDiff . diffThese) f1 f2 >>= k - RWS as bs k -> traverse (runDiff . diffThese) (rws comparableTerms equivalentTerms as bs) >>= k - Delete a k -> k (Diff.deleting a) - Insert b k -> k (Diff.inserting b) - Replace a b k -> k (Diff.replacing a b) - eff (R other) = DiffC . eff . handleCoercible $ other diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs deleted file mode 100644 index 6958561923..0000000000 --- a/src/Language/Go/Assignment.hs +++ /dev/null @@ -1,666 +0,0 @@ -{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.Go.Assignment -( assignment -, Syntax -, Grammar -, Term -) where - -import Prologue - -import Assigning.Assignment hiding (Assignment, Error) -import qualified Assigning.Assignment as Assignment -import qualified Data.Abstract.ScopeGraph as ScopeGraph (AccessControl(..)) -import Data.Abstract.Name (name) -import Data.Syntax - (contextualize, emptyTerm, handleError, infixContext, makeTerm, makeTerm', makeTerm'', makeTerm1, parseError) -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Expression as Expression -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Statement as Statement -import qualified Data.Syntax.Type as Type -import qualified Data.Term as Term -import Language.Go.Syntax as Go.Syntax hiding (runeLiteral, labelName) -import Language.Go.Type as Go.Type -import Data.ImportPath (importPath, defaultAlias) -import TreeSitter.Go as Grammar - -type Syntax = - '[ Comment.Comment - , Declaration.Constructor - , Declaration.Function - , Declaration.Method - , Declaration.MethodSignature - , Declaration.Type - , Declaration.TypeAlias - , Expression.Plus - , Expression.Minus - , Expression.Times - , Expression.DividedBy - , Expression.Modulo - , Expression.Power - , Expression.Negate - , Expression.FloorDivision - , Expression.BOr - , Expression.BAnd - , Expression.BXOr - , Expression.LShift - , Expression.RShift - , Expression.UnsignedRShift - , Expression.Complement - , Expression.Call - , Expression.LessThan - , Expression.LessThanEqual - , Expression.GreaterThan - , Expression.GreaterThanEqual - , Expression.Equal - , Expression.StrictEqual - , Expression.Comparison - , Expression.Subscript - , Expression.Member - , Statement.PostDecrement - , Statement.PostIncrement - , Expression.MemberAccess - , Expression.And - , Expression.Not - , Expression.Or - , Expression.XOr - , Go.Syntax.Composite - , Go.Syntax.DefaultPattern - , Go.Syntax.Defer - , Go.Syntax.Field - , Go.Syntax.Go - , Go.Syntax.Label - , Go.Syntax.Package - , Go.Syntax.Receive - , Go.Syntax.ReceiveOperator - , Go.Syntax.Rune - , Go.Syntax.Select - , Go.Syntax.Send - , Go.Syntax.Slice - , Go.Syntax.TypeAssertion - , Go.Syntax.TypeConversion - , Go.Syntax.TypeSwitch - , Go.Syntax.TypeSwitchGuard - , Go.Syntax.Variadic - , Go.Type.BidirectionalChannel - , Go.Type.ReceiveChannel - , Go.Type.SendChannel - , Go.Syntax.Import - , Go.Syntax.QualifiedImport - , Go.Syntax.SideEffectImport - , Literal.Array - , Literal.Complex - , Literal.Float - , Literal.Hash - , Literal.Integer - , Literal.KeyValue - , Literal.Pointer - , Literal.Reference - , Literal.TextElement - , Statement.Assignment - , Statement.Break - , Statement.Continue - , Statement.For - , Statement.ForEach - , Statement.Goto - , Statement.If - , Statement.Match - , Statement.NoOp - , Statement.Pattern - , Statement.Return - , Statement.Statements - , Syntax.Context - , Syntax.Error - , Syntax.Empty - , Syntax.Identifier - , Type.Annotation - , Type.Array - , Type.Function - , Type.Interface - , Type.Map - , Type.Parenthesized - , Type.Pointer - , Type.Slice - , [] - , Literal.String - , Literal.EscapeSequence - , Literal.Null - , Literal.Boolean - ] - -type Term = Term.Term (Sum Syntax) Location -type Assignment = Assignment.Assignment [] Grammar - --- | Assignment from AST in Go's grammar onto a program in Go's syntax. -assignment :: Assignment Term -assignment = handleError program <|> parseError - -program :: Assignment Term -program = makeTerm <$> symbol SourceFile <*> children (Statement.Statements <$> manyTerm expression) - -expression :: Assignment Term -expression = term (handleError (choice expressionChoices)) - -expressionChoices :: [Assignment Term] -expressionChoices = - [ argumentList - , assignment' - , boolean - , binaryExpression - , block - , breakStatement - , callExpression - , communicationClause - , compositeLiteral - , continueStatement - , varDeclaration - , varSpecification - , decStatement - , defaultCase - , deferStatement - , element - , elseClause - , emptyStatement - , expressionCaseClause - , expressionList - , expressionSwitchStatement - , fallThroughStatement - , fieldDeclaration - , fieldDeclarationList - , fieldIdentifier - , floatLiteral - , forStatement - , functionDeclaration - , goStatement - , gotoStatement - , ifInitializer - , ifStatement - , imaginaryLiteral - , incStatement - , identifier - , importDeclaration - , indexExpression - , interpretedStringLiteral - , intLiteral - , keyedElement - , labelName - , labeledStatement - , literalValue - , methodDeclaration - , methodSpec - , methodSpecList - , nil - , packageClause - , packageIdentifier - , parameterDeclaration - , parameters - , parenthesizedExpression - , rawStringLiteral - , receiveStatement - , returnStatement - , runeLiteral - , selectStatement - , selectorExpression - , sendStatement - , shortVarDeclaration - , sliceExpression - , unaryExpression - , variadicArgument - , variadicParameterDeclaration - , types - ] - -types :: Assignment Term -types = - choice [ arrayType - , channelType - , functionType - , implicitLengthArrayType - , interfaceType - , mapType - , parenthesizedType - , pointerType - , qualifiedType - , sliceType - , structType - , typeAssertion - , typeConversion - , typeDeclaration - , typeIdentifier - , typeCase - , typeCaseClause - , typeSwitchGuard - , typeSwitchStatement - ] - -identifiers :: Assignment Term -identifiers = makeTerm'' <$> location <*> manyTerm identifier - -expressions :: Assignment Term -expressions = makeTerm'' <$> location <*> manyTerm expression - - --- Literals - -comment :: Assignment Term -comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) - -compositeLiteral :: Assignment Term -compositeLiteral = makeTerm <$> symbol CompositeLiteral <*> children (Go.Syntax.Composite <$> expression <*> expression) - -element :: Assignment Term -element = symbol Element *> children expression - -fieldIdentifier :: Assignment Term -fieldIdentifier = makeTerm <$> symbol FieldIdentifier <*> (Syntax.Identifier . name <$> source) - -floatLiteral :: Assignment Term -floatLiteral = makeTerm <$> symbol FloatLiteral <*> (Literal.Float <$> source) - -identifier :: Assignment Term -identifier = makeTerm <$> (symbol Identifier <|> symbol Identifier' <|> symbol Identifier'') <*> (Syntax.Identifier . name <$> source) - -imaginaryLiteral :: Assignment Term -imaginaryLiteral = makeTerm <$> symbol ImaginaryLiteral <*> (Literal.Complex <$> source) - -interpretedStringLiteral :: Assignment Term -interpretedStringLiteral = makeTerm' <$> symbol InterpretedStringLiteral <*> children ( (inject . Literal.String <$> some escapeSequence) - <|> (inject . Literal.TextElement <$> source)) - -escapeSequence :: Assignment Term -escapeSequence = makeTerm <$> symbol EscapeSequence <*> (Literal.EscapeSequence <$> source) - -intLiteral :: Assignment Term -intLiteral = makeTerm <$> symbol IntLiteral <*> (Literal.Integer <$> source) - -literalValue :: Assignment Term -literalValue = makeTerm <$> symbol LiteralValue <*> children (manyTerm expression) - -packageIdentifier :: Assignment Term -packageIdentifier = makeTerm <$> symbol PackageIdentifier <*> (Syntax.Identifier . name <$> source) - -parenthesizedType :: Assignment Term -parenthesizedType = makeTerm <$> symbol Grammar.ParenthesizedType <*> children (Type.Parenthesized <$> expression) - -rawStringLiteral :: Assignment Term -rawStringLiteral = makeTerm <$> symbol RawStringLiteral <*> (Literal.TextElement <$> source) - -runeLiteral :: Assignment Term -runeLiteral = makeTerm <$> symbol Grammar.RuneLiteral <*> (Go.Syntax.Rune <$> source) - -typeIdentifier :: Assignment Term -typeIdentifier = makeTerm <$> symbol TypeIdentifier <*> (Syntax.Identifier . name <$> source) - -nil :: Assignment Term -nil = makeTerm <$> symbol Nil <*> (Literal.Null <$ source) - -boolean :: Assignment Term -boolean = makeTerm <$> token Grammar.True <*> pure Literal.true - <|> makeTerm <$> token Grammar.False <*> pure Literal.false - - --- Primitive Types - -arrayType :: Assignment Term -arrayType = makeTerm <$> symbol ArrayType <*> children (Type.Array . Just <$> expression <*> expression) - -channelType :: Assignment Term -channelType = makeTerm' <$> symbol ChannelType <*> children (mkChannelType <$> optional (token AnonLAngleMinus) <* token AnonChan <*> optional (token AnonLAngleMinus) <*> expression) - where - mkChannelType :: Maybe a -> Maybe a -> b -> Sum Syntax b - mkChannelType receive send | Just _ <- receive = inject . Go.Type.ReceiveChannel - | Just _ <- send = inject . Go.Type.SendChannel - | otherwise = inject . Go.Type.BidirectionalChannel - -fieldDeclaration :: Assignment Term -fieldDeclaration = mkFieldDeclarationWithTag <$> symbol FieldDeclaration <*> children ((,,) <$> (manyTermsTill expression (void (symbol TypeIdentifier)) <|> manyTerm expression) <*> optional expression <*> optional expression) - where - mkFieldDeclarationWithTag loc (fields, type', tag) | Just ty <- type', Just tag' <- tag = makeTerm loc (Go.Syntax.Field [ty, tag'] (makeTerm loc fields)) - | Just ty <- type' = makeTerm loc (Go.Syntax.Field [ty] (makeTerm loc fields)) - | Just tag' <- tag = makeTerm loc (Go.Syntax.Field [tag'] (makeTerm loc fields)) - | otherwise = makeTerm loc (Go.Syntax.Field [] (makeTerm loc fields)) - -fieldDeclarationList :: Assignment Term -fieldDeclarationList = symbol FieldDeclarationList *> children expressions - -functionType :: Assignment Term -functionType = makeTerm <$> symbol FunctionType <*> children (Type.Function <$> params <*> (expression <|> emptyTerm)) - where params = symbol ParameterList *> children (manyTerm expression) - -implicitLengthArrayType :: Assignment Term -implicitLengthArrayType = makeTerm <$> symbol ImplicitLengthArrayType <*> children (Type.Array Nothing <$> expression) - -interfaceType :: Assignment Term -interfaceType = makeTerm <$> symbol InterfaceType <*> children (Type.Interface <$> manyTerm expression) - -mapType :: Assignment Term -mapType = makeTerm <$> symbol MapType <*> children (Type.Map <$> expression <*> expression) - -pointerType :: Assignment Term -pointerType = makeTerm <$> symbol PointerType <*> children (Type.Pointer <$> expression) - -qualifiedType :: Assignment Term -qualifiedType = makeTerm <$> symbol QualifiedType <*> children (Expression.MemberAccess <$> expression <*> typeIdentifier) - -sliceType :: Assignment Term -sliceType = makeTerm <$> symbol SliceType <*> children (Type.Slice <$> expression) - -structType :: Assignment Term -structType = makeTerm <$> symbol StructType <*> children (Declaration.Constructor [] <$> emptyTerm <*> expressions) - -typeAlias :: Assignment Term -typeAlias = makeTerm <$> symbol TypeAlias <*> children (Declaration.TypeAlias [] <$> expression <*> expression) - -typeDeclaration :: Assignment Term -typeDeclaration = makeTerm <$> symbol TypeDeclaration <*> children (manyTerm ( (makeTerm <$> symbol TypeSpec <*> children (Declaration.Type <$> typeIdentifier <*> expression)) - <|> typeAlias )) - - - --- Expressions - -argumentList :: Assignment Term -argumentList = (symbol ArgumentList <|> symbol ArgumentList') *> children expressions - -binaryExpression :: Assignment Term -binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expression expression - [ (inject .) . Expression.Plus <$ symbol AnonPlus - , (inject .) . Expression.Minus <$ symbol AnonMinus - , (inject .) . Expression.Times <$ symbol AnonStar - , (inject .) . Expression.DividedBy <$ symbol AnonSlash - , (inject .) . Expression.Modulo <$ symbol AnonPercent - , (inject .) . Expression.Or <$ symbol AnonPipePipe - , (inject .) . Expression.And <$ symbol AnonAmpersandAmpersand - , (inject .) . Expression.LessThan <$ symbol AnonLAngle - , (inject .) . Expression.LessThanEqual <$ symbol AnonLAngleEqual - , (inject .) . Expression.GreaterThan <$ symbol AnonRAngle - , (inject .) . Expression.GreaterThanEqual <$ symbol AnonRAngleEqual - , (inject .) . invert Expression.Equal <$ symbol AnonBangEqual - , (inject .) . Expression.Equal <$ symbol AnonEqualEqual - , (inject .) . Expression.BOr <$ symbol AnonPipe - , (inject .) . Expression.BAnd <$ symbol AnonAmpersand - , (inject .) . Expression.BAnd <$ symbol AnonAmpersandCaret - , (inject .) . Expression.BXOr <$ symbol AnonCaret - , (inject .) . Expression.LShift <$ symbol AnonLAngleLAngle - , (inject .) . Expression.RShift <$ symbol AnonRAngleRAngle - ]) - where - invert cons a b = Expression.Not (makeTerm1 (cons a b)) - -block :: Assignment Term -block = symbol Block *> children expressions - -defaultCase :: Assignment Term -defaultCase = makeTerm <$> symbol DefaultCase <*> children (Go.Syntax.DefaultPattern <$> (expressions <|> emptyTerm)) - -defaultExpressionCase :: Assignment Term -defaultExpressionCase = makeTerm <$> symbol DefaultCase <*> (Go.Syntax.DefaultPattern <$ rawSource <*> (expressions <|> emptyTerm)) - -callExpression :: Assignment Term -callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call [] <$> expression <*> manyTerm expression <*> emptyTerm) - -expressionCase :: Assignment Term -expressionCase = makeTerm <$> symbol ExpressionCase <*> (Statement.Pattern <$> children expressions <*> expressions) - -expressionCaseClause :: Assignment Term -expressionCaseClause = symbol ExpressionCaseClause *> children (expressionCase <|> defaultExpressionCase) - -expressionList :: Assignment Term -expressionList = symbol ExpressionList *> children expressions - -expressionSwitchStatement :: Assignment Term -expressionSwitchStatement = makeTerm <$> symbol ExpressionSwitchStatement <*> children (Statement.Match <$> (makeTerm <$> location <*> manyTermsTill expression (void (symbol ExpressionCaseClause)) <|> emptyTerm) <*> expressions) - -fallThroughStatement :: Assignment Term -fallThroughStatement = makeTerm <$> symbol FallthroughStatement <*> (Statement.Pattern <$> (makeTerm <$> location <*> (Syntax.Identifier . name <$> source)) <*> emptyTerm) - -functionDeclaration :: Assignment Term -functionDeclaration = makeTerm <$> (symbol FunctionDeclaration <|> symbol FuncLiteral) <*> children (mkFunctionDeclaration <$> (term identifier <|> emptyTerm) <*> params <*> returnTypes <*> (term block <|> emptyTerm)) - where - returnTypes = pure <$> (term types <|> term identifier <|> term returnParameters) - <|> pure [] - params = symbol ParameterList *> children (manyTerm expression) - mkFunctionDeclaration name' params' types' block' = Declaration.Function types' name' params' block' - returnParameters = makeTerm <$> symbol ParameterList <*> children (manyTerm expression) - -importDeclaration :: Assignment Term -importDeclaration = makeTerm'' <$> symbol ImportDeclaration <*> children (manyTerm (importSpec <|> importSpecList)) - where - -- `import . "lib/Math"` - dotImport = inject <$> (flip Go.Syntax.Import <$> dot <*> importFromPath) - -- `import _ "lib/Math"` - sideEffectImport = inject <$> (flip Go.Syntax.SideEffectImport <$> underscore <*> importFromPath) - -- `import m "lib/Math"` - namedImport = inject <$> (flip Go.Syntax.QualifiedImport <$> packageIdentifier <*> importFromPath) - -- `import "lib/Math"` - plainImport = inject <$> (symbol InterpretedStringLiteral >>= \loc -> do - from <- importPath <$> source - let alias = makeTerm loc (Syntax.Identifier (defaultAlias from)) -- Go takes `import "lib/Math"` and uses `Math` as the qualified name (e.g. `Math.Sin()`) - pure $! Go.Syntax.QualifiedImport from alias) - interpretedStringLiteral' = symbol InterpretedStringLiteral *> children ( (inject . Literal.String <$> some escapeSequence) - <|> (inject . Literal.TextElement <$> source)) - rawStringLiteral' = symbol RawStringLiteral *> (inject . Literal.TextElement <$> source) - dot = makeTerm <$> symbol Dot <*> (Literal.TextElement <$> source) - underscore = makeTerm <$> symbol BlankIdentifier <*> (Literal.TextElement <$> source) - importSpec = makeTerm' <$> symbol ImportSpec <*> children (sideEffectImport <|> dotImport <|> namedImport <|> plainImport <|> interpretedStringLiteral' <|> rawStringLiteral') - importSpecList = makeTerm <$> symbol ImportSpecList <*> children (manyTerm (importSpec <|> comment)) - importFromPath = symbol InterpretedStringLiteral *> (importPath <$> source) - -indexExpression :: Assignment Term -indexExpression = makeTerm <$> symbol IndexExpression <*> children (Expression.Subscript <$> expression <*> manyTerm expression) - -methodDeclaration :: Assignment Term -methodDeclaration = makeTerm <$> symbol MethodDeclaration <*> children (mkTypedMethodDeclaration <$> receiver <*> pure publicAccessControl <*> term fieldIdentifier <*> params <*> returnParameters <*> (term block <|> emptyTerm)) - where - params = symbol ParameterList *> children (manyTerm expression) - receiver = symbol ParameterList *> children expressions - mkTypedMethodDeclaration receiver' accessControl name' parameters' type'' body' = Declaration.Method type'' receiver' name' parameters' body' accessControl - returnParameters = (symbol ParameterList *> children (manyTerm expression)) - <|> pure <$> expression - <|> pure [] - -methodSpec :: Assignment Term -methodSpec = makeTerm <$> symbol MethodSpec <*> children (mkMethodSpec publicAccessControl <$> expression <*> params <*> (expression <|> emptyTerm)) - where - params = symbol ParameterList *> children (manyTerm expression) - mkMethodSpec accessControl name' params optionalTypeLiteral = Declaration.MethodSignature [optionalTypeLiteral] name' params accessControl - -publicAccessControl :: ScopeGraph.AccessControl -publicAccessControl = ScopeGraph.Public - -methodSpecList :: Assignment Term -methodSpecList = symbol MethodSpecList *> children expressions - -packageClause :: Assignment Term -packageClause = makeTerm <$> symbol PackageClause <*> children (Go.Syntax.Package <$> expression <*> pure []) - -parameters :: Assignment Term -parameters = symbol ParameterList *> children expressions - -parameterDeclaration :: Assignment Term -parameterDeclaration = makeTerm <$> symbol ParameterDeclaration <*> children (manyTerm expression) - -parenthesizedExpression :: Assignment Term -parenthesizedExpression = symbol ParenthesizedExpression *> children expressions - -selectorExpression :: Assignment Term -selectorExpression = makeWithContext <$> symbol SelectorExpression <*> children ((,,) <$> expression <*> optional comment <*> fieldIdentifier) - where makeWithContext loc (lhs, comment, rhs) = maybe (makeTerm loc (Expression.MemberAccess lhs rhs)) (\c -> makeTerm loc (Syntax.Context (c :| []) (makeTerm loc (Expression.MemberAccess lhs rhs)))) comment - -sliceExpression :: Assignment Term -sliceExpression = makeTerm <$> symbol SliceExpression <*> children (Go.Syntax.Slice <$> expression <* token AnonLBracket <*> (emptyTerm <|> expression) <* token AnonColon <*> (expression <|> emptyTerm) <* optional (token AnonColon) <*> (expression <|> emptyTerm)) - -typeAssertion :: Assignment Term -typeAssertion = makeTerm <$> symbol TypeAssertionExpression <*> children (Go.Syntax.TypeAssertion <$> expression <*> expression) - -typeCase :: Assignment Term -typeCase = symbol TypeCase *> children expressions - -typeCaseClause :: Assignment Term -typeCaseClause = makeTerm <$> symbol TypeCaseClause <*> children (Statement.Pattern <$> expression <*> expressions) - -typeConversion :: Assignment Term -typeConversion = makeTerm <$> symbol TypeConversionExpression <*> children (Go.Syntax.TypeConversion <$> expression <*> expression) - -typeSwitchGuard :: Assignment Term -typeSwitchGuard = makeTerm <$> symbol Grammar.TypeSwitchGuard <*> children (Go.Syntax.TypeSwitchGuard <$> expressions) - -typeSwitchStatement :: Assignment Term -typeSwitchStatement = makeTerm <$> symbol TypeSwitchStatement <*> children (Go.Syntax.TypeSwitch <$> typeSwitchSubject <*> expressions) - where - typeSwitchSubject = makeTerm <$> location <*> manyTermsTill expression (void (symbol TypeCaseClause)) <|> emptyTerm - -unaryExpression :: Assignment Term -unaryExpression = makeTerm' <$> symbol UnaryExpression <*> ( notExpression - <|> unaryMinus - <|> unaryAmpersand - <|> unaryReceive - <|> unaryPointer - <|> unaryComplement - <|> unaryPlus ) - where - notExpression = inject <$> children (Expression.Not <$ symbol AnonBang <*> expression) - unaryAmpersand = inject <$> children (Literal.Reference <$ symbol AnonAmpersand <*> expression) - unaryComplement = inject <$> children (Expression.Complement <$ symbol AnonCaret <*> expression) - unaryMinus = inject <$> children (Expression.Negate <$ symbol AnonMinus <*> expression) - unaryPlus = children (symbol AnonPlus *> (Term.termOut <$> expression)) - unaryPointer = inject <$> children (Literal.Pointer <$ symbol AnonStar <*> expression) - unaryReceive = inject <$> children (Go.Syntax.ReceiveOperator <$ symbol AnonLAngleMinus <*> expression) - -varDeclaration :: Assignment Term -varDeclaration = (symbol ConstDeclaration <|> symbol VarDeclaration) *> children expressions - -variadicArgument :: Assignment Term -variadicArgument = makeTerm <$> symbol VariadicArgument <*> children (Go.Syntax.Variadic [] <$> expressions) - -variadicParameterDeclaration :: Assignment Term -variadicParameterDeclaration = makeTerm <$> symbol VariadicParameterDeclaration <*> children (flip Go.Syntax.Variadic <$> (expression <|> emptyTerm) <* token AnonDotDotDot <*> many expression) - -varSpecification :: Assignment Term -varSpecification = makeTerm <$> (symbol ConstSpec <|> symbol VarSpec) <*> children (Statement.Assignment [] <$> (annotatedLHS <|> identifiers) <*> expressions) - where - annotatedLHS = makeTerm <$> location <*> (Type.Annotation <$> (makeTerm <$> location <*> manyTermsTill identifier (void (symbol TypeIdentifier))) <*> expression) - - --- Statements - -assignment' :: Assignment Term -assignment' = makeTerm' <$> symbol AssignmentStatement <*> children (infixTerm expressionList expressionList - [ assign <$ symbol AnonEqual - , augmentedAssign Expression.Plus <$ symbol AnonPlusEqual - , augmentedAssign Expression.Minus <$ symbol AnonMinusEqual - , augmentedAssign Expression.Times <$ symbol AnonStarEqual - , augmentedAssign Expression.DividedBy <$ symbol AnonSlashEqual - , augmentedAssign Expression.BOr <$ symbol AnonPipeEqual - , augmentedAssign Expression.BAnd <$ symbol AnonAmpersandEqual - , augmentedAssign Expression.Modulo <$ symbol AnonPercentEqual - , augmentedAssign Expression.RShift <$ symbol AnonRAngleRAngleEqual - , augmentedAssign Expression.LShift <$ symbol AnonLAngleLAngleEqual - , augmentedAssign Expression.BXOr <$ symbol AnonCaretEqual - , augmentedAssign (invert Expression.BAnd) <$ symbol AnonAmpersandCaretEqual - ]) - where - assign :: Term -> Term -> Sum Syntax Term - assign l r = inject (Statement.Assignment [] l r) - - augmentedAssign :: (f :< Syntax) => (Term -> Term -> f Term) -> Term -> Term -> Sum Syntax Term - augmentedAssign c l r = assign l (makeTerm1 (c l r)) - - invert cons a b = Expression.Not (makeTerm1 (cons a b)) - -breakStatement :: Assignment Term -breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (expression <|> emptyTerm)) - -communicationClause :: Assignment Term -communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Statement.Pattern <$> (communicationCase <|> expression) <*> expressions) - where - communicationCase = symbol CommunicationCase *> children expression - -continueStatement :: Assignment Term -continueStatement = makeTerm <$> symbol ContinueStatement <*> children (Statement.Continue <$> (expression <|> emptyTerm)) - -decStatement :: Assignment Term -decStatement = makeTerm <$> symbol DecStatement <*> children (Statement.PostDecrement <$> expression) - -deferStatement :: Assignment Term -deferStatement = makeTerm <$> symbol DeferStatement <*> children (Go.Syntax.Defer <$> expression) - -elseClause :: Assignment Term -elseClause = symbol ElseClause *> children expression - -emptyStatement :: Assignment Term -emptyStatement = makeTerm <$> token EmptyStatement <*> (Statement.NoOp <$> emptyTerm) - -forStatement :: Assignment Term -forStatement = makeTerm' <$> symbol ForStatement <*> children (forClause <|> forSimpleClause <|> rangeClause) - where - forClause = inject <$> (symbol ForClause *> children (Statement.For <$> (expression <|> emptyTerm) <*> (expression <|> emptyTerm) <*> (expression <|> emptyTerm)) <*> expression) - forSimpleClause = inject <$> (Statement.For <$> emptyTerm <*> (expression <|> emptyTerm) <*> emptyTerm <*> expression) - rangeClause = inject <$> (symbol RangeClause *> children (Statement.ForEach <$> (expression <|> emptyTerm) <*> expression) <*> expression) - -goStatement :: Assignment Term -goStatement = makeTerm <$> symbol GoStatement <*> children (Go.Syntax.Go <$> expression) - -gotoStatement :: Assignment Term -gotoStatement = makeTerm <$> symbol GotoStatement <*> children (Statement.Goto <$> expression) - -ifStatement :: Assignment Term -ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> (makeTerm <$> location <*> manyTermsTill expression (void (symbol Block))) <*> expression <*> (expression <|> emptyTerm)) - -ifInitializer :: Assignment Term -ifInitializer = symbol IfInitializer *> children expression - -incStatement :: Assignment Term -incStatement = makeTerm <$> symbol IncStatement <*> children (Statement.PostIncrement <$> expression) - -keyedElement :: Assignment Term -keyedElement = makeTerm <$> symbol KeyedElement <*> children (Literal.KeyValue <$> expression <*> expression) - -labelName :: Assignment Term -labelName = makeTerm <$> symbol LabelName <*> (Syntax.Identifier . name <$> source) - -labeledStatement :: Assignment Term -labeledStatement = makeTerm <$> (symbol LabeledStatement <|> symbol LabeledStatement') <*> children (Go.Syntax.Label <$> expression <*> (expression <|> emptyTerm)) - -returnStatement :: Assignment Term -returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> (expression <|> emptyTerm)) - -receiveStatement :: Assignment Term -receiveStatement = makeTerm <$> symbol ReceiveStatement <*> children (Go.Syntax.Receive <$> (expression <|> emptyTerm) <*> expression) - -shortVarDeclaration :: Assignment Term -shortVarDeclaration = makeTerm <$> symbol ShortVarDeclaration <*> children (Statement.Assignment [] <$> expression <*> expression) - -selectStatement :: Assignment Term -selectStatement = makeTerm <$> symbol SelectStatement <*> children (Go.Syntax.Select <$> expressions) - -sendStatement :: Assignment Term -sendStatement = makeTerm <$> symbol SendStatement <*> children (Go.Syntax.Send <$> expression <*> expression) - - --- Helpers - --- | Match infix terms separated by any of a list of operators, assigning any comments following each operand. -infixTerm :: Assignment Term - -> Assignment Term - -> [Assignment (Term -> Term -> Sum Syntax Term)] - -> Assignment (Sum Syntax Term) -infixTerm = infixContext comment - --- | Match a series of terms or comments until a delimiter is matched -manyTermsTill :: Assignment Term - -> Assignment b - -> Assignment [Term] -manyTermsTill step end = manyTill (step <|> comment) end - --- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present. -manyTerm :: Assignment Term -> Assignment [Term] -manyTerm = many . term - --- | Match a term and contextualize any comments preceeding or proceeding the term. -term :: Assignment Term -> Assignment Term -term term' = contextualize comment term' <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs deleted file mode 100644 index be3ea33265..0000000000 --- a/src/Language/Go/Syntax.hs +++ /dev/null @@ -1,254 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.Go.Syntax where - -import Prologue - -import Control.Abstract -import Data.Abstract.BaseError -import Data.Abstract.Evaluatable -import Data.Abstract.Module -import qualified Data.Abstract.Package as Package -import Data.Abstract.Path -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.ImportPath -import Data.JSON.Fields -import qualified Data.Map as Map -import Data.Semigroup.App -import Data.Semigroup.Foldable -import qualified Data.Text as T -import Diffing.Algorithm -import System.FilePath.Posix - -resolveGoImport :: ( Member (Modules address value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Package.PackageInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Member Trace sig - , Carrier sig m - ) - => ImportPath - -> Evaluator term address value m [ModulePath] -resolveGoImport (ImportPath path Data.ImportPath.Unknown) = throwResolutionError $ GoImportError path -resolveGoImport (ImportPath path Relative) = do - ModuleInfo{..} <- currentModule - paths <- listModulesInDir (joinPaths (takeDirectory modulePath) path) - case paths of - [] -> throwResolutionError $ GoImportError path - _ -> pure paths -resolveGoImport (ImportPath path NonRelative) = do - package <- T.unpack . formatName . Package.packageName <$> currentPackage - trace ("attempting to resolve " <> show path <> " for package " <> package) - case splitDirectories path of - -- Import an absolute path that's defined in this package being analyzed. - -- First two are source, next is package name, remaining are path to package - -- (e.g. github.com/golang//path...). - (_ : _ : p : xs) | p == package -> listModulesInDir (joinPath xs) - _ -> throwResolutionError $ GoImportError path - --- | Import declarations (symbols are added directly to the calling environment). --- --- If the list of symbols is empty copy everything to the calling environment. -data Import a = Import { importFrom :: ImportPath, importWildcardToken :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Import - -instance Evaluatable Import where - eval _ _ (Language.Go.Syntax.Import importPath _) = do - paths <- resolveGoImport importPath - for_ paths $ \path -> do - traceResolve (unPath importPath) path - ((moduleScope, moduleFrame), _) <- require path - insertImportEdge moduleScope - insertFrameLink ScopeGraph.Import (Map.singleton moduleScope moduleFrame) - unit - - --- | Qualified Import declarations (symbols are qualified in calling environment). --- --- If the list of symbols is empty copy and qualify everything to the calling environment. -data QualifiedImport a = QualifiedImport { qualifiedImportFrom :: !ImportPath, qualifiedImportAlias :: !a} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically QualifiedImport - -instance Evaluatable QualifiedImport where - eval _ _ (QualifiedImport importPath aliasTerm) = do - paths <- resolveGoImport importPath - span <- ask @Span - scopeAddress <- newScope mempty - name <- declareMaybeName (declaredName aliasTerm) Default Public span ScopeGraph.QualifiedImport (Just scopeAddress) - aliasSlot <- lookupSlot (Declaration name) - - withScope scopeAddress $ do - let - go [] = pure () - go (modulePath : paths) = - mkScopeMap modulePath (\scopeMap -> do - objFrame <- newFrame scopeAddress (Map.singleton ScopeGraph.Import scopeMap) - val <- object objFrame - assign aliasSlot val - for_ paths $ \modulePath -> - mkScopeMap modulePath (withFrame objFrame . insertFrameLink ScopeGraph.Import)) - where mkScopeMap modulePath fun = do - ((moduleScope, moduleFrame), _) <- require modulePath - insertImportEdge moduleScope - fun (Map.singleton moduleScope moduleFrame) - go paths - unit - --- | Side effect only imports (no symbols made available to the calling environment). -data SideEffectImport a = SideEffectImport { sideEffectImportFrom :: !ImportPath, sideEffectImportToken :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically SideEffectImport - --- TODO: Revisit this and confirm if this is correct. -instance Evaluatable SideEffectImport where - eval _ _ (SideEffectImport importPath _) = do - paths <- resolveGoImport importPath - traceResolve (unPath importPath) paths - for_ paths $ \path -> require path -- Do we need to construct any scope / frames for these side-effect imports? - unit - --- A composite literal in Go -data Composite a = Composite { compositeType :: !a, compositeElement :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Composite - --- TODO: Implement Eval instance for Composite -instance Evaluatable Composite - --- | A default pattern in a Go select or switch statement (e.g. `switch { default: s() }`). -newtype DefaultPattern a = DefaultPattern { defaultPatternBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically DefaultPattern - --- TODO: Implement Eval instance for DefaultPattern -instance Evaluatable DefaultPattern - --- | A defer statement in Go (e.g. `defer x()`). -newtype Defer a = Defer { deferBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Defer - --- TODO: Implement Eval instance for Defer -instance Evaluatable Defer - --- | A go statement (i.e. go routine) in Go (e.g. `go x()`). -newtype Go a = Go { goBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Go - --- TODO: Implement Eval instance for Go -instance Evaluatable Go - --- | A label statement in Go (e.g. `label:continue`). -data Label a = Label { labelName :: !a, labelStatement :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Label - --- TODO: Implement Eval instance for Label -instance Evaluatable Label - --- | A rune literal in Go (e.g. `'⌘'`). -newtype Rune a = Rune { runeLiteral :: Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Rune - --- TODO: Implement Eval instance for Rune -instance Evaluatable Rune - --- | A select statement in Go (e.g. `select { case x := <-c: x() }` where each case is a send or receive operation on channels). -newtype Select a = Select { selectCases :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Select - --- TODO: Implement Eval instance for Select -instance Evaluatable Select - --- | A send statement in Go (e.g. `channel <- value`). -data Send a = Send { sendReceiver :: !a, sendValue :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Send - --- TODO: Implement Eval instance for Send -instance Evaluatable Send - --- | A slice expression in Go (e.g. `a[1:4:3]` where a is a list, 1 is the low bound, 4 is the high bound, and 3 is the max capacity). -data Slice a = Slice { sliceName :: !a, sliceLow :: !a, sliceHigh :: !a, sliceCapacity :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Slice - --- TODO: Implement Eval instance for Slice -instance Evaluatable Slice - --- | A type switch statement in Go (e.g. `switch x.(type) { // cases }`). -data TypeSwitch a = TypeSwitch { typeSwitchSubject :: !a, typeSwitchCases :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeSwitch - --- TODO: Implement Eval instance for TypeSwitch -instance Evaluatable TypeSwitch - --- | A type switch guard statement in a Go type switch statement (e.g. `switch i := x.(type) { // cases}`). -newtype TypeSwitchGuard a = TypeSwitchGuard { typeSwitchGuardSubject :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeSwitchGuard - --- TODO: Implement Eval instance for TypeSwitchGuard -instance Evaluatable TypeSwitchGuard - --- | A receive statement in a Go select statement (e.g. `case value := <-channel` ) -data Receive a = Receive { receiveSubject :: !a, receiveExpression :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Receive - --- TODO: Implement Eval instance for Receive -instance Evaluatable Receive - --- | A receive operator unary expression in Go (e.g. `<-channel` ) -newtype ReceiveOperator a = ReceiveOperator { value :: a} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ReceiveOperator - --- TODO: Implement Eval instance for ReceiveOperator -instance Evaluatable ReceiveOperator - --- | A field declaration in a Go struct type declaration. -data Field a = Field { fieldContext :: ![a], fieldName :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Field - --- TODO: Implement Eval instance for Field -instance Evaluatable Field - -data Package a = Package { packageName :: !a, packageContents :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Package - -instance Evaluatable Package where - eval eval _ (Package _ xs) = maybe unit (runApp . foldMap1 (App . eval)) (nonEmpty xs) - --- | A type assertion in Go (e.g. `x.(T)` where the value of `x` is not nil and is of type `T`). -data TypeAssertion a = TypeAssertion { typeAssertionSubject :: !a, typeAssertionType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeAssertion - --- TODO: Implement Eval instance for TypeAssertion -instance Evaluatable TypeAssertion - --- | A type conversion expression in Go (e.g. `T(x)` where `T` is a type and `x` is an expression that can be converted to type `T`). -data TypeConversion a = TypeConversion { typeConversionType :: !a, typeConversionSubject :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeConversion - --- TODO: Implement Eval instance for TypeConversion -instance Evaluatable TypeConversion - --- | Variadic arguments and parameters in Go (e.g. parameter: `param ...Type`, argument: `Type...`). -data Variadic a = Variadic { variadicContext :: [a], variadicIdentifier :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Variadic - --- TODO: Implement Eval instance for Variadic -instance Evaluatable Variadic diff --git a/src/Language/Go/Type.hs b/src/Language/Go/Type.hs deleted file mode 100644 index 6a7813dc55..0000000000 --- a/src/Language/Go/Type.hs +++ /dev/null @@ -1,33 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.Go.Type where - -import Prologue - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import Diffing.Algorithm - --- | A Bidirectional channel in Go (e.g. `chan`). -newtype BidirectionalChannel a = BidirectionalChannel { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically BidirectionalChannel - --- TODO: Implement Eval instance for BidirectionalChannel -instance Evaluatable BidirectionalChannel - --- | A Receive channel in Go (e.g. `<-chan`). -newtype ReceiveChannel a = ReceiveChannel { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ReceiveChannel - --- TODO: Implement Eval instance for ReceiveChannel -instance Evaluatable ReceiveChannel - --- | A Send channel in Go (e.g. `chan<-`). -newtype SendChannel a = SendChannel { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically SendChannel - --- TODO: Implement Eval instance for SendChannel -instance Evaluatable SendChannel diff --git a/src/Language/Haskell/Assignment.hs b/src/Language/Haskell/Assignment.hs deleted file mode 100644 index ff08cd8306..0000000000 --- a/src/Language/Haskell/Assignment.hs +++ /dev/null @@ -1,935 +0,0 @@ -{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.Haskell.Assignment -( assignment -, Syntax -, Grammar -, Term -) where - -import Prologue - -import Assigning.Assignment hiding (Assignment, Error, count) -import qualified Assigning.Assignment as Assignment -import qualified Data.Abstract.Name as Name -import Data.ByteString.Char8 (count) -import qualified Data.List.NonEmpty as NonEmpty -import Data.Syntax - (contextualize, emptyTerm, handleError, makeTerm, makeTerm', makeTerm'', makeTerm1, parseError, postContextualize) -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Statement as Statement -import qualified Data.Syntax.Type as Type -import qualified Data.Term as Term -import qualified Language.Haskell.Syntax as Syntax -import TreeSitter.Haskell as Grammar - -type Syntax = '[ - Comment.Comment - , Declaration.Constructor - , Declaration.Datatype - , Declaration.Function - , Literal.Array - , Literal.Character - , Literal.Float - , Literal.Integer - , Literal.TextElement - , Literal.Tuple - , Statement.If - , Statement.Match - , Statement.Pattern - , Syntax.AllConstructors - , Syntax.AnnotatedTypeVariable - , Syntax.App - , Syntax.ArithmeticSequence - , Syntax.AsPattern - , Syntax.BindPattern - , Syntax.CaseGuardPattern - , Syntax.Class - , Syntax.ConstructorIdentifier - , Syntax.ConstructorOperator - , Syntax.ConstructorPattern - , Syntax.ConstructorSymbol - , Syntax.Context - , Syntax.ContextAlt - , Syntax.CPPDirective - , Syntax.DefaultDeclaration - , Syntax.DefaultSignature - , Syntax.Deriving - , Syntax.Do - , Syntax.Empty - , Syntax.Error - , Syntax.EqualityConstraint - , Syntax.Export - , Syntax.ExpressionTypeSignature - , Syntax.Field - , Syntax.FieldBind - , Syntax.FieldPattern - , Syntax.FixityAlt - , Syntax.FunctionalDependency - , Syntax.FunctionConstructor - , Syntax.FunctionGuardPattern - , Syntax.FunctionType - , Syntax.GADT - , Syntax.GADTConstructor - , Syntax.Generator - , Syntax.Guard - , Syntax.HiddenImport - , Syntax.Identifier - , Syntax.InfixConstructorIdentifier - , Syntax.InfixOperatorApp - , Syntax.InfixVariableIdentifier - , Syntax.ImplicitParameterIdentifier - , Syntax.Import - , Syntax.ImportAlias - , Syntax.ImportDeclaration - , Syntax.InfixDataConstructor - , Syntax.InfixOperatorPattern - , Syntax.Instance - , Syntax.IrrefutablePattern - , Syntax.Kind - , Syntax.KindFunctionType - , Syntax.KindListType - , Syntax.KindParenthesizedConstructor - , Syntax.KindSignature - , Syntax.KindTupleType - , Syntax.LabeledConstruction - , Syntax.LabeledPattern - , Syntax.LabeledUpdate - , Syntax.Lambda - , Syntax.LambdaCase - , Syntax.LeftOperatorSection - , Syntax.Let - , Syntax.ListComprehension - , Syntax.ListConstructor - , Syntax.ListPattern - , Syntax.Module - , Syntax.ModuleExport - , Syntax.ModuleIdentifier - , Syntax.NamedFieldPun - , Syntax.NegativeLiteral - , Syntax.NewType - , Syntax.PatternGuard - , Syntax.Pragma - , Syntax.PrefixNegation - , Syntax.PrimitiveConstructorIdentifier - , Syntax.PrimitiveVariableIdentifier - , Syntax.PromotedTypeOperator - , Syntax.QualifiedConstructorIdentifier - , Syntax.QualifiedInfixVariableIdentifier - , Syntax.QualifiedModuleIdentifier - , Syntax.QualifiedImportDeclaration - , Syntax.QualifiedTypeClassIdentifier - , Syntax.QualifiedTypeConstructorIdentifier - , Syntax.QualifiedVariableIdentifier - , Syntax.QuasiQuotation - , Syntax.QuasiQuotationDeclaration - , Syntax.QuasiQuotationExpression - , Syntax.QuasiQuotationExpressionBody - , Syntax.QuasiQuotationPattern - , Syntax.QuasiQuotationQuoter - , Syntax.QuasiQuotationType - , Syntax.QuotedName - , Syntax.RecordDataConstructor - , Syntax.RecordWildCards - , Syntax.RightOperatorSection - , Syntax.ScopedTypeVariables - , Syntax.Splice - , Syntax.StandaloneDerivingInstance - , Syntax.Star - , Syntax.StrictPattern - , Syntax.StrictType - , Syntax.StrictTypeVariable - , Syntax.TupleConstructor - , Syntax.TupleExpression - , Syntax.TuplePattern - , Syntax.Type - , Syntax.TypeApp - , Syntax.TypeClass - , Syntax.TypeClassIdentifier - , Syntax.TypeClassInstance - , Syntax.TypeConstructorExport - , Syntax.TypeConstructorIdentifier - , Syntax.TypeFamily - , Syntax.TypeInstance - , Syntax.TypeOperator - , Syntax.TypePattern - , Syntax.TypeSignature - , Syntax.TypeSynonym - , Syntax.TypeVariableIdentifier - , Syntax.UnitConstructor - , Syntax.VariableIdentifier - , Syntax.VariableOperator - , Syntax.VariableSymbol - , Syntax.ViewPattern - , Syntax.Wildcard - , Type.TypeParameters - , [] - ] - -type Term = Term.Term (Sum Syntax) Location -type Assignment = Assignment.Assignment [] Grammar - -assignment :: Assignment Term -assignment = handleError $ module' <|> parseError - -algebraicDatatypeDeclaration :: Assignment Term -algebraicDatatypeDeclaration = makeTerm - <$> symbol AlgebraicDatatypeDeclaration - <*> children (Declaration.Datatype - <$> (context' <|> emptyTerm) - <*> (makeTerm <$> location <*> (Syntax.Type <$> typeConstructor <*> typeParameters <*> (kindSignature <|> emptyTerm))) - <*> (constructors <|> pure []) - <*> (term derivingClause <|> emptyTerm)) - where - constructors = symbol Constructors *> children (manyTerm constructor) - -allConstructors :: Assignment Term -allConstructors = makeTerm <$> token AllConstructors <*> pure Syntax.AllConstructors - -alternative :: Assignment Term -alternative = makeTerm <$> symbol Alternative <*> children (Statement.Pattern <$> expression <*> expressions) - -annotatedTypeVariable :: Assignment Term -annotatedTypeVariable = makeTerm <$> symbol AnnotatedTypeVariable <*> children (Syntax.AnnotatedTypeVariable <$> typeVariableIdentifier <* token Annotation <*> expression) - -app :: Assignment Term -app = makeTerm <$> symbol FunctionApplication <*> children (Syntax.App <$> expression <*> (typeApp <|> emptyTerm) <*> expression) - -arithmeticSequence :: Assignment Term -arithmeticSequence = symbol ArithmeticSequence *> children ( enumFrom - <|> enumFromThen - <|> enumFromTo - <|> enumFromThenTo) - where - enumFrom = makeTerm <$> symbol EnumFrom <*> children (Syntax.ArithmeticSequence <$> expression <*> pure Nothing <*> pure Nothing) - enumFromThen = makeTerm <$> symbol EnumFromThen <*> children (Syntax.ArithmeticSequence <$> expression <*> fmap Just expression <*> pure Nothing) - enumFromTo = makeTerm <$> symbol EnumFromTo <*> children (Syntax.ArithmeticSequence <$> expression <*> fmap Just expression <*> pure Nothing) - enumFromThenTo = makeTerm <$> symbol EnumFromThenTo <*> children (Syntax.ArithmeticSequence <$> expression <*> fmap Just expression <*> fmap Just expression) - -asPattern :: Assignment Term -asPattern = makeTerm <$> symbol AsPattern <*> children (Syntax.AsPattern <$> expression <*> expression) - -bindPattern :: Assignment Term -bindPattern = makeTerm <$> symbol BindPattern <*> children (Syntax.BindPattern <$> manyTermsTill expression (symbol AnonLAngleMinus) <*> expression) - -case' :: Assignment Term -case' = makeTerm <$> symbol CaseExpression <*> children (Statement.Match <$> expression <*> expressions) - -caseGuardPattern :: Assignment Term -caseGuardPattern = makeTerm <$> symbol CaseGuardPattern <*> children (Syntax.CaseGuardPattern <$> manyTerm expression) - -character :: Assignment Term -character = makeTerm <$> symbol Char <*> (Literal.Character <$> source) - -class' :: Assignment Term -class' = makeTerm <$> symbol Class <*> children (Syntax.Class <$> manyTerm expression) - -comment :: Assignment Term -comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) - -conditionalExpression :: Assignment Term -conditionalExpression = makeTerm <$> symbol ConditionalExpression <*> children (Statement.If <$> expression <*> expression <*> expression) - -constructor :: Assignment Term -constructor = (makeTerm <$> symbol DataConstructor <*> children (Declaration.Constructor <$> manyTerm (context' <|> scopedTypeVariables) <*> typeConstructor <*> typeParameters)) - <|> term (makeTerm <$> symbol RecordDataConstructor <*> children (Syntax.RecordDataConstructor <$> manyTerm (context' <|> scopedTypeVariables) <*> constructorIdentifier <*> term fields)) - <|> term (makeTerm <$> symbol InfixDataConstructor <*> children (Syntax.InfixDataConstructor <$> manyTerm (context' <|> scopedTypeVariables) <*> expression <*> expression <*> expression)) - -constructorIdentifier :: Assignment Term -constructorIdentifier = makeTerm <$> symbol ConstructorIdentifier <*> (Syntax.ConstructorIdentifier . Name.name <$> source) - -constructorOperator :: Assignment Term -constructorOperator = makeTerm <$> symbol ConstructorOperator <*> children (Syntax.ConstructorOperator <$> expression) - -constructorPattern :: Assignment Term -constructorPattern = makeTerm <$> symbol ConstructorPattern <*> children (Syntax.ConstructorPattern <$> expressions) - -constructorSymbol :: Assignment Term -constructorSymbol = makeTerm <$> symbol ConstructorSymbol <*> (Syntax.ConstructorSymbol . Name.name <$> source) - -context' :: Assignment Term -context' = makeTerm <$> symbol Context <*> children (Syntax.ContextAlt <$> expressions) - -contextPattern :: Assignment Term -contextPattern = symbol ContextPattern *> children expressions - -cppDirective :: Assignment Term -cppDirective = makeTerm <$> symbol CppDirective <*> (Syntax.CPPDirective <$> source) - -defaultDeclaration :: Assignment Term -defaultDeclaration = makeTerm <$> symbol DefaultDeclaration <*> children (Syntax.DefaultDeclaration <$> manyTerm expression) - -defaultSignature :: Assignment Term -defaultSignature = makeTerm <$> symbol DefaultSignature <*> children (Syntax.DefaultSignature <$> manyTermsTill expression (symbol Annotation) <* token Annotation <*> manyTerm (context' <|> scopedTypeVariables) <*> expressions) - -derivingClause :: Assignment Term -derivingClause = makeTerm <$> symbol Deriving <*> children (Syntax.Deriving <$> manyTerm expression) - -do' :: Assignment Term -do' = makeTerm <$> symbol Do <*> children (Syntax.Do <$> manyTerm expression) - -equalityConstraint :: Assignment Term -equalityConstraint = makeTerm <$> symbol EqualityConstraint <*> children (Syntax.EqualityConstraint <$> equalityLhs <*> equalityRhs) - where - equalityLhs = symbol EqualityLhs *> children expression - equalityRhs = symbol EqualityRhs *> children expression - -export :: Assignment Term -export = makeTerm <$> symbol Export <*> children (Syntax.Export <$> expressions) - -expression' :: Assignment Term -expression' = symbol Expression *> children expressions - -expressions :: Assignment Term -expressions = makeTerm'' <$> location <*> manyTerm expression - -expression :: Assignment Term -expression = term (handleError (choice expressionChoices)) - -expressionChoices :: [Assignment Term] -expressionChoices = [ - algebraicDatatypeDeclaration - , allConstructors - , alternative - , annotatedTypeVariable - , app - , arithmeticSequence - , asPattern - , bindPattern - , case' - , caseGuardPattern - , character - , class' - , comment - , conditionalExpression - , context' - , contextPattern - , constructorIdentifier - , constructorOperator - , constructorPattern - , constructorSymbol - , cppDirective - , defaultDeclaration - , defaultSignature - , derivingClause - , do' - , equalityConstraint - , expression' - , expressionTypeSignature - , fields - , fieldBind - , fieldPattern - , fixityDeclaration - , float - , functionalDependency - , functionConstructor - , functionDeclaration - , functionGuardPattern - , functionType - , gadtConstructor - , gadtDeclaration - , generator - , guard' - , implicitParameterIdentifier - , importAlias - , importDeclaration - , infixConstructorIdentifier - , infixOperatorApp - , infixOperatorPattern - , infixVariableIdentifier - , instance' - , integer - , irrefutablePattern - , kind - , kindListType - , kindFunctionType - , kindParenthesizedConstructor - , kindSignature - , kindTupleType - , labeledConstruction - , labeledPattern - , labeledUpdate - , lambda - , lambdaCase - , letExpression - , letStatement - , listConstructor - , listComprehension - , listExpression - , listPattern - , listType - , moduleExport - , moduleIdentifier - , namedFieldPun - , negativeLiteral - , newType - , operator - , operatorSection - , parenthesizedConstructorOperator - , parenthesizedExpression - , parenthesizedPattern - , parenthesizedTypePattern - , pattern' - , patternGuard - , pragma - , prefixNegation - , primitiveConstructorIdentifier - , primitiveVariableIdentifier - , promotedTypeOperator - , qualifiedConstructorIdentifier - , qualifiedImportDeclaration - , qualifiedInfixVariableIdentifier - , qualifiedModuleIdentifier - , qualifiedTypeClassIdentifier - , qualifiedTypeConstructorIdentifier - , qualifiedVariableIdentifier - , quasiQuotation - , quasiQuotationDeclaration - , quasiQuotationExpression - , quasiQuotationExpressionBody - , quasiQuotationPattern - , quasiQuotationQuoter - , quasiQuotationType - , quotedName - , recordWildCards - , scopedTypeVariables - , splice - , standaloneDerivingInstance - , star - , strictPattern - , strictType - , string - , tuple - , tuplePattern - , tupleType - , type' - , type'' - , typeApp - , typeClass - , typeClassIdentifier - , typeClassInstance - , typeConstructor - , typeFamily - , typeInstance - , typePattern - , typeConstructorExport - , typeConstructorIdentifier - , typeOperator - , typeSignature - , typeSynonymDeclaration - , typeVariableIdentifier - , tuplingConstructor - , unitConstructor - , variableIdentifier - , variableOperator - , variableSymbol - , viewPattern - , where' - , wildcard - ] - -expressionTypeSignature :: Assignment Term -expressionTypeSignature = makeTerm <$> symbol ExpressionTypeSignature <*> children (Syntax.ExpressionTypeSignature <$> manyTermsTill expression (symbol Annotation) <* token Annotation <*> manyTerm (context' <|> scopedTypeVariables) <*> expressions) - -fields :: Assignment Term -fields = makeTerm <$> symbol Fields <*> children (manyTerm field) - -field :: Assignment Term -field = makeTerm - <$> symbol Field - <*> children (Syntax.Field - <$> variableIdentifiers - <* token Annotation - <*> fieldType) - where - fieldType = makeTerm <$> location <*> (Syntax.Type <$> term (type' <|> typeVariableIdentifier) <*> typeParameters <*> (kindSignature <|> emptyTerm)) - -fieldBind :: Assignment Term -fieldBind = makeTerm <$> symbol FieldBind <*> children (Syntax.FieldBind <$> expression <*> expression) - -fieldPattern :: Assignment Term -fieldPattern = makeTerm <$> symbol FieldPattern <*> children (Syntax.FieldPattern <$> expression <*> expressions) - -fixityDeclaration :: Assignment Term -fixityDeclaration = makeTerm <$> symbol FixityDeclaration <*> children (Syntax.FixityAlt <$> (integer <|> emptyTerm) <*> manyTerm expression) - -float :: Assignment Term -float = makeTerm <$> symbol Float <*> (Literal.Float <$> source) - -functionalDependency :: Assignment Term -functionalDependency = makeTerm <$> symbol FunctionalDependency <*> children (Syntax.FunctionalDependency <$> expressions) - -functionBody :: Assignment Term -functionBody = makeTerm <$> symbol FunctionBody <*> children (manyTerm expression) - -functionConstructor :: Assignment Term -functionConstructor = makeTerm <$> token FunctionConstructor <*> pure Syntax.FunctionConstructor - -functionDeclaration :: Assignment Term -functionDeclaration = makeTerm - <$> symbol FunctionDeclaration - <*> children (Declaration.Function [] - <$> term expression - <*> (manyTermsTill expression (symbol FunctionBody) <|> pure []) - <*> functionBody) - -functionGuardPattern :: Assignment Term -functionGuardPattern = makeTerm <$> symbol FunctionGuardPattern <*> children (Syntax.FunctionGuardPattern <$> manyTerm expression) - -functionType :: Assignment Term -functionType = makeTerm <$> symbol FunctionType <*> children (Syntax.FunctionType <$> expression <*> expression) - -gadtConstructor :: Assignment Term -gadtConstructor = makeTerm - <$> symbol GadtConstructor - <*> children (Syntax.GADTConstructor - <$> (context' <|> emptyTerm) - <*> expression - <* token Annotation - <*> expressions) - -gadtDeclaration :: Assignment Term -gadtDeclaration = makeTerm - <$> symbol GadtDeclaration - <*> children (Syntax.GADT - <$> (context' <|> emptyTerm) - <*> (makeTerm <$> location <*> (Syntax.Type <$> typeConstructor <*> typeParameters' <*> (kindSignature <|> emptyTerm))) - <*> where') - where - typeParameters' = makeTerm <$> location <*> manyTermsTill expression (symbol KindSignature <|> symbol Where') - -generator :: Assignment Term -generator = makeTerm <$> symbol Generator <*> children (Syntax.Generator <$> expression <*> expression) - -guard' :: Assignment Term -guard' = makeTerm <$> symbol Guard <*> children (Syntax.Guard <$> expressions) - -hiddenImport :: Assignment Term -hiddenImport = makeTerm <$> symbol Import <*> children (Syntax.HiddenImport <$> expressions) - -hiddenImportSpec :: Assignment [Term] -hiddenImportSpec = symbol HiddenImportSpec *> children (manyTerm hiddenImport) - -implicitParameterIdentifier :: Assignment Term -implicitParameterIdentifier = makeTerm <$> symbol ImplicitParameterIdentifier <*> (Syntax.ImplicitParameterIdentifier . Name.name <$> source) - -import' :: Assignment Term -import' = makeTerm <$> symbol Import <*> children (Syntax.Import <$> expressions) - -importAlias :: Assignment Term -importAlias = makeTerm <$> symbol ImportAlias <*> children (Syntax.ImportAlias <$> expression <*> expression) - -importDeclaration :: Assignment Term -importDeclaration = makeTerm - <$> symbol ImportDeclaration - <*> children (Syntax.ImportDeclaration - <$> (packageQualifiedImport <|> emptyTerm) - <*> expression - <*> (importSpec <|> hiddenImportSpec <|> pure [])) - -importSpec :: Assignment [Term] -importSpec = symbol ImportSpec *> children (manyTerm import') - -inClause :: Assignment Term -inClause = symbol InClause *> children expressions - -infixConstructorIdentifier :: Assignment Term -infixConstructorIdentifier = makeTerm <$> symbol InfixConstructorIdentifier <*> children (Syntax.InfixConstructorIdentifier . Name.name <$> source) - -infixOperatorApp :: Assignment Term -infixOperatorApp = makeTerm <$> symbol InfixOperatorApplication <*> children (Syntax.InfixOperatorApp <$> expression <*> (typeApp <|> emptyTerm) <*> expression <*> (expressions <|> emptyTerm)) - -infixOperatorPattern :: Assignment Term -infixOperatorPattern = makeTerm <$> symbol InfixOperatorPattern <*> children (Syntax.InfixOperatorPattern <$> expression <*> operator <*> expression) - -infixVariableIdentifier :: Assignment Term -infixVariableIdentifier = makeTerm <$> symbol InfixVariableIdentifier <*> children (Syntax.InfixVariableIdentifier . Name.name <$> source) - -instance' :: Assignment Term -instance' = makeTerm <$> symbol Instance <*> children (Syntax.Instance <$> expressions) - -integer :: Assignment Term -integer = makeTerm <$> symbol Integer <*> (Literal.Integer <$> source) - -irrefutablePattern :: Assignment Term -irrefutablePattern = makeTerm <$> symbol IrrefutablePattern <*> children (Syntax.IrrefutablePattern <$> expression) - -kind :: Assignment Term -kind = kind' - <|> kindFunctionType - <|> kindListType - <|> kindParenthesizedConstructor - <|> kindSignature - <|> kindTupleType - <|> star - -kind' :: Assignment Term -kind' = makeTerm <$> symbol Kind <*> children (Syntax.Kind <$> expression) - -kindFunctionType :: Assignment Term -kindFunctionType = makeTerm <$> symbol KindFunctionType <*> children (Syntax.KindFunctionType <$> expression <*> expression) - -kindListType :: Assignment Term -kindListType = makeTerm <$> symbol KindListType <*> children (Syntax.KindListType <$> expression) - -kindParenthesizedConstructor :: Assignment Term -kindParenthesizedConstructor = makeTerm <$> symbol KindParenthesizedConstructor <*> children (Syntax.KindParenthesizedConstructor <$> expression) - -kindSignature :: Assignment Term -kindSignature = makeTerm <$> symbol KindSignature <*> children (Syntax.KindSignature <$ token Annotation <*> expression) - -kindTupleType :: Assignment Term -kindTupleType = makeTerm <$> symbol KindTupleType <*> children (Syntax.KindTupleType <$> manyTerm expression) - -labeledConstruction :: Assignment Term -labeledConstruction = makeTerm <$> symbol LabeledConstruction <*> children (Syntax.LabeledConstruction <$> expression <*> manyTerm expression) - -labeledPattern :: Assignment Term -labeledPattern = makeTerm <$> symbol LabeledPattern <*> children (Syntax.LabeledPattern <$> expressions) - -labeledUpdate :: Assignment Term -labeledUpdate = makeTerm <$> symbol LabeledUpdate <*> children (Syntax.LabeledUpdate <$> manyTerm expression) - -lambda :: Assignment Term -lambda = makeTerm <$> symbol Lambda <*> children (Syntax.Lambda <$> lambdaHead <*> lambdaBody) - where - lambdaHead = symbol LambdaHead *> children expressions - lambdaBody = symbol LambdaBody *> children expressions - -lambdaCase :: Assignment Term -lambdaCase = makeTerm <$> symbol LambdaCase <*> children (Syntax.LambdaCase <$> manyTerm expression) - -letExpression :: Assignment Term -letExpression = makeTerm <$> symbol LetExpression <*> children (Syntax.Let <$> manyTermsTill expression (symbol InClause) <*> inClause) - -letStatement :: Assignment Term -letStatement = makeTerm <$> symbol LetStatement <*> children (Syntax.Let <$> manyTerm expression <*> emptyTerm) - -listComprehension :: Assignment Term -listComprehension = makeTerm <$> symbol ListComprehension <*> children (Syntax.ListComprehension <$> expression <*> manyTerm expression) - -listConstructor :: Assignment Term -listConstructor = makeTerm <$> token ListConstructor <*> pure Syntax.ListConstructor - -listExpression :: Assignment Term -listExpression = makeTerm <$> symbol ListExpression <*> children (Literal.Array <$> manyTerm listElement) - where listElement = symbol Expression *> children expression - -listPattern :: Assignment Term -listPattern = makeTerm <$> symbol ListPattern <*> children (Syntax.ListPattern <$> expressions) - -listType :: Assignment Term -listType = makeTerm <$> symbol ListType <*> children (Literal.Array <$> manyTerm type') - -module' :: Assignment Term -module' = makeTerm - <$> symbol Module - <*> children (Syntax.Module - <$> manyTerm (comment <|> pragma) - <*> term (moduleIdentifier <|> qualifiedModuleIdentifier <|> emptyTerm) - <*> moduleExports - <*> term (where' <|> expressions <|> emptyTerm)) - where - moduleExports = symbol ModuleExports *> children (manyTerm export) - <|> pure [] - -moduleExport :: Assignment Term -moduleExport = makeTerm <$> symbol ModuleExport <*> children (Syntax.ModuleExport <$> expressions) - -moduleIdentifier :: Assignment Term -moduleIdentifier = makeTerm <$> symbol ModuleIdentifier <*> (Syntax.ModuleIdentifier . Name.name <$> source) - -namedFieldPun :: Assignment Term -namedFieldPun = makeTerm <$> symbol NamedFieldPun <*> children (Syntax.NamedFieldPun <$> expression) - -negativeLiteral :: Assignment Term -negativeLiteral = makeTerm <$> symbol NegativeLiteral <*> children (Syntax.NegativeLiteral <$> expression) - -newConstructor :: Assignment Term -newConstructor = makeTerm <$> symbol NewConstructor <*> children (Declaration.Constructor <$> manyTerm (context' <|> scopedTypeVariables) <*> expression <*> expressions) - -newType :: Assignment Term -newType = makeTerm <$> symbol NewtypeDeclaration <*> children (Syntax.NewType <$> manyTerm (context' <|> scopedTypeVariables) <*> typeLeft <*> newConstructor <*> (derivingClause <|> emptyTerm)) - where - typeLeft = makeTerm <$> location <*> manyTermsTill expression (symbol NewConstructor) - -operator :: Assignment Term -operator = constructorOperator - <|> typeOperator - <|> promotedTypeOperator - <|> variableOperator - -operatorSection :: Assignment Term -operatorSection = (makeTerm <$> symbol RightOperatorSection <*> children (Syntax.RightOperatorSection <$> expression <*> expression)) - <|> (makeTerm <$> symbol LeftOperatorSection <*> children (Syntax.LeftOperatorSection <$> expression <*> expression)) - -packageQualifiedImport :: Assignment Term -packageQualifiedImport = makeTerm <$> symbol PackageQualifiedImport <*> (Literal.TextElement <$> source) - -parenthesizedConstructorOperator :: Assignment Term -parenthesizedConstructorOperator = symbol ParenthesizedConstructorOperator *> children expression - -parenthesizedExpression :: Assignment Term -parenthesizedExpression = symbol ParenthesizedExpression *> children expressions - -parenthesizedPattern :: Assignment Term -parenthesizedPattern = symbol ParenthesizedPattern *> children expressions - -parenthesizedTypePattern :: Assignment Term -parenthesizedTypePattern = symbol ParenthesizedTypePattern *> children expressions - -pattern' :: Assignment Term -pattern' = symbol Pattern *> children expressions - -patternGuard :: Assignment Term -patternGuard = makeTerm <$> symbol PatternGuard <*> children (Syntax.PatternGuard <$> expression <*> (expression <|> emptyTerm)) - -pragma :: Assignment Term -pragma = makeTerm <$> symbol Pragma <*> (Syntax.Pragma <$> source) - -prefixNegation :: Assignment Term -prefixNegation = makeTerm <$> symbol PrefixNegation <*> children (Syntax.PrefixNegation <$> expression) - -primitiveConstructorIdentifier :: Assignment Term -primitiveConstructorIdentifier = makeTerm <$> symbol PrimitiveConstructorIdentifier <*> (Syntax.PrimitiveConstructorIdentifier . Name.name <$> source) - -primitiveVariableIdentifier :: Assignment Term -primitiveVariableIdentifier = makeTerm <$> symbol PrimitiveVariableIdentifier <*> (Syntax.PrimitiveVariableIdentifier . Name.name <$> source) - -promotedTypeOperator :: Assignment Term -promotedTypeOperator = makeTerm <$> symbol PromotedTypeOperator <*> children (Syntax.PromotedTypeOperator <$> expression) - -qualifiedConstructorIdentifier :: Assignment Term -qualifiedConstructorIdentifier = makeTerm <$> symbol QualifiedConstructorIdentifier <*> children (Syntax.QualifiedConstructorIdentifier <$> someTerm' expression) - -qualifiedImportDeclaration :: Assignment Term -qualifiedImportDeclaration = makeTerm - <$> symbol QualifiedImportDeclaration - <*> children (Syntax.QualifiedImportDeclaration - <$> (packageQualifiedImport <|> emptyTerm) - <*> expression - <*> (importSpec <|> hiddenImportSpec <|> pure [])) - -qualifiedInfixVariableIdentifier :: Assignment Term -qualifiedInfixVariableIdentifier = makeTerm <$> symbol QualifiedInfixVariableIdentifier <*> children (Syntax.QualifiedInfixVariableIdentifier <$> someTerm' expression) - -qualifiedModuleIdentifier :: Assignment Term -qualifiedModuleIdentifier = makeTerm <$> symbol QualifiedModuleIdentifier <*> children (Syntax.QualifiedModuleIdentifier <$> someTerm' expression) - -qualifiedTypeClassIdentifier :: Assignment Term -qualifiedTypeClassIdentifier = makeTerm <$> symbol QualifiedTypeClassIdentifier <*> children (Syntax.QualifiedTypeClassIdentifier <$> someTerm' expression) - -qualifiedTypeConstructorIdentifier :: Assignment Term -qualifiedTypeConstructorIdentifier = makeTerm <$> symbol QualifiedTypeConstructorIdentifier <*> children (Syntax.QualifiedTypeConstructorIdentifier <$> someTerm' expression) - -qualifiedVariableIdentifier :: Assignment Term -qualifiedVariableIdentifier = makeTerm <$> symbol QualifiedVariableIdentifier <*> children (Syntax.QualifiedVariableIdentifier <$> someTerm' expression) - -quasiQuotation :: Assignment Term -quasiQuotation = makeTerm <$> symbol QuasiQuotation <*> children (Syntax.QuasiQuotation <$> (expression <|> emptyTerm) <*> expression) - -quasiQuotationDeclaration :: Assignment Term -quasiQuotationDeclaration = makeTerm <$> token QuasiQuotationDeclaration <*> pure Syntax.QuasiQuotationDeclaration - -quasiQuotationExpression :: Assignment Term -quasiQuotationExpression = makeTerm <$> token QuasiQuotationExpression <*> pure Syntax.QuasiQuotationExpression - -quasiQuotationExpressionBody :: Assignment Term -quasiQuotationExpressionBody = makeTerm <$> symbol QuasiQuotationExpressionBody <*> (Syntax.QuasiQuotationExpressionBody . Name.name <$> source) - -quasiQuotationPattern :: Assignment Term -quasiQuotationPattern = makeTerm <$> token QuasiQuotationPattern <*> pure Syntax.QuasiQuotationPattern - -quasiQuotationQuoter :: Assignment Term -quasiQuotationQuoter = makeTerm <$> symbol QuasiQuotationQuoter <*> (Syntax.QuasiQuotationQuoter . Name.name <$> source) - -quasiQuotationType :: Assignment Term -quasiQuotationType = makeTerm <$> token QuasiQuotationType <*> pure Syntax.QuasiQuotationType - -quotedName :: Assignment Term -quotedName = makeTerm <$> symbol QuotedName <*> children (Syntax.QuotedName <$> expression) - -recordWildCards :: Assignment Term -recordWildCards = makeTerm <$> symbol RecordWildCards <*> (Syntax.RecordWildCards <$ source) - -scopedTypeVariables :: Assignment Term -scopedTypeVariables = makeTerm <$> symbol ScopedTypeVariables <*> children (Syntax.ScopedTypeVariables <$> expressions <* token Dot) - -splice :: Assignment Term -splice = makeTerm <$> symbol Splice <*> children (Syntax.Splice <$> expression) - -standaloneDerivingInstance :: Assignment Term -standaloneDerivingInstance = makeTerm <$> symbol StandaloneDerivingDeclaration <*> children (Syntax.StandaloneDerivingInstance <$> manyTerm (context' <|> scopedTypeVariables) <*> expression <*> instance') - where - instance' = symbol Instance *> children expressions - -star :: Assignment Term -star = makeTerm <$> token Star <*> pure Syntax.Star - -strictPattern :: Assignment Term -strictPattern = makeTerm <$> symbol StrictPattern <*> children (Syntax.StrictPattern <$> expression) - -strictType :: Assignment Term -strictType = makeTerm' - <$> symbol StrictType - <*> children ( (inject <$> (Syntax.StrictType <$> typeConstructor <*> typeParameters)) - <|> (inject <$> (Syntax.StrictTypeVariable <$> expression))) - -string :: Assignment Term -string = makeTerm <$> symbol String <*> (Literal.TextElement <$> source) - -tuple :: Assignment Term -tuple = makeTerm <$> symbol TupleExpression <*> children (Syntax.TupleExpression <$> manyTerm expression) - -tuplePattern :: Assignment Term -tuplePattern = makeTerm <$> symbol TuplePattern <*> children (Syntax.TuplePattern <$> manyTerm expression) - -tupleType :: Assignment Term -tupleType = makeTerm <$> symbol TupleType <*> children (Literal.Tuple <$> manyTerm expression) - -tuplingConstructor :: Assignment Term -tuplingConstructor = makeTerm <$> symbol TuplingConstructor <*> (tupleWithArity <$> rawSource) - -- a tuple (,) has arity two, but only one comma, so apply the successor to the count of commas for the correct arity. - where tupleWithArity = Syntax.TupleConstructor . succ . count ',' - -type' :: Assignment Term -type' = class' - <|> fields - <|> functionType - <|> parenthesizedTypePattern - <|> strictType - <|> type'' - <|> typeConstructor - <|> typePattern - -type'' :: Assignment Term -type'' = makeTerm - <$> symbol Type - <*> children (Syntax.Type <$> expression <*> typeParameters <*> (kindSignature <|> emptyTerm)) - -typeApp :: Assignment Term -typeApp = makeTerm <$> symbol TypeApplication <*> children (Syntax.TypeApp <$> expression) - -typeClass :: Assignment Term -typeClass = makeTerm <$> symbol TypeClassDeclaration <*> children (Syntax.TypeClass - <$> (context' <|> emptyTerm) - <*> expression - <*> manyTermsTill expression (symbol Where) - <*> where') - -typeClassIdentifier :: Assignment Term -typeClassIdentifier = makeTerm <$> symbol TypeClassIdentifier <*> (Syntax.TypeClassIdentifier . Name.name <$> source) - -typeClassInstance :: Assignment Term -typeClassInstance = makeTerm <$> symbol TypeClassInstanceDeclaration <*> children (Syntax.TypeClassInstance - <$> manyTerm (context' <|> scopedTypeVariables) - <*> expression - <*> expression - <*> (where' <|> emptyTerm)) - -typeConstructor :: Assignment Term -typeConstructor = constructorIdentifier - <|> functionConstructor - <|> listConstructor - <|> listType - <|> qualifiedModuleIdentifier - <|> qualifiedTypeClassIdentifier - <|> qualifiedTypeConstructorIdentifier - <|> quotedName - <|> tupleType - <|> tuplingConstructor - <|> typeClassIdentifier - <|> typeConstructorIdentifier - <|> unitConstructor - -typeConstructorExport :: Assignment Term -typeConstructorExport = makeTerm <$> symbol TypeConstructorExport <*> children (Syntax.TypeConstructorExport <$> expression) - -typeConstructorIdentifier :: Assignment Term -typeConstructorIdentifier = makeTerm <$> symbol TypeConstructorIdentifier <*> (Syntax.TypeConstructorIdentifier . Name.name <$> source) - -typeFamily :: Assignment Term -typeFamily = makeTerm <$> symbol TypeFamilyDeclaration <*> children (Syntax.TypeFamily <$> expression <*> manyTermsTill expression typeFamilySeperator <*> (typeSignature <|> kindSignature <|> emptyTerm) <*> (where' <|> emptyTerm)) - where - typeFamilySeperator = symbol TypeSignature - <|> symbol KindSignature - <|> symbol Where - -typeInstance :: Assignment Term -typeInstance = makeTerm <$> symbol TypeInstanceDeclaration <*> children (Syntax.TypeInstance <$> typeInstanceType <*> typeInstanceBody) - where - typeInstanceType = makeTerm <$> location <*> manyTermsTill expression (symbol TypeInstanceBody) - typeInstanceBody = symbol TypeInstanceBody *> children expressions - -typeOperator :: Assignment Term -typeOperator = makeTerm <$> symbol TypeOperator <*> (Syntax.TypeOperator . Name.name <$> source) - -typeSignature :: Assignment Term -typeSignature = makeTerm <$> symbol TypeSignature <*> children (Syntax.TypeSignature <$> manyTermsTill expression (symbol Annotation) <* token Annotation <*> manyTerm (context' <|> scopedTypeVariables) <*> expressions) - -typeParameters :: Assignment Term -typeParameters = makeTerm <$> location <*> (Type.TypeParameters <$> (manyTermsTill expression (symbol Annotation) <|> manyTerm expression)) - -typePattern :: Assignment Term -typePattern = makeTerm <$> symbol TypePattern <*> children (Syntax.TypePattern <$> expressions) - -typeSynonymDeclaration :: Assignment Term -typeSynonymDeclaration = makeTerm - <$> symbol TypeSynonymDeclaration - <*> children (typeSynonym <$> typeLeft <*> typeRight) - where - typeLeft = makeTerm <$> location <*> manyTill expression typeRightSeperator - typeRight = (symbol TypeSynonymBody *> children ((,) <$> manyTerm (context' <|> scopedTypeVariables) <*> expression)) - <|> ((,) [] <$> typeSignature) - <|> ((,) [] <$> kindSignature) - typeRightSeperator = symbol TypeSynonymBody - <|> symbol TypeSignature - <|> symbol KindSignature - typeSynonym typeLeft (contexts, typeRight) = Syntax.TypeSynonym typeLeft contexts typeRight - -typeVariableIdentifier :: Assignment Term -typeVariableIdentifier = makeTerm <$> symbol TypeVariableIdentifier <*> (Syntax.TypeVariableIdentifier . Name.name <$> source) - -unitConstructor :: Assignment Term -unitConstructor = makeTerm <$> token UnitConstructor <*> pure Syntax.UnitConstructor - -variableIdentifier :: Assignment Term -variableIdentifier = makeTerm <$> symbol VariableIdentifier <*> (Syntax.VariableIdentifier . Name.name <$> source) - -variableOperator :: Assignment Term -variableOperator = makeTerm <$> symbol VariableOperator <*> children (Syntax.VariableOperator <$> expression) - -variableSymbol :: Assignment Term -variableSymbol = makeTerm <$> (symbol VariableSymbol <|> symbol VariableSymbol') <*> (Syntax.VariableSymbol . Name.name <$> source) - -variableIdentifiers :: Assignment Term -variableIdentifiers = makeTerm <$> location <*> many variableIdentifier - -viewPattern :: Assignment Term -viewPattern = makeTerm <$> symbol ViewPattern <*> children (Syntax.ViewPattern <$> expression <*> expression) - -where' :: Assignment Term -where' = makeTerm <$> (symbol Where <|> symbol Where') <*> children (manyTerm expression) - -wildcard :: Assignment Term -wildcard = makeTerm <$> token Wildcard <*> pure Syntax.Wildcard - --- | Helpers - -commentedTerm :: Assignment Term -> Assignment Term -commentedTerm term = contextualize (comment <|> pragma) term <|> makeTerm1 <$> (Syntax.Context <$> some1 (comment <|> pragma) <*> emptyTerm) - -manyTerm :: Assignment Term -> Assignment [Term] -manyTerm = many . commentedTerm - -manyTermsTill :: Assignment Term -> Assignment b -> Assignment [Term] -manyTermsTill step = manyTill (step <|> comment) - -someTerm' :: Assignment Term -> Assignment (NonEmpty Term) -someTerm' = NonEmpty.some1 . commentedTerm - -term :: Assignment Term -> Assignment Term -term term = contextualize (comment <|> pragma) (postContextualize (comment <|> pragma) term) diff --git a/src/Language/Haskell/Syntax.hs b/src/Language/Haskell/Syntax.hs deleted file mode 100644 index 0401436b60..0000000000 --- a/src/Language/Haskell/Syntax.hs +++ /dev/null @@ -1,8 +0,0 @@ -module Language.Haskell.Syntax (module X) where - -import Language.Haskell.Syntax.Constructor as X -import Language.Haskell.Syntax.Haskell as X -import Language.Haskell.Syntax.Identifier as X -import Language.Haskell.Syntax.Pattern as X -import Language.Haskell.Syntax.QuasiQuote as X -import Language.Haskell.Syntax.Type as X diff --git a/src/Language/Haskell/Syntax/Constructor.hs b/src/Language/Haskell/Syntax/Constructor.hs deleted file mode 100644 index be0b493469..0000000000 --- a/src/Language/Haskell/Syntax/Constructor.hs +++ /dev/null @@ -1,82 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} - -module Language.Haskell.Syntax.Constructor where - -import Prologue - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import Diffing.Algorithm - -data UnitConstructor a = UnitConstructor - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically UnitConstructor - -instance Evaluatable UnitConstructor - -newtype TupleConstructor a = TupleConstructor { tupleConstructorArity :: Int } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TupleConstructor - -instance Evaluatable TupleConstructor - -data ListConstructor a = ListConstructor - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ListConstructor - -instance Evaluatable ListConstructor - -data FunctionConstructor a = FunctionConstructor - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically FunctionConstructor - -instance Evaluatable FunctionConstructor - -data RecordDataConstructor a = RecordDataConstructor { recordDataConstructorContext :: [a], recordDataConstructorName :: !a, recordDataConstructorFields :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically RecordDataConstructor - -instance Evaluatable RecordDataConstructor - -newtype TypeConstructorExport a = TypeConstructorExport { typeConstructorExportContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeConstructorExport - -instance Evaluatable TypeConstructorExport - -data AllConstructors a = AllConstructors - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically AllConstructors - -instance Evaluatable AllConstructors - -newtype KindParenthesizedConstructor a = KindParenthesizedConstructor { kindParenthesizedConstructorContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically KindParenthesizedConstructor - -instance Evaluatable KindParenthesizedConstructor - -data GADTConstructor a = GADTConstructor { gadtConstructorContext :: a, gadtConstructorName :: a, gadtConstructorTypeSignature :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically GADTConstructor - -instance Evaluatable GADTConstructor - -newtype ConstructorSymbol a = ConstructorSymbol { constructorSymbolName :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ConstructorSymbol - -instance Evaluatable ConstructorSymbol - -data LabeledConstruction a = LabeledConstruction { labeledConstructionConstructor :: a, labeledConstructionFields :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LabeledConstruction - -instance Evaluatable LabeledConstruction - -data InfixDataConstructor a = InfixDataConstructor { infixDataConstructorContext :: [a], infixDataConstructorLeft :: a, infixDataConstructorOperator :: a, infixDataConstructorRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically InfixDataConstructor - -instance Evaluatable InfixDataConstructor diff --git a/src/Language/Haskell/Syntax/Haskell.hs b/src/Language/Haskell/Syntax/Haskell.hs deleted file mode 100644 index 5962585277..0000000000 --- a/src/Language/Haskell/Syntax/Haskell.hs +++ /dev/null @@ -1,316 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} - -module Language.Haskell.Syntax.Haskell where - -import Prologue - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import Diffing.Algorithm - -data Module a = Module { moduleContext :: [a] - , moduleIdentifier :: a - , moduleExports :: [a] - , moduleStatements :: a - } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Module - -instance Evaluatable Module - -data Field a = Field { fieldName :: !a, fieldBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Field - -instance Evaluatable Field - -newtype Pragma a = Pragma { value :: Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Pragma - -instance Evaluatable Pragma - -newtype Deriving a = Deriving { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Deriving - -instance Evaluatable Deriving - -newtype ContextAlt a = ContextAlt { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ContextAlt - -instance Evaluatable ContextAlt - -newtype Class a = Class { classContent :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Class - -instance Evaluatable Class - -data GADT a = GADT { gadtContext :: a, gadtName :: a, gadtConstructors :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically GADT - -instance Evaluatable GADT - -newtype Export a = Export { exportContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Export - -instance Evaluatable Export - -newtype ModuleExport a = ModuleExport { moduleExportContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ModuleExport - -instance Evaluatable ModuleExport - -data InfixOperatorPattern a = InfixOperatorPattern { infixOperatorPatternLeft :: a, infixOperatorPatternOperator :: a, infixOperatorPatternRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically InfixOperatorPattern - -instance Evaluatable InfixOperatorPattern - -newtype QuotedName a = QuotedName { quotedNameContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QuotedName - -instance Evaluatable QuotedName - -newtype ScopedTypeVariables a = ScopedTypeVariables { scopedTypeVariablesContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ScopedTypeVariables - -instance Evaluatable ScopedTypeVariables - -data NewType a = NewType { newTypeContext :: [a], newTypeLeft :: a, newTypeRight :: a, newTypeDeriving :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NewType - -instance Evaluatable NewType - -newtype DefaultDeclaration a = DefaultDeclaration { defaultDeclarationContent :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically DefaultDeclaration - -instance Evaluatable DefaultDeclaration - -newtype VariableOperator a = VariableOperator { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically VariableOperator - -instance Evaluatable VariableOperator - -newtype ConstructorOperator a = ConstructorOperator { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ConstructorOperator - -instance Evaluatable ConstructorOperator - -newtype TypeOperator a = TypeOperator { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeOperator - -instance Evaluatable TypeOperator - -newtype PromotedTypeOperator a = PromotedTypeOperator { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PromotedTypeOperator - -instance Evaluatable PromotedTypeOperator - -newtype VariableSymbol a = VariableSymbol { variableSymbolName :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically VariableSymbol - -instance Evaluatable VariableSymbol - -data ImportDeclaration a = ImportDeclaration { importPackageQualifiedContent :: a, importModule :: a, importSpec :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ImportDeclaration - -instance Evaluatable ImportDeclaration - -data QualifiedImportDeclaration a = QualifiedImportDeclaration { qualifiedImportPackageQualifiedContent :: a, qualifiedImportModule :: a, qualifiedImportSpec :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QualifiedImportDeclaration - -instance Evaluatable QualifiedImportDeclaration - -newtype Import a = Import { importContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Import - -instance Evaluatable Import - -newtype HiddenImport a = HiddenImport { hiddenimportContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically HiddenImport - -instance Evaluatable HiddenImport - -data ImportAlias a = ImportAlias { importAliasSource :: a, importAliasName :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ImportAlias - -instance Evaluatable ImportAlias - -data App a = App { appLeft :: a, appLeftTypeApp :: a, appRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically App - -instance Evaluatable App - -data InfixOperatorApp a = InfixOperatorApp { infixOperatorAppLeft :: a, infixOperatorAppLeftTypeApp :: a, infixOperatorAppOperator :: a, infixOperatorAppRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically InfixOperatorApp - -instance Evaluatable InfixOperatorApp - -newtype TypeApp a = TypeApp { typeAppType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeApp - -instance Evaluatable TypeApp - -data ListComprehension a = ListComprehension { comprehensionValue :: a, comprehensionSource :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ListComprehension - -instance Evaluatable ListComprehension - -data Generator a = Generator { generatorValue :: a, generatorSource :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Generator - -instance Evaluatable Generator - -newtype TupleExpression a = TupleExpression { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TupleExpression - -instance Evaluatable TupleExpression - -newtype TuplePattern a = TuplePattern { value :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TuplePattern - -instance Evaluatable TuplePattern - --- e.g. [1..], [1,2..], [1,2..10] -data ArithmeticSequence a = ArithmeticSequence { from :: a, next :: Maybe a, to :: Maybe a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ArithmeticSequence - -instance Evaluatable ArithmeticSequence - -data RightOperatorSection a = RightOperatorSection { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically RightOperatorSection - -instance Evaluatable RightOperatorSection - -data LeftOperatorSection a = LeftOperatorSection { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LeftOperatorSection - -instance Evaluatable LeftOperatorSection - -newtype ConstructorPattern a = ConstructorPattern { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ConstructorPattern - -instance Evaluatable ConstructorPattern - --- e.g. `a <- b` in a Haskell do block. -data BindPattern a = BindPattern { bindPatternLeft :: [a], bindPatternRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically BindPattern - -instance Evaluatable BindPattern - -newtype Do a = Do { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Do - -instance Evaluatable Do - -data Lambda a = Lambda { lambdaHead :: a, lambdaBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Lambda - -instance Evaluatable Lambda - --- e.g. -1 or (-a) as an expression and not `-` as a variable operator. -newtype PrefixNegation a = PrefixNegation { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PrefixNegation - -instance Evaluatable PrefixNegation - -newtype CPPDirective a = CPPDirective { value :: Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically CPPDirective - -instance Evaluatable CPPDirective - -data FixityAlt a = FixityAlt { fixityPrecedence :: a, fixityIdentifier :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically FixityAlt - -instance Evaluatable FixityAlt - --- e.g. The `{..}` in `foo Bar{..} = baz` -data RecordWildCards a = RecordWildCards - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically RecordWildCards - -instance Evaluatable RecordWildCards - -data Wildcard a = Wildcard - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Wildcard - -instance Evaluatable Wildcard - -data Let a = Let { letStatements :: [a], letInClause :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Let - -instance Evaluatable Let - --- e.g. The `start` or `end` in `f Blob{start, end} = [start, end]`. -newtype NamedFieldPun a = NamedFieldPun { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NamedFieldPun - -instance Evaluatable NamedFieldPun - --- e.g. The `-(1)` in `f (-(1)) = 1`. -newtype NegativeLiteral a = NegativeLiteral { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NegativeLiteral - -instance Evaluatable NegativeLiteral - -newtype LambdaCase a = LambdaCase { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LambdaCase - -instance Evaluatable LambdaCase - --- The `y { a = 1, b = 2} in `f y@Example = y { a = 1, b = 2 }`. -newtype LabeledUpdate a = LabeledUpdate { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LabeledUpdate - -instance Evaluatable LabeledUpdate - --- The `a = 1` in `f y@Example = y { a = 1, b = 2 }`. -data FieldBind a = FieldBind { fieldBindLeft :: a, fieldBindRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically FieldBind - -instance Evaluatable FieldBind diff --git a/src/Language/Haskell/Syntax/Identifier.hs b/src/Language/Haskell/Syntax/Identifier.hs deleted file mode 100644 index ee5550314d..0000000000 --- a/src/Language/Haskell/Syntax/Identifier.hs +++ /dev/null @@ -1,124 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} - -module Language.Haskell.Syntax.Identifier where - -import Prologue - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import Diffing.Algorithm - -newtype QualifiedTypeClassIdentifier a = QualifiedTypeClassIdentifier { values :: NonEmpty a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QualifiedTypeClassIdentifier - -instance Hashable1 QualifiedTypeClassIdentifier where liftHashWithSalt = foldl - -instance Evaluatable QualifiedTypeClassIdentifier - -newtype QualifiedTypeConstructorIdentifier a = QualifiedTypeConstructorIdentifier { values :: NonEmpty a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QualifiedTypeConstructorIdentifier - -instance Hashable1 QualifiedTypeConstructorIdentifier where liftHashWithSalt = foldl - -instance Evaluatable QualifiedTypeConstructorIdentifier - -newtype QualifiedConstructorIdentifier a = QualifiedConstructorIdentifier { values :: NonEmpty a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QualifiedConstructorIdentifier - -instance Hashable1 QualifiedConstructorIdentifier where liftHashWithSalt = foldl - -instance Evaluatable QualifiedConstructorIdentifier - -newtype QualifiedInfixVariableIdentifier a = QualifiedInfixVariableIdentifier { values :: NonEmpty a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QualifiedInfixVariableIdentifier - -instance Hashable1 QualifiedInfixVariableIdentifier where liftHashWithSalt = foldl - -instance Evaluatable QualifiedInfixVariableIdentifier - -newtype QualifiedModuleIdentifier a = QualifiedModuleIdentifier { values :: NonEmpty a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QualifiedModuleIdentifier - -instance Hashable1 QualifiedModuleIdentifier where liftHashWithSalt = foldl - -instance Evaluatable QualifiedModuleIdentifier - -newtype QualifiedVariableIdentifier a = QualifiedVariableIdentifier { values :: NonEmpty a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QualifiedVariableIdentifier - -instance Hashable1 QualifiedVariableIdentifier where liftHashWithSalt = foldl - -instance Evaluatable QualifiedVariableIdentifier - -newtype TypeVariableIdentifier a = TypeVariableIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeVariableIdentifier - -instance Evaluatable TypeVariableIdentifier - -newtype TypeConstructorIdentifier a = TypeConstructorIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeConstructorIdentifier - -instance Evaluatable TypeConstructorIdentifier - -newtype ModuleIdentifier a = ModuleIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ModuleIdentifier - -instance Evaluatable ModuleIdentifier - -newtype ConstructorIdentifier a = ConstructorIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ConstructorIdentifier - -instance Evaluatable ConstructorIdentifier - -newtype ImplicitParameterIdentifier a = ImplicitParameterIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ImplicitParameterIdentifier - -instance Evaluatable ImplicitParameterIdentifier - -newtype InfixConstructorIdentifier a = InfixConstructorIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically InfixConstructorIdentifier - -instance Evaluatable InfixConstructorIdentifier - -newtype InfixVariableIdentifier a = InfixVariableIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically InfixVariableIdentifier - -instance Evaluatable InfixVariableIdentifier - -newtype TypeClassIdentifier a = TypeClassIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeClassIdentifier - -instance Evaluatable TypeClassIdentifier - -newtype VariableIdentifier a = VariableIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically VariableIdentifier - -instance Evaluatable VariableIdentifier - -newtype PrimitiveConstructorIdentifier a = PrimitiveConstructorIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PrimitiveConstructorIdentifier - -instance Evaluatable PrimitiveConstructorIdentifier - -newtype PrimitiveVariableIdentifier a = PrimitiveVariableIdentifier { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PrimitiveVariableIdentifier - -instance Evaluatable PrimitiveVariableIdentifier diff --git a/src/Language/Haskell/Syntax/Pattern.hs b/src/Language/Haskell/Syntax/Pattern.hs deleted file mode 100644 index 86a0712287..0000000000 --- a/src/Language/Haskell/Syntax/Pattern.hs +++ /dev/null @@ -1,89 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} - -module Language.Haskell.Syntax.Pattern where - -import Prologue - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import Diffing.Algorithm - -newtype StrictPattern a = StrictPattern { value :: a} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically StrictPattern - -instance Evaluatable StrictPattern - -newtype ListPattern a = ListPattern { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ListPattern - -instance Evaluatable ListPattern - --- e.g. The `n@num1` in `f n@num1 x@num2 = x` -data AsPattern a = AsPattern { asPatternLeft :: a, asPatternRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically AsPattern - -instance Evaluatable AsPattern - -newtype TypePattern a = TypePattern { typePatternContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypePattern - -instance Evaluatable TypePattern - --- e.g. The `a = 1` in `foo Bar{ a = 1 } = baz`. -data FieldPattern a = FieldPattern { fieldPatternLeft :: a, fieldPatternRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically FieldPattern - -instance Evaluatable FieldPattern - --- e.g. The `~a` in `f ~a = 1` -newtype IrrefutablePattern a = IrrefutablePattern { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically IrrefutablePattern - -instance Evaluatable IrrefutablePattern - --- For handling guards in case alternative expressions. -newtype CaseGuardPattern a = CaseGuardPattern { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically CaseGuardPattern - -instance Evaluatable CaseGuardPattern - --- For handling guards in function declarations. -newtype FunctionGuardPattern a = FunctionGuardPattern { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically FunctionGuardPattern - -instance Evaluatable FunctionGuardPattern - -data ViewPattern a = ViewPattern { viewPatternLeft :: a, viewPatternRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ViewPattern - -instance Evaluatable ViewPattern - --- e.g. The `Bar{..}` in `foo Bar{..} = baz`. -newtype LabeledPattern a = LabeledPattern { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LabeledPattern - -instance Evaluatable LabeledPattern - --- The `a <- b` in `f a | a <- b = c` of a function declaration. -data PatternGuard a = PatternGuard { patternGuardPattern :: a, patternGuardExpression :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PatternGuard - -instance Evaluatable PatternGuard - -newtype Guard a = Guard { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Guard - -instance Evaluatable Guard diff --git a/src/Language/Haskell/Syntax/QuasiQuote.hs b/src/Language/Haskell/Syntax/QuasiQuote.hs deleted file mode 100644 index c45fcc3f08..0000000000 --- a/src/Language/Haskell/Syntax/QuasiQuote.hs +++ /dev/null @@ -1,58 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} - -module Language.Haskell.Syntax.QuasiQuote where - -import Prologue - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import Diffing.Algorithm - -data QuasiQuotation a = QuasiQuotation { quasiQuotationHead :: a, quasiQuotationBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QuasiQuotation - -instance Evaluatable QuasiQuotation - -newtype QuasiQuotationExpressionBody a = QuasiQuotationExpressionBody { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QuasiQuotationExpressionBody - -instance Evaluatable QuasiQuotationExpressionBody - -data QuasiQuotationPattern a = QuasiQuotationPattern - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QuasiQuotationPattern - -instance Evaluatable QuasiQuotationPattern - -data QuasiQuotationType a = QuasiQuotationType - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QuasiQuotationType - -instance Evaluatable QuasiQuotationType - -data QuasiQuotationDeclaration a = QuasiQuotationDeclaration - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QuasiQuotationDeclaration - -instance Evaluatable QuasiQuotationDeclaration - -newtype QuasiQuotationQuoter a = QuasiQuotationQuoter { name :: Name } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QuasiQuotationQuoter - -instance Evaluatable QuasiQuotationQuoter - -data QuasiQuotationExpression a = QuasiQuotationExpression - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QuasiQuotationExpression - -instance Evaluatable QuasiQuotationExpression - -newtype Splice a = Splice { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Splice - -instance Evaluatable Splice diff --git a/src/Language/Haskell/Syntax/Type.hs b/src/Language/Haskell/Syntax/Type.hs deleted file mode 100644 index d03ffc8743..0000000000 --- a/src/Language/Haskell/Syntax/Type.hs +++ /dev/null @@ -1,150 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} - -module Language.Haskell.Syntax.Type where - -import Prologue - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import Diffing.Algorithm - -data StrictType a = StrictType { strictTypeIdentifier :: a, strictTypeParameters :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically StrictType - -instance Evaluatable StrictType - -newtype StrictTypeVariable a = StrictTypeVariable { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically StrictTypeVariable - -instance Evaluatable StrictTypeVariable - -data Type a = Type { typeIdentifier :: a, typeParameters :: a, typeKindSignature :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Type - -instance Evaluatable Type - -data TypeSynonym a = TypeSynonym { typeSynonymLeft :: a, typeSynonymContext :: [a], typeSynonymRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeSynonym - -instance Evaluatable TypeSynonym - -data AnnotatedTypeVariable a = AnnotatedTypeVariable { annotatedTypeVariableIdentifier :: a, annotatedTypeVariableannotation :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically AnnotatedTypeVariable - -instance Evaluatable AnnotatedTypeVariable - -data StandaloneDerivingInstance a = StandaloneDerivingInstance { standaloneDerivingInstanceContext :: [a], standaloneDerivingInstanceClass :: a, standaloneDerivingInstanceInstance :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically StandaloneDerivingInstance - -instance Evaluatable StandaloneDerivingInstance - -data FunctionType a = FunctionType { functionTypeLeft :: a, functionTypeRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically FunctionType - -instance Evaluatable FunctionType - -data TypeSignature a = TypeSignature { typeSignatureName :: [a], typeSignatureContext :: [a], typeSignatureContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeSignature - -instance Evaluatable TypeSignature - -data ExpressionTypeSignature a = ExpressionTypeSignature { expressionTypeSignatureName :: [a], expressionTypeSignatureContext :: [a], expressionTypeSignatureContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ExpressionTypeSignature - -instance Evaluatable ExpressionTypeSignature - -newtype KindSignature a = KindSignature { kindSignatureContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically KindSignature - -instance Evaluatable KindSignature - -data KindFunctionType a = KindFunctionType { kindFunctionTypeLeft :: a, kindFunctionTypeRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically KindFunctionType - -instance Evaluatable KindFunctionType - -newtype Kind a = Kind { kindKind :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Kind - -instance Evaluatable Kind - -newtype KindListType a = KindListType { kindListTypeKind :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically KindListType - -instance Evaluatable KindListType - -data Star a = Star - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Star - -instance Evaluatable Star - -data EqualityConstraint a = EqualityConstraint { equalityConstraintLeft :: a, equalityConstraintRight :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically EqualityConstraint - -instance Evaluatable EqualityConstraint - --- e.g. `type instance F [Int] = Int` where `F` is an open type family. -data TypeInstance a = TypeInstance { typeInstanceType :: a, typeInstanceBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeInstance - -instance Evaluatable TypeInstance - -data TypeClassInstance a = TypeClassInstance { typeClassInstanceContext :: [a], typeClassInstanceIdentifier :: a, typeClassInstanceInstance :: a, typeClassInstanceBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeClassInstance - -instance Evaluatable TypeClassInstance - -newtype Instance a = Instance { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Instance - -instance Evaluatable Instance - -newtype KindTupleType a = KindTupleType { kindTupleType :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically KindTupleType - -instance Evaluatable KindTupleType - -data TypeClass a = TypeClass { typeClassContext :: a, typeClassIdentifier :: a, typeClassParameters :: [a], typeClassBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeClass - -instance Evaluatable TypeClass - --- The default signature of a type class. The default signature has the same shape as a TypeSignature Assignment. -data DefaultSignature a = DefaultSignature { defaultSignatureName :: [a], defaultSignatureContext :: [a], defaultSignatureContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically DefaultSignature - -instance Evaluatable DefaultSignature - -data TypeFamily a = TypeFamily { typeFamilyIdentifier :: a, typeFamilyParameters :: [a], typeFamilySignature :: a, typeFamilyBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeFamily - -instance Evaluatable TypeFamily - -newtype FunctionalDependency a = FunctionalDependency { functionalDependencyContent :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically FunctionalDependency - -instance Evaluatable FunctionalDependency diff --git a/src/Language/JSON/Assignment.hs b/src/Language/JSON/Assignment.hs deleted file mode 100644 index c0be36bc2a..0000000000 --- a/src/Language/JSON/Assignment.hs +++ /dev/null @@ -1,62 +0,0 @@ -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.JSON.Assignment -( assignment -, Syntax -, Grammar -, Term) -where - -import Assigning.Assignment.Deterministic hiding (Assignment) -import qualified Assigning.Assignment.Deterministic as Deterministic -import Data.Sum -import Data.Location -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Literal as Literal -import qualified Data.Term as Term -import Prologue -import Text.Parser.Combinators -import TreeSitter.JSON as Grammar - -type Syntax = - [ Literal.Null - , Literal.Array - , Literal.Boolean - , Literal.Hash - , Literal.Float - , Literal.KeyValue - , Literal.TextElement - , Syntax.Error - ] - -type Term = Term.Term (Sum Syntax) Location -type Assignment = Deterministic.Assignment Grammar - -assignment :: Assignment Term -assignment = value <|> parseError - -value :: Assignment Term -value = branchNode Value (object <|> array <|> parseError) - -jsonValue :: Assignment Term -jsonValue = object <|> array <|> number <|> string <|> boolean <|> none <|> parseError - -object :: Assignment Term -object = toTerm (branchNode Object (Literal.Hash <$ leafNode AnonLBrace <*> sepBy pairs (leafNode AnonComma) <* leafNode AnonRBrace)) - where pairs = toTerm (branchNode Pair (Literal.KeyValue <$> (number <|> string <|> parseError) <* leafNode AnonColon <*> jsonValue)) <|> parseError - -array :: Assignment Term -array = toTerm (branchNode Array (Literal.Array <$ leafNode AnonLBracket <*> sepBy jsonValue (leafNode AnonComma) <* leafNode AnonRBracket)) - -number :: Assignment Term -number = toTerm (Literal.Float <$> leafNode Number) - -string :: Assignment Term -string = toTerm (Literal.TextElement <$> leafNode String) - -boolean :: Assignment Term -boolean = toTerm - ( leafNode Grammar.True $> Literal.true - <|> leafNode Grammar.False $> Literal.false) - -none :: Assignment Term -none = toTerm (leafNode Null $> Literal.Null) diff --git a/src/Language/JSON/PrettyPrint.hs b/src/Language/JSON/PrettyPrint.hs deleted file mode 100644 index 0f9c8550a4..0000000000 --- a/src/Language/JSON/PrettyPrint.hs +++ /dev/null @@ -1,81 +0,0 @@ -module Language.JSON.PrettyPrint - ( defaultBeautyOpts - , defaultJSONPipeline - , printingJSON - , beautifyingJSON - , minimizingJSON - ) where - -import Prologue - -import Control.Effect -import Control.Effect.Error -import Control.Monad.Trans (lift) -import Data.Machine - -import Data.Reprinting.Errors -import Data.Reprinting.Splice -import Data.Reprinting.Token -import Data.Reprinting.Scope - --- | Default printing pipeline for JSON. -defaultJSONPipeline :: (Member (Error TranslationError) sig, Carrier sig m) - => ProcessT m Fragment Splice -defaultJSONPipeline - = printingJSON - ~> beautifyingJSON defaultBeautyOpts - --- | Print JSON syntax. -printingJSON :: Monad m => ProcessT m Fragment Fragment -printingJSON = repeatedly (await >>= step) where - step s@(Defer el cs) = - let ins = yield . New el cs - in case (el, listToMaybe cs) of - (Truth True, _) -> ins "true" - (Truth False, _) -> ins "false" - (Nullity, _) -> ins "null" - - (Open, Just List) -> ins "[" - (Close, Just List) -> ins "]" - (Open, Just Hash) -> ins "{" - (Close, Just Hash) -> ins "}" - - (Sep, Just List) -> ins "," - (Sep, Just Pair) -> ins ":" - (Sep, Just Hash) -> ins "," - - _ -> yield s - step x = yield x - --- TODO: Fill out and implement configurable options like indentation count, --- tabs vs. spaces, etc. -data JSONBeautyOpts = JSONBeautyOpts { jsonIndent :: Int, jsonUseTabs :: Bool } - deriving (Eq, Show) - -defaultBeautyOpts :: JSONBeautyOpts -defaultBeautyOpts = JSONBeautyOpts 2 False - --- | Produce JSON with configurable whitespace and layout. -beautifyingJSON :: (Member (Error TranslationError) sig, Carrier sig m) - => JSONBeautyOpts -> ProcessT m Fragment Splice -beautifyingJSON _ = repeatedly (await >>= step) where - step (Defer el cs) = lift (throwError (NoTranslation el cs)) - step (Verbatim txt) = emit txt - step (New el cs txt) = case (el, cs) of - (Open, Hash:_) -> emit txt *> layout HardWrap *> indent 2 (hashDepth cs) - (Close, Hash:rest) -> layout HardWrap *> indent 2 (hashDepth rest) *> emit txt - (Sep, List:_) -> emit txt *> space - (Sep, Pair:_) -> emit txt *> space - (Sep, Hash:_) -> emit txt *> layout HardWrap *> indent 2 (hashDepth cs) - _ -> emit txt - --- | Produce whitespace minimal JSON. -minimizingJSON :: (Member (Error TranslationError) sig, Carrier sig m) - => ProcessT m Fragment Splice -minimizingJSON = repeatedly (await >>= step) where - step (Defer el cs) = lift (throwError (NoTranslation el cs)) - step (Verbatim txt) = emit txt - step (New _ _ txt) = emit txt - -hashDepth :: [Scope] -> Int -hashDepth = length . filter (== Hash) diff --git a/src/Language/Java/Assignment.hs b/src/Language/Java/Assignment.hs deleted file mode 100644 index fee46956a6..0000000000 --- a/src/Language/Java/Assignment.hs +++ /dev/null @@ -1,656 +0,0 @@ -{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.Java.Assignment -( assignment -, Syntax -, Grammar -, Term -) where - -import Prelude hiding (break) -import Prologue hiding (for, try, This, catches, finally) - -import Assigning.Assignment hiding (Assignment, Error, try) -import qualified Assigning.Assignment as Assignment -import Data.Abstract.Name -import qualified Data.Abstract.ScopeGraph as ScopeGraph (AccessControl(..)) -import Data.Functor (($>)) -import Data.List.NonEmpty (some1) -import Data.Syntax - ( contextualize - , emptyTerm - , handleError - , infixContext - , makeTerm - , makeTerm' - , makeTerm'' - , makeTerm1 - , parseError - , postContextualize - ) -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Expression as Expression -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Statement as Statement -import qualified Data.Syntax.Type as Type -import qualified Data.Term as Term -import qualified Language.Java.Syntax as Java.Syntax -import TreeSitter.Java as Grammar - -type Syntax = - '[ Comment.Comment - , Declaration.Class - , Declaration.InterfaceDeclaration - , Declaration.Method - , Declaration.VariableDeclaration - , Expression.Plus - , Expression.Minus - , Expression.Times - , Expression.DividedBy - , Expression.Modulo - , Expression.Power - , Expression.Negate - , Expression.FloorDivision - , Expression.Call - , Expression.LessThan - , Expression.LessThanEqual - , Expression.GreaterThan - , Expression.GreaterThanEqual - , Expression.Equal - , Expression.StrictEqual - , Expression.Comparison - , Expression.BOr - , Expression.BXOr - , Expression.BAnd - , Expression.LShift - , Expression.RShift - , Expression.UnsignedRShift - , Expression.Complement - , Expression.And - , Expression.Not - , Expression.Or - , Expression.XOr - , Expression.InstanceOf - , Expression.MemberAccess - , Expression.Subscript - , Expression.Member - , Expression.Super - , Expression.This - , Java.Syntax.AnnotatedType - , Java.Syntax.Annotation - , Java.Syntax.AnnotationField - , Java.Syntax.AnnotationTypeElement - , Java.Syntax.ArrayCreationExpression - , Java.Syntax.AssertStatement - , Java.Syntax.Asterisk - , Java.Syntax.CatchType - , Java.Syntax.Constructor - , Java.Syntax.ClassBody - , Java.Syntax.ClassLiteral - , Java.Syntax.DefaultValue - , Java.Syntax.DimsExpr - , Java.Syntax.EnumDeclaration - , Java.Syntax.GenericType - , Java.Syntax.Import - , Java.Syntax.Lambda - , Java.Syntax.LambdaBody - , Java.Syntax.MethodReference - , Java.Syntax.Module - , Java.Syntax.New - , Java.Syntax.NewKeyword - , Java.Syntax.Package - , Java.Syntax.SpreadParameter - , Java.Syntax.StaticInitializer - , Java.Syntax.Synchronized - , Java.Syntax.TryWithResources - , Java.Syntax.TypeParameter - , Java.Syntax.TypeWithModifiers - , Java.Syntax.Variable - , Java.Syntax.Wildcard - , Java.Syntax.WildcardBounds - , Literal.Array - , Literal.Boolean - , Literal.Integer - , Literal.Float - , Literal.Null - , Literal.String - , Literal.TextElement - , Statement.Assignment - , Statement.Break - , Statement.Catch - , Statement.Continue - , Statement.DoWhile - , Statement.Finally - , Statement.For - , Statement.ForEach - , Statement.If - , Statement.Match - , Statement.Pattern - , Statement.PostIncrement - , Statement.PostDecrement - , Statement.PreIncrement - , Statement.PreDecrement - , Statement.While - , Statement.Statements - , Statement.Throw - , Statement.Try - , Syntax.Context - , Syntax.Empty - , Syntax.Error - , Syntax.Identifier - , Syntax.AccessibilityModifier - , Type.Array - , Type.Bool - , Type.Int - , Type.Void - , Type.Float - , Type.Annotation - , Statement.Return - , [] - ] - -type Term = Term.Term (Sum Syntax) Location -type Assignment = Assignment.Assignment [] Grammar - --- | Assignment from AST in Java's grammar onto a program in Java's syntax. -assignment :: Assignment Term -assignment = handleError $ makeTerm <$> symbol Grammar.Program <*> children (Statement.Statements <$> manyTerm expression) <|> parseError - --- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present. -manyTerm :: Assignment Term -> Assignment [Term] -manyTerm term = many (contextualize comment term <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)) - --- | Match a series of terms or comments until a delimiter is matched. -manyTermsTill :: Assignment Term - -> Assignment b - -> Assignment [Term] -manyTermsTill step = manyTill (step <|> comment) - -someTerm :: Assignment Term -> Assignment [Term] -someTerm term = some (contextualize comment term <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)) - --- | Match comments before and after the node. -term :: Assignment Term -> Assignment Term -term term = contextualize comment (postContextualize comment term) - --- | Match -expression :: Assignment Term -expression = handleError (choice expressionChoices) - -expressions :: Assignment Term -expressions = makeTerm'' <$> location <*> many expression - -expressionChoices :: [Assignment Term] -expressionChoices = - [ - arrayAccess - , arrayCreationExpression - , arrayInitializer - , assert - , assignment' - , block - , binary - , boolean - , break - , castExpression - , char - , class' - , classBody - , classInstance - , classLiteral - , continue - , constructorDeclaration - , dimsExpr - , explicitConstructorInvocation - , doWhile - , fieldAccess - , fieldDeclaration - , float - , for - , enum - , if' - , interface - , identifier - , import' - , integer - , lambda - , method - , methodInvocation - , methodReference - , module' - , null' - , package - , return' - , scopedIdentifier - , string - , super - , switch - , staticInitializer - , synchronized - , ternary - , this - , throw - , try - , unary - , update - , localVariableDeclaration - , localVariableDeclarationStatement - , while - ] - -modifier :: Assignment Term -modifier = make <$> symbol Modifier <*> children(Left <$> annotation <|> Right . Syntax.AccessibilityModifier <$> source) - where - make loc (Right modifier) = makeTerm loc modifier - make _ (Left annotation) = annotation - -arrayInitializer :: Assignment Term -arrayInitializer = makeTerm <$> symbol ArrayInitializer <*> children (Literal.Array <$> many expression) - -comment :: Assignment Term -comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) - -localVariableDeclaration :: Assignment Term -localVariableDeclaration = makeTerm <$> symbol LocalVariableDeclaration <*> children ((,) <$> manyTerm modifier <*> type' <**> variableDeclaratorList) - -variableDeclaratorList :: Assignment (([Term], Term) -> [Term]) -variableDeclaratorList = symbol VariableDeclaratorList *> children (makeDecl <$> some variableDeclarator) - where - variableDeclarator = symbol VariableDeclarator *> children ((,) <$> variableDeclaratorId <*> optional expression) - makeDecl decls (modifiers, type') = map (makeSingleDecl modifiers type') decls - makeSingleDecl modifiers type' (target, Nothing) = makeTerm1 (Java.Syntax.Variable modifiers type' target) - makeSingleDecl modifiers type' (target, Just value) = makeTerm1 (Statement.Assignment [] (makeTerm1 (Java.Syntax.Variable modifiers type' target)) value) - -arrayCreationExpression :: Assignment Term -arrayCreationExpression = makeTerm <$> symbol Grammar.ArrayCreationExpression <*> children (Java.Syntax.ArrayCreationExpression <$> (new *> type') <*> many dimsExpr) - where new = token AnonNew $> Java.Syntax.NewKeyword - -localVariableDeclarationStatement :: Assignment Term -localVariableDeclarationStatement = symbol LocalVariableDeclarationStatement *> children localVariableDeclaration - -variableDeclaratorId :: Assignment Term -variableDeclaratorId = symbol VariableDeclaratorId *> children identifier - --- Literals -boolean :: Assignment Term -boolean = makeTerm <$> symbol BooleanLiteral <*> children - (token Grammar.True $> Literal.true - <|> token Grammar.False $> Literal.false) - -null' :: Assignment Term -null' = makeTerm <$> symbol NullLiteral <*> (Literal.Null <$ source) - --- Integer supports all integer and floating point literals (hex, octal, binary) -integer :: Assignment Term -integer = makeTerm <$> symbol IntegerLiteral <*> children (Literal.Integer <$> source) - -float :: Assignment Term -float = makeTerm <$> symbol FloatingPointLiteral <*> children (Literal.Float <$> source) - -string :: Assignment Term -string = makeTerm <$> symbol StringLiteral <*> (Literal.TextElement <$> source) - -char :: Assignment Term -char = makeTerm <$> symbol CharacterLiteral <*> (Literal.TextElement <$> source) - --- Identifiers -identifier :: Assignment Term -identifier = makeTerm <$> symbol Identifier <*> (Syntax.Identifier . name <$> source) - -typeIdentifier :: Assignment Term -typeIdentifier = makeTerm <$> symbol TypeIdentifier <*> (Syntax.Identifier . name <$> source) - -scopedIdentifier :: Assignment Term -scopedIdentifier = makeTerm <$> symbol ScopedIdentifier <*> children (Expression.MemberAccess <$> term expression <*> identifier) - -superInterfaces :: Assignment [Term] -superInterfaces = symbol SuperInterfaces *> children (symbol InterfaceTypeList *> children(manyTerm type')) - --- Declarations -class' :: Assignment Term -class' = makeTerm <$> symbol ClassDeclaration <*> children (makeClass <$> many modifier <*> term identifier <*> (typeParameters <|> pure []) <*> optional superClass <*> (superInterfaces <|> pure []) <*> classBody) - where - makeClass modifiers identifier typeParams superClass superInterfaces = Declaration.Class (modifiers <> typeParams) identifier (maybeToList superClass <> superInterfaces) - superClass = symbol Superclass *> children type' - -classBody :: Assignment Term -classBody = makeTerm <$> symbol Grammar.ClassBody <*> children (manyTerm expression) - -staticInitializer :: Assignment Term -staticInitializer = makeTerm <$> symbol Grammar.StaticInitializer <*> children (Java.Syntax.StaticInitializer <$> block) - -fieldDeclaration :: Assignment Term -fieldDeclaration = makeTerm <$> symbol FieldDeclaration <*> children ((,) <$> manyTerm modifier <*> type' <**> variableDeclaratorList) - -method :: Assignment Term -method = makeTerm <$> symbol MethodDeclaration <*> children (makeMethod <$> many modifier <*> emptyTerm <*> pure accessibility <*> methodHeader <*> methodBody) - where - methodBody = symbol MethodBody *> children (term expression <|> emptyTerm) - methodDeclarator = symbol MethodDeclarator *> children ( (,) <$> identifier <*> formalParameters) - accessibility = ScopeGraph.Public - methodHeader = symbol MethodHeader *> children ((,,,,) <$> (typeParameters <|> pure []) <*> manyTerm annotation <*> type' <*> methodDeclarator <*> (throws <|> pure [])) - makeMethod modifiers receiver accessibility (typeParams, annotations, returnType, (name, params), throws) methodBody = Declaration.Method (returnType : modifiers <> typeParams <> annotations <> throws) receiver name params methodBody accessibility - -generic :: Assignment Term -generic = makeTerm <$> symbol Grammar.GenericType <*> children(Java.Syntax.GenericType <$> term type' <*> manyTerm type') - -methodInvocation :: Assignment Term -methodInvocation = makeTerm <$> symbol MethodInvocation <*> children (uncurry Expression.Call <$> (callFunction <$> expression <*> optional ((,) <$ optional (token AnonRParen) <* token AnonDot <*> manyTerm typeArgument <*> identifier)) <*> (argumentList <|> pure []) <*> emptyTerm) - where - callFunction a (Just (typeArguments, b)) = (typeArguments, makeTerm1 (Expression.MemberAccess a b)) - callFunction a Nothing = ([], a) - -methodReference :: Assignment Term -methodReference = makeTerm <$> symbol Grammar.MethodReference <*> children (Java.Syntax.MethodReference <$> term type' <*> manyTerm typeArgument <*> (new <|> term identifier)) - where new = makeTerm <$> token AnonNew <*> pure Java.Syntax.NewKeyword - -explicitConstructorInvocation :: Assignment Term -explicitConstructorInvocation = makeTerm <$> symbol ExplicitConstructorInvocation <*> children (uncurry Expression.Call <$> (callFunction <$> term expression <*> optional ((,) <$ optional (token AnonRParen) <* token AnonDot <*> manyTerm type' <*> identifier)) <*> argumentList <*> emptyTerm) - where - callFunction a (Just (typeArguments, b)) = (typeArguments, makeTerm1 (Expression.MemberAccess a b)) - callFunction a Nothing = ([], a) - -module' :: Assignment Term -module' = makeTerm <$> symbol ModuleDeclaration <*> children (Java.Syntax.Module <$> expression <*> many expression) - -import' :: Assignment Term -import' = makeTerm <$> symbol ImportDeclaration <*> children (Java.Syntax.Import <$> someTerm (expression <|> asterisk)) - where asterisk = makeTerm <$> token Grammar.Asterisk <*> pure Java.Syntax.Asterisk - -interface :: Assignment Term -interface = makeTerm <$> symbol InterfaceDeclaration <*> children (normal <|> annotationType) - where - interfaceBody = makeTerm <$> symbol InterfaceBody <*> children (manyTerm interfaceMemberDeclaration) - normal = symbol NormalInterfaceDeclaration *> children (makeInterface <$> manyTerm modifier <*> identifier <*> (typeParameters <|> pure []) <*> (extends <|> pure []) <*> interfaceBody) - makeInterface modifiers identifier typeParams = Declaration.InterfaceDeclaration (modifiers <> typeParams) identifier - annotationType = symbol AnnotationTypeDeclaration *> children (Declaration.InterfaceDeclaration [] <$> identifier <*> pure [] <*> annotationTypeBody) - annotationTypeBody = makeTerm <$> symbol AnnotationTypeBody <*> children (manyTerm annotationTypeMember) - annotationTypeMember = symbol AnnotationTypeMemberDeclaration *> children (class' <|> interface <|> constant <|> annotationTypeElement) - annotationTypeElement = makeTerm <$> symbol AnnotationTypeElementDeclaration <*> children (Java.Syntax.AnnotationTypeElement <$> many modifier <*> type' <*> identifier <*> (dims <|> pure []) <*> (defaultValue <|> emptyTerm)) - defaultValue = makeTerm <$> symbol DefaultValue <*> children (Java.Syntax.DefaultValue <$> elementValue) - elementValue = symbol ElementValue *> children (term expression) - interfaceMemberDeclaration = symbol InterfaceMemberDeclaration *> children (constant <|> method <|> class' <|> interface) - extends = symbol ExtendsInterfaces *> children (symbol InterfaceTypeList *> children (manyTerm type')) - -constant :: Assignment Term -constant = makeTerm <$> symbol ConstantDeclaration <*> children ((,) [] <$> type' <**> variableDeclaratorList) - -package :: Assignment Term -package = makeTerm <$> symbol PackageDeclaration <*> children (Java.Syntax.Package <$> someTerm expression) - -enum :: Assignment Term -enum = makeTerm <$> symbol Grammar.EnumDeclaration <*> children (Java.Syntax.EnumDeclaration <$> manyTerm modifier <*> term identifier <*> (superInterfaces <|> pure []) <*> manyTerm enumConstant <*> (enumBodyDeclarations <|> pure [])) - where - enumConstant = symbol EnumConstant *> children (term identifier) - enumBodyDeclarations = symbol EnumBodyDeclarations *> children (manyTerm expression) - -return' :: Assignment Term -return' = makeTerm <$> symbol ReturnStatement <*> (Statement.Return <$> children (expression <|> emptyTerm)) - -dims :: Assignment [Term] -dims = symbol Dims *> children (many (emptyTerm <* token AnonLBracket <* token AnonRBracket)) - -dimsExpr :: Assignment Term -dimsExpr = makeTerm <$> symbol Grammar.DimsExpr <*> children (Java.Syntax.DimsExpr <$> manyTerm annotation <*> manyTerm expression) - -type' :: Assignment Term -type' = choice [ - makeTerm <$> symbol VoidType <*> children (pure Type.Void) - , makeTerm <$> symbol IntegralType <*> children (pure Type.Int) - , makeTerm <$> symbol FloatingPointType <*> children (pure Type.Float) - , makeTerm <$> symbol BooleanType <*> children (pure Type.Bool) - , symbol ArrayType *> children (array <$> type' <*> dims) -- type rule recurs into itself - , makeTerm <$> symbol ScopedTypeIdentifier <*> children (Expression.MemberAccess <$> term type' <*> identifier) - , wildcard - , identifier - , typeIdentifier - , generic - , typeArgument - , annotatedType - ] - where array = foldl (\into each -> makeTerm1 (Type.Array (Just each) into)) - -annotatedType :: Assignment Term -annotatedType = makeTerm <$> symbol AnnotatedType <*> children (Java.Syntax.AnnotatedType <$> many annotation <*> type') - -typeArgument :: Assignment Term -typeArgument = symbol TypeArgument *> children (term type') - -wildcard :: Assignment Term -wildcard = makeTerm <$> symbol Grammar.Wildcard <*> children (Java.Syntax.Wildcard <$> manyTerm annotation <*> optional (super <|> extends)) - where - super = makeTerm <$> token Super <*> (Java.Syntax.WildcardBoundSuper <$> type') - extends = makeTerm1 <$> (Java.Syntax.WildcardBoundExtends <$> type') - -if' :: Assignment Term -if' = makeTerm <$> symbol IfThenElseStatement <*> children (Statement.If <$> term expression <*> term expression <*> (term expression <|> emptyTerm)) - -block :: Assignment Term -block = makeTerm <$> symbol Block <*> children (manyTerm expression) - -while :: Assignment Term -while = makeTerm <$> symbol WhileStatement <*> children (Statement.While <$> term expression <*> term expression) - -doWhile :: Assignment Term -doWhile = makeTerm <$> symbol DoStatement <*> children (flip Statement.DoWhile <$> term expression <*> term expression) - -switch :: Assignment Term -switch = makeTerm <$> symbol SwitchStatement <*> children (Statement.Match <$> term expression <*> switchBlock) - where - switchBlock = makeTerm <$> symbol SwitchBlock <*> children (manyTerm switchLabel) - switchLabel = makeTerm <$> symbol SwitchLabel <*> (Statement.Pattern <$> children (term expression <|> emptyTerm) <*> expressions) - -break :: Assignment Term -break = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (term expression <|> emptyTerm)) - -continue :: Assignment Term -continue = makeTerm <$> symbol ContinueStatement <*> children (Statement.Continue <$> (term expression <|> emptyTerm)) - -throw :: Assignment Term -throw = makeTerm <$> symbol ThrowStatement <*> children (Statement.Throw <$> term expression) - -try :: Assignment Term -try = symbol TryStatement *> children tryWithResources <|> makeTerm <$> symbol TryStatement <*> children (Statement.Try <$> term expression <*> (append <$> optional catches <*> optional finally)) - -catches :: Assignment [Term] -catches = symbol Catches *> children (manyTerm catch) - where - catch = makeTerm <$> symbol CatchClause <*> children (Statement.Catch <$> catchFormalParameter <*> term expression) - catchFormalParameter = makeTerm <$> symbol CatchFormalParameter <*> children (flip Type.Annotation <$> catchType <* symbol VariableDeclaratorId <*> children identifier) - -catchType :: Assignment Term -catchType = makeTerm <$> symbol CatchType <*> (Java.Syntax.CatchType <$> many type') - -finally :: Assignment Term -finally = makeTerm <$> symbol Finally <*> children (Statement.Finally <$> term expression) - -append :: Maybe [a] -> Maybe a -> [a] -append Nothing Nothing = [] -append Nothing (Just a) = [a] -append (Just a) Nothing = a -append (Just a) (Just b) = a <> [b] - -tryWithResources :: Assignment Term -tryWithResources = makeTerm <$> symbol TryWithResourcesStatement <*> children (Java.Syntax.TryWithResources <$> resourceSpecification <*> block <*> (append <$> optional catches <*> optional finally)) - where - resourceSpecification = symbol ResourceSpecification *> children (manyTerm resource) - resource = symbol Resource *> children variableAccess <|> makeTerm <$> symbol Resource <*> children (makeSingleDecl <$> many modifier <*> type' <*> variableDeclaratorId <*> term expression) - variableAccess = symbol VariableAccess *> children (identifier <|> fieldAccess) - makeSingleDecl modifiers type' target = Statement.Assignment [] (makeTerm1 (Java.Syntax.Variable modifiers type' target)) - -for :: Assignment Term -for = symbol ForStatement *> children (basicFor <|> enhancedFor) - -basicFor :: Assignment Term -basicFor = makeTerm <$> symbol BasicForStatement <*> children (Statement.For <$ token AnonFor <* token AnonLParen <*> (token AnonSemicolon *> emptyTerm <|> forInit <* token AnonSemicolon) <*> (token AnonSemicolon *> emptyTerm <|> term expression <* token AnonSemicolon) <*> forStep <*> term expression) - where - forInit = symbol ForInit *> children (term expression) - forStep = makeTerm <$> location <*> manyTermsTill expression (token AnonRParen) - -enhancedFor :: Assignment Term -enhancedFor = makeTerm <$> symbol EnhancedForStatement <*> children (Statement.ForEach <$> (variable <$> manyTerm modifier <*> type' <*> variableDeclaratorId) <*> term expression <*> term expression) - where variable modifiers type' variableDeclaratorId = makeTerm1 (Java.Syntax.Variable modifiers type' variableDeclaratorId) - -assert :: Assignment Term -assert = makeTerm <$> symbol Grammar.AssertStatement <*> children (Java.Syntax.AssertStatement <$> term expression <*> optional (term expression)) - -binary :: Assignment Term -binary = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expressionAndParens expressionAndParens - [ (inject .) . Expression.LessThan <$ symbol AnonLAngle - , (inject .) . Expression.GreaterThan <$ symbol AnonRAngle - , (inject .) . Expression.Equal <$ symbol AnonEqualEqual - , (inject .) . Expression.GreaterThanEqual <$ symbol AnonRAngleEqual - , (inject .) . Expression.LessThanEqual <$ symbol AnonLAngleEqual - , (inject .) . invert Expression.Equal <$ symbol AnonBangEqual - , (inject .) . Expression.And <$ symbol AnonAmpersandAmpersand - , (inject .) . Expression.Or <$ symbol AnonPipePipe - , (inject .) . Expression.BAnd <$ symbol AnonAmpersand - , (inject .) . Expression.BOr <$ symbol AnonPipe - , (inject .) . Expression.BXOr <$ symbol AnonCaret - , (inject .) . Expression.Modulo <$ symbol AnonPercent - , (inject .) . Expression.LShift <$ symbol AnonLAngleLAngle - , (inject .) . Expression.RShift <$ symbol AnonRAngleRAngle - , (inject .) . Expression.UnsignedRShift <$ symbol AnonRAngleRAngleRAngle - , (inject .) . Expression.Plus <$ symbol AnonPlus - , (inject .) . Expression.Minus <$ symbol AnonMinus - , (inject .) . Expression.Times <$ symbol AnonStar - , (inject .) . Expression.DividedBy <$ symbol AnonSlash - , (inject .) . Expression.InstanceOf <$ symbol AnonInstanceof - ]) - where - invert cons a b = Expression.Not (makeTerm1 (cons a b)) - expressionAndParens = token AnonLParen *> expressionAndParens <* token AnonRParen <|> expression - -- TODO: expressionAndParens is a hack that accommodates Java's nested parens - -- but altering the TreeSitter Java grammar is a better longer term goal. - --- | Match infix terms separated by any of a list of operators, assigning any comments following each operand. -infixTerm :: Assignment Term - -> Assignment Term - -> [Assignment (Term -> Term -> Sum Syntax Term)] - -> Assignment (Sum Syntax Term) -infixTerm = infixContext comment - -assignment' :: Assignment Term -assignment' = makeTerm' <$> symbol AssignmentExpression <*> children (infixTerm lhs expression - [ (inject .) . Statement.Assignment [] <$ symbol AnonEqual - , assign Expression.Plus <$ symbol AnonPlusEqual - , assign Expression.Minus <$ symbol AnonMinusEqual - , assign Expression.Times <$ symbol AnonStarEqual - , assign Expression.DividedBy <$ symbol AnonSlashEqual - , assign Expression.BOr <$ symbol AnonPipeEqual - , assign Expression.BAnd <$ symbol AnonAmpersandEqual - , assign Expression.Modulo <$ symbol AnonPercentEqual - , assign Expression.RShift <$ symbol AnonRAngleRAngleEqual - , assign Expression.UnsignedRShift <$ symbol AnonRAngleRAngleRAngleEqual - , assign Expression.LShift <$ symbol AnonLAngleLAngleEqual - , assign Expression.BXOr <$ symbol AnonCaretEqual - ]) - where - assign :: (f :< Syntax) => (Term -> Term -> f Term) -> Term -> Term -> Sum Syntax Term - assign c l r = inject (Statement.Assignment [] l (makeTerm1 (c l r))) - lhs = symbol Lhs *> children (term expression) - -data UnaryType - = UPlus - | UMinus - | UBang - | UTilde - -unary :: Assignment Term -unary = make <$> symbol UnaryExpression <*> children ((,) <$> operator <*> term expression) - where - make _ (UPlus, operand) = operand - make loc (UMinus, operand) = makeTerm loc (Expression.Negate operand) - make loc (UBang, operand) = makeTerm loc (Expression.Not operand) - make loc (UTilde, operand) = makeTerm loc (Expression.Complement operand) - operator = token AnonPlus $> UPlus - <|> token AnonMinus $> UMinus - <|> token AnonBang $> UBang - <|> token AnonTilde $> UTilde - -update :: Assignment Term -update = makeTerm' <$> symbol UpdateExpression <*> children ( - inject . Statement.PreIncrement <$ token AnonPlusPlus <*> term expression - <|> inject . Statement.PreDecrement <$ token AnonMinusMinus <*> term expression - <|> inject . Statement.PostIncrement <$> term expression <* token AnonPlusPlus - <|> inject . Statement.PostDecrement <$> term expression <* token AnonMinusMinus) - -ternary :: Assignment Term -ternary = makeTerm <$> symbol TernaryExpression <*> children (Statement.If <$> term expression <*> term expression <*> term expression) - -synchronized :: Assignment Term -synchronized = makeTerm <$> symbol SynchronizedStatement <*> children (Java.Syntax.Synchronized <$> term expression <*> term expression) - -classInstance :: Assignment Term -classInstance = makeTerm <$> symbol ClassInstanceCreationExpression <*> children unqualified - where - unqualified = symbol UnqualifiedClassInstanceCreationExpression *> children (Java.Syntax.New <$> type' <*> (argumentList <|> pure []) <*> optional classBody) - -classLiteral :: Assignment Term -classLiteral = makeTerm <$> symbol Grammar.ClassLiteral <*> children (Java.Syntax.ClassLiteral <$> type') - -argumentList :: Assignment [Term] -argumentList = symbol ArgumentList *> children (manyTerm expression) - -super :: Assignment Term -super = makeTerm <$> token Super <*> pure Expression.Super - -this :: Assignment Term -this = makeTerm <$> token This <*> pure Expression.This - -constructorDeclaration :: Assignment Term -constructorDeclaration = makeTerm <$> symbol ConstructorDeclaration <*> children ( - constructor <$> manyTerm modifier <*> constructorDeclarator <*> (throws <|> pure []) <*> constructorBody) - where - constructorDeclarator = symbol ConstructorDeclarator *> children ((,,) <$> (typeParameters <|> pure []) <*> term identifier <*> formalParameters) - constructorBody = makeTerm <$> symbol ConstructorBody <*> children (manyTerm expression) -- wrapping list of terms up in single node - constructor modifiers (typeParameters, identifier, formalParameters) = Java.Syntax.Constructor modifiers typeParameters identifier formalParameters -- let partial application do its thing - -typeParameters :: Assignment [Term] -typeParameters = symbol TypeParameters *> children (manyTerm typeParam) - where - typeParam = makeTerm <$> symbol Grammar.TypeParameter <*> children (Java.Syntax.TypeParameter <$> manyTerm annotation <*> term identifier <*> (typeBound <|> pure [])) - typeBound = symbol TypeBound *> children (manyTerm type') - - -annotation :: Assignment Term -annotation = makeTerm <$> symbol NormalAnnotation <*> children (Java.Syntax.Annotation <$> term expression <*> (elementValuePairList <|> pure [])) - <|> makeTerm <$> symbol MarkerAnnotation <*> children (Java.Syntax.Annotation <$> term expression <*> pure []) - <|> makeTerm <$> symbol SingleElementAnnotation <*> children (Java.Syntax.Annotation <$> term expression <*> (pure <$> term elementValue)) - where - elementValuePairList = symbol ElementValuePairList *> children (manyTerm elementValuePair) - elementValuePair = makeTerm <$> symbol ElementValuePair <*> children (Java.Syntax.AnnotationField <$> term expression <*> term elementValue) - elementValue = symbol ElementValue *> children (term expression) - -throws :: Assignment [Term] -throws = symbol Throws *> children (symbol ExceptionTypeList *> children (manyTerm type')) - -formalParameters :: Assignment [Term] -formalParameters = manyTerm (parameter <|> spreadParameter) - where - parameter = makeTerm <$> symbol FormalParameter <*> children (makeAnnotation <$> manyTerm modifier <*> type' <* symbol VariableDeclaratorId <*> children identifier) - makeAnnotation [] type' variableName = Type.Annotation variableName type' - makeAnnotation modifiers type' variableName = Type.Annotation variableName (makeTerm1 (Java.Syntax.TypeWithModifiers modifiers type')) - -castExpression :: Assignment Term -castExpression = makeTerm <$> symbol CastExpression <*> children (flip Type.Annotation <$> type' <*> term expression) - -fieldAccess :: Assignment Term -fieldAccess = makeTerm <$> symbol FieldAccess <*> children (Expression.MemberAccess <$> term expression <*> identifier) - -spreadParameter :: Assignment Term -spreadParameter = makeTerm <$> symbol Grammar.SpreadParameter <*> children (Java.Syntax.SpreadParameter <$> (makeSingleDecl <$> manyTerm modifier <*> type' <*> variableDeclarator)) - where - variableDeclarator = symbol VariableDeclarator *> children ((,) <$> variableDeclaratorId <*> optional expression) - makeSingleDecl modifiers type' (target, Nothing) = makeTerm1 (Java.Syntax.Variable modifiers type' target) - makeSingleDecl modifiers type' (target, Just value) = makeTerm1 (Statement.Assignment [] (makeTerm1 (Java.Syntax.Variable modifiers type' target)) value) - -arrayAccess :: Assignment Term -arrayAccess = makeTerm <$> symbol ArrayAccess <*> children (Expression.Subscript <$> term expression <*> manyTerm expression) - -lambda :: Assignment Term -lambda = makeTerm <$> symbol LambdaExpression <*> children (Java.Syntax.Lambda <$> manyTerm expression <*> lambdaBody) - where - lambdaBody = makeTerm <$> symbol Grammar.LambdaBody <*> children (Java.Syntax.LambdaBody <$> manyTerm expression) diff --git a/src/Language/Java/Syntax.hs b/src/Language/Java/Syntax.hs deleted file mode 100644 index eb03d1d4e0..0000000000 --- a/src/Language/Java/Syntax.hs +++ /dev/null @@ -1,222 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.Java.Syntax where - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import Diffing.Algorithm -import Prologue - -newtype Import a = Import { imports :: [a]} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Import - --- TODO: Implement Eval instance for ArrayType -instance Evaluatable Import - -data Module a = Module { moduleIdentifier :: !a, moduleStatements :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Module - -instance Evaluatable Module - -newtype Package a = Package { packages :: [a]} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Package - --- TODO: Implement Eval instance for ArrayType -instance Evaluatable Package - -data EnumDeclaration a = EnumDeclaration { enumDeclarationModifier :: ![a], enumDeclarationIdentifier :: !a, enumDeclarationSuperInterfaces :: ![a], enumDeclarationConstant :: ![a], enumDeclarationBody :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically EnumDeclaration - -instance Evaluatable EnumDeclaration - -data Variable a = Variable { variableModifiers :: ![a], variableType :: !a, variableName :: !a} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Variable - --- TODO: Implement Eval instance for Variable -instance Evaluatable Variable - -data Synchronized a = Synchronized { synchronizedSubject :: !a, synchronizedBody :: !a} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Synchronized - --- TODO: Implement Eval instance for Synchronized -instance Evaluatable Synchronized - -data New a = New { newType :: !a, newArgs :: ![a], newClassBody :: Maybe a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically New - --- TODO: Implement Eval instance for New -instance Evaluatable New - -data Asterisk a = Asterisk - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Asterisk - --- TODO: Implement Eval instance for New -instance Evaluatable Asterisk - -data Constructor a = Constructor { constructorModifiers :: ![a], constructorTypeParams :: ![a], constructorIdentifier :: !a, constructorParams :: ![a], constructorThrows :: ![a], constructorBody :: a} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Constructor - --- TODO: Implement Eval instance for Constructor -instance Evaluatable Constructor - -data TypeParameter a = TypeParameter { typeParamAnnotation :: ![a], typeParamIdentifier :: !a, typeParamTypeBound :: ![a]} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeParameter - --- TODO: Implement Eval instance for TypeParameter -instance Evaluatable TypeParameter - -data Annotation a = Annotation { annotationName :: !a, annotationField :: [a]} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Annotation - --- TODO: Implement Eval instance for Annotation -instance Evaluatable Annotation - -data AnnotationField a = AnnotationField { annotationFieldName :: a, annotationFieldValue :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically AnnotationField - --- TODO: Implement Eval instance for AnnotationField -instance Evaluatable AnnotationField - -data GenericType a = GenericType { genericTypeIdentifier :: a, genericTypeArguments :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically GenericType - --- TODO: Implement Eval instance for GenericType -instance Evaluatable GenericType - -data AnnotatedType a = AnnotatedType { annotationes :: [a], annotatedType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically AnnotatedType - --- TODO: Implement Eval instance for AnnotatedType -instance Evaluatable AnnotatedType - -newtype CatchType a = CatchType { types :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically CatchType - --- TODO: Implement Eval instance for CatchType -instance Evaluatable CatchType - -data TypeWithModifiers a = TypeWithModifiers { types :: [a], modifier :: a} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeWithModifiers - --- TODO: Implement Eval instance for TypeWithModifiers -instance Evaluatable TypeWithModifiers - -data Wildcard a = Wildcard { wildcardAnnotation :: [a], wildcardBounds :: Maybe a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Wildcard - --- TODO: Implement Eval instance for TypeWithModifiers -instance Evaluatable Wildcard - -data WildcardBounds a = WildcardBoundExtends { wildcardBoundExtendsType :: a} | WildcardBoundSuper { wildcardBoundSuperType :: a} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically WildcardBounds - --- TODO: Implement Eval instance for TypeWithModifiers -instance Evaluatable WildcardBounds - -newtype SpreadParameter a = SpreadParameter { spreadParameterVariableDeclarator :: a} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically SpreadParameter - --- TODO: Implement Eval instance for SpreadParameter -instance Evaluatable SpreadParameter - -newtype StaticInitializer a = StaticInitializer { staticInitializerBlock :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically StaticInitializer - -instance Evaluatable StaticInitializer - -data MethodReference a = MethodReference { methodReferenceType :: !a, methodReferenceTypeArgs :: ![a], methodReferenceIdentifier :: !a} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically MethodReference - --- TODO: Implement Eval instance for TypeWithModifiers -instance Evaluatable MethodReference - -data NewKeyword a = NewKeyword - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically NewKeyword - --- TODO: Implement Eval instance for TypeWithModifiers -instance Evaluatable NewKeyword - -data Lambda a = Lambda { lambdaParams :: ![a], lambdaBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Lambda - -instance Evaluatable Lambda - -newtype LambdaBody a = LambdaBody { lambdaBodyExpression :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically LambdaBody - -instance Evaluatable LambdaBody - -data ArrayCreationExpression a = ArrayCreationExpression { arrayCreationExpressionType :: !a, arrayCreationExpressionDims :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ArrayCreationExpression - -instance Evaluatable ArrayCreationExpression - -data DimsExpr a = DimsExpr { dimsExprAnnotation :: ![a], dimsExprExpression :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically DimsExpr - -instance Evaluatable DimsExpr - -newtype ClassBody a = ClassBody { classBodyExpression :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ClassBody - -instance Evaluatable ClassBody - -newtype ClassLiteral a = ClassLiteral { classLiteralType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ClassLiteral - -instance Evaluatable ClassLiteral - -data TryWithResources a = TryWithResources { tryResources :: ![a], tryBody :: !a, tryCatch :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TryWithResources - --- TODO: Implement Eval instance for TryWithResources -instance Evaluatable TryWithResources - -data AssertStatement a = AssertStatement { assertLHS :: !a, assertRHS :: !(Maybe a) } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically AssertStatement - --- TODO: Implement Eval instance for AssertStatement -instance Evaluatable AssertStatement - -newtype DefaultValue a = DefaultValue { defaultValueElement :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically DefaultValue - -instance Evaluatable DefaultValue - -data AnnotationTypeElement a = AnnotationTypeElement { modifiers :: ![a], annotationType :: a, identifier :: !a, dims :: ![a], defaultValue :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, NFData1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically AnnotationTypeElement - --- TODO: Implement Eval instance for AnnotationTypeElement -instance Evaluatable AnnotationTypeElement diff --git a/src/Language/Markdown/Assignment.hs b/src/Language/Markdown/Assignment.hs deleted file mode 100644 index 2156e8b95c..0000000000 --- a/src/Language/Markdown/Assignment.hs +++ /dev/null @@ -1,170 +0,0 @@ -{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.Markdown.Assignment -( assignment -, Syntax -, Grammar -, Language.Markdown.Assignment.Term -) where - -import Prologue - -import Assigning.Assignment hiding (Assignment, Error) -import qualified Assigning.Assignment as Assignment -import qualified CMarkGFM -import Data.Syntax (makeTerm) -import qualified Data.Syntax as Syntax -import qualified Data.Term as Term -import qualified Data.Text as Text -import qualified Language.Markdown.Syntax as Markup -import Parsing.CMark as Grammar (Grammar (..)) - -type Syntax = - '[ Markup.Document - -- Block elements - , Markup.BlockQuote - , Markup.Heading - , Markup.HTMLBlock - , Markup.OrderedList - , Markup.Paragraph - , Markup.ThematicBreak - , Markup.UnorderedList - , Markup.Table - , Markup.TableRow - , Markup.TableCell - -- Inline elements - , Markup.Code - , Markup.Emphasis - , Markup.Image - , Markup.LineBreak - , Markup.Link - , Markup.Strong - , Markup.Text - , Markup.Strikethrough - -- Assignment errors; cmark does not provide parse errors. - , Syntax.Error - , [] - ] - -type Term = Term.Term (Sum Syntax) Location -type Assignment = Assignment.Assignment (Term.TermF [] CMarkGFM.NodeType) Grammar - -assignment :: Assignment Term -assignment = Syntax.handleError $ makeTerm <$> symbol Document <*> children (Markup.Document <$> many blockElement) - - --- Block elements - -blockElement :: Assignment Term -blockElement = choice - [ paragraph - , list - , blockQuote - , codeBlock - , thematicBreak - , htmlBlock - , heading - , table - ] - -paragraph :: Assignment Term -paragraph = makeTerm <$> symbol Paragraph <*> children (Markup.Paragraph <$> many inlineElement) - -list :: Assignment Term -list = Term.termIn <$> symbol List <*> (makeList . Term.termFAnnotation . Term.termFOut <$> currentNode <*> children (many item)) - where - makeList (CMarkGFM.LIST CMarkGFM.ListAttributes{..}) = case listType of - CMarkGFM.BULLET_LIST -> inject . Markup.UnorderedList - CMarkGFM.ORDERED_LIST -> inject . Markup.OrderedList - makeList _ = inject . Markup.UnorderedList - -item :: Assignment Term -item = makeTerm <$> symbol Item <*> children (many blockElement) - -heading :: Assignment Term -heading = makeTerm <$> symbol Heading <*> (makeHeading . Term.termFAnnotation . Term.termFOut <$> currentNode <*> children (many inlineElement) <*> manyTill blockElement (void (symbol Heading) <|> eof)) - where - makeHeading (CMarkGFM.HEADING level) = Markup.Heading level - makeHeading _ = Markup.Heading 0 - -blockQuote :: Assignment Term -blockQuote = makeTerm <$> symbol BlockQuote <*> children (Markup.BlockQuote <$> many blockElement) - -codeBlock :: Assignment Term -codeBlock = makeTerm <$> symbol CodeBlock <*> (makeCode . Term.termFAnnotation . Term.termFOut <$> currentNode <*> source) - where - makeCode (CMarkGFM.CODE_BLOCK language _) = Markup.Code (nullText language) - makeCode _ = Markup.Code Nothing - -thematicBreak :: Assignment Term -thematicBreak = makeTerm <$> token ThematicBreak <*> pure Markup.ThematicBreak - -htmlBlock :: Assignment Term -htmlBlock = makeTerm <$> symbol HTMLBlock <*> (Markup.HTMLBlock <$> source) - -table :: Assignment Term -table = makeTerm <$> symbol Table <*> children (Markup.Table <$> many tableRow) - -tableRow :: Assignment Term -tableRow = makeTerm <$> symbol TableRow <*> children (Markup.TableRow <$> many tableCell) - -tableCell :: Assignment Term -tableCell = makeTerm <$> symbol TableCell <*> children (Markup.TableCell <$> many inlineElement) - --- Inline elements - -inlineElement :: Assignment Term -inlineElement = choice - [ strong - , emphasis - , strikethrough - , text - , link - , htmlInline - , image - , code - , lineBreak - , softBreak - ] - -strong :: Assignment Term -strong = makeTerm <$> symbol Strong <*> children (Markup.Strong <$> many inlineElement) - -emphasis :: Assignment Term -emphasis = makeTerm <$> symbol Emphasis <*> children (Markup.Emphasis <$> many inlineElement) - -strikethrough :: Assignment Term -strikethrough = makeTerm <$> symbol Strikethrough <*> children (Markup.Strikethrough <$> many inlineElement) - -text :: Assignment Term -text = makeTerm <$> symbol Text <*> (Markup.Text <$> source) - -htmlInline :: Assignment Term -htmlInline = makeTerm <$> symbol HTMLInline <*> (Markup.HTMLBlock <$> source) - -link :: Assignment Term -link = makeTerm <$> symbol Link <*> (makeLink . Term.termFAnnotation . Term.termFOut <$> currentNode) <* advance - where - makeLink (CMarkGFM.LINK url title) = Markup.Link url (nullText title) - makeLink _ = Markup.Link mempty Nothing - -image :: Assignment Term -image = makeTerm <$> symbol Image <*> (makeImage . Term.termFAnnotation . Term.termFOut <$> currentNode) <* advance - where - makeImage (CMarkGFM.IMAGE url title) = Markup.Image url (nullText title) - makeImage _ = Markup.Image mempty Nothing - -code :: Assignment Term -code = makeTerm <$> symbol Code <*> (Markup.Code Nothing <$> source) - -lineBreak :: Assignment Term -lineBreak = makeTerm <$> token LineBreak <*> pure Markup.LineBreak - -softBreak :: Assignment Term -softBreak = makeTerm <$> token SoftBreak <*> pure Markup.LineBreak - - --- Implementation details - -nullText :: Text.Text -> Maybe Text.Text -nullText text = if Text.null text then Nothing else Just text diff --git a/src/Language/Markdown/Syntax.hs b/src/Language/Markdown/Syntax.hs deleted file mode 100644 index a07af152db..0000000000 --- a/src/Language/Markdown/Syntax.hs +++ /dev/null @@ -1,91 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.Markdown.Syntax where - -import Data.Abstract.Declarations -import Data.JSON.Fields -import qualified Data.Text as T -import Diffing.Algorithm -import Prologue hiding (Text) - -newtype Document a = Document { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Document - - --- Block elements - -newtype Paragraph a = Paragraph { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Paragraph - -data Heading a = Heading { headingLevel :: Int, headingContent :: [a], sectionContent :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Heading - -newtype UnorderedList a = UnorderedList { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically UnorderedList - -newtype OrderedList a = OrderedList { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically OrderedList - -newtype BlockQuote a = BlockQuote { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically BlockQuote - -data ThematicBreak a = ThematicBreak - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ThematicBreak - -newtype HTMLBlock a = HTMLBlock { value :: T.Text } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically HTMLBlock - -newtype Table a = Table { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Table - -newtype TableRow a = TableRow { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TableRow - -newtype TableCell a = TableCell { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TableCell - - --- Inline elements - -newtype Strong a = Strong { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Strong - -newtype Emphasis a = Emphasis { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Emphasis - -newtype Text a = Text { value :: T.Text} - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Text - -data Link a = Link { linkURL :: T.Text, linkTitle :: Maybe T.Text } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Link - -data Image a = Image { imageURL :: T.Text, imageTitle :: Maybe T.Text } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Image - -data Code a = Code { codeLanguage :: Maybe T.Text, codeContent :: T.Text } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Code - -data LineBreak a = LineBreak - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LineBreak - -newtype Strikethrough a = Strikethrough { values :: [a] } - deriving (Eq, Ord, Show, Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Strikethrough diff --git a/src/Language/PHP/Assignment.hs b/src/Language/PHP/Assignment.hs deleted file mode 100644 index 605744b383..0000000000 --- a/src/Language/PHP/Assignment.hs +++ /dev/null @@ -1,814 +0,0 @@ -{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.PHP.Assignment -( assignment -, Syntax -, Grammar -, Term -) where - -import Prologue - -import Assigning.Assignment hiding (Assignment, Error) -import qualified Assigning.Assignment as Assignment -import qualified Data.Abstract.Name as Name -import qualified Data.Abstract.ScopeGraph as ScopeGraph (AccessControl(..)) -import qualified Data.List.NonEmpty as NonEmpty -import Data.Syntax - ( contextualize - , emptyTerm - , handleError - , infixContext - , makeTerm - , makeTerm' - , makeTerm1 - , parseError - , postContextualize - ) -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Expression as Expression -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Statement as Statement -import qualified Data.Syntax.Type as Type -import qualified Data.Term as Term -import qualified Language.PHP.Syntax as Syntax -import TreeSitter.PHP as Grammar - -type Syntax = '[ - Comment.Comment - , Declaration.Class - , Declaration.Function - , Declaration.Method - , Declaration.VariableDeclaration - , Expression.Plus - , Expression.Minus - , Expression.Times - , Expression.DividedBy - , Expression.Modulo - , Expression.Power - , Expression.Negate - , Expression.FloorDivision - , Expression.BAnd - , Expression.BOr - , Expression.BXOr - , Expression.LShift - , Expression.RShift - , Expression.And - , Expression.Not - , Expression.Or - , Expression.XOr - , Expression.Call - , Expression.Cast - , Expression.LessThan - , Expression.LessThanEqual - , Expression.GreaterThan - , Expression.GreaterThanEqual - , Expression.Equal - , Expression.StrictEqual - , Expression.Comparison - , Expression.InstanceOf - , Expression.MemberAccess - , Expression.New - , Expression.SequenceExpression - , Expression.Subscript - , Expression.Member - , Literal.Array - , Literal.Float - , Literal.Integer - , Literal.KeyValue - , Literal.TextElement - , Statement.Assignment - , Statement.Break - , Statement.Catch - , Statement.Continue - , Statement.DoWhile - , Statement.Else - , Statement.Finally - , Statement.For - , Statement.ForEach - , Statement.Goto - , Statement.If - , Statement.Match - , Statement.Pattern - , Statement.Return - , Statement.Statements - , Statement.Throw - , Statement.Try - , Statement.While - , Statement.Yield - , Syntax.AliasAs - , Syntax.ArrayElement - , Syntax.BaseTypeDeclaration - , Syntax.CastType - , Syntax.ClassBaseClause - , Syntax.ClassConstDeclaration - , Syntax.ClassInterfaceClause - , Syntax.ClassModifier - , Syntax.Clone - , Syntax.ConstDeclaration - , Syntax.ConstructorDeclaration - , Syntax.Context - , Syntax.Declare - , Syntax.DeclareDirective - , Syntax.DestructorDeclaration - , Syntax.Echo - , Syntax.Empty - , Syntax.EmptyIntrinsic - , Syntax.Error - , Syntax.ErrorControl - , Syntax.EvalIntrinsic - , Syntax.ExitIntrinsic - , Syntax.GlobalDeclaration - , Syntax.Identifier - , Syntax.Include - , Syntax.IncludeOnce - , Syntax.InsteadOf - , Syntax.InterfaceBaseClause - , Syntax.InterfaceDeclaration - , Syntax.IssetIntrinsic - , Syntax.LabeledStatement - , Syntax.Namespace - , Syntax.NamespaceAliasingClause - , Syntax.NamespaceName - , Syntax.NamespaceUseClause - , Syntax.NamespaceUseDeclaration - , Syntax.NamespaceUseGroupClause - , Syntax.NewVariable - , Syntax.PrintIntrinsic - , Syntax.PropertyDeclaration - , Syntax.PropertyModifier - , Syntax.QualifiedName - , Syntax.RelativeScope - , Syntax.Require - , Syntax.RequireOnce - , Syntax.ReturnType - , Syntax.ScalarType - , Syntax.ShellCommand - , Syntax.SimpleVariable - , Syntax.Static - , Syntax.Text - , Syntax.TraitDeclaration - , Syntax.TraitUseClause - , Syntax.TraitUseSpecification - , Syntax.TypeDeclaration - , Syntax.Unset - , Syntax.Update - , Syntax.UseClause - , Syntax.VariableName - , Type.Annotation - , [] - ] - -type Term = Term.Term (Sum Syntax) Location -type Assignment = Assignment.Assignment [] Grammar - --- | Assignment from AST in PHP's grammar onto a program in PHP's syntax. -assignment :: Assignment Term -assignment = handleError $ makeTerm <$> symbol Program <*> children (Statement.Statements <$> (bookend <$> (text <|> emptyTerm) <*> manyTerm statement <*> (text <|> emptyTerm))) <|> parseError - -text :: Assignment Term -text = makeTerm <$> symbol Text <*> (Syntax.Text <$> source) - -textInterpolation :: Assignment Term -textInterpolation = makeTerm <$> symbol TextInterpolation <*> (Syntax.Text <$> source) - -statement :: Assignment Term -statement = handleError everything - where - everything = choice [ - compoundStatement - , namedLabelStatement - , expressionStatement - , selectionStatement - , iterationStatement - , jumpStatement - , tryStatement - , declareStatement - , echoStatement - , unsetStatement - , constDeclaration - , functionDefinition - , classDeclaration - , interfaceDeclaration - , traitDeclaration - , namespaceDefinition - , namespaceUseDeclaration - , globalDeclaration - , functionStaticDeclaration - ] - -expression :: Assignment Term -expression = choice [ - assignmentExpression, - augmentedAssignmentExpression, - conditionalExpression, - yieldExpression, - includeExpression, - includeOnceExpression, - requireExpression, - requireOnceExpression, - binaryExpression, - unaryExpression - ] - -unaryExpression :: Assignment Term -unaryExpression = choice [ - cloneExpression, - exponentiationExpression, - unaryOpExpression, - castExpression, - primaryExpression - ] - -assignmentExpression :: Assignment Term -assignmentExpression = makeTerm <$> symbol AssignmentExpression <*> children (Statement.Assignment [] <$> term (variable <|> list <|> arrayCreationExpression) <*> term (expression <|> variable)) - -augmentedAssignmentExpression :: Assignment Term -augmentedAssignmentExpression = makeTerm' <$> symbol AugmentedAssignmentExpression <*> children (infixTerm variable (term expression) [ - assign Expression.Power <$ symbol AnonStarStarEqual - , assign Expression.Times <$ symbol AnonStarEqual - , assign Expression.Modulo <$ symbol AnonPercentEqual - , assign Expression.DividedBy <$ symbol AnonSlashEqual - , assign Expression.Plus <$ symbol AnonPlusEqual - , assign Expression.Minus <$ symbol AnonMinusEqual - , assign Expression.Times <$ symbol AnonDotEqual - , assign Expression.LShift <$ symbol AnonLAngleLAngleEqual - , assign Expression.RShift <$ symbol AnonRAngleRAngleEqual - , assign Expression.BAnd <$ symbol AnonAmpersandEqual - , assign Expression.BXOr <$ symbol AnonCaretEqual - , assign Expression.BOr <$ symbol AnonPipeEqual ]) - where - assign c l r = inject (Statement.Assignment [] l (makeTerm1 (c l r))) - -binaryExpression :: Assignment Term -binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expression (term (expression <|> classTypeDesignator)) - [ (inject .) . Expression.And <$ symbol AnonAnd - , (inject .) . Expression.Or <$ symbol AnonOr - , (inject .) . Expression.XOr <$ symbol AnonXor - , (inject .) . Expression.Or <$ symbol AnonPipePipe - , (inject .) . Expression.And <$ symbol AnonAmpersandAmpersand - , (inject .) . Expression.BOr <$ symbol AnonPipe - , (inject .) . Expression.BXOr <$ symbol AnonCaret - , (inject .) . Expression.BAnd <$ symbol AnonAmpersand - , (inject .) . Expression.Or <$ symbol AnonQuestionQuestion -- Not sure if this is right. - , (inject .) . Expression.Equal <$ symbol AnonEqualEqual - , (inject .) . Expression.StrictEqual <$ symbol AnonEqualEqualEqual - , (inject .) . invert Expression.Equal <$ (symbol AnonBangEqual <|> symbol AnonLAngleRAngle <|> symbol AnonBangEqualEqual) - , (inject .) . invert Expression.StrictEqual <$ symbol AnonBangEqualEqual - , (inject .) . Expression.LessThan <$ symbol AnonLAngle - , (inject .) . Expression.GreaterThan <$ symbol AnonRAngle - , (inject .) . Expression.LessThanEqual <$ symbol AnonLAngleEqual - , (inject .) . Expression.GreaterThanEqual <$ symbol AnonRAngleEqual - , (inject .) . Expression.Comparison <$ symbol AnonLAngleEqualRAngle - , (inject .) . Expression.LShift <$ symbol AnonLAngleLAngle - , (inject .) . Expression.RShift <$ symbol AnonRAngleRAngle - , (inject .) . Expression.Plus <$ symbol AnonPlus - , (inject .) . Expression.Minus <$ symbol AnonMinus - , (inject .) . Expression.Times <$ (symbol AnonStar <|> symbol AnonDot) - , (inject .) . Expression.DividedBy <$ symbol AnonSlash - , (inject .) . Expression.Modulo <$ symbol AnonPercent - , (inject .) . Expression.InstanceOf <$ symbol AnonInstanceof - ]) where invert cons a b = Expression.Not (makeTerm1 (cons a b)) - -conditionalExpression :: Assignment Term -conditionalExpression = makeTerm <$> symbol ConditionalExpression <*> children (Statement.If <$> term (binaryExpression <|> unaryExpression) <*> (term expression <|> emptyTerm) <*> term expression) - -list :: Assignment Term -list = makeTerm <$> symbol ListLiteral <*> children (Literal.Array <$> manyTerm (list <|> variable)) - -exponentiationExpression :: Assignment Term -exponentiationExpression = makeTerm <$> symbol ExponentiationExpression <*> children (Expression.Power <$> term (cloneExpression <|> primaryExpression) <*> term (primaryExpression <|> cloneExpression <|> exponentiationExpression)) - -cloneExpression :: Assignment Term -cloneExpression = makeTerm <$> symbol CloneExpression <*> children (Syntax.Clone <$> term primaryExpression) - -primaryExpression :: Assignment Term -primaryExpression = choice [ - variable, - classConstantAccessExpression, - qualifiedName, - literal, - arrayCreationExpression, - intrinsic, - anonymousFunctionCreationExpression, - objectCreationExpression, - updateExpression, - shellCommandExpression, - parenthesizedExpression - ] - -parenthesizedExpression :: Assignment Term -parenthesizedExpression = symbol ParenthesizedExpression *> children (term expression) - -classConstantAccessExpression :: Assignment Term -classConstantAccessExpression = makeTerm <$> symbol ClassConstantAccessExpression <*> children (Expression.MemberAccess <$> term scopeResolutionQualifier <*> name) - -variable :: Assignment Term -variable = callableVariable <|> scopedPropertyAccessExpression <|> memberAccessExpression <|> castExpression - -callableVariable :: Assignment Term -callableVariable = choice [ - simpleVariable', - subscriptExpression, - memberCallExpression, - scopedCallExpression, - functionCallExpression - ] - -memberCallExpression :: Assignment Term -memberCallExpression = makeTerm <$> symbol MemberCallExpression <*> children (Expression.Call [] <$> (makeMemberAccess <$> location <*> term dereferencableExpression <*> memberName) <*> arguments <*> emptyTerm) - where makeMemberAccess loc expr memberName = makeTerm loc (Expression.MemberAccess expr memberName) - -scopedCallExpression :: Assignment Term -scopedCallExpression = makeTerm <$> symbol ScopedCallExpression <*> children (Expression.Call [] <$> (makeMemberAccess <$> location <*> term scopeResolutionQualifier <*> memberName) <*> arguments <*> emptyTerm) - where makeMemberAccess loc expr memberName = makeTerm loc (Expression.MemberAccess expr memberName) - -functionCallExpression :: Assignment Term -functionCallExpression = makeTerm <$> symbol FunctionCallExpression <*> children (Expression.Call [] <$> term (qualifiedName <|> callableExpression) <*> arguments <*> emptyTerm) - -callableExpression :: Assignment Term -callableExpression = choice [ - callableVariable, - expression, - arrayCreationExpression, - string - ] - -subscriptExpression :: Assignment Term -subscriptExpression = makeTerm <$> symbol SubscriptExpression <*> children (Expression.Subscript <$> term dereferencableExpression <*> (pure <$> (term expression <|> emptyTerm))) - -memberAccessExpression :: Assignment Term -memberAccessExpression = makeTerm <$> symbol MemberAccessExpression <*> children (Expression.MemberAccess <$> term dereferencableExpression <*> memberName) - -dereferencableExpression :: Assignment Term -dereferencableExpression = symbol DereferencableExpression *> children (term (variable <|> expression <|> arrayCreationExpression <|> string)) - -scopedPropertyAccessExpression :: Assignment Term -scopedPropertyAccessExpression = makeTerm <$> symbol ScopedPropertyAccessExpression <*> children (Expression.MemberAccess <$> term scopeResolutionQualifier <*> simpleVariable') - -scopeResolutionQualifier :: Assignment Term -scopeResolutionQualifier = choice [ - relativeScope, - qualifiedName, - dereferencableExpression - ] - -arrayCreationExpression :: Assignment Term -arrayCreationExpression = makeTerm <$> symbol ArrayCreationExpression <*> children (Literal.Array <$> manyTerm arrayElementInitializer) - -intrinsic :: Assignment Term -intrinsic = choice [ - emptyIntrinsic, - evalIntrinsic, - exitIntrinsic, - issetIntrinsic, - printIntrinsic - ] - -emptyIntrinsic :: Assignment Term -emptyIntrinsic = makeTerm <$> symbol EmptyIntrinsic <*> children (Syntax.EmptyIntrinsic <$> term expression) - -evalIntrinsic :: Assignment Term -evalIntrinsic = makeTerm <$> symbol EvalIntrinsic <*> children (Syntax.EvalIntrinsic <$> term expression) - -exitIntrinsic :: Assignment Term -exitIntrinsic = makeTerm <$> symbol ExitIntrinsic <*> children (Syntax.ExitIntrinsic <$> (term expression <|> emptyTerm)) - -issetIntrinsic :: Assignment Term -issetIntrinsic = makeTerm <$> symbol IssetIntrinsic <*> children (Syntax.IssetIntrinsic <$> (makeTerm <$> location <*> someTerm variable)) - -printIntrinsic :: Assignment Term -printIntrinsic = makeTerm <$> symbol PrintIntrinsic <*> children (Syntax.PrintIntrinsic <$> term expression) - -anonymousFunctionCreationExpression :: Assignment Term -anonymousFunctionCreationExpression = makeTerm <$> symbol AnonymousFunctionCreationExpression <*> children (makeFunction <$> emptyTerm <*> parameters <*> (term functionUseClause <|> emptyTerm) <*> (term returnType <|> emptyTerm) <*> term compoundStatement) - where - makeFunction identifier parameters functionUseClause returnType statement = Declaration.Function [functionUseClause, returnType] identifier parameters statement - -parameters :: Assignment [Term] -parameters = manyTerm (simpleParameter <|> variadicParameter) - -simpleParameter :: Assignment Term -simpleParameter = makeTerm <$> symbol SimpleParameter <*> children (makeAnnotation <$> (term typeDeclaration <|> emptyTerm) <*> (makeAssignment <$> location <*> term variableName <*> (term defaultArgumentSpecifier <|> emptyTerm))) - where - makeAnnotation typeDecl assignment = Type.Annotation assignment typeDecl - makeAssignment loc name argument = makeTerm loc (Statement.Assignment [] name argument) - -defaultArgumentSpecifier :: Assignment Term -defaultArgumentSpecifier = symbol DefaultArgumentSpecifier *> children (term expression) - - -variadicParameter :: Assignment Term -variadicParameter = makeTerm <$> symbol VariadicParameter <*> children (makeTypeAnnotation <$> (term typeDeclaration <|> emptyTerm) <*> term variableName) - where makeTypeAnnotation ty variableName = Type.Annotation variableName ty - -functionUseClause :: Assignment Term -functionUseClause = makeTerm <$> symbol AnonymousFunctionUseClause <*> children (Syntax.UseClause <$> someTerm variableName) - -returnType :: Assignment Term -returnType = makeTerm <$> symbol ReturnType <*> children (Syntax.ReturnType <$> (term typeDeclaration <|> emptyTerm)) - -typeDeclaration :: Assignment Term -typeDeclaration = makeTerm <$> symbol TypeDeclaration <*> children (Syntax.TypeDeclaration <$> term baseTypeDeclaration) - -baseTypeDeclaration :: Assignment Term -baseTypeDeclaration = makeTerm <$> symbol BaseTypeDeclaration <*> children (Syntax.BaseTypeDeclaration <$> term (scalarType <|> qualifiedName <|> emptyTerm)) - -scalarType :: Assignment Term -scalarType = makeTerm <$> symbol ScalarType <*> (Syntax.ScalarType <$> source) - -compoundStatement :: Assignment Term -compoundStatement = makeTerm <$> symbol CompoundStatement <*> children (manyTerm statement) - -objectCreationExpression :: Assignment Term -objectCreationExpression = makeTerm <$> symbol ObjectCreationExpression <*> children (Expression.New <$> term classTypeDesignator <*> emptyTerm <*> (arguments <|> pure [])) - - <|> (makeTerm <$> symbol ObjectCreationExpression <*> children (makeAnonClass <$ token AnonNew <* token AnonClass <*> emptyTerm <*> (arguments <|> pure []) <*> (term classBaseClause <|> emptyTerm) <*> (term classInterfaceClause <|> emptyTerm) <*> (makeTerm <$> location <*> manyTerm classMemberDeclaration))) - where makeAnonClass identifier args baseClause interfaceClause declarations = Declaration.Class [] identifier (args <> [baseClause, interfaceClause]) declarations - -classMemberDeclaration :: Assignment Term -classMemberDeclaration = choice [ - classConstDeclaration, - propertyDeclaration, - methodDeclaration, - constructorDeclaration, - destructorDeclaration, - traitUseClause - ] - -publicAccessControl :: ScopeGraph.AccessControl -publicAccessControl = ScopeGraph.Public - --- TODO: Update to check for AccessControl. -methodDeclaration :: Assignment Term -methodDeclaration = (makeTerm <$> symbol MethodDeclaration <*> children (makeMethod1 publicAccessControl <$> manyTerm methodModifier <*> emptyTerm <*> functionDefinitionParts)) - <|> makeTerm <$> symbol MethodDeclaration <*> children (makeMethod2 publicAccessControl <$> someTerm methodModifier <*> emptyTerm <*> term name <*> parameters <*> term (returnType <|> emptyTerm) <*> emptyTerm) - where - functionDefinitionParts = symbol FunctionDefinition *> children ((,,,) <$> term name <*> parameters <*> term (returnType <|> emptyTerm) <*> (term compoundStatement <|> emptyTerm)) - makeMethod1 accessControl modifiers receiver (name, params, returnType, compoundStatement) = Declaration.Method (modifiers <> [returnType]) receiver name params compoundStatement accessControl - makeMethod2 accessControl modifiers receiver name params returnType compoundStatement = Declaration.Method (modifiers <> [returnType]) receiver name params compoundStatement accessControl - -classBaseClause :: Assignment Term -classBaseClause = makeTerm <$> symbol ClassBaseClause <*> children (Syntax.ClassBaseClause <$> term qualifiedName) - -classInterfaceClause :: Assignment Term -classInterfaceClause = makeTerm <$> symbol ClassInterfaceClause <*> children (Syntax.ClassInterfaceClause <$> someTerm qualifiedName) - -classConstDeclaration :: Assignment Term -classConstDeclaration = makeTerm <$> symbol ClassConstDeclaration <*> children (Syntax.ClassConstDeclaration <$> (term accessControlModifier <|> emptyTerm) <*> manyTerm constElement) - --- TODO: Update to ScopeGraph.AccessControl -accessControlModifier :: Assignment Term -accessControlModifier = makeTerm <$> symbol VisibilityModifier <*> (Syntax.Identifier . Name.name <$> source) - -constElement :: Assignment Term -constElement = makeTerm <$> symbol ConstElement <*> children (Statement.Assignment [] <$> term name <*> term expression) - -arguments :: Assignment [Term] -arguments = symbol Arguments *> children (manyTerm (variadicUnpacking <|> expression)) - -variadicUnpacking :: Assignment Term -variadicUnpacking = symbol VariadicUnpacking *> children (term expression) - -classTypeDesignator :: Assignment Term -classTypeDesignator = qualifiedName <|> newVariable - -newVariable :: Assignment Term -newVariable = makeTerm <$> symbol NewVariable <*> children (Syntax.NewVariable <$> ((pure <$> term simpleVariable') <|> ((\a b -> [a, b]) <$> term (newVariable <|> qualifiedName <|> relativeScope) <*> term (expression <|> memberName <|> emptyTerm)))) - -memberName :: Assignment Term -memberName = name <|> simpleVariable' <|> expression - -relativeScope :: Assignment Term -relativeScope = makeTerm <$> symbol RelativeScope <*> (Syntax.RelativeScope <$> source) - -qualifiedName :: Assignment Term -qualifiedName = makeTerm <$> symbol QualifiedName <*> children (Syntax.QualifiedName <$> (term namespaceNameAsPrefix <|> emptyTerm) <*> term name) - -namespaceNameAsPrefix :: Assignment Term -namespaceNameAsPrefix = symbol NamespaceNameAsPrefix *> children (term namespaceName <|> emptyTerm) - -namespaceName :: Assignment Term -namespaceName = makeTerm <$> symbol NamespaceName <*> children (Syntax.NamespaceName <$> someTerm' name) - -namespaceName' :: Assignment (NonEmpty Term) -namespaceName' = symbol NamespaceName *> children (someTerm' name) - -updateExpression :: Assignment Term -updateExpression = makeTerm <$> symbol UpdateExpression <*> children (Syntax.Update <$> term expression) - -shellCommandExpression :: Assignment Term -shellCommandExpression = makeTerm <$> symbol ShellCommandExpression <*> (Syntax.ShellCommand <$> source) - -literal :: Assignment Term -literal = integer <|> float <|> string - -float :: Assignment Term -float = makeTerm <$> symbol Float <*> (Literal.Float <$> source) - -integer :: Assignment Term -integer = makeTerm <$> symbol Integer <*> (Literal.Integer <$> source) - -unaryOpExpression :: Assignment Term -unaryOpExpression = symbol UnaryOpExpression >>= \ loc -> - makeTerm loc . Expression.Not <$> children ((symbol AnonTilde <|> symbol AnonBang) *> term expression) - <|> makeTerm loc . Expression.Negate <$> children ((symbol AnonMinus <|> symbol AnonPlus) *> term expression) - <|> makeTerm loc . Syntax.ErrorControl <$> children (symbol AnonAt *> term expression) - -castExpression :: Assignment Term -castExpression = makeTerm <$> (symbol CastExpression <|> symbol CastExpression') <*> children (flip Expression.Cast <$> term castType <*> term unaryExpression) - -castType :: Assignment Term -castType = makeTerm <$> symbol CastType <*> (Syntax.CastType <$> source) - -expressionStatement :: Assignment Term -expressionStatement = symbol ExpressionStatement *> children (term expression) - -namedLabelStatement :: Assignment Term -namedLabelStatement = makeTerm <$> symbol NamedLabelStatement <*> children (Syntax.LabeledStatement <$> term name) - -selectionStatement :: Assignment Term -selectionStatement = ifStatement <|> switchStatement - -ifStatement :: Assignment Term -ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> term expression <*> (makeTerm <$> location <*> manyTerm statement) <*> (makeTerm <$> location <*> ((\as b -> as <> [b]) <$> manyTerm elseIfClause <*> (term elseClause <|> emptyTerm)))) - -switchStatement :: Assignment Term -switchStatement = makeTerm <$> symbol SwitchStatement <*> children (Statement.Match <$> term expression <*> (makeTerm <$> location <*> manyTerm (caseStatement <|> defaultStatement))) - -caseStatement :: Assignment Term -caseStatement = makeTerm <$> symbol CaseStatement <*> children (Statement.Pattern <$> term expression <*> (makeTerm <$> location <*> manyTerm statement)) - -defaultStatement :: Assignment Term -defaultStatement = makeTerm <$> symbol DefaultStatement <*> children (Statement.Pattern <$> emptyTerm <*> (makeTerm <$> location <*> manyTerm statement)) - -elseIfClause :: Assignment Term -elseIfClause = makeTerm <$> symbol ElseIfClause <*> children (Statement.Else <$> term expression <*> (makeTerm <$> location <*> manyTerm statement)) - -elseClause :: Assignment Term -elseClause = makeTerm <$> symbol ElseClause <*> children (Statement.Else <$> emptyTerm <*> (makeTerm <$> location <*> manyTerm statement)) - -iterationStatement :: Assignment Term -iterationStatement = choice [ - whileStatement, - doStatement, - forStatement, - foreachStatement - ] - -whileStatement :: Assignment Term -whileStatement = makeTerm <$> symbol WhileStatement <*> children (Statement.While <$> expression <*> (term (statement <|> (makeTerm <$> location <*> manyTerm statement)) <|> emptyTerm)) - -doStatement :: Assignment Term -doStatement = makeTerm <$> symbol DoStatement <*> children (Statement.DoWhile <$> term statement <*> term expression) - -forStatement :: Assignment Term -forStatement = makeTerm <$> symbol ForStatement <*> children (Statement.For <$> (term expressions <|> emptyTerm) <*> (term expressions <|> emptyTerm) <*> (term expressions <|> emptyTerm) <*> (makeTerm <$> location <*> manyTerm statement)) - -foreachStatement :: Assignment Term -foreachStatement = makeTerm <$> symbol ForeachStatement <*> children (forEachStatement' <$> term expression <*> term (pair <|> expression <|> list) <*> (makeTerm <$> location <*> manyTerm statement)) - where forEachStatement' array value body = Statement.ForEach value array body - -pair :: Assignment Term -pair = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> term expression <*> term (expression <|> list)) - -jumpStatement :: Assignment Term -jumpStatement = choice [ - gotoStatement, - continueStatement, - breakStatement, - returnStatement, - throwStatement - ] - -gotoStatement :: Assignment Term -gotoStatement = makeTerm <$> symbol GotoStatement <*> children (Statement.Goto <$> term name) - -continueStatement :: Assignment Term -continueStatement = makeTerm <$> symbol ContinueStatement <*> children (Statement.Continue <$> (term breakoutLevel <|> emptyTerm)) - -breakoutLevel :: Assignment Term -breakoutLevel = integer - -breakStatement :: Assignment Term -breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (term breakoutLevel <|> emptyTerm)) - -returnStatement :: Assignment Term -returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> (term expression <|> emptyTerm)) - -throwStatement :: Assignment Term -throwStatement = makeTerm <$> symbol ThrowStatement <*> children (Statement.Throw <$> term expression) - - -tryStatement :: Assignment Term -tryStatement = makeTerm <$> symbol TryStatement <*> children (Statement.Try <$> term compoundStatement <*> (((\as b -> as <> [b]) <$> someTerm catchClause <*> term finallyClause) <|> someTerm catchClause <|> someTerm finallyClause)) - -catchClause :: Assignment Term -catchClause = makeTerm <$> symbol CatchClause <*> children (Statement.Catch <$> (makeTerm <$> location <*> ((\a b -> [a, b]) <$> term qualifiedName <*> term variableName)) <*> term compoundStatement) - -finallyClause :: Assignment Term -finallyClause = makeTerm <$> symbol FinallyClause <*> children (Statement.Finally <$> term compoundStatement) - -declareStatement :: Assignment Term -declareStatement = makeTerm <$> symbol DeclareStatement <*> children (Syntax.Declare <$> term declareDirective <*> (makeTerm <$> location <*> manyTerm statement)) - - --- | TODO: Figure out how to parse assignment token -declareDirective :: Assignment Term -declareDirective = makeTerm <$> symbol DeclareDirective <*> children (Syntax.DeclareDirective <$> literal) - - -echoStatement :: Assignment Term -echoStatement = makeTerm <$> symbol EchoStatement <*> children (Syntax.Echo <$> term expressions) - -unsetStatement :: Assignment Term -unsetStatement = makeTerm <$> symbol UnsetStatement <*> children (Syntax.Unset <$> (makeTerm <$> location <*> someTerm variable)) - -expressions :: Assignment Term -expressions = expression <|> sequenceExpression - -sequenceExpression :: Assignment Term -sequenceExpression = makeTerm <$> symbol SequenceExpression <*> children (Expression.SequenceExpression <$> term expression <*> term expressions) - -constDeclaration :: Assignment Term -constDeclaration = makeTerm <$> symbol ConstDeclaration <*> children (Syntax.ConstDeclaration <$> someTerm constElement) - -functionDefinition :: Assignment Term -functionDefinition = makeTerm <$> symbol FunctionDefinition <*> children (makeFunction <$> term name <*> parameters <*> (term returnType <|> emptyTerm) <*> term compoundStatement) - where - makeFunction identifier parameters returnType statement = Declaration.Function [returnType] identifier parameters statement - -classDeclaration :: Assignment Term -classDeclaration = makeTerm <$> symbol ClassDeclaration <*> children (makeClass <$> (term classModifier <|> emptyTerm) <*> term name <*> (term classBaseClause <|> emptyTerm) <*> (term classInterfaceClause <|> emptyTerm) <*> (makeTerm <$> location <*> manyTerm classMemberDeclaration)) - where - makeClass modifier name baseClause interfaceClause declarations = Declaration.Class [modifier] name [baseClause, interfaceClause] declarations - -interfaceDeclaration :: Assignment Term -interfaceDeclaration = makeTerm <$> symbol InterfaceDeclaration <*> children (Syntax.InterfaceDeclaration <$> term name <*> (term interfaceBaseClause <|> emptyTerm) <*> manyTerm interfaceMemberDeclaration) - -interfaceBaseClause :: Assignment Term -interfaceBaseClause = makeTerm <$> symbol InterfaceBaseClause <*> children (Syntax.InterfaceBaseClause <$> someTerm qualifiedName) - -interfaceMemberDeclaration :: Assignment Term -interfaceMemberDeclaration = methodDeclaration <|> classConstDeclaration - -traitDeclaration :: Assignment Term -traitDeclaration = makeTerm <$> symbol TraitDeclaration <*> children (Syntax.TraitDeclaration <$> term name <*> manyTerm traitMemberDeclaration) - -traitMemberDeclaration :: Assignment Term -traitMemberDeclaration = choice [ - propertyDeclaration, - methodDeclaration, - constructorDeclaration, - destructorDeclaration, - traitUseClause - ] - -propertyDeclaration :: Assignment Term -propertyDeclaration = makeTerm <$> symbol PropertyDeclaration <*> children (Syntax.PropertyDeclaration <$> term propertyModifier <*> someTerm propertyElement) - -propertyModifier :: Assignment Term -propertyModifier = (makeTerm <$> symbol PropertyModifier <*> children (Syntax.PropertyModifier <$> (term accessControlModifier <|> emptyTerm) <*> (term staticModifier <|> emptyTerm))) <|> term (makeTerm <$> symbol PropertyModifier <*> (Syntax.Identifier . Name.name <$> source)) - -propertyElement :: Assignment Term -propertyElement = makeTerm <$> symbol PropertyElement <*> children (Statement.Assignment [] <$> term variableName <*> term propertyInitializer) <|> (symbol PropertyElement *> children (term variableName)) - where propertyInitializer = symbol PropertyInitializer *> children (term expression) - -constructorDeclaration :: Assignment Term -constructorDeclaration = makeTerm <$> symbol ConstructorDeclaration <*> children (Syntax.ConstructorDeclaration <$> someTerm methodModifier <*> parameters <*> term compoundStatement) - -destructorDeclaration :: Assignment Term -destructorDeclaration = makeTerm <$> symbol DestructorDeclaration <*> children (Syntax.DestructorDeclaration <$> someTerm methodModifier <*> term compoundStatement) - -methodModifier :: Assignment Term -methodModifier = choice [ - accessControlModifier, - classModifier, - staticModifier - ] - -staticModifier :: Assignment Term -staticModifier = makeTerm <$> symbol StaticModifier <*> (Syntax.Static <$> source) - -classModifier :: Assignment Term -classModifier = makeTerm <$> symbol ClassModifier <*> (Syntax.ClassModifier <$> source) - -traitUseClause :: Assignment Term -traitUseClause = makeTerm <$> symbol TraitUseClause <*> children (Syntax.TraitUseClause <$> someTerm qualifiedName <*> (term traitUseSpecification <|> emptyTerm)) - -traitUseSpecification :: Assignment Term -traitUseSpecification = makeTerm <$> symbol TraitUseSpecification <*> children (Syntax.TraitUseSpecification <$> manyTerm traitSelectAndAliasClause) - -traitSelectAndAliasClause :: Assignment Term -traitSelectAndAliasClause = traitSelectInsteadOfClause <|> traitAliasAsClause - -traitSelectInsteadOfClause :: Assignment Term -traitSelectInsteadOfClause = makeTerm <$> symbol TraitSelectInsteadOfClause <*> children (Syntax.InsteadOf <$> term (classConstantAccessExpression <|> name) <*> term name) - -traitAliasAsClause :: Assignment Term -traitAliasAsClause = makeTerm <$> symbol TraitAliasAsClause <*> children (Syntax.AliasAs <$> term (classConstantAccessExpression <|> name) <*> (term accessControlModifier <|> emptyTerm) <*> (term name <|> emptyTerm)) - -namespaceDefinition :: Assignment Term -namespaceDefinition = makeTerm <$> symbol NamespaceDefinition <*> children (Syntax.Namespace <$> (toList <$> namespaceName' <|> pure []) <*> (term compoundStatement <|> emptyTerm)) - -namespaceUseDeclaration :: Assignment Term -namespaceUseDeclaration = makeTerm <$> symbol NamespaceUseDeclaration <*> children (Syntax.NamespaceUseDeclaration <$> - ((mappend <$> (pure <$> (term namespaceFunctionOrConst <|> emptyTerm)) <*> someTerm namespaceUseClause) <|> ((\a b cs -> a : b : cs) <$> term namespaceFunctionOrConst <*> term namespaceName <*> someTerm namespaceUseGroupClause1) <|> ((:) <$> term namespaceName <*> someTerm namespaceUseGroupClause2))) - -namespaceUseClause :: Assignment Term -namespaceUseClause = makeTerm <$> symbol NamespaceUseClause <*> children (fmap Syntax.NamespaceUseClause $ (\a b -> [a, b]) <$> term qualifiedName <*> (term namespaceAliasingClause <|> emptyTerm)) - -namespaceUseGroupClause1 :: Assignment Term -namespaceUseGroupClause1 = makeTerm <$> symbol NamespaceUseGroupClause_1 <*> children (fmap Syntax.NamespaceUseGroupClause $ (\a b -> [a, b]) <$> term namespaceName <*> (term namespaceAliasingClause <|> emptyTerm)) - -namespaceUseGroupClause2 :: Assignment Term -namespaceUseGroupClause2 = makeTerm <$> symbol NamespaceUseGroupClause_2 <*> children (fmap Syntax.NamespaceUseGroupClause $ (\a b c -> [a, b, c]) <$> (term namespaceFunctionOrConst <|> emptyTerm) <*> term namespaceName <*> (term namespaceAliasingClause <|> emptyTerm)) - -namespaceAliasingClause :: Assignment Term -namespaceAliasingClause = makeTerm <$> symbol NamespaceAliasingClause <*> children (Syntax.NamespaceAliasingClause <$> term name) - --- | TODO Do something better than Identifier -namespaceFunctionOrConst :: Assignment Term -namespaceFunctionOrConst = makeTerm <$> symbol NamespaceFunctionOrConst <*> (Syntax.Identifier . Name.name <$> source) - -globalDeclaration :: Assignment Term -globalDeclaration = makeTerm <$> symbol GlobalDeclaration <*> children (Syntax.GlobalDeclaration <$> manyTerm simpleVariable') - -simpleVariable :: Assignment Term -simpleVariable = makeTerm <$> symbol SimpleVariable <*> children (Syntax.SimpleVariable <$> term (simpleVariable' <|> expression)) - -simpleVariable' :: Assignment Term -simpleVariable' = choice [simpleVariable, variableName] - - -yieldExpression :: Assignment Term -yieldExpression = makeTerm <$> symbol YieldExpression <*> children (Statement.Yield <$> term (arrayElementInitializer <|> expression)) - -arrayElementInitializer :: Assignment Term -arrayElementInitializer = makeTerm <$> symbol ArrayElementInitializer <*> children (Literal.KeyValue <$> term expression <*> term expression) <|> (symbol ArrayElementInitializer *> children (term expression)) - -includeExpression :: Assignment Term -includeExpression = makeTerm <$> symbol IncludeExpression <*> children (Syntax.Include <$> term expression) - - -includeOnceExpression :: Assignment Term -includeOnceExpression = makeTerm <$> symbol IncludeOnceExpression <*> children (Syntax.IncludeOnce <$> term expression) - -requireExpression :: Assignment Term -requireExpression = makeTerm <$> symbol RequireExpression <*> children (Syntax.Require <$> term expression) - - -requireOnceExpression :: Assignment Term -requireOnceExpression = makeTerm <$> symbol RequireOnceExpression <*> children (Syntax.RequireOnce <$> term expression) - -variableName :: Assignment Term -variableName = makeTerm <$> symbol VariableName <*> children (Syntax.VariableName <$> term name) - -name :: Assignment Term -name = makeTerm <$> (symbol Name <|> symbol Name') <*> (Syntax.Identifier . Name.name <$> source) - -functionStaticDeclaration :: Assignment Term -functionStaticDeclaration = makeTerm <$> symbol FunctionStaticDeclaration <*> children (Declaration.VariableDeclaration <$> manyTerm staticVariableDeclaration) - -staticVariableDeclaration :: Assignment Term -staticVariableDeclaration = makeTerm <$> symbol StaticVariableDeclaration <*> children (Statement.Assignment [] <$> term variableName <*> (term expression <|> emptyTerm)) - -comment :: Assignment Term -comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) - -string :: Assignment Term -string = makeTerm <$> (symbol Grammar.String <|> symbol Heredoc) <*> (Literal.TextElement <$> source) - - --- Helpers - -append :: a -> [a] -> [a] -append x xs = xs <> [x] - -bookend :: a -> [a] -> a -> [a] -bookend head_ list last_ = head_ : append last_ list - -term :: Assignment Term -> Assignment Term -term term = contextualize (comment <|> textInterpolation) (postContextualize (comment <|> textInterpolation) term) - -commentedTerm :: Assignment Term -> Assignment Term -commentedTerm term = contextualize (comment <|> textInterpolation) term <|> makeTerm1 <$> (Syntax.Context <$> some1 (comment <|> textInterpolation) <*> emptyTerm) - --- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present. -manyTerm :: Assignment Term -> Assignment [Term] -manyTerm = many . commentedTerm - -someTerm :: Assignment Term -> Assignment [Term] -someTerm = fmap NonEmpty.toList . someTerm' - -someTerm' :: Assignment Term -> Assignment (NonEmpty Term) -someTerm' = NonEmpty.some1 . commentedTerm - --- | Match infix terms separated by any of a list of operators, assigning any comments following each operand. -infixTerm :: Assignment Term - -> Assignment Term - -> [Assignment (Term -> Term -> Sum Syntax Term)] - -> Assignment (Sum Syntax Term) -infixTerm = infixContext (comment <|> textInterpolation) diff --git a/src/Language/PHP/Syntax.hs b/src/Language/PHP/Syntax.hs deleted file mode 100644 index 06b72399f4..0000000000 --- a/src/Language/PHP/Syntax.hs +++ /dev/null @@ -1,424 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.PHP.Syntax where - -import Prelude hiding (span) -import Prologue hiding (Text) - -import Control.Lens.Getter -import qualified Data.Map.Strict as Map -import qualified Data.Text as T - -import Control.Abstract as Abstract -import Data.Abstract.BaseError -import Data.Abstract.Evaluatable as Abstract -import Data.Abstract.Module -import Data.Abstract.Path -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.JSON.Fields -import qualified Data.Language as Language -import Data.Span -import Diffing.Algorithm - -newtype Text a = Text { value :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Text - -instance Evaluatable Text - -newtype VariableName a = VariableName { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically VariableName - -instance Evaluatable VariableName - --- TODO: Variables defined in an included file take on scope of the source line --- on which the inclusion occurs in the including file. However, functions and --- classes defined in the included file are always in global scope. - --- TODO: If inclusion occurs inside a function definition within the including --- file, the complete contents of the included file are treated as though it --- were defined inside that function. - -resolvePHPName :: ( Member (Modules address value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Carrier sig m - ) - => T.Text - -> Evaluator term address value m ModulePath -resolvePHPName n = do - modulePath <- resolve [name] - maybeM (throwResolutionError $ NotFoundError name [name] Language.PHP) modulePath - where name = toName n - toName = T.unpack . dropRelativePrefix . stripQuotes - -include :: ( Carrier sig m - , Member (Modules address value) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (State (ScopeGraph address)) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Member (State (Heap address address value)) sig - , Member (Abstract.String value) sig - , Member Trace sig - , Ord address - ) - => (term -> Evaluator term address value m value) - -> term - -> (ModulePath -> Evaluator term address value m (ModuleResult address value)) - -> Evaluator term address value m value -include eval pathTerm f = do - name <- eval pathTerm >>= asString - path <- resolvePHPName name - traceResolve name path - ((moduleScope, moduleFrame), v) <- f path - insertImportEdge moduleScope - insertFrameLink ScopeGraph.Import (Map.singleton moduleScope moduleFrame) - pure v - -newtype Require a = Require { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Require - -instance Evaluatable Require where - eval eval _ (Require path) = include eval path load - - -newtype RequireOnce a = RequireOnce { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically RequireOnce - -instance Evaluatable RequireOnce where - eval eval _ (RequireOnce path) = include eval path require - -newtype Include a = Include { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Include - -instance Evaluatable Include where - eval eval _ (Include path) = include eval path load - -newtype IncludeOnce a = IncludeOnce { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically IncludeOnce - -instance Evaluatable IncludeOnce where - eval eval _ (IncludeOnce path) = include eval path require - -newtype ArrayElement a = ArrayElement { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ArrayElement - -instance Evaluatable ArrayElement - -newtype GlobalDeclaration a = GlobalDeclaration { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically GlobalDeclaration - -instance Evaluatable GlobalDeclaration - -newtype SimpleVariable a = SimpleVariable { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically SimpleVariable - -instance Evaluatable SimpleVariable - --- | TODO: Unify with TypeScript's PredefinedType -newtype CastType a = CastType { _castType :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically CastType - -instance Evaluatable CastType - -newtype ErrorControl a = ErrorControl { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ErrorControl - -instance Evaluatable ErrorControl - -newtype Clone a = Clone { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Clone - -instance Evaluatable Clone - -newtype ShellCommand a = ShellCommand { value :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ShellCommand - -instance Evaluatable ShellCommand - --- | TODO: Combine with TypeScript update expression. -newtype Update a = Update { _updateSubject :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Update -instance Evaluatable Update - -newtype NewVariable a = NewVariable { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NewVariable - -instance Evaluatable NewVariable - -newtype RelativeScope a = RelativeScope { value :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically RelativeScope - -instance Evaluatable RelativeScope - -data QualifiedName a = QualifiedName { name :: a, identifier :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QualifiedName - -instance Evaluatable QualifiedName where - eval _ _ (QualifiedName obj iden) = do - -- TODO: Consider gensym'ed names used for References. - name <- maybeM (throwNoNameError obj) (declaredName obj) - reference (Reference name) (obj^.span) ScopeGraph.Identifier (Declaration name) - childScope <- associatedScope (Declaration name) - - propName <- maybeM (throwNoNameError iden) (declaredName iden) - case childScope of - Just childScope -> do - currentScopeAddress <- currentScope - currentFrameAddress <- currentFrame - frameAddress <- newFrame childScope (Map.singleton Lexical (Map.singleton currentScopeAddress currentFrameAddress)) - withScopeAndFrame frameAddress $ do - reference (Reference propName) (iden^.span) ScopeGraph.Identifier (Declaration propName) - slot <- lookupSlot (Declaration propName) - deref slot - Nothing -> - -- TODO: Throw an ReferenceError because we can't find the associated child scope for `obj`. - unit - -newtype NamespaceName a = NamespaceName { names :: NonEmpty a } - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Diffable, FreeVariables1, Declarations1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NamespaceName - -instance Hashable1 NamespaceName where liftHashWithSalt = foldl - -instance Evaluatable NamespaceName - -newtype ConstDeclaration a = ConstDeclaration { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ConstDeclaration - -instance Evaluatable ConstDeclaration - -data ClassConstDeclaration a = ClassConstDeclaration { visibility :: a, elements :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ClassConstDeclaration - -instance Evaluatable ClassConstDeclaration - -newtype ClassInterfaceClause a = ClassInterfaceClause { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ClassInterfaceClause - -instance Evaluatable ClassInterfaceClause - -newtype ClassBaseClause a = ClassBaseClause { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ClassBaseClause - -instance Evaluatable ClassBaseClause - -newtype UseClause a = UseClause { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically UseClause - -instance Evaluatable UseClause - -newtype ReturnType a = ReturnType { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ReturnType - -instance Evaluatable ReturnType - -newtype TypeDeclaration a = TypeDeclaration { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TypeDeclaration - -instance Evaluatable TypeDeclaration - -newtype BaseTypeDeclaration a = BaseTypeDeclaration { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically BaseTypeDeclaration -instance Evaluatable BaseTypeDeclaration - -newtype ScalarType a = ScalarType { value :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ScalarType - -instance Evaluatable ScalarType - -newtype EmptyIntrinsic a = EmptyIntrinsic { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically EmptyIntrinsic - -instance Evaluatable EmptyIntrinsic - -newtype ExitIntrinsic a = ExitIntrinsic { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ExitIntrinsic - -instance Evaluatable ExitIntrinsic - -newtype IssetIntrinsic a = IssetIntrinsic { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically IssetIntrinsic - -instance Evaluatable IssetIntrinsic - -newtype EvalIntrinsic a = EvalIntrinsic { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically EvalIntrinsic - -instance Evaluatable EvalIntrinsic - -newtype PrintIntrinsic a = PrintIntrinsic { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PrintIntrinsic - -instance Evaluatable PrintIntrinsic - -newtype NamespaceAliasingClause a = NamespaceAliasingClause { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NamespaceAliasingClause -instance Evaluatable NamespaceAliasingClause - -newtype NamespaceUseDeclaration a = NamespaceUseDeclaration { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NamespaceUseDeclaration - -instance Evaluatable NamespaceUseDeclaration - -newtype NamespaceUseClause a = NamespaceUseClause { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NamespaceUseClause - -instance Evaluatable NamespaceUseClause - -newtype NamespaceUseGroupClause a = NamespaceUseGroupClause { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically NamespaceUseGroupClause - -instance Evaluatable NamespaceUseGroupClause - -data Namespace a = Namespace { namespaceName :: [a], namespaceBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Namespace - -instance Evaluatable Namespace - -data TraitDeclaration a = TraitDeclaration { traitName :: a, traitStatements :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TraitDeclaration - -instance Evaluatable TraitDeclaration - -data AliasAs a = AliasAs { aliasAsName :: a, aliasAsModifier :: a, aliasAsClause :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically AliasAs - -instance Evaluatable AliasAs - -data InsteadOf a = InsteadOf { left :: a, right :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically InsteadOf - -instance Evaluatable InsteadOf - -newtype TraitUseSpecification a = TraitUseSpecification { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TraitUseSpecification - -instance Evaluatable TraitUseSpecification - -data TraitUseClause a = TraitUseClause { namespace :: [a], alias :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically TraitUseClause - -instance Evaluatable TraitUseClause - -data DestructorDeclaration a = DestructorDeclaration { body:: [a], name :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically DestructorDeclaration - -instance Evaluatable DestructorDeclaration - -newtype Static a = Static { value :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Static - -instance Evaluatable Static - -newtype ClassModifier a = ClassModifier { value :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ClassModifier - -instance Evaluatable ClassModifier - -data ConstructorDeclaration a = ConstructorDeclaration { modifiers :: [a], parameters :: [a], body :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ConstructorDeclaration -instance Evaluatable ConstructorDeclaration - -data PropertyDeclaration a = PropertyDeclaration { modifier :: a, elements :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PropertyDeclaration - -instance Evaluatable PropertyDeclaration - -data PropertyModifier a = PropertyModifier { visibility :: a , static :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically PropertyModifier - -instance Evaluatable PropertyModifier - -data InterfaceDeclaration a = InterfaceDeclaration { name :: a, base :: a, declarations :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically InterfaceDeclaration - -instance Evaluatable InterfaceDeclaration - -newtype InterfaceBaseClause a = InterfaceBaseClause { values :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically InterfaceBaseClause - -instance Evaluatable InterfaceBaseClause - -newtype Echo a = Echo { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Echo - -instance Evaluatable Echo - -newtype Unset a = Unset { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Unset - -instance Evaluatable Unset - -data Declare a = Declare { left :: a, right :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Declare - -instance Evaluatable Declare - -newtype DeclareDirective a = DeclareDirective { value :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically DeclareDirective - -instance Evaluatable DeclareDirective - -newtype LabeledStatement a = LabeledStatement { _labeledStatementIdentifier :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LabeledStatement - -instance Evaluatable LabeledStatement diff --git a/src/Language/Python/Assignment.hs b/src/Language/Python/Assignment.hs deleted file mode 100644 index 25921c53ee..0000000000 --- a/src/Language/Python/Assignment.hs +++ /dev/null @@ -1,559 +0,0 @@ -{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.Python.Assignment -( assignment -, Syntax -, Grammar -, Term -) where - -import Assigning.Assignment hiding (Assignment, Error) -import qualified Assigning.Assignment as Assignment -import Data.Abstract.Name (name) -import qualified Data.List.NonEmpty as NonEmpty -import Data.Sum -import Data.Syntax - ( contextualize - , emptyTerm - , handleError - , infixContext - , makeTerm - , makeTerm' - , makeTerm'' - , makeTerm1 - , parseError - , postContextualize - ) -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Expression as Expression -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Statement as Statement -import qualified Data.Syntax.Type as Type -import qualified Data.Term as Term -import Language.Python.Syntax as Python.Syntax -import Prologue -import TreeSitter.Python as Grammar - - --- | The type of Python syntax. -type Syntax = - '[ Comment.Comment - , Declaration.Class - , Declaration.Comprehension - , Declaration.Decorator - , Declaration.Function - , Declaration.RequiredParameter - , Expression.Plus - , Expression.Minus - , Expression.Times - , Expression.DividedBy - , Expression.Modulo - , Expression.Power - , Expression.Negate - , Expression.FloorDivision - , Expression.And - , Expression.Not - , Expression.Or - , Expression.XOr - , Expression.BAnd - , Expression.BOr - , Expression.BXOr - , Expression.LShift - , Expression.RShift - , Expression.Complement - , Expression.Call - , Expression.LessThan - , Expression.LessThanEqual - , Expression.GreaterThan - , Expression.GreaterThanEqual - , Expression.Equal - , Expression.StrictEqual - , Expression.Comparison - , Expression.Enumeration - , Expression.ScopeResolution - , Expression.MemberAccess - , Expression.Subscript - , Expression.Member - , Literal.Array - , Literal.Boolean - , Literal.Float - , Literal.Hash - , Literal.Integer - , Literal.KeyValue - , Literal.Null - , Literal.Set - , Literal.String - , Literal.TextElement - , Literal.Tuple - , Python.Syntax.Alias - , Python.Syntax.Ellipsis - , Python.Syntax.FutureImport - , Python.Syntax.Import - , Python.Syntax.QualifiedImport - , Python.Syntax.QualifiedAliasedImport - , Python.Syntax.Redirect - , Statement.Assignment - , Statement.Break - , Statement.Catch - , Statement.Continue - , Statement.Else - , Statement.Finally - , Statement.ForEach - , Statement.If - , Statement.Let - , Statement.NoOp - , Statement.Return - , Statement.Statements - , Statement.Throw - , Statement.Try - , Statement.While - , Statement.Yield - , Syntax.Context - , Syntax.Empty - , Syntax.Error - , Syntax.Identifier - , Type.Annotation - , [] - ] - -type Term = Term.Term (Sum Syntax) Location -type Assignment = Assignment.Assignment [] Grammar - --- | Assignment from AST in Python's grammar onto a program in Python's syntax. -assignment :: Assignment Term -assignment = handleError $ makeTerm <$> symbol Module <*> children (Statement.Statements <$> manyTerm expression) <|> parseError - -expression :: Assignment Term -expression = handleError (choice expressionChoices) - -expressionChoices :: [Assignment Term] -expressionChoices = - -- Long-term, can we de/serialize assignments and avoid paying the cost of construction altogether? - [ argumentList - , assertStatement - , assignment' - , await - , binaryOperator - , block - , boolean - , booleanOperator - , breakStatement - , call - , classDefinition - , comparisonOperator - , comprehension - , concatenatedString - , conditionalExpression - , continueStatement - , decoratedDefinition - , deleteStatement - , dictionary - , dictionarySplat - , ellipsis - , exceptClause - , execStatement - , expressionList - , expressionStatement - , finallyClause - , float - , forInClause - , forStatement - , functionDefinition - , globalStatement - , identifier - , ifClause - , ifStatement - , import' - , integer - , keywordArgument - , list' - , listSplat - , memberAccess - , none - , nonlocalStatement - , notOperator - , pair - , parameter - , parenthesizedExpression - , parseError - , passStatement - , printStatement - , raiseStatement - , returnStatement - , set - , slice - , string - , subscript - , tryStatement - , tuple - , type' - , unaryOperator - , variables - , whileStatement - , withStatement - , yield - ] - -expressions :: Assignment Term -expressions = makeTerm'' <$> location <*> manyTerm expression - -block :: Assignment Term -block = symbol Block *> children (makeTerm'' <$> location <*> manyTerm expression) - -block' :: Assignment Term -block' = symbol Block *> children (makeTerm <$> location <*> manyTerm expression) - -expressionStatement :: Assignment Term -expressionStatement = makeTerm'' <$> symbol ExpressionStatement <*> children (someTerm expression) - -expressionList :: Assignment Term -expressionList = makeTerm'' <$> symbol ExpressionList <*> children (someTerm expression) - -listSplat :: Assignment Term -listSplat = makeTerm <$> symbol ListSplat <*> (Syntax.Identifier . name <$> source) - -dictionarySplat :: Assignment Term -dictionarySplat = makeTerm <$> symbol DictionarySplat <*> (Syntax.Identifier . name <$> source) - -keywordArgument :: Assignment Term -keywordArgument = makeTerm <$> symbol KeywordArgument <*> children (Statement.Assignment [] <$> term expression <*> term expression) - -parenthesizedExpression :: Assignment Term -parenthesizedExpression = symbol ParenthesizedExpression *> children expressions - -parameter :: Assignment Term -parameter = makeTerm <$> symbol DefaultParameter <*> children (Statement.Assignment [] <$> term expression <*> term expression) - <|> makeTerm <$> symbol TypedParameter <*> children (Type.Annotation <$> term expression <*> term type') - <|> makeAnnotation <$> symbol TypedDefaultParameter <*> children ((,,) <$> term expression <*> term expression <*> term expression) - where - makeAnnotation loc (identifier', type', value') = makeTerm loc (Type.Annotation (makeAssignment loc identifier' value') type') - makeAssignment loc identifier' value' = makeTerm loc (Statement.Assignment [] identifier' value') - -decoratedDefinition :: Assignment Term -decoratedDefinition = symbol DecoratedDefinition *> children (term decorator) - where - decorator = makeTerm <$> symbol Decorator <*> (children (Declaration.Decorator <$> term expression <*> manyTerm expression) <*> term (decorator <|> functionDefinition <|> classDefinition)) - -argumentList :: Assignment Term -argumentList = symbol ArgumentList *> children expressions - -withStatement :: Assignment Term -withStatement = symbol WithStatement *> children (flip (foldr make) <$> some withItem <*> term block') - where - make (val, name) = makeTerm1 . Statement.Let name val - withItem = symbol WithItem *> children ((,) <$> term expression <*> term (expression <|> emptyTerm)) - -forStatement :: Assignment Term -forStatement = symbol ForStatement >>= \ loc -> children (make loc <$> (symbol Variables *> children expressions) <*> term expressionList <*> term block' <*> optional (symbol ElseClause *> children expressions)) - where - make loc binding subject body forElseClause = case forElseClause of - Nothing -> makeTerm loc (Statement.ForEach binding subject body) - Just a -> makeTerm loc (Statement.Else (makeTerm loc $ Statement.ForEach binding subject body) a) - -whileStatement :: Assignment Term -whileStatement = symbol WhileStatement >>= \ loc -> children (make loc <$> term expression <*> term block <*> optional (symbol ElseClause *> children expressions)) - where - make loc whileCondition whileBody whileElseClause = case whileElseClause of - Nothing -> makeTerm loc (Statement.While whileCondition whileBody) - Just a -> makeTerm loc (Statement.Else (makeTerm loc $ Statement.While whileCondition whileBody) a) - -tryStatement :: Assignment Term -tryStatement = makeTerm <$> symbol TryStatement <*> children (Statement.Try <$> term block <*> manyTerm (expression <|> elseClause)) - where elseClause = makeTerm <$> symbol ElseClause <*> children (Statement.Else <$> emptyTerm <*> term block) - -exceptClause :: Assignment Term -exceptClause = makeTerm <$> symbol ExceptClause <*> children - (Statement.Catch <$> term ((makeTerm <$> location <*> (uncurry (flip Statement.Let) <$> ((,) <$> term expression <* symbol AnonAs <*> term expression) <*> emptyTerm)) - <|> expressions) - <*> expressions) - -functionParam :: Assignment Term -functionParam = (makeParameter <$> location <*> identifier) - <|> tuple - <|> parameter - <|> listSplat - <|> dictionarySplat - where makeParameter loc term = makeTerm loc (Declaration.RequiredParameter term) - -functionDefinition :: Assignment Term -functionDefinition = - makeFunctionDeclaration <$> symbol FunctionDefinition <*> children ((,,,) <$> term expression <* symbol Parameters <*> children (manyTerm functionParam) <*> optional (symbol Type *> children (term expression)) <*> term block') - <|> makeFunctionDeclaration <$> (symbol Lambda' <|> symbol Lambda) <*> children ((,,,) <$ token AnonLambda <*> emptyTerm <*> (symbol LambdaParameters *> children (manyTerm expression) <|> pure []) <*> optional (symbol Type *> children (term expression)) <*> expressions') - where - expressions' = makeTerm <$> location <*> manyTerm expression - makeFunctionDeclaration loc (functionName', functionParameters, ty, functionBody) - = let fn = makeTerm loc (Declaration.Function [] functionName' functionParameters functionBody) - in maybe fn (makeTerm loc . Type.Annotation fn) ty - -classDefinition :: Assignment Term -classDefinition = makeTerm <$> symbol ClassDefinition <*> children (Declaration.Class [] <$> term expression <*> argumentList <*> term block') - where - argumentList = symbol ArgumentList *> children (manyTerm expression) - <|> pure [] - -type' :: Assignment Term -type' = symbol Type *> children (term expression) - -finallyClause :: Assignment Term -finallyClause = makeTerm <$> symbol FinallyClause <*> children (Statement.Finally <$> expressions) - -ellipsis :: Assignment Term -ellipsis = makeTerm <$> token Grammar.Ellipsis <*> pure Python.Syntax.Ellipsis - -comparisonOperator :: Assignment Term -comparisonOperator = symbol ComparisonOperator *> children (expression `chainl1Term` choice - [ (makeTerm1 .) . Expression.LessThan <$ token AnonLAngle - , (makeTerm1 .) . Expression.LessThanEqual <$ token AnonLAngleEqual - , (makeTerm1 .) . Expression.GreaterThan <$ token AnonRAngle - , (makeTerm1 .) . Expression.GreaterThanEqual <$ token AnonRAngleEqual - , (makeTerm1 .) . Expression.Equal <$ token AnonEqualEqual - , (makeTerm1 .) . invert Expression.Equal <$ token AnonBangEqual - , (makeTerm1 .) . invert Expression.Equal <$ token AnonLAngleRAngle - , (makeTerm1 .) . invert Expression.Member <$ token AnonNot - , (makeTerm1 .) . Expression.Member <$ token AnonIn - , token AnonIs *> ((makeTerm1 .) . invert Expression.Equal <$ token AnonNot <|> pure ((makeTerm1 .) . Expression.Equal)) - ]) - where invert cons a b = Expression.Not (makeTerm1 (cons a b)) - -notOperator :: Assignment Term -notOperator = makeTerm <$> symbol NotOperator <*> children (Expression.Not <$> term expression) - -tuple :: Assignment Term -tuple = makeTerm <$> symbol Tuple <*> children (Literal.Tuple <$> manyTerm expression) - -unaryOperator :: Assignment Term -unaryOperator = symbol UnaryOperator >>= \ location -> arithmetic location <|> bitwise location <|> children ( symbol AnonPlus *> term expression ) - where - arithmetic location = makeTerm location . Expression.Negate <$> children ( symbol AnonMinus *> term expression ) - bitwise location = makeTerm location . Expression.Complement <$> children ( symbol AnonTilde *> term expression ) - -binaryOperator :: Assignment Term -binaryOperator = makeTerm' <$> symbol BinaryOperator <*> children (infixTerm expression (term expression) - [ (inject .) . Expression.Plus <$ symbol AnonPlus - , (inject .) . Expression.Minus <$ symbol AnonMinus - , (inject .) . Expression.Times <$ symbol AnonStar - , (inject .) . Expression.Times <$ symbol AnonAt -- Matrix multiplication, TODO: May not want to assign to Expression.Times. - , (inject .) . Expression.DividedBy <$ symbol AnonSlash - , (inject .) . Expression.FloorDivision <$ symbol AnonSlashSlash - , (inject .) . Expression.Modulo <$ symbol AnonPercent - , (inject .) . Expression.Power <$ symbol AnonStarStar - , (inject .) . Expression.BOr <$ symbol AnonPipe - , (inject .) . Expression.BAnd <$ symbol AnonAmpersand - , (inject .) . Expression.BXOr <$ symbol AnonCaret - , (inject .) . Expression.LShift <$ symbol AnonLAngleLAngle - , (inject .) . Expression.RShift <$ symbol AnonRAngleRAngle - ]) - -booleanOperator :: Assignment Term -booleanOperator = makeTerm' <$> symbol BooleanOperator <*> children (infixTerm expression (term expression) - [ (inject .) . Expression.And <$ symbol AnonAnd - , (inject .) . Expression.Or <$ symbol AnonOr - ]) - -assignment' :: Assignment Term -assignment' = makeAssignment <$> symbol Assignment <*> children ((,,) <$> term expressionList <*> optional (symbol Type *> children (term expression)) <*> term rvalue) - <|> makeTerm' <$> symbol AugmentedAssignment <*> children (infixTerm expressionList (term rvalue) - [ assign Expression.Plus <$ symbol AnonPlusEqual - , assign Expression.Minus <$ symbol AnonMinusEqual - , assign Expression.Times <$ symbol AnonStarEqual - , assign Expression.Times <$ symbol AnonAtEqual -- Matrix multiplication assignment. TODO: May not want to assign to Expression.Times. - , assign Expression.Power <$ symbol AnonStarStarEqual - , assign Expression.DividedBy <$ symbol AnonSlashEqual - , assign Expression.DividedBy <$ symbol AnonSlashSlashEqual - , assign Expression.BOr <$ symbol AnonPipeEqual - , assign Expression.BAnd <$ symbol AnonAmpersandEqual - , assign Expression.Modulo <$ symbol AnonPercentEqual - , assign Expression.RShift <$ symbol AnonRAngleRAngleEqual - , assign Expression.LShift <$ symbol AnonLAngleLAngleEqual - , assign Expression.BXOr <$ symbol AnonCaretEqual - ]) - where rvalue = expressionList <|> assignment' <|> yield <|> emptyTerm - makeAssignment loc (lhs, maybeType, rhs) = makeTerm loc (Statement.Assignment (maybeToList maybeType) lhs rhs) - assign :: (f :< Syntax) => (Term -> Term -> f Term) -> Term -> Term -> Sum Syntax Term - assign c l r = inject (Statement.Assignment [] l (makeTerm1 (c l r))) - -yield :: Assignment Term -yield = makeTerm <$> symbol Yield <*> (Statement.Yield <$> children (term ( expression <|> emptyTerm ))) - -identifier :: Assignment Term -identifier = makeTerm <$> (symbol Identifier <|> symbol DottedName) <*> (Syntax.Identifier . name <$> source) - -set :: Assignment Term -set = makeTerm <$> symbol Set <*> children (Literal.Set <$> manyTerm expression) - -dictionary :: Assignment Term -dictionary = makeTerm <$> symbol Dictionary <*> children (Literal.Hash <$> manyTerm expression) - -pair :: Assignment Term -pair = makeTerm' <$> symbol Pair <*> children (infixTerm expression (term expression) [ (inject .) . Literal.KeyValue <$ symbol AnonColon ]) - -list' :: Assignment Term -list' = makeTerm <$> symbol List <*> children (Literal.Array <$> manyTerm expression) - -string :: Assignment Term -string = makeTerm <$> symbol String <*> (Literal.TextElement <$> source) - -concatenatedString :: Assignment Term -concatenatedString = makeTerm <$> symbol ConcatenatedString <*> children (manyTerm string) - -float :: Assignment Term -float = makeTerm <$> symbol Float <*> (Literal.Float <$> source) - -integer :: Assignment Term -integer = makeTerm <$> symbol Integer <*> (Literal.Integer <$> source) - -comment :: Assignment Term -comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) - -import' :: Assignment Term -import' = makeTerm'' <$> symbol ImportStatement <*> children (manyTerm (aliasedImport <|> plainImport)) - <|> makeTerm <$> symbol ImportFromStatement <*> children (Python.Syntax.Import <$> importPath <*> (wildcard <|> some (aliasImportSymbol <|> importSymbol))) - <|> makeTerm <$> symbol FutureImportStatement <*> children (Python.Syntax.FutureImport <$> some (aliasImportSymbol <|> importSymbol)) - where - -- `import a as b` - aliasedImport = makeTerm <$> symbol AliasedImport <*> children (Python.Syntax.QualifiedAliasedImport <$> importPath <*> expression) - -- `import a` - plainImport = makeTerm <$> symbol DottedName <*> children (Python.Syntax.QualifiedImport <$> NonEmpty.some1 identifier) - -- `from a import foo ` - importSymbol = makeNameAliasPair <$> (symbol Identifier <|> symbol DottedName) <*> (mkIdentifier <$> location <*> source) - -- `from a import foo as bar` - aliasImportSymbol = makeTerm <$> symbol AliasedImport <*> children (Python.Syntax.Alias <$> identifier <*> identifier) - -- `from a import *` - wildcard = symbol WildcardImport *> (name <$> source) $> [] - - importPath = importDottedName <|> importRelative - importDottedName = symbol DottedName *> children (qualifiedName <$> NonEmpty.some1 identifierSource) - importRelative = symbol RelativeImport *> children (relativeQualifiedName <$> importPrefix <*> ((symbol DottedName *> children (many identifierSource)) <|> pure [])) - importPrefix = symbol ImportPrefix *> source - identifierSource = symbol Identifier *> source - - makeNameAliasPair location alias = makeTerm location (Python.Syntax.Alias alias alias) - mkIdentifier location source = makeTerm location (Syntax.Identifier (name source)) - -assertStatement :: Assignment Term -assertStatement = makeTerm <$> symbol AssertStatement <*> children (Expression.Call [] <$> (makeTerm <$> symbol AnonAssert <*> (Syntax.Identifier . name <$> source)) <*> manyTerm expression <*> emptyTerm) - -printStatement :: Assignment Term -printStatement = do - location <- symbol PrintStatement - children $ do - print <- term printKeyword - term (redirectCallTerm location print <|> printCallTerm location print) - where - printKeyword = makeTerm <$> symbol AnonPrint <*> (Syntax.Identifier . name <$> source) - redirectCallTerm location identifier = makeTerm location <$ symbol Chevron <*> (flip Python.Syntax.Redirect <$> children (term expression) <*> term (printCallTerm location identifier)) - printCallTerm location identifier = makeTerm location <$> (Expression.Call [] identifier <$> manyTerm expression <*> emptyTerm) - -nonlocalStatement :: Assignment Term -nonlocalStatement = makeTerm <$> symbol NonlocalStatement <*> children (Expression.Call [] <$> term (makeTerm <$> symbol AnonNonlocal <*> (Syntax.Identifier . name <$> source)) <*> manyTerm expression <*> emptyTerm) - -globalStatement :: Assignment Term -globalStatement = makeTerm <$> symbol GlobalStatement <*> children (Expression.Call [] <$> term (makeTerm <$> symbol AnonGlobal <*> (Syntax.Identifier . name <$> source)) <*> manyTerm expression <*> emptyTerm) - -await :: Assignment Term -await = makeTerm <$> symbol Await <*> children (Expression.Call [] <$> term (makeTerm <$> symbol AnonAwait <*> (Syntax.Identifier . name <$> source)) <*> manyTerm expression <*> emptyTerm) - -returnStatement :: Assignment Term -returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> term (expressionList <|> emptyTerm)) - -deleteStatement :: Assignment Term -deleteStatement = makeTerm <$> symbol DeleteStatement <*> children (Expression.Call [] <$> term deleteIdentifier <* symbol ExpressionList <*> children (manyTerm expression) <*> emptyTerm) - where deleteIdentifier = makeTerm <$> symbol AnonDel <*> (Syntax.Identifier . name <$> source) - -raiseStatement :: Assignment Term -raiseStatement = makeTerm <$> symbol RaiseStatement <*> children (Statement.Throw <$> expressions) - -ifStatement :: Assignment Term -ifStatement = makeTerm <$> symbol IfStatement <*> children if' - where - if' = Statement.If <$> term expression <*> thenClause <*> (elseClause <|> emptyTerm) - thenClause = makeTerm'' <$> location <*> manyTermsTill expression (void (symbol ElseClause) <|> void (symbol ElifClause) <|> eof) - elseClause = makeTerm'' <$> location <*> many (comment <|> elif <|> else') - elif = makeTerm <$> symbol ElifClause <*> children if' - else' = symbol ElseClause *> children expressions - -execStatement :: Assignment Term -execStatement = makeTerm <$> symbol ExecStatement <*> children (Expression.Call [] <$> term (makeTerm <$> location <*> (Syntax.Identifier . name <$> source)) <*> manyTerm (string <|> expression) <*> emptyTerm) - -passStatement :: Assignment Term -passStatement = makeTerm <$> symbol PassStatement <*> (Statement.NoOp <$> emptyTerm <* advance) - -breakStatement :: Assignment Term -breakStatement = makeTerm <$> symbol BreakStatement <*> (Statement.Break <$> emptyTerm <* advance) - -continueStatement :: Assignment Term -continueStatement = makeTerm <$> symbol ContinueStatement <*> (Statement.Continue <$> emptyTerm <* advance) - -memberAccess :: Assignment Term -memberAccess = makeTerm <$> symbol Attribute <*> children (Expression.MemberAccess <$> term expression <*> identifier) - -subscript :: Assignment Term -subscript = makeTerm <$> symbol Subscript <*> children (Expression.Subscript <$> term expression <*> manyTerm expression) - -slice :: Assignment Term -slice = makeTerm <$> symbol Slice <*> children - (Expression.Enumeration <$> ((emptyTerm <* token AnonColon) <|> (term expression <* token AnonColon)) - <*> ((emptyTerm <* token AnonColon) <|> (term expression <* token AnonColon) <|> (term expression <|> emptyTerm)) - <*> (term expression <|> emptyTerm)) - -call :: Assignment Term -call = makeTerm <$> symbol Call <*> children (Expression.Call [] <$> term (identifier <|> expression) <*> (symbol ArgumentList *> children (manyTerm expression) <|> someTerm comprehension) <*> emptyTerm) - -boolean :: Assignment Term -boolean = makeTerm <$> token Grammar.True <*> pure Literal.true - <|> makeTerm <$> token Grammar.False <*> pure Literal.false - -none :: Assignment Term -none = makeTerm <$> symbol None <*> (Literal.Null <$ rawSource) - -comprehension :: Assignment Term -comprehension = makeTerm <$> symbol ListComprehension <*> children (Declaration.Comprehension <$> term expression <*> expressions) - <|> makeTerm <$> symbol GeneratorExpression <*> children (Declaration.Comprehension <$> term expression <*> expressions) - <|> makeTerm <$> symbol SetComprehension <*> children (Declaration.Comprehension <$> term expression <*> expressions) - <|> makeTerm <$> symbol DictionaryComprehension <*> children (Declaration.Comprehension <$> term expression <*> expressions) - -forInClause :: Assignment Term -forInClause = symbol ForInClause *> children expressions - -variables :: Assignment Term -variables = symbol Variables *> children expressions - -ifClause :: Assignment Term -ifClause = symbol IfClause *> children expressions - -conditionalExpression :: Assignment Term -conditionalExpression = makeTerm <$> symbol ConditionalExpression <*> children (flip Statement.If <$> term expression <*> term expression <*> expressions) - - --- Helpers - --- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present. -manyTerm :: Assignment Term -> Assignment [Term] -manyTerm term = many (contextualize comment term <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)) - -someTerm :: Assignment Term -> Assignment [Term] -someTerm term = some (contextualize comment term <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)) - -term :: Assignment Term -> Assignment Term -term term = contextualize comment (postContextualize comment term) - -term' :: Assignment Term -> Assignment Term -term' term = contextualize comment' (postContextualize comment' term) - where comment' = choice [ comment, symbol AnonLambda *> empty ] - --- | Match a left-associated infix chain of terms, optionally followed by comments. Like 'chainl1' but assigning comment nodes automatically. -chainl1Term :: Assignment Term -> Assignment (Term -> Term -> Term) -> Assignment Term -chainl1Term expr op = term' expr `chainl1` op - --- | Match a series of terms or comments until a delimiter is matched. -manyTermsTill :: Assignment Term -> Assignment b -> Assignment [Term] -manyTermsTill step end = manyTill (step <|> comment) end - --- | Match infix terms separated by any of a list of operators, assigning any comments following each operand. -infixTerm :: Assignment Term - -> Assignment Term - -> [Assignment (Term -> Term -> Sum Syntax Term)] - -> Assignment (Sum Syntax Term) -infixTerm = infixContext comment diff --git a/src/Language/Python/PrettyPrint.hs b/src/Language/Python/PrettyPrint.hs deleted file mode 100644 index 00f0854fe8..0000000000 --- a/src/Language/Python/PrettyPrint.hs +++ /dev/null @@ -1,69 +0,0 @@ -{-# LANGUAGE RankNTypes #-} - -module Language.Python.PrettyPrint ( printingPython ) where - -import Control.Effect -import Control.Effect.Error -import Control.Monad.Trans (lift) -import Data.Machine - -import Data.Reprinting.Errors -import Data.Reprinting.Splice -import Data.Reprinting.Token as Token -import Data.Reprinting.Scope -import Data.Reprinting.Operator - --- | Print Python syntax. -printingPython :: (Member (Error TranslationError) sig, Carrier sig m) => ProcessT m Fragment Splice -printingPython = repeatedly (await >>= step) - -step :: (Member (Error TranslationError) sig, Carrier sig m) => Fragment -> PlanT k Splice m () -step (Verbatim txt) = emit txt -step (New _ _ txt) = emit txt -step (Defer el cs) = case (el, cs) of - -- Function declarations - (Open, Function:_) -> emit "def" *> space - (Open, Params:Function:_) -> emit "(" - (Close, Params:Function:_) -> emit "):" - (Close, Function:xs) -> endContext (imperativeDepth xs) - - -- Return statements - (Open, Return:_) -> emit "return" *> space - (Close, Return:_) -> pure () - (Open, Imperative:Return:_) -> pure () - (Sep, Imperative:Return:_) -> emit "," *> space - (Close, Imperative:Return:_) -> pure () -- Don't hardwarp or indent for return statements - - -- If statements - (Open, If:_) -> emit "if" *> space - (Flow Then, If:_) -> emit ":" - (Flow Else, If:xs) -> endContext (imperativeDepth xs) *> emit "else:" - (Close, If:_) -> pure () - - -- Booleans - (Truth True, _) -> emit "True" - (Truth False, _) -> emit "False" - - -- Infix binary operators - (Open, InfixL _ p:xs) -> emitIf (p < precedenceOf xs) "(" - (Sym, InfixL Add _:_) -> space *> emit "+" *> space - (Sym, InfixL Multiply _:_) -> space *> emit "*" *> space - (Sym, InfixL Subtract _:_) -> space *> emit "-" *> space - (Close, InfixL _ p:xs) -> emitIf (p < precedenceOf xs) ")" - - -- General params handling - (Open, Params:_) -> emit "(" - (Sep, Params:_) -> emit "," *> space - (Close, Params:_) -> emit ")" - - -- Imperative context and whitespace handling - (Open, [Imperative]) -> pure () -- Don't indent at the top-level imperative context... - (Close, [Imperative]) -> layout HardWrap -- but end the program with a newline. - (Open, Imperative:xs) -> layout HardWrap *> indent 4 (imperativeDepth xs) - (Sep, Imperative:xs) -> layout HardWrap *> indent 4 (imperativeDepth xs) - (Close, Imperative:_) -> pure () - - _ -> lift (throwError (NoTranslation el cs)) - - where - endContext times = layout HardWrap *> indent 4 (pred times) diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs deleted file mode 100644 index 428451dd65..0000000000 --- a/src/Language/Python/Syntax.hs +++ /dev/null @@ -1,262 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.Python.Syntax where - -import Prelude hiding (span) -import Prologue - -import Control.Lens.Getter -import Data.Aeson hiding (object) -import qualified Data.List as List -import qualified Data.List.NonEmpty as NonEmpty -import qualified Data.Map.Strict as Map -import qualified Data.Text as T -import System.FilePath.Posix - -import Control.Abstract.Heap -import Control.Abstract.ScopeGraph hiding (Import) -import Data.Abstract.BaseError -import Data.Abstract.Evaluatable -import Data.Abstract.Module -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.JSON.Fields -import qualified Data.Language as Language -import Data.Span -import Diffing.Algorithm - -data QualifiedName - = QualifiedName { paths :: NonEmpty FilePath } - | RelativeQualifiedName { path :: FilePath, maybeQualifiedName :: Maybe QualifiedName } - deriving (Eq, Generic, Hashable, Ord, Show, ToJSON, NFData) - -qualifiedName :: NonEmpty Text -> QualifiedName -qualifiedName xs = QualifiedName (T.unpack <$> xs) - -relativeQualifiedName :: Text -> [Text] -> QualifiedName -relativeQualifiedName prefix [] = RelativeQualifiedName (T.unpack prefix) Nothing -relativeQualifiedName prefix paths = RelativeQualifiedName (T.unpack prefix) (Just (qualifiedName (NonEmpty.fromList paths))) - --- Python module resolution. --- https://docs.python.org/3/reference/import.html#importsystem --- --- TODO: Namespace packages --- --- Regular packages resolution: --- --- parent/ --- __init__.py --- one/ --- __init__.py --- two/ --- __init__.py --- three/ --- __init__.py --- --- `import parent.one` will implicitly execute: --- `parent/__init__.py` and --- `parent/one/__init__.py` --- Subsequent imports of `parent.two` or `parent.three` will execute --- `parent/two/__init__.py` and --- `parent/three/__init__.py` respectively. -resolvePythonModules :: ( Member (Modules address value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Member Trace sig - , Carrier sig m - ) - => QualifiedName - -> Evaluator term address value m (NonEmpty ModulePath) -resolvePythonModules q = do - relRootDir <- rootDir q <$> currentModule - for (moduleNames q) $ \relPath -> do - x <- search relRootDir relPath - x <$ traceResolve relPath x - where - rootDir (QualifiedName _) ModuleInfo{..} = mempty -- overall rootDir of the Package. - rootDir (RelativeQualifiedName n _) ModuleInfo{..} = upDir numDots (takeDirectory modulePath) - where numDots = pred (length n) - upDir n dir | n <= 0 = dir - | otherwise = takeDirectory (upDir (pred n) dir) - - moduleNames (QualifiedName qualifiedName) = NonEmpty.scanl1 () qualifiedName - moduleNames (RelativeQualifiedName x Nothing) = error $ "importing from '" <> show x <> "' is not implemented" - moduleNames (RelativeQualifiedName _ (Just paths)) = moduleNames paths - - search rootDir x = do - trace ("searching for " <> show x <> " in " <> show rootDir) - let path = normalise (rootDir normalise x) - let searchPaths = [ path "__init__.py" - , path <.> ".py" - ] - modulePath <- resolve searchPaths - maybeM (throwResolutionError $ NotFoundError path searchPaths Language.Python) modulePath - -data Alias a = Alias { aliasValue :: a, aliasName :: a} - deriving (Generic1, Diffable, Eq, Foldable, FreeVariables1, Functor, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Alias - -instance Declarations1 Alias where - liftDeclaredName declaredName = declaredName . aliasValue - liftDeclaredAlias declaredAlias = declaredAlias . aliasName - -instance Evaluatable Alias where - --- | Import declarations (symbols are added directly to the calling environment). --- --- If the list of symbols is empty copy everything to the calling environment. -data Import a = Import { importFrom :: QualifiedName, importSymbols :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Import - -newtype FutureImport a = FutureImport { futureImportSymbols :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically FutureImport - -instance Evaluatable FutureImport where - --- from a import b -instance Evaluatable Import where - -- from . import moduleY -- aliasValue = moduleY, aliasName = moduleY - -- from . import moduleY as moduleZ -- aliasValue = moduleY, aliasName = moduleZ - -- This is a bit of a special case in the syntax as this actually behaves like a qualified relative import. - eval _ _ (Import (RelativeQualifiedName n Nothing) [aliasTerm]) = do - aliasValue' <- maybeM (throwNoNameError aliasTerm) (declaredName aliasTerm) - path <- NonEmpty.last <$> resolvePythonModules (RelativeQualifiedName n (Just (qualifiedName (formatName aliasValue' :| [])))) - ((moduleScope, moduleFrame), _) <- require path - - -- Construct a proxy scope containing an import edge to the imported module's last returned scope. - importScope <- newScope (Map.singleton ScopeGraph.Import [ moduleScope ]) - - -- Construct an object frame. - let scopeMap = Map.singleton moduleScope moduleFrame - aliasFrame <- newFrame importScope (Map.singleton ScopeGraph.Import scopeMap) - - -- Add declaration of the alias name to the current scope (within our current module). - aliasName <- maybeM (throwNoNameError aliasTerm) (declaredAlias aliasTerm) - declare (Declaration aliasName) Default Public (aliasTerm^.span) ScopeGraph.UnqualifiedImport (Just importScope) - -- Retrieve the frame slot for the new declaration. - aliasSlot <- lookupSlot (Declaration aliasName) - assign aliasSlot =<< object aliasFrame - - unit - - -- from a import b - -- from a import b as c - -- from a import * - -- from .moduleY import b - eval _ _ (Import name xs) = do - modulePaths <- resolvePythonModules name - - -- Eval parent modules first - for_ (NonEmpty.init modulePaths) require - - -- Last module path is the one we want to import - let path = NonEmpty.last modulePaths - ((moduleScope, moduleFrame), _) <- require path - if Prologue.null xs then do - insertImportEdge moduleScope - insertFrameLink ScopeGraph.Import (Map.singleton moduleScope moduleFrame) - else do - let scopeEdges = Map.singleton ScopeGraph.Import [ moduleScope ] - scopeAddress <- newScope scopeEdges - - let frameLinks = Map.singleton moduleScope moduleFrame - frameAddress <- newFrame scopeAddress (Map.singleton ScopeGraph.Import frameLinks) - - insertImportEdge scopeAddress - insertFrameLink ScopeGraph.Import (Map.singleton scopeAddress frameAddress) - - withScope moduleScope . - for_ xs $ \aliasTerm -> do - aliasName <- maybeM (throwNoNameError aliasTerm) (declaredAlias aliasTerm) - aliasValue <- maybeM (throwNoNameError aliasTerm) (declaredName aliasTerm) - if aliasValue /= aliasName then do - insertImportReference (Reference aliasName) (aliasTerm^.span) ScopeGraph.Identifier (Declaration aliasValue) scopeAddress - else - pure () - - unit - -deriving instance Hashable1 NonEmpty - -newtype QualifiedImport a = QualifiedImport { qualifiedImportFrom :: NonEmpty a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QualifiedImport - --- import a.b.c -instance Evaluatable QualifiedImport where - eval _ _ (QualifiedImport qualifiedNames) = do - -- TODO: Consider gensym'ed names for imports. - qualifiedName <- fmap (T.unpack . formatName) <$> traverse (\term -> maybeM (throwNoNameError term) (declaredName term)) qualifiedNames - modulePaths <- resolvePythonModules (QualifiedName qualifiedName) - let namesAndPaths = toList (NonEmpty.zip (NonEmpty.zip qualifiedNames (Data.Abstract.Evaluatable.name . T.pack <$> qualifiedName)) modulePaths) - - go namesAndPaths - unit - where - go [] = pure () - go (((nameTerm, name), modulePath) : namesAndPaths) = do - scopeAddress <- newScope mempty - declare (Declaration name) Default Public (nameTerm^.span) ScopeGraph.QualifiedImport (Just scopeAddress) - aliasSlot <- lookupSlot (Declaration name) - -- a.b.c - withScope scopeAddress $ - mkScopeMap modulePath (\scopeMap -> do - objFrame <- newFrame scopeAddress (Map.singleton ScopeGraph.Import scopeMap) - val <- object objFrame - assign aliasSlot val - - withFrame objFrame $ do - let (namePaths, rest) = List.partition ((== name) . snd . fst) namesAndPaths - for_ namePaths $ \(_, modulePath) -> do - mkScopeMap modulePath $ \scopeMap -> do - withFrame objFrame $ do - insertFrameLink ScopeGraph.Import scopeMap - go rest) - mkScopeMap modulePath fun = do - ((moduleScope, moduleFrame), _) <- require modulePath - insertImportEdge moduleScope - fun (Map.singleton moduleScope moduleFrame) - -data QualifiedAliasedImport a = QualifiedAliasedImport { qualifiedAliasedImportFrom :: QualifiedName, qualifiedAliasedImportAlias :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically QualifiedAliasedImport - --- import a.b.c as e -instance Evaluatable QualifiedAliasedImport where - eval _ _ (QualifiedAliasedImport name aliasTerm) = do - modulePaths <- resolvePythonModules name - - span <- ask @Span - scopeAddress <- newScope mempty - alias <- maybeM (throwNoNameError aliasTerm) (declaredName aliasTerm) - declare (Declaration alias) Default Public span ScopeGraph.QualifiedAliasedImport (Just scopeAddress) - objFrame <- newFrame scopeAddress mempty - val <- object objFrame - aliasSlot <- lookupSlot (Declaration alias) - assign aliasSlot val - - withScopeAndFrame objFrame . - for_ modulePaths $ \modulePath -> do - ((moduleScope, moduleFrame), _) <- require modulePath - insertImportEdge moduleScope - insertFrameLink ScopeGraph.Import (Map.singleton moduleScope moduleFrame) - - unit - --- | Ellipsis (used in splice expressions and alternatively can be used as a fill in expression, like `undefined` in Haskell) -data Ellipsis a = Ellipsis - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Ellipsis - --- TODO: Implement Eval instance for Ellipsis -instance Evaluatable Ellipsis - -data Redirect a = Redirect { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Redirect - --- TODO: Implement Eval instance for Redirect -instance Evaluatable Redirect diff --git a/src/Language/Ruby/Assignment.hs b/src/Language/Ruby/Assignment.hs deleted file mode 100644 index 4926e2cbde..0000000000 --- a/src/Language/Ruby/Assignment.hs +++ /dev/null @@ -1,573 +0,0 @@ -{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.Ruby.Assignment -( assignment -, Syntax -, Grammar -, Term -) where - -import Prologue hiding (for, unless) - -import Assigning.Assignment hiding (Assignment, Error) -import qualified Assigning.Assignment as Assignment -import Data.Abstract.Name (name) -import qualified Data.Abstract.ScopeGraph as ScopeGraph (AccessControl(..)) -import Data.List (elem) -import qualified Data.List.NonEmpty as NonEmpty -import Data.Syntax - ( contextualize - , emptyTerm - , handleError - , infixContext - , makeTerm - , makeTerm' - , makeTerm'' - , makeTerm1 - , parseError - , postContextualize - ) -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Directive as Directive -import qualified Data.Syntax.Expression as Expression -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Statement as Statement -import qualified Data.Term as Term -import qualified Language.Ruby.Syntax as Ruby.Syntax -import TreeSitter.Ruby as Grammar - --- | The type of Ruby syntax. -type Syntax = '[ - Comment.Comment - , Declaration.Function - , Declaration.Method - , Directive.File - , Directive.Line - , Expression.Plus - , Expression.Minus - , Expression.Times - , Expression.DividedBy - , Expression.Modulo - , Expression.Power - , Expression.Negate - , Expression.FloorDivision - , Expression.BAnd - , Expression.BOr - , Expression.BXOr - , Expression.LShift - , Expression.RShift - , Expression.Complement - , Expression.And - , Expression.Not - , Expression.Or - , Expression.XOr - , Expression.Call - , Expression.LessThan - , Expression.LessThanEqual - , Expression.GreaterThan - , Expression.GreaterThanEqual - , Expression.Equal - , Expression.StrictEqual - , Expression.Comparison - , Expression.Enumeration - , Expression.Matches - , Expression.NotMatches - , Expression.MemberAccess - , Expression.ScopeResolution - , Expression.Subscript - , Expression.Member - , Expression.This - , Literal.Array - , Literal.Boolean - , Literal.Character - , Literal.Complex - , Literal.EscapeSequence - , Literal.Float - , Literal.Hash - , Literal.Integer - , Literal.InterpolationElement - , Literal.KeyValue - , Literal.Null - , Literal.Rational - , Literal.Regex - , Literal.String - , Literal.Symbol - , Literal.SymbolElement - , Literal.TextElement - , Ruby.Syntax.Assignment - , Statement.Break - , Statement.Catch - , Statement.Continue - , Statement.Else - , Statement.Finally - , Statement.ForEach - , Statement.If - , Statement.Match - , Statement.Pattern - , Statement.Retry - , Statement.Return - , Statement.ScopeEntry - , Statement.ScopeExit - , Statement.Statements - , Statement.Try - , Statement.While - , Statement.Yield - , Syntax.Context - , Syntax.Empty - , Syntax.Error - , Syntax.Identifier - , Ruby.Syntax.Class - , Ruby.Syntax.Load - , Ruby.Syntax.LowPrecedenceAnd - , Ruby.Syntax.LowPrecedenceOr - , Ruby.Syntax.Module - , Ruby.Syntax.Require - , Ruby.Syntax.Send - , Ruby.Syntax.ZSuper - , [] - ] - -type Term = Term.Term (Sum Syntax) Location -type Assignment = Assignment.Assignment [] Grammar - --- | Assignment from AST in Ruby’s grammar onto a program in Ruby’s syntax. -assignment :: Assignment Term -assignment = handleError $ makeTerm <$> symbol Program <*> children (Statement.Statements <$> many expression) <|> parseError - -expression :: Assignment Term -expression = term (handleError (choice expressionChoices)) - -expressionChoices :: [Assignment Term] -expressionChoices = - [ alias - , assignment' - , begin - , beginBlock - , binary - , block - , call - , case' - , class' - , conditional - , emptyStatement - , endBlock - , for - , heredoc - , identifier - , if' - , then' - , lambda - , literal - , method - , methodCall - , mk Break Statement.Break - , mk Next Statement.Continue - , mk Redo Statement.Retry - , mk Retry Statement.Retry - , mk Return Statement.Return - , mk Yield Statement.Yield - , module' - , pair - , parenthesizedExpressions - , parseError - , rescue - , scopeResolution - , self - , singletonClass - , singletonMethod - , subscript - , unary - , undef - , unless - , until' - , while' - ] - where - mk s construct = makeTerm <$> symbol s <*> children ((construct .) . fromMaybe <$> emptyTerm <*> optional (symbol ArgumentList *> children expressions)) - -expressions :: Assignment Term -expressions = makeTerm'' <$> location <*> many expression - -parenthesizedExpressions :: Assignment Term -parenthesizedExpressions = makeTerm'' <$> symbol ParenthesizedStatements <*> children (many expression) - -withExtendedScope :: Assignment a -> Assignment a -withExtendedScope inner = do - locals <- getLocals - result <- inner - putLocals locals - pure result - -withNewScope :: Assignment a -> Assignment a -withNewScope inner = withExtendedScope $ do - putLocals [] - inner - --- Looks up identifiers in the list of locals to determine vcall vs. local identifier. -identifier :: Assignment Term -identifier = - vcallOrLocal - <|> zsuper - <|> mk Constant - <|> mk InstanceVariable - <|> mk ClassVariable - <|> mk GlobalVariable - <|> mk Operator - <|> mk Setter - <|> mk SplatArgument - <|> mk HashSplatArgument - <|> mk BlockArgument - <|> mk Uninterpreted - where - mk s = makeTerm <$> symbol s <*> (Syntax.Identifier . name <$> source) - zsuper = makeTerm <$> symbol Super <*> (Ruby.Syntax.ZSuper <$ source) - vcallOrLocal = do - (loc, ident, locals) <- identWithLocals - case ident of - "__FILE__" -> pure $ makeTerm loc Directive.File - "__LINE__" -> pure $ makeTerm loc Directive.Line - _ -> do - let identTerm = makeTerm loc (Syntax.Identifier (name ident)) - if ident `elem` locals - then pure identTerm - else pure $ makeTerm loc (Ruby.Syntax.Send Nothing (Just identTerm) [] Nothing) - -self :: Assignment Term -self = makeTerm <$> symbol Self <*> (Expression.This <$ source) - --- TODO: Handle interpolation in all literals that support it (strings, regexes, symbols, subshells, etc). -literal :: Assignment Term -literal = - makeTerm <$> token Grammar.True <*> pure Literal.true - <|> makeTerm <$> token Grammar.False <*> pure Literal.false - <|> makeTerm <$> token Grammar.Nil <*> pure Literal.Null - <|> makeTerm <$> symbol Grammar.Integer <*> (Literal.Integer <$> source) - <|> makeTerm <$> symbol Grammar.Float <*> (Literal.Float <$> source) - <|> makeTerm <$> symbol Grammar.Rational <*> (Literal.Rational <$> source) - <|> makeTerm <$> symbol Grammar.Complex <*> (Literal.Complex <$> source) - -- TODO: Do we want to represent the difference between .. and ... - <|> makeTerm <$> symbol Range <*> children (Expression.Enumeration <$> expression <*> expression <*> emptyTerm) - <|> makeTerm <$> symbol Array <*> children (Literal.Array <$> many expression) - <|> makeTerm <$> symbol StringArray <*> children (Literal.Array <$> many expression) - <|> makeTerm <$> symbol SymbolArray <*> children (Literal.Array <$> many expression) - <|> makeTerm <$> symbol Hash <*> children (Literal.Hash <$> many expression) - <|> makeTerm <$> symbol Subshell <*> (Literal.TextElement <$> source) - <|> string - <|> symbol' - <|> makeTerm <$> symbol Character <*> (Literal.Character <$> source) - <|> makeTerm <$> symbol ChainedString <*> children (many (makeTerm <$> symbol String <*> (Literal.TextElement <$> source))) - <|> makeTerm <$> symbol Regex <*> (Literal.Regex <$> source) - - where - string :: Assignment Term - string = makeTerm' <$> (symbol String <|> symbol BareString) <*> - (children (inject . Literal.String <$> some (interpolation <|> escapeSequence)) <|> inject . Literal.TextElement <$> source) - - symbol' :: Assignment Term - symbol' = makeTerm' <$> (symbol Symbol <|> symbol Symbol' <|> symbol BareSymbol) <*> - (children (inject . Literal.Symbol <$> some interpolation) <|> inject . Literal.SymbolElement <$> source) - -interpolation :: Assignment Term -interpolation = makeTerm <$> symbol Interpolation <*> children (Literal.InterpolationElement <$> expression) - -escapeSequence :: Assignment Term -escapeSequence = makeTerm <$> symbol EscapeSequence <*> (Literal.EscapeSequence <$> source) - -heredoc :: Assignment Term -heredoc = makeTerm <$> symbol HeredocBeginning <*> (Literal.TextElement <$> source) - <|> makeTerm <$> symbol HeredocBody <*> children (some (interpolation <|> escapeSequence <|> heredocEnd)) - where heredocEnd = makeTerm <$> symbol HeredocEnd <*> (Literal.TextElement <$> source) - -beginBlock :: Assignment Term -beginBlock = makeTerm <$> symbol BeginBlock <*> children (Statement.ScopeEntry <$> many expression) - -endBlock :: Assignment Term -endBlock = makeTerm <$> symbol EndBlock <*> children (Statement.ScopeExit <$> many expression) - -class' :: Assignment Term -class' = makeTerm <$> symbol Class <*> (withNewScope . children) (Ruby.Syntax.Class <$> expression <*> optional superclass <*> expressions) - where - superclass :: Assignment Term - superclass = symbol Superclass *> children expression - -singletonClass :: Assignment Term -singletonClass = makeTerm <$> symbol SingletonClass <*> (withNewScope . children) (Ruby.Syntax.Class <$> expression <*> pure Nothing <*> expressions) - -module' :: Assignment Term -module' = makeTerm <$> symbol Module <*> (withNewScope . children) (Ruby.Syntax.Module <$> expression <*> many expression) - -scopeResolution :: Assignment Term -scopeResolution = makeTerm <$> symbol ScopeResolution <*> children (Expression.ScopeResolution <$> NonEmpty.some1 expression) - -parameter :: Assignment Term -parameter = postContextualize comment (term uncontextualizedParameter) - where - uncontextualizedParameter = - lhsIdent - <|> splatParameter - <|> hashSplatParameter - <|> blockParameter - <|> keywordParameter - <|> optionalParameter - <|> makeTerm <$> symbol DestructuredParameter <*> children (many parameter) - -- splat and hash splat arguments can be unnamed. we don't currently - -- support unnamed arguments in the term syntax, so the use of emptyTerm - -- here is a huge hack. what we should be able to do is return a Nothing - -- for the argument name for splats and hash splats. TODO fix me: - mkSplat s = symbol s *> children (lhsIdent <|> emptyTerm) - splatParameter = mkSplat SplatParameter - hashSplatParameter = mkSplat HashSplatParameter - blockParameter = symbol BlockParameter *> children lhsIdent - -- we don't yet care about default expressions for optional (including - -- keyword) parameters, but we need to match on them to prevent errors: - keywordParameter = symbol KeywordParameter *> children (lhsIdent <* optional expression) - optionalParameter = symbol OptionalParameter *> children (lhsIdent <* expression) - -publicAccessControl :: ScopeGraph.AccessControl -publicAccessControl = ScopeGraph.Public - -method :: Assignment Term -method = makeTerm <$> symbol Method <*> (withNewScope . children) (Declaration.Method [] <$> emptyTerm <*> methodSelector <*> params <*> expressions' <*> pure publicAccessControl) - where params = symbol MethodParameters *> children (many parameter) <|> pure [] - expressions' = makeTerm <$> location <*> many expression - -singletonMethod :: Assignment Term -singletonMethod = makeTerm <$> symbol SingletonMethod <*> (withNewScope . children) (Declaration.Method [] <$> expression <*> methodSelector <*> params <*> expressions <*> pure publicAccessControl) - where params = symbol MethodParameters *> children (many parameter) <|> pure [] - -lambda :: Assignment Term -lambda = makeTerm <$> symbol Lambda <*> (withExtendedScope . children) ( - Declaration.Function [] <$> emptyTerm - <*> ((symbol BlockParameters <|> symbol LambdaParameters) *> children (many parameter) <|> pure []) - <*> expressions) - -block :: Assignment Term -block = makeTerm <$> symbol DoBlock <*> scopedBlockChildren - <|> makeTerm <$> symbol Block <*> scopedBlockChildren - where scopedBlockChildren = withExtendedScope blockChildren - blockChildren = children (Declaration.Function [] <$> emptyTerm <*> params <*> expressions) - params = symbol BlockParameters *> children (many parameter) <|> pure [] - -comment :: Assignment Term -comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) - -alias :: Assignment Term -alias = makeTerm <$> symbol Alias <*> children (Expression.Call [] <$> name' <*> some expression <*> emptyTerm) - where name' = makeTerm <$> location <*> (Syntax.Identifier . name <$> source) - -undef :: Assignment Term -undef = makeTerm <$> symbol Undef <*> children (Expression.Call [] <$> name' <*> some expression <*> emptyTerm) - where name' = makeTerm <$> location <*> (Syntax.Identifier . name <$> source) - -if' :: Assignment Term -if' = ifElsif If - <|> makeTerm <$> symbol IfModifier <*> children (flip Statement.If <$> expression <*> expression <*> emptyTerm) - where - ifElsif s = makeTerm <$> symbol s <*> children (Statement.If <$> expression <*> expressions' <*> (elsif' <|> else' <|> emptyTerm)) - elsif' = postContextualize comment (ifElsif Elsif) - expressions' = makeTerm <$> location <*> manyTermsTill expression (void (symbol Else) <|> void (symbol Elsif) <|> eof) - else' = postContextualize comment (symbol Else *> children expressions) - -then' :: Assignment Term -then' = postContextualize comment (symbol Then *> children expressions) - -unless :: Assignment Term -unless = makeTerm <$> symbol Unless <*> children (Statement.If <$> invert expression <*> expressions' <*> (else' <|> emptyTerm)) - <|> makeTerm <$> symbol UnlessModifier <*> children (flip Statement.If <$> expression <*> invert expression <*> emptyTerm) - where expressions' = makeTerm <$> location <*> manyTermsTill expression (void (symbol Else) <|> eof) - else' = postContextualize comment (symbol Else *> children expressions) - -while' :: Assignment Term -while' = - makeTerm <$> symbol While <*> children (Statement.While <$> expression <*> expressions) - <|> makeTerm <$> symbol WhileModifier <*> children (flip Statement.While <$> expression <*> expression) - -until' :: Assignment Term -until' = - makeTerm <$> symbol Until <*> children (Statement.While <$> invert expression <*> expressions) - <|> makeTerm <$> symbol UntilModifier <*> children (flip Statement.While <$> expression <*> invert expression) - -for :: Assignment Term -for = makeTerm <$> symbol For <*> children (Statement.ForEach <$> (makeTerm <$> location <*> manyTermsTill expression (symbol In)) <*> inClause <*> expressions) - where inClause = symbol In *> children expression - -case' :: Assignment Term -case' = makeTerm <$> symbol Case <*> children (Statement.Match <$> (symbol When *> emptyTerm <|> expression) <*> whens) - where - whens = makeTerm <$> location <*> many (when' <|> else' <|> expression) - when' = makeTerm <$> symbol When <*> children (Statement.Pattern <$> (makeTerm <$> location <*> some pattern') <*> whens) - pattern' = postContextualize comment (symbol Pattern *> children ((symbol SplatArgument *> children expression) <|> expression)) - else' = postContextualize comment (symbol Else *> children expressions) - -subscript :: Assignment Term -subscript = makeTerm <$> symbol ElementReference <*> children (Expression.Subscript <$> expression <*> many expression) - -pair :: Assignment Term -pair = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> expression <*> (expression <|> emptyTerm)) - -args :: Assignment [Term] -args = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children (many expression) <|> many expression - -methodCall :: Assignment Term -methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|> send) - where - send = inject <$> ((regularCall <|> funcCall <|> scopeCall <|> dotCall) <*> optional block) - - funcCall = Ruby.Syntax.Send Nothing <$> selector <*> args - regularCall = symbol Call *> children (Ruby.Syntax.Send <$> (Just <$> postContextualize heredoc expression) <*> selector) <*> args - scopeCall = symbol ScopeResolution *> children (Ruby.Syntax.Send <$> (Just <$> expression) <*> selector) <*> args - dotCall = symbol Call *> children (Ruby.Syntax.Send <$> (Just <$> term expression) <*> pure Nothing <*> args) - - selector = Just <$> term methodSelector - require = inject <$> (symbol Identifier *> do - s <- rawSource - guard (s `elem` ["require", "require_relative"]) - Ruby.Syntax.Require (s == "require_relative") <$> nameExpression) - load = inject <$ symbol Identifier <*> do - s <- rawSource - guard (s == "load") - (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children (Ruby.Syntax.Load <$> expression <*> optional expression) - nameExpression = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children expression - -methodSelector :: Assignment Term -methodSelector = makeTerm <$> symbols <*> (Syntax.Identifier <$> (name <$> source)) - where - symbols = symbol Identifier - <|> symbol Constant - <|> symbol Operator - <|> symbol Setter - <|> symbol Super -- TODO(@charliesome): super calls are *not* method calls and need to be assigned into their own syntax terms - -call :: Assignment Term -call = makeTerm <$> symbol Call <*> children ( - (Ruby.Syntax.Send <$> (Just <$> term expression) <*> (Just <$> methodSelector) <*> pure [] <*> pure Nothing) <|> - (Ruby.Syntax.Send <$> (Just <$> term expression) <*> pure Nothing <*> args <*> pure Nothing)) - -rescue :: Assignment Term -rescue = rescue' - <|> makeTerm <$> symbol RescueModifier <*> children (Statement.Try <$> expression <*> many (makeTerm <$> location <*> (Statement.Catch <$> expression <*> emptyTerm))) - <|> makeTerm <$> symbol Ensure <*> children (Statement.Finally <$> expressions) - <|> makeTerm <$> symbol Else <*> children (Statement.Else <$> emptyTerm <*> expressions) - where - rescue' = makeTerm <$> symbol Rescue <*> children (Statement.Catch <$> exceptions <*> (rescue' <|> expressions)) - exceptions = makeTerm <$> location <*> many ex - ex = makeTerm <$> symbol Exceptions <*> children (many expression) - <|> makeTerm <$> symbol ExceptionVariable <*> children (many expression) - -begin :: Assignment Term -begin = makeTerm <$> symbol Begin <*> children (Statement.Try <$> expressions <*> many rescue) - -assignment' :: Assignment Term -assignment' = makeTerm <$> symbol Assignment <*> children (Ruby.Syntax.Assignment [] <$> lhs <*> rhs) - <|> makeTerm' <$> symbol OperatorAssignment <*> children (infixTerm lhs expression - [ assign Expression.Plus <$ symbol AnonPlusEqual - , assign Expression.Minus <$ symbol AnonMinusEqual - , assign Expression.Times <$ symbol AnonStarEqual - , assign Expression.Power <$ symbol AnonStarStarEqual - , assign Expression.DividedBy <$ symbol AnonSlashEqual - , assign Expression.Or <$ symbol AnonPipePipeEqual - , assign Expression.BOr <$ symbol AnonPipeEqual - , assign Expression.And <$ symbol AnonAmpersandAmpersandEqual - , assign Expression.BAnd <$ symbol AnonAmpersandEqual - , assign Expression.Modulo <$ symbol AnonPercentEqual - , assign Expression.RShift <$ symbol AnonRAngleRAngleEqual - , assign Expression.LShift <$ symbol AnonLAngleLAngleEqual - , assign Expression.BXOr <$ symbol AnonCaretEqual - ]) - where - assign :: (f :< Syntax) => (Term -> Term -> f Term) -> Term -> Term -> Sum Syntax Term - assign c l r = inject (Ruby.Syntax.Assignment [] l (makeTerm1 (c l r))) - - lhs = makeTerm <$> symbol LeftAssignmentList <*> children (many expr) <|> expr - rhs = makeTerm <$> symbol RightAssignmentList <*> children (many expr) <|> expr - expr = makeTerm <$> symbol RestAssignment <*> (Syntax.Identifier . name <$> source) - <|> makeTerm <$> symbol DestructuredLeftAssignment <*> children (many expr) - <|> lhsIdent - <|> expression - -identWithLocals :: Assignment (Location, Text, [Text]) -identWithLocals = do - loc <- symbol Identifier - -- source advances, so it's important we call getLocals first - locals <- getLocals - ident <- source - pure (loc, ident, locals) - -lhsIdent :: Assignment Term -lhsIdent = do - (loc, ident, locals) <- identWithLocals - putLocals (ident : locals) - pure $ makeTerm loc (Syntax.Identifier (name ident)) - -unary :: Assignment Term -unary = symbol Unary >>= \ location -> - makeTerm location . Expression.Complement <$> children ( symbol AnonTilde *> expression ) - <|> makeTerm location . Expression.Not <$> children ( symbol AnonBang *> expression ) - <|> makeTerm location . Expression.Not <$> children ( symbol AnonNot *> expression ) - <|> makeTerm location <$> children (Expression.Call [] <$> (makeTerm <$> symbol AnonDefinedQuestion <*> (Syntax.Identifier . name <$> source)) <*> some expression <*> emptyTerm) - <|> makeTerm location . Expression.Negate <$> children ( (symbol AnonMinus <|> symbol AnonMinus' <|> symbol AnonMinus'') *> expression ) - <|> children ( symbol AnonPlus *> expression ) - --- TODO: Distinguish `===` from `==` ? -binary :: Assignment Term -binary = makeTerm' <$> symbol Binary <*> children (infixTerm expression expression - [ (inject .) . Expression.Plus <$ symbol AnonPlus - , (inject .) . Expression.Minus <$ (symbol AnonMinus <|> symbol AnonMinus' <|> symbol AnonMinus'') - , (inject .) . Expression.Times <$ (symbol AnonStar <|> symbol AnonStar') - , (inject .) . Expression.Power <$ symbol AnonStarStar - , (inject .) . Expression.DividedBy <$ (symbol AnonSlash <|> symbol AnonSlash') - , (inject .) . Expression.Modulo <$ symbol AnonPercent - , (inject .) . Expression.And <$ symbol AnonAmpersandAmpersand - , (inject .) . Ruby.Syntax.LowPrecedenceAnd <$ symbol AnonAnd - , (inject .) . Expression.BAnd <$ symbol AnonAmpersand - , (inject .) . Expression.Or <$ symbol AnonPipePipe - , (inject .) . Ruby.Syntax.LowPrecedenceOr <$ symbol AnonOr - , (inject .) . Expression.BOr <$ symbol AnonPipe - , (inject .) . Expression.BXOr <$ symbol AnonCaret - -- TODO: AnonEqualEqualEqual corresponds to Ruby's "case equality" - -- function, which (unless overridden) is true if b is an instance - -- of or inherits from a. We need a custom equality operator - -- for this situation. - , (inject .) . Expression.Equal <$ (symbol AnonEqualEqual <|> symbol AnonEqualEqualEqual) - , (inject .) . invert Expression.Equal <$ symbol AnonBangEqual - , (inject .) . Expression.LShift <$ (symbol AnonLAngleLAngle <|> symbol AnonLAngleLAngle') - , (inject .) . Expression.RShift <$ symbol AnonRAngleRAngle - , (inject .) . Expression.Comparison <$ symbol AnonLAngleEqualRAngle - , (inject .) . Expression.LessThan <$ symbol AnonLAngle - , (inject .) . Expression.GreaterThan <$ symbol AnonRAngle - , (inject .) . Expression.LessThanEqual <$ symbol AnonLAngleEqual - , (inject .) . Expression.GreaterThanEqual <$ symbol AnonRAngleEqual - , (inject .) . Expression.Matches <$ symbol AnonEqualTilde - , (inject .) . Expression.NotMatches <$ symbol AnonBangTilde - ]) - where invert cons a b = Expression.Not (makeTerm1 (cons a b)) - -conditional :: Assignment Term -conditional = makeTerm <$> symbol Conditional <*> children (Statement.If <$> expression <*> expression <*> expression) - -emptyStatement :: Assignment Term -emptyStatement = makeTerm <$> symbol EmptyStatement <*> (Syntax.Empty <$ rawSource <|> pure Syntax.Empty) - - --- Helpers - -invert :: Assignment Term -> Assignment Term -invert term = makeTerm <$> location <*> fmap Expression.Not term - --- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present. -term :: Assignment Term -> Assignment Term -term term = contextualize comment term <|> makeTerm1 <$> (Syntax.Context <$> some1 (comment <|> heredocEnd) <*> emptyTerm) - where heredocEnd = makeTerm <$> symbol HeredocEnd <*> (Literal.TextElement <$> source) - --- | Match a series of terms or comments until a delimiter is matched. -manyTermsTill :: Assignment Term -> Assignment b -> Assignment [Term] -manyTermsTill step end = manyTill (step <|> comment) end - --- | Match infix terms separated by any of a list of operators, assigning any comments following each operand. -infixTerm :: Assignment Term - -> Assignment Term - -> [Assignment (Term -> Term -> Sum Syntax Term)] - -> Assignment (Sum Syntax Term) -infixTerm = infixContext comment diff --git a/src/Language/Ruby/PrettyPrint.hs b/src/Language/Ruby/PrettyPrint.hs deleted file mode 100644 index 6b6abbcce7..0000000000 --- a/src/Language/Ruby/PrettyPrint.hs +++ /dev/null @@ -1,55 +0,0 @@ -{-# LANGUAGE Rank2Types #-} - -module Language.Ruby.PrettyPrint ( printingRuby ) where - -import Control.Effect -import Control.Effect.Error -import Control.Monad.Trans (lift) -import Data.Machine - -import Data.Reprinting.Scope -import Data.Reprinting.Errors -import Data.Reprinting.Operator -import Data.Reprinting.Splice -import Data.Reprinting.Token as Token - --- | Print Ruby syntax. -printingRuby :: (Member (Error TranslationError) sig, Carrier sig m) => ProcessT m Fragment Splice -printingRuby = repeatedly (await >>= step) - -step :: (Member (Error TranslationError) sig, Carrier sig m) => Fragment -> PlanT k Splice m () -step (Verbatim txt) = emit txt -step (New _ _ txt) = emit txt -step (Defer el cs) = case (el, cs) of - (Open, Method:_) -> emit "def" *> space - (Close, Method:xs) -> endContext (imperativeDepth xs) *> emit "end" - - -- ODO: do..end vs {..} should be configurable. - (Open, Function:_) -> space *> emit "do" *> space - (Open, Params:Function:_) -> emit "|" - (Close, Params:Function:_) -> emit "|" - (Close, Function:xs) -> endContext (imperativeDepth xs) *> emit "end" - - -- ODO: Parens for calls are a style choice, make configurable. - (Open, Params:_) -> emit "(" - (Sep, Params:_) -> emit "," *> space - (Close, Params:_) -> emit ")" - - (Open, InfixL _ p:xs) -> emitIf (p < precedenceOf xs) "(" - (Sym, InfixL Add _:_) -> space *> emit "+" *> space - (Sym, InfixL Multiply _:_) -> space *> emit "*" *> space - (Sym, InfixL Subtract _:_) -> space *> emit "-" *> space - (Close, InfixL _ p:xs) -> emitIf (p < precedenceOf xs) ")" - - (Open, [Imperative]) -> pure () - (Open, Imperative:xs) -> layout HardWrap *> indent 2 (imperativeDepth xs) - (Sep, Imperative:xs) -> layout HardWrap *> indent 2 (imperativeDepth xs) - (Close, [Imperative]) -> layout HardWrap - (Close, Imperative:xs) -> indent 2 (pred (imperativeDepth xs)) - - (Sep, Call:_) -> emit "." - - _ -> lift (throwError (NoTranslation el cs)) - - where - endContext times = layout HardWrap *> indent 2 (pred times) diff --git a/src/Language/Ruby/Syntax.hs b/src/Language/Ruby/Syntax.hs deleted file mode 100644 index e085045294..0000000000 --- a/src/Language/Ruby/Syntax.hs +++ /dev/null @@ -1,368 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields, TupleSections #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.Ruby.Syntax where - -import Prologue - -import Control.Abstract as Abstract hiding (Load, String) -import Control.Abstract.Heap (Heap, HeapError, insertFrameLink) -import Control.Abstract.ScopeGraph (insertImportEdge) -import Control.Abstract.Value (Boolean) -import Control.Monad (unless) -import Data.Abstract.BaseError -import Data.Abstract.Evaluatable -import qualified Data.Abstract.Module as M -import Data.Abstract.Name as Name -import Data.Abstract.Path -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.JSON.Fields -import qualified Data.Language as Language -import qualified Data.Map.Strict as Map -import qualified Data.Reprinting.Scope as Scope -import qualified Data.Reprinting.Token as Token -import Data.Semigroup.App -import Data.Semigroup.Foldable -import qualified Data.Text as T -import Diffing.Algorithm -import Reprinting.Tokenize hiding (Superclass) -import System.FilePath.Posix - --- TODO: Fully sort out ruby require/load mechanics --- --- require "json" -resolveRubyName :: ( Member (Modules address value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Carrier sig m - ) - => Text - -> Evaluator term address value m M.ModulePath -resolveRubyName name = do - let name' = cleanNameOrPath name - let paths = [name' <.> "rb"] - modulePath <- resolve paths - maybeM (throwResolutionError $ NotFoundError name' paths Language.Ruby) modulePath - --- load "/root/src/file.rb" -resolveRubyPath :: ( Member (Modules address value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Carrier sig m - ) - => Text - -> Evaluator term address value m M.ModulePath -resolveRubyPath path = do - let name' = cleanNameOrPath path - modulePath <- resolve [name'] - maybeM (throwResolutionError $ NotFoundError name' [name'] Language.Ruby) modulePath - -cleanNameOrPath :: Text -> String -cleanNameOrPath = T.unpack . dropRelativePrefix . stripQuotes - -data Send a = Send { sendReceiver :: Maybe a, sendSelector :: Maybe a, sendArgs :: [a], sendBlock :: Maybe a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Send - -instance Evaluatable Send where - eval eval _ Send{..} = do - sel <- case sendSelector of - Just sel -> maybeM (throwNoNameError sel) (declaredName sel) - Nothing -> - pure (Name.name "call") - - let self = deref =<< lookupSlot (Declaration __self) - lhsValue <- maybe self eval sendReceiver - lhsFrame <- Abstract.scopedEnvironment lhsValue - - let callFunction = do - span <- ask @Span - reference (Reference sel) span ScopeGraph.Call (Declaration sel) - func <- deref =<< lookupSlot (Declaration sel) - args <- traverse eval sendArgs - boundFunc <- bindThis lhsValue func - call boundFunc args -- TODO pass through sendBlock - maybe callFunction (`withScopeAndFrame` callFunction) lhsFrame - -instance Tokenize Send where - tokenize Send{..} = within Scope.Call $ do - maybe (pure ()) (\r -> r *> yield Sep) sendReceiver - fromMaybe (pure ()) sendSelector - within' Scope.Params $ sequenceA_ (sep sendArgs) - fromMaybe (pure ()) sendBlock - -data Require a = Require { requireRelative :: Bool, requirePath :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Require - -instance Evaluatable Require where - eval evalΒ _ (Require _ x) = do - name <- eval x >>= asString - path <- resolveRubyName name - traceResolve name path - ((moduleScope, moduleFrame), v) <- doRequire path - insertImportEdge moduleScope - insertFrameLink ScopeGraph.Import (Map.singleton moduleScope moduleFrame) - pure v -- Returns True if the file was loaded, False if it was already loaded. http://ruby-doc.org/core-2.5.0/Kernel.html#method-i-require - -instance Tokenize Require where - tokenize Require{..} = do - yield . Run $ if requireRelative - then "require_relative" - else "require" - within' Scope.Params requirePath - -doRequire :: ( Member (Boolean value) sig - , Member (Modules address value) sig - , Carrier sig m - ) - => M.ModulePath - -> Evaluator term address value m ((address, address), value) -doRequire path = do - result <- lookupModule path - case result of - Nothing -> (,) . fst <$> load path <*> boolean True - Just (scopeAndFrame, _) -> (scopeAndFrame, ) <$> boolean False - - -data Load a = Load { loadPath :: a, loadWrap :: Maybe a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Load - -instance Tokenize Load where - tokenize Load{..} = do - yield (Run "load") - within' Scope.Params $ loadPath *> fromMaybe (pure ()) loadWrap - -instance Evaluatable Load where - eval eval _ (Load x Nothing) = do - path <- eval x >>= asString - doLoad path False - eval eval _ (Load x (Just wrap)) = do - path <- eval x >>= asString - shouldWrap <- eval wrap >>= asBool - doLoad path shouldWrap - -doLoad :: ( Member (Boolean value) sig - , Member (Modules address value) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Member (State (ScopeGraph.ScopeGraph address)) sig - , Member (State (Heap address address value)) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member Trace sig - , Ord address - , Carrier sig m - ) - => Text - -> Bool - -> Evaluator term address value m value -doLoad path shouldWrap = do - path' <- resolveRubyPath path - traceResolve path path' - (moduleScope, moduleFrame) <- fst <$> load path' - unless shouldWrap $ do - insertImportEdge moduleScope - insertFrameLink ScopeGraph.Import (Map.singleton moduleScope moduleFrame) - boolean Prelude.True -- load always returns true. http://ruby-doc.org/core-2.5.0/Kernel.html#method-i-load - --- TODO: autoload - -data Class a = Class { classIdentifier :: !a, classSuperClass :: !(Maybe a), classBody :: !a } - deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, FreeVariables1, ToJSONFields1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Class - -instance Diffable Class where - equivalentBySubterm = Just . classIdentifier - -instance Evaluatable Class where - eval eval _ Class{..} = do - (name, relation) <- case declaredName classIdentifier of - Just name -> pure (name, Default) - _ -> gensym >>= \name -> pure (name, Gensym) - span <- ask @Span - currentScope' <- currentScope - - let declaration = Declaration name - maybeSlot <- maybeLookupDeclaration declaration - - case maybeSlot of - Just slot -> do - classVal <- deref slot - maybeFrame <- scopedEnvironment classVal - case maybeFrame of - Just classFrame -> withScopeAndFrame classFrame (eval classBody) - Nothing -> throwEvalError (DerefError classVal) - Nothing -> do - let classSuperclasses = maybeToList classSuperClass - superScopes <- for classSuperclasses $ \superclass -> do - name <- maybeM (throwNoNameError superclass) (declaredName superclass) - scope <- associatedScope (Declaration name) - slot <- lookupSlot (Declaration name) - superclassFrame <- scopedEnvironment =<< deref slot - pure $ case (scope, superclassFrame) of - (Just scope, Just frame) -> Just (scope, frame) - _ -> Nothing - - let superclassEdges = (Superclass, ) . pure . fst <$> catMaybes superScopes - current = (Lexical, ) <$> pure (pure currentScope') - edges = Map.fromList (superclassEdges <> current) - classScope <- newScope edges - declare (Declaration name) relation Public span ScopeGraph.Class (Just classScope) - - let frameEdges = Map.singleton Superclass (Map.fromList (catMaybes superScopes)) - childFrame <- newFrame classScope frameEdges - - withScopeAndFrame childFrame $ do - void $ eval classBody - - classSlot <- lookupSlot (Declaration name) - assign classSlot =<< klass (Declaration name) childFrame - - unit - -instance Declarations1 Class where - liftDeclaredName declaredName = declaredName . classIdentifier - -instance Tokenize Class where - tokenize Class{..} = within' Scope.Class $ do - classIdentifier - case classSuperClass of - Just a -> yield Token.Extends *> a - Nothing -> pure () - classBody - - -data Module a = Module { moduleIdentifier :: !a, moduleStatements :: ![a] } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Module - -instance Evaluatable Module where - eval eval _ Module{..} = do - (name, relation) <- case declaredName moduleIdentifier of - Just name -> pure (name, Default) - _ -> gensym >>= \name -> pure (name, Gensym) - span <- ask @Span - currentScope' <- currentScope - - let declaration = Declaration name - moduleBody = maybe unit (runApp . foldMap1 (App . eval)) (nonEmpty moduleStatements) - maybeSlot <- maybeLookupDeclaration declaration - - case maybeSlot of - Just slot -> do - moduleVal <- deref slot - maybeFrame <- scopedEnvironment moduleVal - case maybeFrame of - Just moduleFrame -> do - withScopeAndFrame moduleFrame moduleBody - Nothing -> throwEvalError (DerefError moduleVal) - Nothing -> do - let edges = Map.singleton Lexical [ currentScope' ] - classScope <- newScope edges - declare (Declaration name) relation Public span ScopeGraph.Module (Just classScope) - - currentFrame' <- currentFrame - let frameEdges = Map.singleton Lexical (Map.singleton currentScope' currentFrame') - childFrame <- newFrame classScope frameEdges - - withScopeAndFrame childFrame (void moduleBody) - - moduleSlot <- lookupSlot (Declaration name) - assign moduleSlot =<< klass (Declaration name) childFrame - - unit - -instance Declarations1 Module where - liftDeclaredName declaredName = declaredName . moduleIdentifier - -instance Tokenize Module where - tokenize Module{..} = do - yield (Run "module") - moduleIdentifier - within' Scope.Namespace $ sequenceA_ moduleStatements - - -data LowPrecedenceAnd a = LowPrecedenceAnd { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LowPrecedenceAnd - -instance Evaluatable LowPrecedenceAnd where - -- N.B. we have to use Monad rather than Applicative/Traversable on 'And' and 'Or' so that we don't evaluate both operands - eval eval _ t = go (fmap eval t) where - go (LowPrecedenceAnd a b) = do - cond <- a - ifthenelse cond b (pure cond) - --- TODO: These should probably be expressed with a new context/token, --- rather than a literal run, and need to take surrounding precedence --- into account. -instance Tokenize LowPrecedenceAnd where - tokenize LowPrecedenceAnd{..} = lhs *> yield (Token.Run "and") <* rhs - -data LowPrecedenceOr a = LowPrecedenceOr { lhs :: a, rhs :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically LowPrecedenceOr - -instance Evaluatable LowPrecedenceOr where - -- N.B. we have to use Monad rather than Applicative/Traversable on 'And' and 'Or' so that we don't evaluate both operands - eval eval _ t = go (fmap eval t) where - go (LowPrecedenceOr a b) = do - cond <- a - ifthenelse cond (pure cond) b - -instance Tokenize LowPrecedenceOr where - tokenize LowPrecedenceOr{..} = lhs *> yield (Token.Run "or") <* rhs - -data Assignment a = Assignment { assignmentContext :: ![a], assignmentTarget :: !a, assignmentValue :: !a } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically Assignment - -instance Declarations1 Assignment where - liftDeclaredName declaredName Assignment{..} = declaredName assignmentTarget - -instance Evaluatable Assignment where - eval eval ref Assignment{..} = do - (lhsName, relation) <- case declaredName assignmentTarget of - Just name -> pure (name, Default) - _ -> gensym >>= \name -> pure (name, Gensym) - maybeSlot <- maybeLookupDeclaration (Declaration lhsName) - assignmentSpan <- ask @Span - maybe (declare (Declaration lhsName) relation Public assignmentSpan ScopeGraph.Assignment Nothing) (const (pure ())) maybeSlot - - lhs <- ref assignmentTarget - rhs <- eval assignmentValue - - case declaredName assignmentValue of - Just rhsName -> do - assocScope <- associatedScope (Declaration rhsName) - case assocScope of - Just assocScope' -> do - objectScope <- newScope (Map.singleton Import [ assocScope' ]) - putSlotDeclarationScope lhs (Just objectScope) -- TODO: not sure if this is right - Nothing -> - pure () - Nothing -> - pure () - assign lhs rhs - pure rhs - -instance Tokenize Assignment where - -- Should we be using 'assignmentContext' in here? - tokenize Assignment{..} = assignmentTarget *> yield Token.Assign <* assignmentValue - --- | A call to @super@ without parentheses in Ruby is known as "zsuper", which has --- the semantics of invoking @super()@ but implicitly passing the current function's --- arguments to the @super()@ invocation. -data ZSuper a = ZSuper - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically ZSuper - -instance Evaluatable ZSuper - -instance Tokenize ZSuper where - tokenize _ = yield $ Run "super" diff --git a/src/Language/TSX/Assignment.hs b/src/Language/TSX/Assignment.hs deleted file mode 100644 index 839f7aeca1..0000000000 --- a/src/Language/TSX/Assignment.hs +++ /dev/null @@ -1,971 +0,0 @@ -{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.TSX.Assignment -( assignment -, Syntax -, Grammar -, Term -) where - -import Assigning.Assignment hiding (Assignment, Error) -import Data.Abstract.Name (name) -import qualified Data.Abstract.ScopeGraph as ScopeGraph (AccessControl(..)) -import qualified Assigning.Assignment as Assignment -import Data.Sum -import Data.Syntax - ( contextualize - , emptyTerm - , handleError - , infixContext - , makeTerm - , makeTerm' - , makeTerm'' - , makeTerm1 - , parseError - , postContextualize - ) -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Expression as Expression -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Statement as Statement -import qualified Data.Syntax.Type as Type -import qualified Data.Term as Term -import qualified Language.TSX.Syntax as TSX.Syntax -import qualified Language.TypeScript.Resolution as TypeScript.Resolution -import Prologue -import TreeSitter.TSX as Grammar - --- | The type of TSX syntax. -type Syntax = '[ - Comment.Comment - , Comment.HashBang - , Declaration.Class - , Declaration.Function - , Declaration.Method - , Declaration.MethodSignature - , Declaration.InterfaceDeclaration - , Declaration.PublicFieldDefinition - , Declaration.VariableDeclaration - , Declaration.TypeAlias - , Expression.Plus - , Expression.Minus - , Expression.Times - , Expression.DividedBy - , Expression.Modulo - , Expression.Power - , Expression.Negate - , Expression.FloorDivision - , Expression.BAnd - , Expression.BOr - , Expression.BXOr - , Expression.LShift - , Expression.RShift - , Expression.UnsignedRShift - , Expression.Complement - , Expression.And - , Expression.Not - , Expression.Or - , Expression.XOr - , Expression.Call - , Expression.Cast - , Expression.LessThan - , Expression.LessThanEqual - , Expression.GreaterThan - , Expression.GreaterThanEqual - , Expression.Equal - , Expression.StrictEqual - , Expression.Comparison - , Expression.Enumeration - , Expression.MemberAccess - , Expression.NonNullExpression - , Expression.ScopeResolution - , Expression.SequenceExpression - , Expression.Subscript - , Expression.Member - , Expression.Delete - , Expression.Void - , Expression.Typeof - , Expression.InstanceOf - , Expression.New - , Expression.Await - , Expression.This - , Literal.Array - , Literal.Boolean - , Literal.Float - , Literal.Hash - , Literal.Integer - , Literal.KeyValue - , Literal.Null - , Literal.String - , Literal.TextElement - , Literal.Regex - , Statement.Assignment - , Statement.Break - , Statement.Catch - , Statement.Continue - , Statement.DoWhile - , Statement.Else - , Statement.Finally - , Statement.For - , Statement.ForEach - , Statement.If - , Statement.Match - , Statement.Pattern - , Statement.Retry - , Statement.Return - , Statement.ScopeEntry - , Statement.ScopeExit - , Statement.Statements - , Statement.Throw - , Statement.Try - , Statement.While - , Statement.Yield - , Syntax.AccessibilityModifier - , Syntax.Empty - , Syntax.Error - , Syntax.Identifier - , Syntax.Context - , Type.Readonly - , Type.TypeParameters - , TSX.Syntax.TypeParameter - , TSX.Syntax.Constraint - , TSX.Syntax.ParenthesizedType - , TSX.Syntax.DefaultType - , TSX.Syntax.PredefinedType - , TSX.Syntax.TypeIdentifier - , TSX.Syntax.NestedIdentifier - , TSX.Syntax.NestedTypeIdentifier - , TSX.Syntax.GenericType - , TSX.Syntax.TypeArguments - , TSX.Syntax.TypePredicate - , TSX.Syntax.CallSignature - , TSX.Syntax.ConstructSignature - , TSX.Syntax.ArrayType - , TSX.Syntax.LookupType - , TSX.Syntax.FlowMaybeType - , TSX.Syntax.TypeQuery - , TSX.Syntax.IndexTypeQuery - , TSX.Syntax.ThisType - , TSX.Syntax.ExistentialType - , TSX.Syntax.AbstractMethodSignature - , TSX.Syntax.IndexSignature - , TSX.Syntax.ObjectType - , TSX.Syntax.LiteralType - , TSX.Syntax.Union - , TSX.Syntax.Intersection - , TSX.Syntax.Module - , TSX.Syntax.InternalModule - , TSX.Syntax.FunctionType - , TSX.Syntax.Tuple - , TSX.Syntax.Constructor - , TSX.Syntax.TypeAssertion - , TSX.Syntax.ImportAlias - , TSX.Syntax.Debugger - , TSX.Syntax.ShorthandPropertyIdentifier - , TSX.Syntax.Super - , TSX.Syntax.Undefined - , TSX.Syntax.ClassHeritage - , TSX.Syntax.AbstractClass - , TSX.Syntax.ImplementsClause - , TSX.Syntax.JsxElement - , TSX.Syntax.JsxSelfClosingElement - , TSX.Syntax.JsxOpeningElement - , TSX.Syntax.JsxText - , TSX.Syntax.JsxClosingElement - , TSX.Syntax.JsxExpression - , TSX.Syntax.JsxAttribute - , TSX.Syntax.JsxFragment - , TSX.Syntax.JsxNamespaceName - , TSX.Syntax.OptionalParameter - , TSX.Syntax.RequiredParameter - , TSX.Syntax.RestParameter - , TSX.Syntax.PropertySignature - , TSX.Syntax.AmbientDeclaration - , TSX.Syntax.EnumDeclaration - , TSX.Syntax.ExtendsClause - , TSX.Syntax.AmbientFunction - , TSX.Syntax.ImportRequireClause - , TSX.Syntax.ImportClause - , TSX.Syntax.LabeledStatement - , TSX.Syntax.Annotation - , TSX.Syntax.With - , TSX.Syntax.ForOf - , TSX.Syntax.Update - , TSX.Syntax.ComputedPropertyName - , TSX.Syntax.Decorator - , TSX.Syntax.Import - , TSX.Syntax.QualifiedAliasedImport - , TSX.Syntax.SideEffectImport - , TSX.Syntax.DefaultExport - , TSX.Syntax.QualifiedExport - , TSX.Syntax.QualifiedExportFrom - , TSX.Syntax.JavaScriptRequire - , [] - , Statement.StatementBlock - , TSX.Syntax.MetaProperty - , TSX.Syntax.AnnotatedExpression - ] - -type Term = Term.Term (Sum Syntax) Location -type Assignment = Assignment.Assignment [] Grammar - --- | Assignment from AST in TSX’s grammar onto a program in TSX’s syntax. -assignment :: Assignment Term -assignment = handleError $ makeTerm <$> symbol Program <*> children (Statement.Statements <$> manyTerm statement) <|> parseError - -expression :: Assignment Term -expression = handleError everything - where - everything = choice [ - asExpression, - nonNullExpression', - importAlias', - internalModule, - super, - object, - array, - jsxElement', - jsxFragment, - class', - anonymousClass, - function, - arrowFunction, - assignmentExpression, - augmentedAssignmentExpression, - awaitExpression, - unaryExpression, - binaryExpression, - ternaryExpression, - updateExpression, - callExpression, - memberExpression, - newExpression, - parenthesizedExpression, - subscriptExpression, - yieldExpression, - this, - number, - string, - templateString, - regex, - true, - false, - null', - undefined', - identifier - ] - -undefined' :: Assignment Term -undefined' = makeTerm <$> symbol Grammar.Undefined <*> (TSX.Syntax.Undefined <$ rawSource) - -assignmentExpression :: Assignment Term -assignmentExpression = makeTerm <$> symbol AssignmentExpression <*> children (Statement.Assignment [] <$> term (memberExpression <|> subscriptExpression <|> identifier <|> destructuringPattern) <*> expression) - -augmentedAssignmentExpression :: Assignment Term -augmentedAssignmentExpression = makeTerm' <$> symbol AugmentedAssignmentExpression <*> children (infixTerm (memberExpression <|> subscriptExpression <|> identifier <|> destructuringPattern) (term expression) [ - assign Expression.Plus <$ symbol AnonPlusEqual - , assign Expression.Minus <$ symbol AnonMinusEqual - , assign Expression.Times <$ symbol AnonStarEqual - , assign Expression.DividedBy <$ symbol AnonSlashEqual - , assign Expression.Modulo <$ symbol AnonPercentEqual - , assign Expression.BXOr <$ symbol AnonCaretEqual - , assign Expression.BAnd <$ symbol AnonAmpersandEqual - , assign Expression.RShift <$ symbol AnonRAngleRAngleEqual - , assign Expression.LShift <$ symbol AnonLAngleLAngleEqual - , assign Expression.UnsignedRShift <$ symbol AnonRAngleRAngleRAngleEqual - , assign Expression.LShift <$ symbol AnonLAngleLAngleEqual - , assign Expression.BOr <$ symbol AnonPipeEqual ]) - where assign :: (f :< Syntax) => (Term -> Term -> f Term) -> Term -> Term -> Sum Syntax Term - assign c l r = inject (Statement.Assignment [] l (makeTerm1 (c l r))) - - -awaitExpression :: Assignment Term -awaitExpression = makeTerm <$> symbol Grammar.AwaitExpression <*> children (Expression.Await <$> term expression) - -unaryExpression :: Assignment Term -unaryExpression = symbol Grammar.UnaryExpression >>= \ loc -> - makeTerm loc . Expression.Not <$> children (symbol AnonBang *> term expression) - <|> makeTerm loc . Expression.Complement <$> children (symbol AnonTilde *> term expression) - <|> makeTerm loc . Expression.Negate <$> children ((symbol AnonMinus <|> symbol AnonPlus) *> term expression) - <|> makeTerm loc . Expression.Typeof <$> children (symbol AnonTypeof *> term expression) - <|> makeTerm loc . Expression.Void <$> children (symbol AnonVoid *> term expression) - <|> makeTerm loc . Expression.Delete <$> children (symbol AnonDelete *> term expression) - -ternaryExpression :: Assignment Term -ternaryExpression = makeTerm <$> symbol Grammar.TernaryExpression <*> children (Statement.If <$> term expression <*> term expression <*> term expression) - -memberExpression :: Assignment Term -memberExpression = makeTerm <$> (symbol Grammar.MemberExpression <|> symbol Grammar.MemberExpression') <*> children (Expression.MemberAccess <$> term expression <*> propertyIdentifier) - -newExpression :: Assignment Term -newExpression = makeTerm <$> symbol Grammar.NewExpression <*> children (Expression.New <$> term constructableExpression <*> (typeArguments' <|> emptyTerm) <*> (arguments <|> pure [])) - -constructableExpression :: Assignment Term -constructableExpression = choice [ - this - , identifier - , number - , string - , templateString - , regex - , true - , false - , null' - , undefined' - , object - , array - , function - , arrowFunction - , class' - , anonymousClass - , parenthesizedExpression - , subscriptExpression - , memberExpression - , metaProperty - , newExpression - ] - -metaProperty :: Assignment Term -metaProperty = makeTerm <$> symbol Grammar.MetaProperty <*> (TSX.Syntax.MetaProperty <$ rawSource) - -updateExpression :: Assignment Term -updateExpression = makeTerm <$> symbol Grammar.UpdateExpression <*> children (TSX.Syntax.Update <$> term expression) - -yieldExpression :: Assignment Term -yieldExpression = makeTerm <$> symbol Grammar.YieldExpression <*> children (Statement.Yield <$> term (expression <|> emptyTerm)) - -this :: Assignment Term -this = makeTerm <$> symbol Grammar.This <*> (Expression.This <$ rawSource) - -regex :: Assignment Term -regex = makeTerm <$> symbol Grammar.Regex <*> (Literal.Regex <$> source) - -null' :: Assignment Term -null' = makeTerm <$> symbol Null <*> (Literal.Null <$ rawSource) - -anonymousClass :: Assignment Term -anonymousClass = makeTerm <$> symbol Grammar.AnonymousClass <*> children (Declaration.Class [] <$> emptyTerm <*> (classHeritage' <|> pure []) <*> classBodyStatements) - -abstractClass :: Assignment Term -abstractClass = makeTerm <$> symbol Grammar.AbstractClass <*> children (TSX.Syntax.AbstractClass <$> term typeIdentifier <*> (term typeParameters <|> emptyTerm) <*> (classHeritage' <|> pure []) <*> classBodyStatements) - -abstractMethodSignature :: Assignment Term -abstractMethodSignature = makeSignature <$> symbol Grammar.AbstractMethodSignature <*> children ((,,) <$> accessibilityModifier' <*> term propertyName <*> callSignatureParts) - where makeSignature loc (modifier, propertyName, (typeParams, params, annotation)) = makeTerm loc (TSX.Syntax.AbstractMethodSignature [typeParams, annotation] propertyName params modifier) - -classHeritage' :: Assignment [Term] -classHeritage' = symbol Grammar.ClassHeritage *> children ((mappend `on` toList) <$> optional (term extendsClause) <*> optional (term implementsClause')) - -extendsClause :: Assignment Term -extendsClause = makeTerm <$> symbol Grammar.ExtendsClause <*> children (TSX.Syntax.ExtendsClause <$> manyTerm (typeReference <|> expression)) - -typeReference :: Assignment Term -typeReference = typeIdentifier <|> nestedTypeIdentifier <|> genericType - -implementsClause' :: Assignment Term -implementsClause' = makeTerm <$> symbol Grammar.ImplementsClause <*> children (TSX.Syntax.ImplementsClause <$> manyTerm ty) - -super :: Assignment Term -super = makeTerm <$> symbol Grammar.Super <*> (TSX.Syntax.Super <$ rawSource) - -asExpression :: Assignment Term -asExpression = makeTerm <$> symbol AsExpression <*> children (Expression.Cast <$> term expression <*> term (ty <|> templateString)) - -templateString :: Assignment Term -templateString = makeTerm <$> symbol TemplateString <*> children (Literal.String <$> manyTerm templateSubstitution) - -templateSubstitution :: Assignment Term -templateSubstitution = symbol TemplateSubstitution *> children (term expressions) - -nonNullExpression' :: Assignment Term -nonNullExpression' = makeTerm <$> symbol Grammar.NonNullExpression <*> children (Expression.NonNullExpression <$> term expression) - -importAlias' :: Assignment Term -importAlias' = makeTerm <$> symbol Grammar.ImportAlias <*> children (TSX.Syntax.ImportAlias <$> term identifier <*> term (identifier <|> nestedIdentifier)) - -number :: Assignment Term -number = makeTerm <$> symbol Grammar.Number <*> (Literal.Float <$> source) - -string :: Assignment Term -string = makeTerm <$> symbol Grammar.String <*> (Literal.TextElement <$> source) - -true :: Assignment Term -true = makeTerm <$> symbol Grammar.True <*> (Literal.true <$ rawSource) - -false :: Assignment Term -false = makeTerm <$> symbol Grammar.False <*> (Literal.false <$ rawSource) - -identifier :: Assignment Term -identifier = makeTerm <$> symbol Identifier <*> (Syntax.Identifier . name <$> source) - -class' :: Assignment Term -class' = makeClass <$> symbol Class <*> children ((,,,,) <$> manyTerm decorator <*> term typeIdentifier <*> (symbol TypeParameters *> children (manyTerm typeParameter') <|> pure []) <*> (classHeritage' <|> pure []) <*> classBodyStatements) - where makeClass loc (decorators, expression, typeParams, classHeritage, statements) = makeTerm loc (Declaration.Class (decorators <> typeParams) expression classHeritage statements) - -object :: Assignment Term -object = makeTerm <$> (symbol Object <|> symbol ObjectPattern) <*> children (Literal.Hash <$> manyTerm (pair <|> spreadElement <|> methodDefinition <|> assignmentPattern <|> shorthandPropertyIdentifier)) - -array :: Assignment Term -array = makeTerm <$> (symbol Array <|> symbol ArrayPattern) <*> children (Literal.Array <$> manyTerm (expression <|> spreadElement)) - -jsxElement' :: Assignment Term -jsxElement' = choice [ jsxElement, jsxSelfClosingElement ] - -jsxElement :: Assignment Term -jsxElement = makeTerm <$> symbol Grammar.JsxElement <*> children (TSX.Syntax.JsxElement <$> term jsxOpeningElement' <*> manyTerm jsxChild <*> term jsxClosingElement') - -jsxFragment :: Assignment Term -jsxFragment = makeTerm <$> symbol Grammar.JsxFragment <*> children (TSX.Syntax.JsxFragment <$> manyTerm jsxChild) - -jsxChild :: Assignment Term -jsxChild = choice [ jsxElement', jsxExpression', jsxText ] - -jsxSelfClosingElement :: Assignment Term -jsxSelfClosingElement = makeTerm <$> symbol Grammar.JsxSelfClosingElement <*> children (TSX.Syntax.JsxSelfClosingElement <$> term jsxElementName <*> manyTerm jsxAttribute') - -jsxAttribute' :: Assignment Term -jsxAttribute' = jsxAttribute <|> jsxExpression' - -jsxOpeningElement' :: Assignment Term -jsxOpeningElement' = makeTerm <$> symbol Grammar.JsxOpeningElement <*> children (TSX.Syntax.JsxOpeningElement <$> term jsxElementName <*> manyTerm jsxAttribute') - -jsxElementName :: Assignment Term -jsxElementName = choice [ identifier, nestedIdentifier, jsxNamespaceName ] - -jsxNamespaceName :: Assignment Term -jsxNamespaceName = makeTerm <$> symbol Grammar.JsxNamespaceName <*> children (TSX.Syntax.JsxNamespaceName <$> identifier <*> identifier) - -jsxExpression' :: Assignment Term -jsxExpression' = makeTerm <$> symbol Grammar.JsxExpression <*> children (TSX.Syntax.JsxExpression <$> term (expressions <|> spreadElement <|> emptyTerm)) - -jsxText :: Assignment Term -jsxText = makeTerm <$> symbol Grammar.JsxText <*> (TSX.Syntax.JsxText <$> source) - -jsxClosingElement' :: Assignment Term -jsxClosingElement' = makeTerm <$> symbol Grammar.JsxClosingElement <*> children (TSX.Syntax.JsxClosingElement <$> term jsxElementName) - -jsxAttribute :: Assignment Term -jsxAttribute = makeTerm <$> symbol Grammar.JsxAttribute <*> children (TSX.Syntax.JsxAttribute <$> term (propertyIdentifier <|> jsxNamespaceName) <*> (term jsxAttributeValue <|> emptyTerm)) - where jsxAttributeValue = choice [ string, jsxExpression', jsxElement', jsxFragment ] - -propertyIdentifier :: Assignment Term -propertyIdentifier = makeTerm <$> symbol PropertyIdentifier <*> (Syntax.Identifier . name <$> source) - -sequenceExpression :: Assignment Term -sequenceExpression = makeTerm <$> symbol Grammar.SequenceExpression <*> children (Expression.SequenceExpression <$> term expression <*> term expressions) - -expressions :: Assignment Term -expressions = annotatedExpression <|> expression <|> sequenceExpression - -annotatedExpression :: Assignment Term -annotatedExpression = mkAnnotated <$> location <*> expression <*> typeAnnotation' - where mkAnnotated loc expr ann = makeTerm loc (TSX.Syntax.AnnotatedExpression expr ann) - -parameter :: Assignment Term -parameter = requiredParameter - <|> restParameter - <|> optionalParameter - -accessibilityModifier' :: Assignment ScopeGraph.AccessControl -accessibilityModifier' = (symbol AccessibilityModifier >> children (public <|> protected <|> private)) <|> default' - where public = symbol AnonPublic >> pure ScopeGraph.Public - protected = symbol AnonProtected >> pure ScopeGraph.Protected - private = symbol AnonPrivate >> pure ScopeGraph.Private - default' = pure ScopeGraph.Public - - -destructuringPattern :: Assignment Term -destructuringPattern = object <|> array - -spreadElement :: Assignment Term -spreadElement = symbol SpreadElement *> children (term expression) - -readonly' :: Assignment Term -readonly' = makeTerm <$> symbol Readonly <*> (Type.Readonly <$ rawSource) - -methodDefinition :: Assignment Term -methodDefinition = makeMethod <$> - symbol MethodDefinition - <*> children ((,,,,,) <$> accessibilityModifier' <*> (term readonly' <|> emptyTerm) <*> emptyTerm <*> term propertyName <*> callSignatureParts <*> term statementBlock) - where - makeMethod loc (modifier, readonly, receiver, propertyName', (typeParameters', params, ty'), statements) = makeTerm loc (Declaration.Method [readonly, typeParameters', ty'] receiver propertyName' params statements modifier) - -callSignatureParts :: Assignment (Term, [Term], Term) -callSignatureParts = contextualize' <$> Assignment.manyThrough comment (postContextualize' <$> callSignature' <*> many comment) - where - callSignature' = symbol Grammar.CallSignature *> children ((,,) <$> (term typeParameters <|> emptyTerm) <*> formalParameters <*> (term typeAnnotation' <|> emptyTerm)) - contextualize' (cs, (typeParams, formalParams, annotation)) = case nonEmpty cs of - Just cs -> (makeTerm1 (Syntax.Context cs typeParams), formalParams, annotation) - Nothing -> (typeParams, formalParams, annotation) - postContextualize' (typeParams, formalParams, annotation) cs = case nonEmpty cs of - Just cs -> (typeParams, formalParams, makeTerm1 (Syntax.Context cs annotation)) - Nothing -> (typeParams, formalParams, annotation) - -callSignature :: Assignment Term -callSignature = makeTerm <$> symbol Grammar.CallSignature <*> children (TSX.Syntax.CallSignature <$> (fromMaybe <$> emptyTerm <*> optional (term typeParameters)) <*> formalParameters <*> (fromMaybe <$> emptyTerm <*> optional (term typeAnnotation'))) - -constructSignature :: Assignment Term -constructSignature = makeTerm <$> symbol Grammar.ConstructSignature <*> children (TSX.Syntax.ConstructSignature <$> (fromMaybe <$> emptyTerm <*> optional (term typeParameters)) <*> formalParameters <*> (fromMaybe <$> emptyTerm <*> optional (term typeAnnotation'))) - -indexSignature :: Assignment Term -indexSignature = makeTerm <$> symbol Grammar.IndexSignature <*> children (TSX.Syntax.IndexSignature <$> term identifier <*> predefinedTy <*> term typeAnnotation') - -methodSignature :: Assignment Term -methodSignature = makeMethodSignature <$> symbol Grammar.MethodSignature <*> children ((,,,) <$> accessibilityModifier' <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> callSignatureParts) - where makeMethodSignature loc (accessControl, readonly, propertyName, (typeParams, params, annotation)) = makeTerm loc (Declaration.MethodSignature [readonly, typeParams, annotation] propertyName params accessControl) - -formalParameters :: Assignment [Term] -formalParameters = symbol FormalParameters *> children (contextualize' <$> Assignment.manyThrough comment (postContextualize' <$> (concat <$> many ((\as b -> as <> [b]) <$> manyTerm decorator <*> term parameter)) <*> many comment)) - where - contextualize' (cs, formalParams) = case nonEmpty cs of - Just cs -> toList cs <> formalParams - Nothing -> formalParams - postContextualize' formalParams cs = case nonEmpty cs of - Just cs -> formalParams <> toList cs - Nothing -> formalParams - - -decorator :: Assignment Term -decorator = makeTerm <$> symbol Grammar.Decorator <*> children (TSX.Syntax.Decorator <$> term (identifier <|> memberExpression <|> callExpression)) - -typeParameters :: Assignment Term -typeParameters = makeTerm <$> symbol TypeParameters <*> children (Type.TypeParameters <$> manyTerm typeParameter') - -typeAnnotation' :: Assignment Term -typeAnnotation' = makeTerm <$> symbol TypeAnnotation <*> children (TSX.Syntax.Annotation <$> term ty) - -typeParameter' :: Assignment Term -typeParameter' = makeTerm <$> symbol Grammar.TypeParameter <*> children (TSX.Syntax.TypeParameter <$> term typeIdentifier <*> term (constraint <|> emptyTerm) <*> term (defaultType <|> emptyTerm)) - -defaultType :: Assignment Term -defaultType = makeTerm <$> symbol Grammar.DefaultType <*> children (TSX.Syntax.DefaultType <$> term ty) - -constraint :: Assignment Term -constraint = makeTerm <$> symbol Grammar.Constraint <*> children (TSX.Syntax.Constraint <$> term ty) - -function :: Assignment Term -function = makeFunction <$> (symbol Grammar.Function <|> symbol Grammar.GeneratorFunction) <*> children ((,,) <$> term (identifier <|> emptyTerm) <*> callSignatureParts <*> term statementBlock) - where makeFunction loc (id, (typeParams, params, annotation), statements) = makeTerm loc (Declaration.Function [typeParams, annotation] id params statements) - --- TODO: FunctionSignatures can, but don't have to be ambient functions. -ambientFunction :: Assignment Term -ambientFunction = makeAmbientFunction <$> symbol Grammar.FunctionSignature <*> children ((,) <$> term identifier <*> callSignatureParts) - where makeAmbientFunction loc (id, (typeParams, params, annotation)) = makeTerm loc (TSX.Syntax.AmbientFunction [typeParams, annotation] id params) - -ty :: Assignment Term -ty = primaryType <|> unionType <|> intersectionType <|> functionTy <|> constructorTy - -primaryType :: Assignment Term -primaryType = arrayTy - <|> existentialType - <|> flowMaybeTy - <|> genericType - <|> indexTypeQuery - <|> literalType - <|> lookupType - <|> nestedTypeIdentifier - <|> objectType - <|> parenthesizedTy - <|> predefinedTy - <|> thisType - <|> tupleType - <|> typeIdentifier - <|> typePredicate - <|> typeQuery - -parenthesizedTy :: Assignment Term -parenthesizedTy = makeTerm <$> symbol Grammar.ParenthesizedType <*> children (TSX.Syntax.ParenthesizedType <$> term ty) - -predefinedTy :: Assignment Term -predefinedTy = makeTerm <$> symbol Grammar.PredefinedType <*> (TSX.Syntax.PredefinedType <$> source) - -typeIdentifier :: Assignment Term -typeIdentifier = makeTerm <$> symbol Grammar.TypeIdentifier <*> (TSX.Syntax.TypeIdentifier <$> source) - -nestedIdentifier :: Assignment Term -nestedIdentifier = makeTerm <$> symbol Grammar.NestedIdentifier <*> children (TSX.Syntax.NestedIdentifier <$> term (identifier <|> nestedIdentifier) <*> term identifier) - -nestedTypeIdentifier :: Assignment Term -nestedTypeIdentifier = makeTerm <$> symbol Grammar.NestedTypeIdentifier <*> children (TSX.Syntax.NestedTypeIdentifier <$> term (identifier <|> nestedIdentifier) <*> term typeIdentifier) - -genericType :: Assignment Term -genericType = makeTerm <$> symbol Grammar.GenericType <*> children (TSX.Syntax.GenericType <$> term (typeIdentifier <|> nestedTypeIdentifier) <*> term typeArguments') - -typeArguments' :: Assignment Term -typeArguments' = makeTerm <$> symbol Grammar.TypeArguments <*> children (TSX.Syntax.TypeArguments <$> some (term ty)) - -typePredicate :: Assignment Term -typePredicate = makeTerm <$> symbol Grammar.TypePredicate <*> children (TSX.Syntax.TypePredicate <$> term identifier <*> term ty) - -objectType :: Assignment Term -objectType = makeTerm <$> symbol Grammar.ObjectType <*> children (TSX.Syntax.ObjectType <$> manyTerm (exportStatement <|> propertySignature <|> callSignature <|> constructSignature <|> indexSignature <|> methodSignature)) - -arrayTy :: Assignment Term -arrayTy = makeTerm <$> symbol Grammar.ArrayType <*> children (TSX.Syntax.ArrayType <$> term ty) - -lookupType :: Assignment Term -lookupType = makeTerm <$> symbol Grammar.LookupType <*> children (TSX.Syntax.LookupType <$> term (typeIdentifier <|> nestedTypeIdentifier) <*> term ty) - -flowMaybeTy :: Assignment Term -flowMaybeTy = makeTerm <$> symbol Grammar.FlowMaybeType <*> children (TSX.Syntax.FlowMaybeType <$> term primaryType) - -typeQuery :: Assignment Term -typeQuery = makeTerm <$> symbol Grammar.TypeQuery <*> children (TSX.Syntax.TypeQuery <$> term (identifier <|> nestedIdentifier)) - -indexTypeQuery :: Assignment Term -indexTypeQuery = makeTerm <$> symbol Grammar.IndexTypeQuery <*> children (TSX.Syntax.IndexTypeQuery <$> term (typeIdentifier <|> nestedTypeIdentifier)) - -thisType :: Assignment Term -thisType = makeTerm <$> symbol Grammar.ThisType <*> (TSX.Syntax.ThisType <$> source) - -existentialType :: Assignment Term -existentialType = makeTerm <$> symbol Grammar.ExistentialType <*> (TSX.Syntax.ExistentialType <$> source) - -literalType :: Assignment Term -literalType = makeTerm <$> symbol Grammar.LiteralType <*> children (TSX.Syntax.LiteralType <$> term (number <|> string <|> true <|> false)) - -unionType :: Assignment Term -unionType = makeTerm <$> symbol UnionType <*> children (TSX.Syntax.Union <$> (term ty <|> emptyTerm) <*> term ty) - -intersectionType :: Assignment Term -intersectionType = makeTerm <$> symbol IntersectionType <*> children (TSX.Syntax.Intersection <$> term ty <*> term ty) - -functionTy :: Assignment Term -functionTy = makeTerm <$> symbol Grammar.FunctionType <*> children (TSX.Syntax.FunctionType <$> (fromMaybe <$> emptyTerm <*> optional (term typeParameters)) <*> formalParameters <*> term ty) - -tupleType :: Assignment Term -tupleType = makeTerm <$> symbol TupleType <*> children (TSX.Syntax.Tuple <$> manyTerm ty) - -constructorTy :: Assignment Term -constructorTy = makeTerm <$> symbol ConstructorType <*> children (TSX.Syntax.Constructor <$> (fromMaybe <$> emptyTerm <*> optional (term typeParameters)) <*> formalParameters <*> term ty) - -statementTerm :: Assignment Term -statementTerm = makeTerm <$> symbol StatementBlock <*> children (Statement.Statements <$> manyTerm statement) - -statementBlock :: Assignment Term -statementBlock = makeTerm <$> symbol StatementBlock <*> children (Statement.StatementBlock <$> manyTerm statement) - -classBodyStatements :: Assignment Term -classBodyStatements = makeTerm'' <$> symbol ClassBody <*> children (contextualize' <$> Assignment.manyThrough comment (postContextualize' <$> (concat <$> many ((\as b -> as <> [b]) <$> manyTerm decorator <*> term (methodDefinition <|> publicFieldDefinition <|> methodSignature <|> indexSignature <|> abstractMethodSignature))) <*> many comment)) - where - contextualize' (cs, formalParams) = case nonEmpty cs of - Just cs -> toList cs <> formalParams - Nothing -> formalParams - postContextualize' formalParams cs = case nonEmpty cs of - Just cs -> formalParams <> toList cs - Nothing -> formalParams - -publicFieldDefinition :: Assignment Term -publicFieldDefinition = makeField <$> symbol Grammar.PublicFieldDefinition <*> children ((,,,,) <$> accessibilityModifier' <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> (term typeAnnotation' <|> emptyTerm) <*> (term expression <|> emptyTerm)) - where makeField loc (accessControl, readonly, propertyName, annotation, expression) = makeTerm loc (Declaration.PublicFieldDefinition [readonly, annotation] propertyName expression accessControl) - - -statement :: Assignment Term -statement = handleError everything - where - everything = choice [ - exportStatement - , importStatement - , debuggerStatement - , expressionStatement' - , declaration - , statementTerm - , ifStatement - , switchStatement - , forStatement - , forInStatement - , forOfStatement - , whileStatement - , doStatement - , tryStatement - , withStatement - , breakStatement - , continueStatement - , returnStatement - , throwStatement - , hashBang - , emptyStatement - , labeledStatement ] - -forOfStatement :: Assignment Term -forOfStatement = makeTerm <$> symbol ForOfStatement <*> children (TSX.Syntax.ForOf <$> term expression <*> term expressions <*> term statement) - -forInStatement :: Assignment Term -forInStatement = makeTerm <$> symbol ForInStatement <*> children (Statement.ForEach <$> term expression <*> term expression <*> term statement) - -doStatement :: Assignment Term -doStatement = makeTerm <$> symbol DoStatement <*> children (flip Statement.DoWhile <$> term statement <*> term parenthesizedExpression) - -continueStatement :: Assignment Term -continueStatement = makeTerm <$> symbol ContinueStatement <*> children (Statement.Continue <$> (statementIdentifier <|> term emptyTerm)) - -breakStatement :: Assignment Term -breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (statementIdentifier <|> term emptyTerm)) - -withStatement :: Assignment Term -withStatement = makeTerm <$> symbol WithStatement <*> children (TSX.Syntax.With <$> term parenthesizedExpression <*> term statement) - -returnStatement :: Assignment Term -returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> (term expressions <|> term emptyTerm)) - -throwStatement :: Assignment Term -throwStatement = makeTerm <$> symbol Grammar.ThrowStatement <*> children (Statement.Throw <$> term expressions) - -hashBang :: Assignment Term -hashBang = makeTerm <$> symbol HashBangLine <*> (Comment.HashBang <$> source) - -labeledStatement :: Assignment Term -labeledStatement = makeTerm <$> symbol Grammar.LabeledStatement <*> children (TSX.Syntax.LabeledStatement <$> statementIdentifier <*> term statement) - -statementIdentifier :: Assignment Term -statementIdentifier = makeTerm <$> symbol StatementIdentifier <*> (Syntax.Identifier . name <$> source) - -importStatement :: Assignment Term -importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> children ((,) <$> importClause <*> fromClause) - <|> makeTerm' <$> symbol Grammar.ImportStatement <*> children (requireImport <|> sideEffectImport) - where - -- `import foo = require "./foo"` - requireImport = inject <$> (symbol Grammar.ImportRequireClause *> children (TSX.Syntax.QualifiedAliasedImport <$> term identifier <*> fromClause)) - -- `import "./foo"` - sideEffectImport = inject <$> (TSX.Syntax.SideEffectImport <$> fromClause) - -- `import { bar } from "./foo"` - namedImport = (,) Nothing <$> (symbol Grammar.NamedImports *> children (many importSymbol)) - -- `import defaultMember from "./foo"` - defaultImport = (,) Nothing <$> (pure <$> (makeNameAliasPair <$> rawIdentifier <*> pure Nothing)) - -- `import * as name from "./foo"` - namespaceImport = symbol Grammar.NamespaceImport *> children ((,) . Just <$> term identifier <*> pure []) - - -- Combinations of the above. - importClause = symbol Grammar.ImportClause *> - children ( - (pure <$> namedImport) - <|> (pure <$> namespaceImport) - <|> ((\a b -> [a, b]) <$> defaultImport <*> (namedImport <|> namespaceImport)) - <|> (pure <$> defaultImport)) - - makeImportTerm1 loc from (Just alias, _) = makeTerm loc (TSX.Syntax.QualifiedAliasedImport alias from) - makeImportTerm1 loc from (Nothing, symbols) = makeTerm loc (TSX.Syntax.Import (uncurry TSX.Syntax.Alias <$> symbols) from) - makeImportTerm loc ([x], from) = makeImportTerm1 loc from x - makeImportTerm loc (xs, from) = makeTerm loc $ fmap (makeImportTerm1 loc from) xs - importSymbol = symbol Grammar.ImportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> ((Just <$> rawIdentifier) <|> pure Nothing)) - rawIdentifier = symbol Identifier *> (name <$> source) - makeNameAliasPair from (Just alias) = (from, alias) - makeNameAliasPair from Nothing = (from, from) - - -- TODO: Need to validate that inline comments are still handled with this change in assigning to Path and not a Term. - fromClause = symbol Grammar.String *> (TypeScript.Resolution.importPath <$> source) - -debuggerStatement :: Assignment Term -debuggerStatement = makeTerm <$> symbol Grammar.DebuggerStatement <*> (TSX.Syntax.Debugger <$ rawSource) - -expressionStatement' :: Assignment Term -expressionStatement' = symbol ExpressionStatement *> children (term expressions) - -declaration :: Assignment Term -declaration = everything - where - everything = choice [ - exportStatement, - importAlias', - function, - internalModule, - ambientFunction, - abstractClass, - class', - module', - variableDeclaration, - typeAliasDeclaration, - enumDeclaration, - interfaceDeclaration, - ambientDeclaration - ] - -typeAliasDeclaration :: Assignment Term -typeAliasDeclaration = makeTypeAliasDecl <$> symbol Grammar.TypeAliasDeclaration <*> children ((,,) <$> term typeIdentifier <*> (term typeParameters <|> emptyTerm) <*> term ty) - where makeTypeAliasDecl loc (identifier, typeParams, body) = makeTerm loc (Declaration.TypeAlias [typeParams] identifier body) - -enumDeclaration :: Assignment Term -enumDeclaration = makeTerm <$> symbol Grammar.EnumDeclaration <*> children (TSX.Syntax.EnumDeclaration <$> term identifier <*> (symbol EnumBody *> children (manyTerm (propertyName <|> enumAssignment)))) - -enumAssignment :: Assignment Term -enumAssignment = makeTerm <$> symbol Grammar.EnumAssignment <*> children (Statement.Assignment [] <$> term propertyName <*> term expression) - -interfaceDeclaration :: Assignment Term -interfaceDeclaration = makeInterfaceDecl <$> symbol Grammar.InterfaceDeclaration <*> children ((,,,) <$> term typeIdentifier <*> (term typeParameters <|> emptyTerm) <*> optional (term extendsClause) <*> term objectType) - where makeInterfaceDecl loc (identifier, typeParams, clause, objectType) = makeTerm loc (Declaration.InterfaceDeclaration [typeParams] identifier (toList clause) objectType) - -ambientDeclaration :: Assignment Term -ambientDeclaration = makeTerm <$> symbol Grammar.AmbientDeclaration <*> children (TSX.Syntax.AmbientDeclaration <$> term (choice [propertyIdentifier *> ty, declaration, statementBlock])) - -exportStatement :: Assignment Term -exportStatement = makeTerm <$> symbol Grammar.ExportStatement <*> children (flip TSX.Syntax.QualifiedExportFrom <$> exportClause <*> fromClause) - <|> makeTerm <$> symbol Grammar.ExportStatement <*> children (TSX.Syntax.QualifiedExport <$> exportClause) - <|> makeTerm <$> symbol Grammar.ExportStatement <*> children (TSX.Syntax.DefaultExport <$> contextualize decorator (term (declaration <|> expression <|> identifier <|> importAlias'))) - where - exportClause = symbol Grammar.ExportClause *> children (many exportSymbol) - exportSymbol = symbol Grammar.ExportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> (Just <$> rawIdentifier)) - <|> symbol Grammar.ExportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> pure Nothing) - makeNameAliasPair from (Just alias) = TSX.Syntax.Alias from alias - makeNameAliasPair from Nothing = TSX.Syntax.Alias from from - rawIdentifier = symbol Identifier *> (name <$> source) - -- TODO: Need to validate that inline comments are still handled with this change in assigning to Path and not a Term. - fromClause = symbol Grammar.String *> (TypeScript.Resolution.importPath <$> source) - -propertySignature :: Assignment Term -propertySignature = makePropertySignature <$> symbol Grammar.PropertySignature <*> children ((,,,) <$> accessibilityModifier' <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> (term typeAnnotation' <|> emptyTerm)) - where makePropertySignature loc (modifier, readonly, propertyName, annotation) = makeTerm loc (TSX.Syntax.PropertySignature [readonly, annotation] propertyName modifier) - -propertyName :: Assignment Term -propertyName = term (propertyIdentifier <|> string <|> number <|> computedPropertyName) - -computedPropertyName :: Assignment Term -computedPropertyName = makeTerm <$> symbol Grammar.ComputedPropertyName <*> children (TSX.Syntax.ComputedPropertyName <$> term expression) - -assignmentPattern :: Assignment Term -assignmentPattern = makeTerm <$> symbol AssignmentPattern <*> children (Statement.Assignment [] <$> term shorthandPropertyIdentifier <*> term expression) - -shorthandPropertyIdentifier :: Assignment Term -shorthandPropertyIdentifier = makeTerm <$> symbol Grammar.ShorthandPropertyIdentifier <*> (TSX.Syntax.ShorthandPropertyIdentifier <$> source) - -requiredParameter :: Assignment Term -requiredParameter = makeRequiredParameter - <$> symbol Grammar.RequiredParameter - <*> children ( (,,,,) - <$> accessibilityModifier' - <*> (term readonly' <|> emptyTerm) - <*> term (identifier <|> destructuringPattern <|> this) - <*> (term typeAnnotation' <|> emptyTerm) - <*> (term expression <|> emptyTerm)) - where - makeRequiredParameter loc (modifier, readonly, identifier, annotation, initializer) = makeTerm loc (TSX.Syntax.RequiredParameter [readonly, annotation] identifier initializer modifier) - -restParameter :: Assignment Term -restParameter = makeRestParameter <$> symbol Grammar.RestParameter <*> children ((,) <$> term identifier <*> (term typeAnnotation' <|> emptyTerm)) - where makeRestParameter loc (identifier, annotation) = makeTerm loc (TSX.Syntax.RestParameter [annotation] identifier) - -optionalParameter :: Assignment Term -optionalParameter = makeOptionalParam <$> symbol Grammar.OptionalParameter <*> children ((,,,,) <$> accessibilityModifier' <*> (term readonly' <|> emptyTerm) <*> (term identifier <|> destructuringPattern) <*> (term typeAnnotation' <|> emptyTerm) <*> (term expression <|> emptyTerm)) - where makeOptionalParam loc (modifier, readonly, subject, annotation, initializer) = makeTerm loc (TSX.Syntax.OptionalParameter [readonly, annotation] (makeTerm loc (Statement.Assignment [] subject initializer)) modifier) - -internalModule :: Assignment Term -internalModule = makeTerm <$> symbol Grammar.InternalModule <*> children (TSX.Syntax.InternalModule <$> term (string <|> identifier <|> nestedIdentifier) <*> statements) - -module' :: Assignment Term -module' = makeTerm <$> symbol Module <*> children (TSX.Syntax.Module <$> term (string <|> identifier <|> nestedIdentifier) <*> (statements <|> pure [])) - - -statements :: Assignment [Term] -statements = symbol StatementBlock *> children (manyTerm statement) - -arrowFunction :: Assignment Term -arrowFunction = makeArrowFun <$> symbol ArrowFunction <*> children ((,,) <$> emptyTerm <*> (((\a b c -> (a, [b], c)) <$> emptyTerm <*> term identifier <*> emptyTerm) <|> callSignatureParts) <*> term (expression <|> statementBlock)) - where makeArrowFun loc (identifier, (typeParams, params, returnTy), body) = makeTerm loc (Declaration.Function [ typeParams, returnTy ] identifier params body) - -comment :: Assignment Term -comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) - -ifStatement :: Assignment Term -ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> term parenthesizedExpression <*> term statement <*> (term statement <|> emptyTerm)) - -whileStatement :: Assignment Term -whileStatement = makeTerm <$> symbol WhileStatement <*> children (Statement.While <$> term expression <*> term statement) - -forStatement :: Assignment Term -forStatement = makeTerm <$> symbol ForStatement <*> children (Statement.For <$> term (variableDeclaration <|> expressionStatement' <|> emptyStatement) <*> term (expressionStatement' <|> emptyStatement) <*> term (expressions <|> emptyTerm) <*> term statement) - -variableDeclaration :: Assignment Term -variableDeclaration = makeTerm <$> (symbol Grammar.VariableDeclaration <|> symbol Grammar.LexicalDeclaration) <*> children (Declaration.VariableDeclaration <$> manyTerm variableDeclarator) - -variableDeclarator :: Assignment Term -variableDeclarator = - makeTerm <$> symbol VariableDeclarator <*> children (TSX.Syntax.JavaScriptRequire <$> identifier <*> requireCall) - <|> makeVarDecl <$> symbol VariableDeclarator <*> children ((,,) <$> term (identifier <|> destructuringPattern) <*> (term typeAnnotation' <|> emptyTerm) <*> (term expression <|> emptyTerm)) - where - makeVarDecl loc (subject, annotations, value) = makeTerm loc (Statement.Assignment [annotations] subject value) - - requireCall = symbol CallExpression *> children (symbol Identifier *> do - s <- source - guard (s == "require") - symbol Arguments *> children (symbol Grammar.String *> (TypeScript.Resolution.importPath <$> source)) - ) - - -parenthesizedExpression :: Assignment Term -parenthesizedExpression = symbol ParenthesizedExpression *> children (term expressions) - -switchStatement :: Assignment Term -switchStatement = makeTerm <$> symbol SwitchStatement <*> children (Statement.Match <$> term parenthesizedExpression <*> term switchBody) - where - switchBody = symbol SwitchBody *> children (makeTerm <$> location <*> manyTerm switchCase) - switchCase = makeTerm <$> (symbol SwitchCase <|> symbol SwitchDefault) <*> children (Statement.Pattern <$> (term expressions <|> emptyTerm) <*> (makeTerm <$> location <*> manyTerm statement)) - -subscriptExpression :: Assignment Term -subscriptExpression = makeTerm <$> symbol SubscriptExpression <*> children (Expression.Subscript <$> term expression <*> (pure <$> term expressions)) - -pair :: Assignment Term -pair = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> term propertyName <*> term expression) - -callExpression :: Assignment Term -callExpression = makeCall <$> (symbol CallExpression <|> symbol CallExpression') <*> children ((,,,) <$> term (expression <|> super <|> function) <*> (typeArguments <|> pure []) <*> (arguments <|> (pure <$> term templateString)) <*> emptyTerm) - where makeCall loc (subject, typeArgs, args, body) = makeTerm loc (Expression.Call typeArgs subject args body) - typeArguments = symbol Grammar.TypeArguments *> children (some (term ty)) - -arguments :: Assignment [Term] -arguments = symbol Arguments *> children (manyTerm (expression <|> spreadElement)) - -tryStatement :: Assignment Term -tryStatement = makeTry <$> symbol TryStatement <*> children ((,,) <$> term statementTerm <*> optional (term catchClause) <*> optional (term finallyClause)) - where - makeTry loc (statementBlock', catch, finally) = makeTerm loc (Statement.Try statementBlock' (catMaybes [catch, finally])) - catchClause = makeTerm <$> symbol CatchClause <*> children (Statement.Catch <$> (identifier <|> emptyTerm) <*> statementTerm) - finallyClause = makeTerm <$> symbol FinallyClause <*> children (Statement.Finally <$> statementTerm) - -binaryExpression :: Assignment Term -binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expression (term expression) - [ (inject .) . Expression.Plus <$ symbol AnonPlus - , (inject .) . Expression.Minus <$ symbol AnonMinus - , (inject .) . Expression.Times <$ symbol AnonStar - , (inject .) . Expression.DividedBy <$ symbol AnonSlash - , (inject .) . Expression.Modulo <$ symbol AnonPercent - , (inject .) . Expression.Member <$ symbol AnonIn - , (inject .) . Expression.And <$ symbol AnonAmpersandAmpersand - , (inject .) . Expression.BAnd <$ symbol AnonAmpersand - , (inject .) . Expression.Or <$ symbol AnonPipePipe - , (inject .) . Expression.BOr <$ symbol AnonPipe - , (inject .) . Expression.BXOr <$ symbol AnonCaret - , (inject .) . Expression.InstanceOf <$ symbol AnonInstanceof - , (inject .) . Expression.Equal <$ symbol AnonEqualEqual - , (inject .) . Expression.StrictEqual <$ symbol AnonEqualEqualEqual - , (inject .) . invert Expression.Equal <$ symbol AnonBangEqual - , (inject .) . invert Expression.StrictEqual <$ symbol AnonBangEqualEqual - , (inject .) . Expression.LShift <$ symbol AnonLAngleLAngle - , (inject .) . Expression.RShift <$ symbol AnonRAngleRAngle - , (inject .) . Expression.UnsignedRShift <$ symbol AnonRAngleRAngleRAngle - , (inject .) . Expression.LessThan <$ symbol AnonLAngle - , (inject .) . Expression.GreaterThan <$ symbol AnonRAngle - , (inject .) . Expression.LessThanEqual <$ symbol AnonLAngleEqual - , (inject .) . Expression.GreaterThanEqual <$ symbol AnonRAngleEqual - ]) - where invert cons a b = Expression.Not (makeTerm1 (cons a b)) - - --- Helpers - --- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present. -manyTerm :: Assignment Term -> Assignment [Term] -manyTerm term = many (contextualize comment term <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)) - -term :: Assignment Term -> Assignment Term -term term = contextualize comment (postContextualize comment term) - -emptyStatement :: Assignment Term -emptyStatement = makeTerm <$> symbol EmptyStatement <*> (Syntax.Empty <$ rawSource <|> pure Syntax.Empty) - --- | Match infix terms separated by any of a list of operators, assigning any comments following each operand. -infixTerm :: Assignment Term - -> Assignment Term - -> [Assignment (Term -> Term -> Sum Syntax Term)] - -> Assignment (Sum Syntax Term) -infixTerm = infixContext comment diff --git a/src/Language/TSX/Syntax.hs b/src/Language/TSX/Syntax.hs deleted file mode 100644 index caef2e7388..0000000000 --- a/src/Language/TSX/Syntax.hs +++ /dev/null @@ -1,7 +0,0 @@ -module Language.TSX.Syntax ( module X ) where - -import Language.TypeScript.Syntax.Import as X -import Language.TypeScript.Syntax.JavaScript as X -import Language.TSX.Syntax.JSX as X -import Language.TypeScript.Syntax.TypeScript as X -import Language.TypeScript.Syntax.Types as X diff --git a/src/Language/TSX/Syntax/JSX.hs b/src/Language/TSX/Syntax/JSX.hs deleted file mode 100644 index 9430e67435..0000000000 --- a/src/Language/TSX/Syntax/JSX.hs +++ /dev/null @@ -1,65 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.TSX.Syntax.JSX where - -import Prologue - -import Data.Abstract.Evaluatable -import Data.JSON.Fields -import qualified Data.Text as T -import Diffing.Algorithm - - -data JsxElement a = JsxElement { jsxOpeningElement :: !a, jsxElements :: ![a], jsxClosingElement :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically JsxElement - -instance Evaluatable JsxElement - -newtype JsxText a = JsxText { contents :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically JsxText - -instance Evaluatable JsxText - -newtype JsxExpression a = JsxExpression { jsxExpression :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically JsxExpression - -instance Evaluatable JsxExpression - -data JsxOpeningElement a = JsxOpeningElement { jsxOpeningElementIdentifier :: !a, jsxAttributes :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically JsxOpeningElement - -instance Evaluatable JsxOpeningElement - -newtype JsxClosingElement a = JsxClosingElement { jsxClosingElementIdentifier :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically JsxClosingElement - -instance Evaluatable JsxClosingElement - -data JsxSelfClosingElement a = JsxSelfClosingElement { jsxSelfClosingElementIdentifier :: !a, jsxSelfClosingElementAttributes :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically JsxSelfClosingElement - -instance Evaluatable JsxSelfClosingElement - -data JsxAttribute a = JsxAttribute { jsxAttributeTarget :: !a, jsxAttributeValue :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically JsxAttribute - -instance Evaluatable JsxAttribute - -newtype JsxFragment a = JsxFragment { terms :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically JsxFragment - -instance Evaluatable JsxFragment - -data JsxNamespaceName a = JsxNamespaceName { left :: a, right :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically JsxNamespaceName - -instance Evaluatable JsxNamespaceName diff --git a/src/Language/TSX/Syntax/Types.hs b/src/Language/TSX/Syntax/Types.hs deleted file mode 100644 index 93f2440c8a..0000000000 --- a/src/Language/TSX/Syntax/Types.hs +++ /dev/null @@ -1,143 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.TypeScript.Syntax.Types where - -import Prologue - -import Control.Abstract hiding (Import) -import Data.Abstract.Evaluatable as Evaluatable -import Data.JSON.Fields -import qualified Data.Text as T -import Diffing.Algorithm -import qualified Data.Abstract.ScopeGraph as ScopeGraph - --- | Lookup type for a type-level key in a typescript map. -data LookupType a = LookupType { lookupTypeIdentifier :: a, lookupTypeKey :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically LookupType - -instance Evaluatable LookupType - -data FunctionType a = FunctionType { functionTypeParameters :: !a, functionFormalParameters :: ![a], functionType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically FunctionType - -instance Evaluatable FunctionType - -data TypeParameter a = TypeParameter { typeParameter :: !a, typeParameterConstraint :: !a, typeParameterDefaultType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeParameter - -instance Evaluatable TypeParameter - -data TypeAssertion a = TypeAssertion { typeAssertionParameters :: !a, typeAssertionExpression :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeAssertion - -instance Evaluatable TypeAssertion - -newtype DefaultType a = DefaultType { defaultType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically DefaultType - -instance Evaluatable DefaultType - -newtype ParenthesizedType a = ParenthesizedType { parenthesizedType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ParenthesizedType - -instance Evaluatable ParenthesizedType - -newtype PredefinedType a = PredefinedType { predefinedType :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically PredefinedType - --- TODO: Implement Eval instance for PredefinedType -instance Evaluatable PredefinedType - -newtype TypeIdentifier a = TypeIdentifier { contents :: T.Text } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeIdentifier - -instance Declarations1 TypeIdentifier where - liftDeclaredName _ (TypeIdentifier identifier) = Just (Evaluatable.name identifier) - --- TODO: TypeIdentifier shouldn't evaluate to an address in the heap? -instance Evaluatable TypeIdentifier where - eval _ _ TypeIdentifier{..} = do - -- Add a reference to the type identifier in the current scope. - span <- ask @Span - reference (Reference (Evaluatable.name contents)) span ScopeGraph.TypeIdentifier (Declaration (Evaluatable.name contents)) - unit - -data NestedTypeIdentifier a = NestedTypeIdentifier { left :: !a, right :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically NestedTypeIdentifier - -instance Evaluatable NestedTypeIdentifier - -data GenericType a = GenericType { genericTypeIdentifier :: !a, genericTypeArguments :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically GenericType - -instance Evaluatable GenericType - -data TypePredicate a = TypePredicate { typePredicateIdentifier :: !a, typePredicateType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypePredicate - -instance Evaluatable TypePredicate - -newtype ObjectType a = ObjectType { objectTypeElements :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ObjectType - -instance Evaluatable ObjectType - -newtype ArrayType a = ArrayType { arrayType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ArrayType - -instance Evaluatable ArrayType - -newtype FlowMaybeType a = FlowMaybeType { flowMaybeType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically FlowMaybeType - -instance Evaluatable FlowMaybeType - -newtype TypeQuery a = TypeQuery { typeQuerySubject :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeQuery - -instance Evaluatable TypeQuery - -newtype IndexTypeQuery a = IndexTypeQuery { indexTypeQuerySubject :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically IndexTypeQuery - -instance Evaluatable IndexTypeQuery - -newtype TypeArguments a = TypeArguments { typeArguments :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeArguments - -instance Evaluatable TypeArguments - -newtype ThisType a = ThisType { contents :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ThisType - -instance Evaluatable ThisType - -newtype ExistentialType a = ExistentialType { contents :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ExistentialType - -instance Evaluatable ExistentialType - -newtype LiteralType a = LiteralType { literalTypeSubject :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically LiteralType - -instance Evaluatable LiteralType diff --git a/src/Language/TypeScript/Assignment.hs b/src/Language/TypeScript/Assignment.hs deleted file mode 100644 index 4bf163b402..0000000000 --- a/src/Language/TypeScript/Assignment.hs +++ /dev/null @@ -1,924 +0,0 @@ -{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME -module Language.TypeScript.Assignment -( assignment -, Syntax -, Grammar -, Term -) where - -import Assigning.Assignment hiding (Assignment, Error) -import Data.Abstract.Name (name) -import qualified Data.Abstract.ScopeGraph as ScopeGraph (AccessControl(..)) -import qualified Assigning.Assignment as Assignment -import Data.Sum -import Data.Syntax - ( contextualize - , emptyTerm - , handleError - , infixContext - , makeTerm - , makeTerm' - , makeTerm'' - , makeTerm1 - , parseError - , postContextualize - ) -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Expression as Expression -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Statement as Statement -import qualified Data.Syntax.Type as Type -import qualified Data.Term as Term -import qualified Language.TypeScript.Syntax as TypeScript.Syntax -import qualified Language.TypeScript.Resolution as TypeScript.Resolution -import Prologue -import TreeSitter.TypeScript as Grammar - --- | The type of TypeScript syntax. -type Syntax = '[ - Comment.Comment - , Comment.HashBang - , Declaration.Class - , Declaration.Function - , Declaration.Method - , Declaration.MethodSignature - , Declaration.InterfaceDeclaration - , Declaration.PublicFieldDefinition - , Declaration.VariableDeclaration - , Declaration.TypeAlias - , Expression.Plus - , Expression.Minus - , Expression.Times - , Expression.DividedBy - , Expression.Modulo - , Expression.Power - , Expression.Negate - , Expression.FloorDivision - , Expression.BAnd - , Expression.BOr - , Expression.BXOr - , Expression.LShift - , Expression.RShift - , Expression.UnsignedRShift - , Expression.Complement - , Expression.And - , Expression.Not - , Expression.Or - , Expression.XOr - , Expression.Call - , Expression.Cast - , Expression.LessThan - , Expression.LessThanEqual - , Expression.GreaterThan - , Expression.GreaterThanEqual - , Expression.Equal - , Expression.StrictEqual - , Expression.Comparison - , Expression.Enumeration - , Expression.MemberAccess - , Expression.NonNullExpression - , Expression.ScopeResolution - , Expression.SequenceExpression - , Expression.Subscript - , Expression.Member - , Expression.Delete - , Expression.Void - , Expression.Typeof - , Expression.InstanceOf - , Expression.New - , Expression.Await - , Expression.This - , Literal.Array - , Literal.Boolean - , Literal.Float - , Literal.Hash - , Literal.Integer - , Literal.KeyValue - , Literal.Null - , Literal.String - , Literal.TextElement - , Literal.Regex - , Statement.Assignment - , Statement.Break - , Statement.Catch - , Statement.Continue - , Statement.DoWhile - , Statement.Else - , Statement.Finally - , Statement.For - , Statement.ForEach - , Statement.If - , Statement.Match - , Statement.Pattern - , Statement.Retry - , Statement.Return - , Statement.ScopeEntry - , Statement.ScopeExit - , Statement.Statements - , Statement.Throw - , Statement.Try - , Statement.While - , Statement.Yield - , Syntax.AccessibilityModifier - , Syntax.Empty - , Syntax.Error - , Syntax.Identifier - , Syntax.Context - , Type.Readonly - , Type.TypeParameters - , TypeScript.Syntax.TypeParameter - , TypeScript.Syntax.Constraint - , TypeScript.Syntax.ParenthesizedType - , TypeScript.Syntax.DefaultType - , TypeScript.Syntax.PredefinedType - , TypeScript.Syntax.TypeIdentifier - , TypeScript.Syntax.NestedIdentifier - , TypeScript.Syntax.NestedTypeIdentifier - , TypeScript.Syntax.GenericType - , TypeScript.Syntax.TypeArguments - , TypeScript.Syntax.TypePredicate - , TypeScript.Syntax.CallSignature - , TypeScript.Syntax.ConstructSignature - , TypeScript.Syntax.ArrayType - , TypeScript.Syntax.LookupType - , TypeScript.Syntax.FlowMaybeType - , TypeScript.Syntax.TypeQuery - , TypeScript.Syntax.IndexTypeQuery - , TypeScript.Syntax.ThisType - , TypeScript.Syntax.ExistentialType - , TypeScript.Syntax.AbstractMethodSignature - , TypeScript.Syntax.IndexSignature - , TypeScript.Syntax.ObjectType - , TypeScript.Syntax.LiteralType - , TypeScript.Syntax.Union - , TypeScript.Syntax.Intersection - , TypeScript.Syntax.Module - , TypeScript.Syntax.InternalModule - , TypeScript.Syntax.FunctionType - , TypeScript.Syntax.Tuple - , TypeScript.Syntax.Constructor - , TypeScript.Syntax.TypeAssertion - , TypeScript.Syntax.ImportAlias - , TypeScript.Syntax.Debugger - , TypeScript.Syntax.ShorthandPropertyIdentifier - , TypeScript.Syntax.Super - , TypeScript.Syntax.Undefined - , TypeScript.Syntax.ClassHeritage - , TypeScript.Syntax.AbstractClass - , TypeScript.Syntax.ImplementsClause - , TypeScript.Syntax.OptionalParameter - , TypeScript.Syntax.RequiredParameter - , TypeScript.Syntax.RestParameter - , TypeScript.Syntax.PropertySignature - , TypeScript.Syntax.AmbientDeclaration - , TypeScript.Syntax.EnumDeclaration - , TypeScript.Syntax.ExtendsClause - , TypeScript.Syntax.AmbientFunction - , TypeScript.Syntax.ImportRequireClause - , TypeScript.Syntax.ImportClause - , TypeScript.Syntax.LabeledStatement - , TypeScript.Syntax.Annotation - , TypeScript.Syntax.With - , TypeScript.Syntax.ForOf - , TypeScript.Syntax.Update - , TypeScript.Syntax.ComputedPropertyName - , TypeScript.Syntax.Decorator - , TypeScript.Syntax.Import - , TypeScript.Syntax.QualifiedAliasedImport - , TypeScript.Syntax.SideEffectImport - , TypeScript.Syntax.DefaultExport - , TypeScript.Syntax.QualifiedExport - , TypeScript.Syntax.QualifiedExportFrom - , TypeScript.Syntax.JavaScriptRequire - , [] - , Statement.StatementBlock - , TypeScript.Syntax.MetaProperty - , TypeScript.Syntax.AnnotatedExpression - ] - -type Term = Term.Term (Sum Syntax) Location -type Assignment = Assignment.Assignment [] Grammar - --- | Assignment from AST in TypeScript’s grammar onto a program in TypeScript’s syntax. -assignment :: Assignment Term -assignment = handleError $ makeTerm <$> symbol Program <*> children (Statement.Statements <$> manyTerm statement) <|> parseError - -expression :: Assignment Term -expression = handleError everything - where - everything = choice [ - typeAssertion, - asExpression, - nonNullExpression', - importAlias', - internalModule, - super, - object, - array, - class', - anonymousClass, - function, - arrowFunction, - assignmentExpression, - augmentedAssignmentExpression, - awaitExpression, - unaryExpression, - binaryExpression, - ternaryExpression, - updateExpression, - callExpression, - memberExpression, - newExpression, - parenthesizedExpression, - subscriptExpression, - yieldExpression, - this, - number, - string, - templateString, - regex, - true, - false, - null', - undefined', - identifier - ] - -undefined' :: Assignment Term -undefined' = makeTerm <$> symbol Grammar.Undefined <*> (TypeScript.Syntax.Undefined <$ rawSource) - -assignmentExpression :: Assignment Term -assignmentExpression = makeTerm <$> symbol AssignmentExpression <*> children (Statement.Assignment [] <$> term (memberExpression <|> subscriptExpression <|> identifier <|> destructuringPattern) <*> expression) - -augmentedAssignmentExpression :: Assignment Term -augmentedAssignmentExpression = makeTerm' <$> symbol AugmentedAssignmentExpression <*> children (infixTerm (memberExpression <|> subscriptExpression <|> identifier <|> destructuringPattern) (term expression) [ - assign Expression.Plus <$ symbol AnonPlusEqual - , assign Expression.Minus <$ symbol AnonMinusEqual - , assign Expression.Times <$ symbol AnonStarEqual - , assign Expression.DividedBy <$ symbol AnonSlashEqual - , assign Expression.Modulo <$ symbol AnonPercentEqual - , assign Expression.BXOr <$ symbol AnonCaretEqual - , assign Expression.BAnd <$ symbol AnonAmpersandEqual - , assign Expression.RShift <$ symbol AnonRAngleRAngleEqual - , assign Expression.LShift <$ symbol AnonLAngleLAngleEqual - , assign Expression.UnsignedRShift <$ symbol AnonRAngleRAngleRAngleEqual - , assign Expression.LShift <$ symbol AnonLAngleLAngleEqual - , assign Expression.BOr <$ symbol AnonPipeEqual ]) - where assign :: (f :< Syntax) => (Term -> Term -> f Term) -> Term -> Term -> Sum Syntax Term - assign c l r = inject (Statement.Assignment [] l (makeTerm1 (c l r))) - - -awaitExpression :: Assignment Term -awaitExpression = makeTerm <$> symbol Grammar.AwaitExpression <*> children (Expression.Await <$> term expression) - -unaryExpression :: Assignment Term -unaryExpression = symbol Grammar.UnaryExpression >>= \ loc -> - makeTerm loc . Expression.Not <$> children (symbol AnonBang *> term expression) - <|> makeTerm loc . Expression.Complement <$> children (symbol AnonTilde *> term expression) - <|> makeTerm loc . Expression.Negate <$> children ((symbol AnonMinus <|> symbol AnonPlus) *> term expression) - <|> makeTerm loc . Expression.Typeof <$> children (symbol AnonTypeof *> term expression) - <|> makeTerm loc . Expression.Void <$> children (symbol AnonVoid *> term expression) - <|> makeTerm loc . Expression.Delete <$> children (symbol AnonDelete *> term expression) - -ternaryExpression :: Assignment Term -ternaryExpression = makeTerm <$> symbol Grammar.TernaryExpression <*> children (Statement.If <$> term expression <*> term expression <*> term expression) - -memberExpression :: Assignment Term -memberExpression = makeTerm <$> (symbol Grammar.MemberExpression <|> symbol Grammar.MemberExpression') <*> children (Expression.MemberAccess <$> term expression <*> propertyIdentifier) - -newExpression :: Assignment Term -newExpression = makeTerm <$> symbol Grammar.NewExpression <*> children (Expression.New <$> term constructableExpression <*> (typeArguments' <|> emptyTerm) <*> (arguments <|> pure [])) - -constructableExpression :: Assignment Term -constructableExpression = choice [ - this - , identifier - , number - , string - , templateString - , regex - , true - , false - , null' - , undefined' - , object - , array - , function - , arrowFunction - , class' - , anonymousClass - , parenthesizedExpression - , subscriptExpression - , memberExpression - , metaProperty - , newExpression - ] - -metaProperty :: Assignment Term -metaProperty = makeTerm <$> symbol Grammar.MetaProperty <*> (TypeScript.Syntax.MetaProperty <$ rawSource) - -updateExpression :: Assignment Term -updateExpression = makeTerm <$> symbol Grammar.UpdateExpression <*> children (TypeScript.Syntax.Update <$> term expression) - -yieldExpression :: Assignment Term -yieldExpression = makeTerm <$> symbol Grammar.YieldExpression <*> children (Statement.Yield <$> term (expression <|> emptyTerm)) - -this :: Assignment Term -this = makeTerm <$> symbol Grammar.This <*> (Expression.This <$ rawSource) - -regex :: Assignment Term -regex = makeTerm <$> symbol Grammar.Regex <*> (Literal.Regex <$> source) - -null' :: Assignment Term -null' = makeTerm <$> symbol Null <*> (Literal.Null <$ rawSource) - -anonymousClass :: Assignment Term -anonymousClass = makeTerm <$> symbol Grammar.AnonymousClass <*> children (Declaration.Class [] <$> emptyTerm <*> (classHeritage' <|> pure []) <*> classBodyStatements) - -abstractClass :: Assignment Term -abstractClass = makeTerm <$> symbol Grammar.AbstractClass <*> children (TypeScript.Syntax.AbstractClass <$> term typeIdentifier <*> (term typeParameters <|> emptyTerm) <*> (classHeritage' <|> pure []) <*> classBodyStatements) - -abstractMethodSignature :: Assignment Term -abstractMethodSignature = makeSignature <$> symbol Grammar.AbstractMethodSignature <*> children ((,,) <$> accessibilityModifier' <*> term propertyName <*> callSignatureParts) - where makeSignature loc (modifier, propertyName, (typeParams, params, annotation)) = makeTerm loc (TypeScript.Syntax.AbstractMethodSignature [typeParams, annotation] propertyName params modifier) - -classHeritage' :: Assignment [Term] -classHeritage' = symbol Grammar.ClassHeritage *> children ((mappend `on` toList) <$> optional (term extendsClause) <*> optional (term implementsClause')) - -extendsClause :: Assignment Term -extendsClause = makeTerm <$> symbol Grammar.ExtendsClause <*> children (TypeScript.Syntax.ExtendsClause <$> manyTerm (typeReference <|> expression)) - -typeReference :: Assignment Term -typeReference = typeIdentifier <|> nestedTypeIdentifier <|> genericType - -implementsClause' :: Assignment Term -implementsClause' = makeTerm <$> symbol Grammar.ImplementsClause <*> children (TypeScript.Syntax.ImplementsClause <$> manyTerm ty) - -super :: Assignment Term -super = makeTerm <$> symbol Grammar.Super <*> (TypeScript.Syntax.Super <$ rawSource) - -typeAssertion :: Assignment Term -typeAssertion = makeTerm <$> symbol Grammar.TypeAssertion <*> children (TypeScript.Syntax.TypeAssertion <$> term typeArguments' <*> term expression) - -asExpression :: Assignment Term -asExpression = makeTerm <$> symbol AsExpression <*> children (Expression.Cast <$> term expression <*> term (ty <|> templateString)) - -templateString :: Assignment Term -templateString = makeTerm <$> symbol TemplateString <*> children (Literal.String <$> manyTerm templateSubstitution) - -templateSubstitution :: Assignment Term -templateSubstitution = symbol TemplateSubstitution *> children (term expressions) - -nonNullExpression' :: Assignment Term -nonNullExpression' = makeTerm <$> symbol Grammar.NonNullExpression <*> children (Expression.NonNullExpression <$> term expression) - -importAlias' :: Assignment Term -importAlias' = makeTerm <$> symbol Grammar.ImportAlias <*> children (TypeScript.Syntax.ImportAlias <$> term identifier <*> term (identifier <|> nestedIdentifier)) - -number :: Assignment Term -number = makeTerm <$> symbol Grammar.Number <*> (Literal.Float <$> source) - -string :: Assignment Term -string = makeTerm <$> symbol Grammar.String <*> (Literal.TextElement <$> source) - -true :: Assignment Term -true = makeTerm <$> symbol Grammar.True <*> (Literal.true <$ rawSource) - -false :: Assignment Term -false = makeTerm <$> symbol Grammar.False <*> (Literal.false <$ rawSource) - -identifier :: Assignment Term -identifier = makeTerm <$> symbol Identifier <*> (Syntax.Identifier . name <$> source) - -class' :: Assignment Term -class' = makeClass <$> symbol Class <*> children ((,,,,) <$> manyTerm decorator <*> term typeIdentifier <*> (symbol TypeParameters *> children (manyTerm typeParameter') <|> pure []) <*> (classHeritage' <|> pure []) <*> classBodyStatements) - where makeClass loc (decorators, expression, typeParams, classHeritage, statements) = makeTerm loc (Declaration.Class (decorators <> typeParams) expression classHeritage statements) - -object :: Assignment Term -object = makeTerm <$> (symbol Object <|> symbol ObjectPattern) <*> children (Literal.Hash <$> manyTerm (pair <|> spreadElement <|> methodDefinition <|> assignmentPattern <|> shorthandPropertyIdentifier)) - -array :: Assignment Term -array = makeTerm <$> (symbol Array <|> symbol ArrayPattern) <*> children (Literal.Array <$> manyTerm (expression <|> spreadElement)) - -propertyIdentifier :: Assignment Term -propertyIdentifier = makeTerm <$> symbol PropertyIdentifier <*> (Syntax.Identifier . name <$> source) - -sequenceExpression :: Assignment Term -sequenceExpression = makeTerm <$> symbol Grammar.SequenceExpression <*> children (Expression.SequenceExpression <$> term expression <*> term expressions) - -expressions :: Assignment Term -expressions = annotatedExpression <|> expression <|> sequenceExpression - -annotatedExpression :: Assignment Term -annotatedExpression = mkAnnotated <$> location <*> expression <*> typeAnnotation' - where mkAnnotated loc expr ann = makeTerm loc (TypeScript.Syntax.AnnotatedExpression expr ann) - -parameter :: Assignment Term -parameter = requiredParameter - <|> restParameter - <|> optionalParameter - -accessibilityModifier' :: Assignment ScopeGraph.AccessControl -accessibilityModifier' = (symbol AccessibilityModifier >> children (public <|> protected <|> private)) <|> default' - where public = symbol AnonPublic >> pure ScopeGraph.Public - protected = symbol AnonProtected >> pure ScopeGraph.Protected - private = symbol AnonPrivate >> pure ScopeGraph.Private - default' = pure ScopeGraph.Public - - -destructuringPattern :: Assignment Term -destructuringPattern = object <|> array - -spreadElement :: Assignment Term -spreadElement = symbol SpreadElement *> children (term expression) - -readonly' :: Assignment Term -readonly' = makeTerm <$> symbol Readonly <*> (Type.Readonly <$ rawSource) - -methodDefinition :: Assignment Term -methodDefinition = makeMethod <$> - symbol MethodDefinition - <*> children ((,,,,,) <$> accessibilityModifier' <*> (term readonly' <|> emptyTerm) <*> emptyTerm <*> term propertyName <*> callSignatureParts <*> term statementBlock) - where - makeMethod loc (modifier, readonly, receiver, propertyName', (typeParameters', params, ty'), statements) = makeTerm loc (Declaration.Method [readonly, typeParameters', ty'] receiver propertyName' params statements modifier) - -callSignatureParts :: Assignment (Term, [Term], Term) -callSignatureParts = contextualize' <$> Assignment.manyThrough comment (postContextualize' <$> callSignature' <*> many comment) - where - callSignature' = symbol Grammar.CallSignature *> children ((,,) <$> (term typeParameters <|> emptyTerm) <*> formalParameters <*> (term typeAnnotation' <|> emptyTerm)) - contextualize' (cs, (typeParams, formalParams, annotation)) = case nonEmpty cs of - Just cs -> (makeTerm1 (Syntax.Context cs typeParams), formalParams, annotation) - Nothing -> (typeParams, formalParams, annotation) - postContextualize' (typeParams, formalParams, annotation) cs = case nonEmpty cs of - Just cs -> (typeParams, formalParams, makeTerm1 (Syntax.Context cs annotation)) - Nothing -> (typeParams, formalParams, annotation) - -callSignature :: Assignment Term -callSignature = makeTerm <$> symbol Grammar.CallSignature <*> children (TypeScript.Syntax.CallSignature <$> (fromMaybe <$> emptyTerm <*> optional (term typeParameters)) <*> formalParameters <*> (fromMaybe <$> emptyTerm <*> optional (term typeAnnotation'))) - -constructSignature :: Assignment Term -constructSignature = makeTerm <$> symbol Grammar.ConstructSignature <*> children (TypeScript.Syntax.ConstructSignature <$> (fromMaybe <$> emptyTerm <*> optional (term typeParameters)) <*> formalParameters <*> (fromMaybe <$> emptyTerm <*> optional (term typeAnnotation'))) - -indexSignature :: Assignment Term -indexSignature = makeTerm <$> symbol Grammar.IndexSignature <*> children (TypeScript.Syntax.IndexSignature <$> term identifier <*> predefinedTy <*> term typeAnnotation') - -methodSignature :: Assignment Term -methodSignature = makeMethodSignature <$> symbol Grammar.MethodSignature <*> children ((,,,) <$> accessibilityModifier' <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> callSignatureParts) - where makeMethodSignature loc (accessControl, readonly, propertyName, (typeParams, params, annotation)) = makeTerm loc (Declaration.MethodSignature [readonly, typeParams, annotation] propertyName params accessControl) - -formalParameters :: Assignment [Term] -formalParameters = symbol FormalParameters *> children (contextualize' <$> Assignment.manyThrough comment (postContextualize' <$> (concat <$> many ((\as b -> as <> [b]) <$> manyTerm decorator <*> term parameter)) <*> many comment)) - where - contextualize' (cs, formalParams) = case nonEmpty cs of - Just cs -> toList cs <> formalParams - Nothing -> formalParams - postContextualize' formalParams cs = case nonEmpty cs of - Just cs -> formalParams <> toList cs - Nothing -> formalParams - - -decorator :: Assignment Term -decorator = makeTerm <$> symbol Grammar.Decorator <*> children (TypeScript.Syntax.Decorator <$> term (identifier <|> memberExpression <|> callExpression)) - -typeParameters :: Assignment Term -typeParameters = makeTerm <$> symbol TypeParameters <*> children (Type.TypeParameters <$> manyTerm typeParameter') - -typeAnnotation' :: Assignment Term -typeAnnotation' = makeTerm <$> symbol TypeAnnotation <*> children (TypeScript.Syntax.Annotation <$> term ty) - -typeParameter' :: Assignment Term -typeParameter' = makeTerm <$> symbol Grammar.TypeParameter <*> children (TypeScript.Syntax.TypeParameter <$> term typeIdentifier <*> term (constraint <|> emptyTerm) <*> term (defaultType <|> emptyTerm)) - -defaultType :: Assignment Term -defaultType = makeTerm <$> symbol Grammar.DefaultType <*> children (TypeScript.Syntax.DefaultType <$> term ty) - -constraint :: Assignment Term -constraint = makeTerm <$> symbol Grammar.Constraint <*> children (TypeScript.Syntax.Constraint <$> term ty) - -function :: Assignment Term -function = makeFunction <$> (symbol Grammar.Function <|> symbol Grammar.GeneratorFunction) <*> children ((,,) <$> term (identifier <|> emptyTerm) <*> callSignatureParts <*> term statementBlock) - where makeFunction loc (id, (typeParams, params, annotation), statements) = makeTerm loc (Declaration.Function [typeParams, annotation] id params statements) - --- TODO: FunctionSignatures can, but don't have to be ambient functions. -ambientFunction :: Assignment Term -ambientFunction = makeAmbientFunction <$> symbol Grammar.FunctionSignature <*> children ((,) <$> term identifier <*> callSignatureParts) - where makeAmbientFunction loc (id, (typeParams, params, annotation)) = makeTerm loc (TypeScript.Syntax.AmbientFunction [typeParams, annotation] id params) - -ty :: Assignment Term -ty = primaryType <|> unionType <|> intersectionType <|> functionTy <|> constructorTy - -primaryType :: Assignment Term -primaryType = arrayTy - <|> existentialType - <|> flowMaybeTy - <|> genericType - <|> indexTypeQuery - <|> literalType - <|> lookupType - <|> nestedTypeIdentifier - <|> objectType - <|> parenthesizedTy - <|> predefinedTy - <|> thisType - <|> tupleType - <|> typeIdentifier - <|> typePredicate - <|> typeQuery - -parenthesizedTy :: Assignment Term -parenthesizedTy = makeTerm <$> symbol Grammar.ParenthesizedType <*> children (TypeScript.Syntax.ParenthesizedType <$> term ty) - -predefinedTy :: Assignment Term -predefinedTy = makeTerm <$> symbol Grammar.PredefinedType <*> (TypeScript.Syntax.PredefinedType <$> source) - -typeIdentifier :: Assignment Term -typeIdentifier = makeTerm <$> symbol Grammar.TypeIdentifier <*> (TypeScript.Syntax.TypeIdentifier <$> source) - -nestedIdentifier :: Assignment Term -nestedIdentifier = makeTerm <$> symbol Grammar.NestedIdentifier <*> children (TypeScript.Syntax.NestedIdentifier <$> term (identifier <|> nestedIdentifier) <*> term identifier) - -nestedTypeIdentifier :: Assignment Term -nestedTypeIdentifier = makeTerm <$> symbol Grammar.NestedTypeIdentifier <*> children (TypeScript.Syntax.NestedTypeIdentifier <$> term (identifier <|> nestedIdentifier) <*> term typeIdentifier) - -genericType :: Assignment Term -genericType = makeTerm <$> symbol Grammar.GenericType <*> children (TypeScript.Syntax.GenericType <$> term (typeIdentifier <|> nestedTypeIdentifier) <*> term typeArguments') - -typeArguments' :: Assignment Term -typeArguments' = makeTerm <$> symbol Grammar.TypeArguments <*> children (TypeScript.Syntax.TypeArguments <$> some (term ty)) - -typePredicate :: Assignment Term -typePredicate = makeTerm <$> symbol Grammar.TypePredicate <*> children (TypeScript.Syntax.TypePredicate <$> term identifier <*> term ty) - -objectType :: Assignment Term -objectType = makeTerm <$> symbol Grammar.ObjectType <*> children (TypeScript.Syntax.ObjectType <$> manyTerm (exportStatement <|> propertySignature <|> callSignature <|> constructSignature <|> indexSignature <|> methodSignature)) - -arrayTy :: Assignment Term -arrayTy = makeTerm <$> symbol Grammar.ArrayType <*> children (TypeScript.Syntax.ArrayType <$> term ty) - -lookupType :: Assignment Term -lookupType = makeTerm <$> symbol Grammar.LookupType <*> children (TypeScript.Syntax.LookupType <$> term (typeIdentifier <|> nestedTypeIdentifier) <*> term ty) - -flowMaybeTy :: Assignment Term -flowMaybeTy = makeTerm <$> symbol Grammar.FlowMaybeType <*> children (TypeScript.Syntax.FlowMaybeType <$> term primaryType) - -typeQuery :: Assignment Term -typeQuery = makeTerm <$> symbol Grammar.TypeQuery <*> children (TypeScript.Syntax.TypeQuery <$> term (identifier <|> nestedIdentifier)) - -indexTypeQuery :: Assignment Term -indexTypeQuery = makeTerm <$> symbol Grammar.IndexTypeQuery <*> children (TypeScript.Syntax.IndexTypeQuery <$> term (typeIdentifier <|> nestedTypeIdentifier)) - -thisType :: Assignment Term -thisType = makeTerm <$> symbol Grammar.ThisType <*> (TypeScript.Syntax.ThisType <$> source) - -existentialType :: Assignment Term -existentialType = makeTerm <$> symbol Grammar.ExistentialType <*> (TypeScript.Syntax.ExistentialType <$> source) - -literalType :: Assignment Term -literalType = makeTerm <$> symbol Grammar.LiteralType <*> children (TypeScript.Syntax.LiteralType <$> term (number <|> string <|> true <|> false)) - -unionType :: Assignment Term -unionType = makeTerm <$> symbol UnionType <*> children (TypeScript.Syntax.Union <$> (term ty <|> emptyTerm) <*> term ty) - -intersectionType :: Assignment Term -intersectionType = makeTerm <$> symbol IntersectionType <*> children (TypeScript.Syntax.Intersection <$> term ty <*> term ty) - -functionTy :: Assignment Term -functionTy = makeTerm <$> symbol Grammar.FunctionType <*> children (TypeScript.Syntax.FunctionType <$> (fromMaybe <$> emptyTerm <*> optional (term typeParameters)) <*> formalParameters <*> term ty) - -tupleType :: Assignment Term -tupleType = makeTerm <$> symbol TupleType <*> children (TypeScript.Syntax.Tuple <$> manyTerm ty) - -constructorTy :: Assignment Term -constructorTy = makeTerm <$> symbol ConstructorType <*> children (TypeScript.Syntax.Constructor <$> (fromMaybe <$> emptyTerm <*> optional (term typeParameters)) <*> formalParameters <*> term ty) - -statementTerm :: Assignment Term -statementTerm = makeTerm <$> symbol StatementBlock <*> children (Statement.Statements <$> manyTerm statement) - -statementBlock :: Assignment Term -statementBlock = makeTerm <$> symbol StatementBlock <*> children (Statement.StatementBlock <$> manyTerm statement) - -classBodyStatements :: Assignment Term -classBodyStatements = makeTerm'' <$> symbol ClassBody <*> children (contextualize' <$> Assignment.manyThrough comment (postContextualize' <$> (concat <$> many ((\as b -> as <> [b]) <$> manyTerm decorator <*> term (methodDefinition <|> publicFieldDefinition <|> methodSignature <|> indexSignature <|> abstractMethodSignature))) <*> many comment)) - where - contextualize' (cs, formalParams) = case nonEmpty cs of - Just cs -> toList cs <> formalParams - Nothing -> formalParams - postContextualize' formalParams cs = case nonEmpty cs of - Just cs -> formalParams <> toList cs - Nothing -> formalParams - -publicFieldDefinition :: Assignment Term -publicFieldDefinition = makeField <$> symbol Grammar.PublicFieldDefinition <*> children ((,,,,) <$> accessibilityModifier' <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> (term typeAnnotation' <|> emptyTerm) <*> (term expression <|> emptyTerm)) - where makeField loc (accessControl, readonly, propertyName, annotation, expression) = makeTerm loc (Declaration.PublicFieldDefinition [readonly, annotation] propertyName expression accessControl) - - -statement :: Assignment Term -statement = handleError everything - where - everything = choice [ - exportStatement - , importStatement - , debuggerStatement - , expressionStatement' - , declaration - , statementTerm - , ifStatement - , switchStatement - , forStatement - , forInStatement - , forOfStatement - , whileStatement - , doStatement - , tryStatement - , withStatement - , breakStatement - , continueStatement - , returnStatement - , throwStatement - , hashBang - , emptyStatement - , labeledStatement ] - -forOfStatement :: Assignment Term -forOfStatement = makeTerm <$> symbol ForOfStatement <*> children (TypeScript.Syntax.ForOf <$> term expression <*> term expressions <*> term statement) - -forInStatement :: Assignment Term -forInStatement = makeTerm <$> symbol ForInStatement <*> children (Statement.ForEach <$> term expression <*> term expression <*> term statement) - -doStatement :: Assignment Term -doStatement = makeTerm <$> symbol DoStatement <*> children (flip Statement.DoWhile <$> term statement <*> term parenthesizedExpression) - -continueStatement :: Assignment Term -continueStatement = makeTerm <$> symbol ContinueStatement <*> children (Statement.Continue <$> (statementIdentifier <|> term emptyTerm)) - -breakStatement :: Assignment Term -breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (statementIdentifier <|> term emptyTerm)) - -withStatement :: Assignment Term -withStatement = makeTerm <$> symbol WithStatement <*> children (TypeScript.Syntax.With <$> term parenthesizedExpression <*> term statement) - -returnStatement :: Assignment Term -returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> (term expressions <|> term emptyTerm)) - -throwStatement :: Assignment Term -throwStatement = makeTerm <$> symbol Grammar.ThrowStatement <*> children (Statement.Throw <$> term expressions) - -hashBang :: Assignment Term -hashBang = makeTerm <$> symbol HashBangLine <*> (Comment.HashBang <$> source) - -labeledStatement :: Assignment Term -labeledStatement = makeTerm <$> symbol Grammar.LabeledStatement <*> children (TypeScript.Syntax.LabeledStatement <$> statementIdentifier <*> term statement) - -statementIdentifier :: Assignment Term -statementIdentifier = makeTerm <$> symbol StatementIdentifier <*> (Syntax.Identifier . name <$> source) - -importStatement :: Assignment Term -importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> children ((,) <$> importClause <*> fromClause) - <|> makeTerm' <$> symbol Grammar.ImportStatement <*> children (requireImport <|> sideEffectImport) - where - -- `import foo = require "./foo"` - requireImport = inject <$> (symbol Grammar.ImportRequireClause *> children (TypeScript.Syntax.QualifiedAliasedImport <$> term identifier <*> fromClause)) - -- `import "./foo"` - sideEffectImport = inject <$> (TypeScript.Syntax.SideEffectImport <$> fromClause) - -- `import { bar } from "./foo"` - namedImport = (,) Nothing <$> (symbol Grammar.NamedImports *> children (many importSymbol)) - -- `import defaultMember from "./foo"` - defaultImport = (,) Nothing <$> (pure <$> (makeNameAliasPair <$> rawIdentifier <*> pure Nothing)) - -- `import * as name from "./foo"` - namespaceImport = symbol Grammar.NamespaceImport *> children ((,) . Just <$> term identifier <*> pure []) - - -- Combinations of the above. - importClause = symbol Grammar.ImportClause *> - children ( - (pure <$> namedImport) - <|> (pure <$> namespaceImport) - <|> ((\a b -> [a, b]) <$> defaultImport <*> (namedImport <|> namespaceImport)) - <|> (pure <$> defaultImport)) - - makeImportTerm1 loc from (Just alias, _) = makeTerm loc (TypeScript.Syntax.QualifiedAliasedImport alias from) - makeImportTerm1 loc from (Nothing, symbols) = makeTerm loc (TypeScript.Syntax.Import (uncurry TypeScript.Syntax.Alias <$> symbols) from) - makeImportTerm loc ([x], from) = makeImportTerm1 loc from x - makeImportTerm loc (xs, from) = makeTerm loc $ fmap (makeImportTerm1 loc from) xs - importSymbol = symbol Grammar.ImportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> ((Just <$> rawIdentifier) <|> pure Nothing)) - rawIdentifier = symbol Identifier *> (name <$> source) - makeNameAliasPair from (Just alias) = (from, alias) - makeNameAliasPair from Nothing = (from, from) - - -- TODO: Need to validate that inline comments are still handled with this change in assigning to Path and not a Term. - fromClause = symbol Grammar.String *> (TypeScript.Resolution.importPath <$> source) - -debuggerStatement :: Assignment Term -debuggerStatement = makeTerm <$> symbol Grammar.DebuggerStatement <*> (TypeScript.Syntax.Debugger <$ rawSource) - -expressionStatement' :: Assignment Term -expressionStatement' = symbol ExpressionStatement *> children (term expressions) - -declaration :: Assignment Term -declaration = everything - where - everything = choice [ - exportStatement, - importAlias', - function, - internalModule, - ambientFunction, - abstractClass, - class', - module', - variableDeclaration, - typeAliasDeclaration, - enumDeclaration, - interfaceDeclaration, - ambientDeclaration - ] - -typeAliasDeclaration :: Assignment Term -typeAliasDeclaration = makeTypeAliasDecl <$> symbol Grammar.TypeAliasDeclaration <*> children ((,,) <$> term typeIdentifier <*> (term typeParameters <|> emptyTerm) <*> term ty) - where makeTypeAliasDecl loc (identifier, typeParams, body) = makeTerm loc (Declaration.TypeAlias [typeParams] identifier body) - -enumDeclaration :: Assignment Term -enumDeclaration = makeTerm <$> symbol Grammar.EnumDeclaration <*> children (TypeScript.Syntax.EnumDeclaration <$> term identifier <*> (symbol EnumBody *> children (manyTerm (propertyName <|> enumAssignment)))) - -enumAssignment :: Assignment Term -enumAssignment = makeTerm <$> symbol Grammar.EnumAssignment <*> children (Statement.Assignment [] <$> term propertyName <*> term expression) - -interfaceDeclaration :: Assignment Term -interfaceDeclaration = makeInterfaceDecl <$> symbol Grammar.InterfaceDeclaration <*> children ((,,,) <$> term typeIdentifier <*> (term typeParameters <|> emptyTerm) <*> optional (term extendsClause) <*> term objectType) - where makeInterfaceDecl loc (identifier, typeParams, clause, objectType) = makeTerm loc (Declaration.InterfaceDeclaration [typeParams] identifier (toList clause) objectType) - -ambientDeclaration :: Assignment Term -ambientDeclaration = makeTerm <$> symbol Grammar.AmbientDeclaration <*> children (TypeScript.Syntax.AmbientDeclaration <$> term (choice [propertyIdentifier *> ty, declaration, statementBlock])) - -exportStatement :: Assignment Term -exportStatement = makeTerm <$> symbol Grammar.ExportStatement <*> children (flip TypeScript.Syntax.QualifiedExportFrom <$> exportClause <*> fromClause) - <|> makeTerm <$> symbol Grammar.ExportStatement <*> children (TypeScript.Syntax.QualifiedExport <$> exportClause) - <|> makeTerm <$> symbol Grammar.ExportStatement <*> children (TypeScript.Syntax.DefaultExport <$> contextualize decorator (term (declaration <|> expression <|> identifier <|> importAlias'))) - where - exportClause = symbol Grammar.ExportClause *> children (many exportSymbol) - exportSymbol = symbol Grammar.ExportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> (Just <$> rawIdentifier)) - <|> symbol Grammar.ExportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> pure Nothing) - makeNameAliasPair from (Just alias) = TypeScript.Syntax.Alias from alias - makeNameAliasPair from Nothing = TypeScript.Syntax.Alias from from - rawIdentifier = symbol Identifier *> (name <$> source) - -- TODO: Need to validate that inline comments are still handled with this change in assigning to Path and not a Term. - fromClause = symbol Grammar.String *> (TypeScript.Resolution.importPath <$> source) - -propertySignature :: Assignment Term -propertySignature = makePropertySignature <$> symbol Grammar.PropertySignature <*> children ((,,,) <$> accessibilityModifier' <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> (term typeAnnotation' <|> emptyTerm)) - where makePropertySignature loc (modifier, readonly, propertyName, annotation) = makeTerm loc (TypeScript.Syntax.PropertySignature [readonly, annotation] propertyName modifier) - -propertyName :: Assignment Term -propertyName = term (propertyIdentifier <|> string <|> number <|> computedPropertyName) - -computedPropertyName :: Assignment Term -computedPropertyName = makeTerm <$> symbol Grammar.ComputedPropertyName <*> children (TypeScript.Syntax.ComputedPropertyName <$> term expression) - -assignmentPattern :: Assignment Term -assignmentPattern = makeTerm <$> symbol AssignmentPattern <*> children (Statement.Assignment [] <$> term shorthandPropertyIdentifier <*> term expression) - -shorthandPropertyIdentifier :: Assignment Term -shorthandPropertyIdentifier = makeTerm <$> symbol Grammar.ShorthandPropertyIdentifier <*> (TypeScript.Syntax.ShorthandPropertyIdentifier <$> source) - -requiredParameter :: Assignment Term -requiredParameter = makeRequiredParameter - <$> symbol Grammar.RequiredParameter - <*> children ( (,,,,) - <$> accessibilityModifier' - <*> (term readonly' <|> emptyTerm) - <*> term (identifier <|> destructuringPattern <|> this) - <*> (term typeAnnotation' <|> emptyTerm) - <*> (term expression <|> emptyTerm)) - where - makeRequiredParameter loc (modifier, readonly, identifier, annotation, initializer) = makeTerm loc (TypeScript.Syntax.RequiredParameter [readonly, annotation] identifier initializer modifier) - -restParameter :: Assignment Term -restParameter = makeRestParameter <$> symbol Grammar.RestParameter <*> children ((,) <$> term identifier <*> (term typeAnnotation' <|> emptyTerm)) - where makeRestParameter loc (identifier, annotation) = makeTerm loc (TypeScript.Syntax.RestParameter [annotation] identifier) - -optionalParameter :: Assignment Term -optionalParameter = makeOptionalParam <$> symbol Grammar.OptionalParameter <*> children ((,,,,) <$> accessibilityModifier' <*> (term readonly' <|> emptyTerm) <*> (term identifier <|> destructuringPattern) <*> (term typeAnnotation' <|> emptyTerm) <*> (term expression <|> emptyTerm)) - where makeOptionalParam loc (modifier, readonly, subject, annotation, initializer) = makeTerm loc (TypeScript.Syntax.OptionalParameter [readonly, annotation] (makeTerm loc (Statement.Assignment [] subject initializer)) modifier) - -internalModule :: Assignment Term -internalModule = makeTerm <$> symbol Grammar.InternalModule <*> children (TypeScript.Syntax.InternalModule <$> term (string <|> identifier <|> nestedIdentifier) <*> statements) - -module' :: Assignment Term -module' = makeTerm <$> symbol Module <*> children (TypeScript.Syntax.Module <$> term (string <|> identifier <|> nestedIdentifier) <*> (statements <|> pure [])) - - -statements :: Assignment [Term] -statements = symbol StatementBlock *> children (manyTerm statement) - -arrowFunction :: Assignment Term -arrowFunction = makeArrowFun <$> symbol ArrowFunction <*> children ((,,) <$> emptyTerm <*> (((\a b c -> (a, [b], c)) <$> emptyTerm <*> term identifier <*> emptyTerm) <|> callSignatureParts) <*> term (expression <|> statementBlock)) - where makeArrowFun loc (identifier, (typeParams, params, returnTy), body) = makeTerm loc (Declaration.Function [ typeParams, returnTy ] identifier params body) - -comment :: Assignment Term -comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) - -ifStatement :: Assignment Term -ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> term parenthesizedExpression <*> term statement <*> (term statement <|> emptyTerm)) - -whileStatement :: Assignment Term -whileStatement = makeTerm <$> symbol WhileStatement <*> children (Statement.While <$> term expression <*> term statement) - -forStatement :: Assignment Term -forStatement = makeTerm <$> symbol ForStatement <*> children (Statement.For <$> term (variableDeclaration <|> expressionStatement' <|> emptyStatement) <*> term (expressionStatement' <|> emptyStatement) <*> term (expressions <|> emptyTerm) <*> term statement) - -variableDeclaration :: Assignment Term -variableDeclaration = makeTerm <$> (symbol Grammar.VariableDeclaration <|> symbol Grammar.LexicalDeclaration) <*> children (Declaration.VariableDeclaration <$> manyTerm variableDeclarator) - -variableDeclarator :: Assignment Term -variableDeclarator = - makeTerm <$> symbol VariableDeclarator <*> children (TypeScript.Syntax.JavaScriptRequire <$> identifier <*> requireCall) - <|> makeVarDecl <$> symbol VariableDeclarator <*> children ((,,) <$> term (identifier <|> destructuringPattern) <*> (term typeAnnotation' <|> emptyTerm) <*> (term expression <|> emptyTerm)) - where - makeVarDecl loc (subject, annotations, value) = makeTerm loc (Statement.Assignment [annotations] subject value) - - requireCall = symbol CallExpression *> children (symbol Identifier *> do - s <- source - guard (s == "require") - symbol Arguments *> children (symbol Grammar.String *> (TypeScript.Resolution.importPath <$> source)) - ) - - -parenthesizedExpression :: Assignment Term -parenthesizedExpression = symbol ParenthesizedExpression *> children (term expressions) - -switchStatement :: Assignment Term -switchStatement = makeTerm <$> symbol SwitchStatement <*> children (Statement.Match <$> term parenthesizedExpression <*> term switchBody) - where - switchBody = symbol SwitchBody *> children (makeTerm <$> location <*> manyTerm switchCase) - switchCase = makeTerm <$> (symbol SwitchCase <|> symbol SwitchDefault) <*> children (Statement.Pattern <$> (term expressions <|> emptyTerm) <*> (makeTerm <$> location <*> manyTerm statement)) - -subscriptExpression :: Assignment Term -subscriptExpression = makeTerm <$> symbol SubscriptExpression <*> children (Expression.Subscript <$> term expression <*> (pure <$> term expressions)) - -pair :: Assignment Term -pair = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> term propertyName <*> term expression) - -callExpression :: Assignment Term -callExpression = makeCall <$> (symbol CallExpression <|> symbol CallExpression') <*> children ((,,,) <$> term (expression <|> super <|> function) <*> (typeArguments <|> pure []) <*> (arguments <|> (pure <$> term templateString)) <*> emptyTerm) - where makeCall loc (subject, typeArgs, args, body) = makeTerm loc (Expression.Call typeArgs subject args body) - typeArguments = symbol Grammar.TypeArguments *> children (some (term ty)) - -arguments :: Assignment [Term] -arguments = symbol Arguments *> children (manyTerm (expression <|> spreadElement)) - -tryStatement :: Assignment Term -tryStatement = makeTry <$> symbol TryStatement <*> children ((,,) <$> term statementTerm <*> optional (term catchClause) <*> optional (term finallyClause)) - where - makeTry loc (statementBlock', catch, finally) = makeTerm loc (Statement.Try statementBlock' (catMaybes [catch, finally])) - catchClause = makeTerm <$> symbol CatchClause <*> children (Statement.Catch <$> (identifier <|> emptyTerm) <*> statementTerm) - finallyClause = makeTerm <$> symbol FinallyClause <*> children (Statement.Finally <$> statementTerm) - -binaryExpression :: Assignment Term -binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expression (term expression) - [ (inject .) . Expression.Plus <$ symbol AnonPlus - , (inject .) . Expression.Minus <$ symbol AnonMinus - , (inject .) . Expression.Times <$ symbol AnonStar - , (inject .) . Expression.DividedBy <$ symbol AnonSlash - , (inject .) . Expression.Modulo <$ symbol AnonPercent - , (inject .) . Expression.Member <$ symbol AnonIn - , (inject .) . Expression.And <$ symbol AnonAmpersandAmpersand - , (inject .) . Expression.BAnd <$ symbol AnonAmpersand - , (inject .) . Expression.Or <$ symbol AnonPipePipe - , (inject .) . Expression.BOr <$ symbol AnonPipe - , (inject .) . Expression.BXOr <$ symbol AnonCaret - , (inject .) . Expression.InstanceOf <$ symbol AnonInstanceof - , (inject .) . Expression.Equal <$ symbol AnonEqualEqual - , (inject .) . Expression.StrictEqual <$ symbol AnonEqualEqualEqual - , (inject .) . invert Expression.Equal <$ symbol AnonBangEqual - , (inject .) . invert Expression.StrictEqual <$ symbol AnonBangEqualEqual - , (inject .) . Expression.LShift <$ symbol AnonLAngleLAngle - , (inject .) . Expression.RShift <$ symbol AnonRAngleRAngle - , (inject .) . Expression.UnsignedRShift <$ symbol AnonRAngleRAngleRAngle - , (inject .) . Expression.LessThan <$ symbol AnonLAngle - , (inject .) . Expression.GreaterThan <$ symbol AnonRAngle - , (inject .) . Expression.LessThanEqual <$ symbol AnonLAngleEqual - , (inject .) . Expression.GreaterThanEqual <$ symbol AnonRAngleEqual - ]) - where invert cons a b = Expression.Not (makeTerm1 (cons a b)) - - --- Helpers - --- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present. -manyTerm :: Assignment Term -> Assignment [Term] -manyTerm term = many (contextualize comment term <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)) - -term :: Assignment Term -> Assignment Term -term term = contextualize comment (postContextualize comment term) - -emptyStatement :: Assignment Term -emptyStatement = makeTerm <$> symbol EmptyStatement <*> (Syntax.Empty <$ rawSource <|> pure Syntax.Empty) - --- | Match infix terms separated by any of a list of operators, assigning any comments following each operand. -infixTerm :: Assignment Term - -> Assignment Term - -> [Assignment (Term -> Term -> Sum Syntax Term)] - -> Assignment (Sum Syntax Term) -infixTerm = infixContext comment diff --git a/src/Language/TypeScript/Resolution.hs b/src/Language/TypeScript/Resolution.hs deleted file mode 100644 index 6fd40cfea4..0000000000 --- a/src/Language/TypeScript/Resolution.hs +++ /dev/null @@ -1,128 +0,0 @@ -module Language.TypeScript.Resolution - ( ImportPath (..) - , IsRelative (..) - , importPath - , toName - , resolveWithNodejsStrategy - , resolveModule - , resolveNonRelativePath - , javascriptExtensions - , typescriptExtensions - ) where - -import qualified Data.Map as Map -import System.FilePath.Posix - -import Data.Abstract.BaseError -import Data.Abstract.Evaluatable -import qualified Data.Abstract.Module as M -import Data.Abstract.Package -import Data.Abstract.Path -import Data.ImportPath -import qualified Data.Language as Language - --- Node.js resolution algorithm: https://nodejs.org/api/modules.html#modules_all_together --- --- NB: TypeScript has a couple of different strategies, but the main one (and the --- only one we support) mimics Node.js. -resolveWithNodejsStrategy :: ( Member (Modules address value) sig - , Member (Reader M.ModuleInfo) sig - , Member (Reader PackageInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Member Trace sig - , Carrier sig m - ) - => ImportPath - -> [String] - -> Evaluator term address value m M.ModulePath -resolveWithNodejsStrategy (ImportPath path NonRelative) exts = resolveNonRelativePath path exts -resolveWithNodejsStrategy (ImportPath path _) exts = resolveRelativePath path exts - --- | Resolve a relative TypeScript import to a known 'ModuleName' or fail. --- --- import { b } from "./moduleB" in /root/src/moduleA.ts --- --- /root/src/moduleB.ts --- /root/src/moduleB/package.json (if it specifies a "types" property) --- /root/src/moduleB/index.ts -resolveRelativePath :: ( Member (Modules address value) sig - , Member (Reader M.ModuleInfo) sig - , Member (Reader PackageInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Member Trace sig - , Carrier sig m - ) - => FilePath - -> [String] - -> Evaluator term address value m M.ModulePath -resolveRelativePath relImportPath exts = do - M.ModuleInfo{..} <- currentModule - let relRootDir = takeDirectory modulePath - let path = joinPaths relRootDir relImportPath - trace ("attempting to resolve (relative) require/import " <> show relImportPath) - resolveModule path exts >>= either notFound (\x -> x <$ traceResolve relImportPath path) - where - notFound xs = throwResolutionError $ NotFoundError relImportPath xs Language.TypeScript - --- | Resolve a non-relative TypeScript import to a known 'ModuleName' or fail. --- --- import { b } from "moduleB" in source file /root/src/moduleA.ts --- --- /root/src/node_modules/moduleB.ts --- /root/src/node_modules/moduleB/package.json (if it specifies a "types" property) --- /root/src/node_modules/moduleB/index.ts --- --- /root/node_modules/moduleB.ts, etc --- /node_modules/moduleB.ts, etc -resolveNonRelativePath :: ( Member (Modules address value) sig - , Member (Reader M.ModuleInfo) sig - , Member (Reader PackageInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Member Trace sig - , Carrier sig m - ) - => FilePath - -> [String] - -> Evaluator term address value m M.ModulePath -resolveNonRelativePath name exts = do - M.ModuleInfo{..} <- currentModule - go "." modulePath mempty - where - nodeModulesPath dir = takeDirectory dir "node_modules" name - -- Recursively search in a 'node_modules' directory, stepping up a directory each time. - go root path searched = do - trace ("attempting to resolve (non-relative) require/import " <> show name) - res <- resolveModule (nodeModulesPath path) exts - case res of - Left xs | parentDir <- takeDirectory path , root /= parentDir -> go root parentDir (searched <> xs) - | otherwise -> notFound (searched <> xs) - Right m -> m <$ traceResolve name m - notFound xs = throwResolutionError $ NotFoundError name xs Language.TypeScript - --- | Resolve a module name to a ModulePath. -resolveModule :: ( Member (Modules address value) sig - , Member (Reader PackageInfo) sig - , Member Trace sig - , Carrier sig m - ) - => FilePath -- ^ Module path used as directory to search in - -> [String] -- ^ File extensions to look for - -> Evaluator term address value m (Either [FilePath] M.ModulePath) -resolveModule path' exts = do - let path = makeRelative "." path' - PackageInfo{..} <- currentPackage - let packageDotJSON = Map.lookup (path "package.json") packageResolutions - let searchPaths = ((path <.>) <$> exts) - <> maybe mempty (:[]) packageDotJSON - <> (((path "index") <.>) <$> exts) - trace ("searching in " <> show searchPaths) - maybe (Left searchPaths) Right <$> resolve searchPaths - -typescriptExtensions :: [String] -typescriptExtensions = ["ts", "tsx", "d.ts"] - -javascriptExtensions :: [String] -javascriptExtensions = ["js"] diff --git a/src/Language/TypeScript/Syntax.hs b/src/Language/TypeScript/Syntax.hs deleted file mode 100644 index e18502279a..0000000000 --- a/src/Language/TypeScript/Syntax.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Language.TypeScript.Syntax ( module X ) where - -import Language.TypeScript.Syntax.Import as X -import Language.TypeScript.Syntax.JavaScript as X -import Language.TypeScript.Syntax.TypeScript as X -import Language.TypeScript.Syntax.Types as X diff --git a/src/Language/TypeScript/Syntax/Import.hs b/src/Language/TypeScript/Syntax/Import.hs deleted file mode 100644 index 4ae7ce6a25..0000000000 --- a/src/Language/TypeScript/Syntax/Import.hs +++ /dev/null @@ -1,165 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.TypeScript.Syntax.Import where - -import Prologue - -import Control.Abstract hiding (Import) -import Data.Abstract.Evaluatable as Evaluatable -import qualified Data.Abstract.Name as Name -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.JSON.Fields -import Diffing.Algorithm -import Language.TypeScript.Resolution -import Data.Span (emptySpan) -import qualified Data.Map.Strict as Map -import Data.Aeson (ToJSON) - -data Import a = Import { importSymbols :: ![Alias], importFrom :: ImportPath } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Import - - -- http://www.typescriptlang.org/docs/handbook/module-resolution.html -instance Evaluatable Import where - eval _ _ (Import symbols importPath) = do - modulePath <- resolveWithNodejsStrategy importPath typescriptExtensions - ((moduleScope, moduleFrame), _) <- require modulePath - if Prologue.null symbols then do - insertImportEdge moduleScope - insertFrameLink ScopeGraph.Import (Map.singleton moduleScope moduleFrame) - else do - let scopeEdges = Map.singleton ScopeGraph.Import [ moduleScope ] - scopeAddress <- newScope scopeEdges - let frameLinks = Map.singleton ScopeGraph.Import (Map.singleton moduleScope moduleFrame) - frameAddress <- newFrame scopeAddress frameLinks - - -- Insert import references into the import scope starting from the perspective of the import scope. - withScopeAndFrame moduleFrame $ do - for_ symbols $ \Alias{..} -> - -- TODO: Need an easier way to get the span of an Alias. It's difficult because we no longer have a term. - -- Even if we had one we'd have to evaluate it at the moment. - insertImportReference (Reference aliasName) emptySpan ScopeGraph.Identifier (Declaration aliasValue) scopeAddress - - -- Create edges from the current scope/frame to the import scope/frame. - insertImportEdge scopeAddress - insertFrameLink ScopeGraph.Import (Map.singleton scopeAddress frameAddress) - unit - -data QualifiedAliasedImport a = QualifiedAliasedImport { qualifiedAliasedImportAlias :: !a, qualifiedAliasedImportFrom :: ImportPath } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically QualifiedAliasedImport - -instance Evaluatable QualifiedAliasedImport where - eval _ _ (QualifiedAliasedImport aliasTerm importPath) = do - modulePath <- resolveWithNodejsStrategy importPath typescriptExtensions - ((moduleScope, moduleFrame), _) <- require modulePath - span <- ask @Span - - importScope <- newScope (Map.singleton ScopeGraph.Import [ moduleScope ]) - let scopeMap = Map.singleton moduleScope moduleFrame - aliasFrame <- newFrame importScope (Map.singleton ScopeGraph.Import scopeMap) - name <- declareMaybeName (declaredName aliasTerm) Default Public span ScopeGraph.QualifiedAliasedImport (Just importScope) - aliasSlot <- lookupSlot (Declaration name) - assign aliasSlot =<< object aliasFrame - - unit - -newtype SideEffectImport a = SideEffectImport { sideEffectImportFrom :: ImportPath } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically SideEffectImport - -instance Evaluatable SideEffectImport where - eval _ _ (SideEffectImport importPath) = do - modulePath <- resolveWithNodejsStrategy importPath typescriptExtensions - void $ require modulePath - unit - --- | Qualified Export declarations -newtype QualifiedExport a = QualifiedExport { qualifiedExportSymbols :: [Alias] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically QualifiedExport - -instance Evaluatable QualifiedExport where - eval _ _ (QualifiedExport exportSymbols) = do - -- Create a Lexical edge from the qualifed export's scope to the current scope. - currentScopeAddress <- currentScope - let edges = Map.singleton Lexical [ currentScopeAddress ] - exportScope <- newScope edges - insertExportEdge exportScope -- Create an export edge from the current scope to the export scope - withScope exportScope . - for_ exportSymbols $ \Alias{..} -> do - -- TODO: Replace Alias in QualifedExport with terms and use a real span - reference (Reference aliasName) emptySpan ScopeGraph.Identifier (Declaration aliasValue) - - -- Create an export edge from a new scope to the qualifed export's scope. - unit - -data Alias = Alias { aliasValue :: Name, aliasName :: Name } - deriving (Eq, Generic, Hashable, Ord, Show, ToJSON, NFData) - -toTuple :: Alias -> (Name, Name) -toTuple Alias{..} = (aliasValue, aliasName) - --- | Qualified Export declarations that export from another module. -data QualifiedExportFrom a = QualifiedExportFrom { qualifiedExportFrom :: ImportPath, qualifiedExportFromSymbols :: ![Alias]} - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically QualifiedExportFrom - -instance Evaluatable QualifiedExportFrom where - eval _ _ (QualifiedExportFrom importPath exportSymbols) = do - modulePath <- resolveWithNodejsStrategy importPath typescriptExtensions - - ((moduleScope, moduleFrame), _) <- require modulePath - exportScope <- newScope (Map.singleton ScopeGraph.Import [ moduleScope ]) - exportFrame <- newFrame exportScope (Map.singleton ScopeGraph.Import (Map.singleton moduleScope moduleFrame)) - - withScopeAndFrame moduleFrame . - for_ exportSymbols $ \Alias{..} -> do - -- TODO: Replace Alias with terms in QualifiedExportFrom and use a real span below. - insertImportReference (Reference aliasName) emptySpan ScopeGraph.Identifier (Declaration aliasValue) exportScope - - insertExportEdge exportScope - insertFrameLink ScopeGraph.Export (Map.singleton exportScope exportFrame) - - unit - -newtype DefaultExport a = DefaultExport { defaultExport :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically DefaultExport - -instance Evaluatable DefaultExport where - eval eval _ (DefaultExport term) = do - case declaredName term of - Just _ -> do - exportScope <- newScope mempty - exportFrame <- newFrame exportScope mempty - exportSpan <- ask @Span - withScopeAndFrame exportFrame $ do - valueRef <- eval term - let declaration = Declaration $ Name.name "__default" - declare declaration Default Public exportSpan ScopeGraph.DefaultExport Nothing - defaultSlot <- lookupSlot declaration - assign defaultSlot valueRef - - insertExportEdge exportScope - insertFrameLink ScopeGraph.Export (Map.singleton exportScope exportFrame) - Nothing -> throwEvalError DefaultExportError - unit - -data ImportRequireClause a = ImportRequireClause { importRequireIdentifier :: !a, importRequireSubject :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ImportRequireClause - -instance Evaluatable ImportRequireClause - -newtype ImportClause a = ImportClause { importClauseElements :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ImportClause - -instance Evaluatable ImportClause - -data ImportAlias a = ImportAlias { importAliasSubject :: !a, importAlias :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ImportAlias - -instance Evaluatable ImportAlias diff --git a/src/Language/TypeScript/Syntax/JavaScript.hs b/src/Language/TypeScript/Syntax/JavaScript.hs deleted file mode 100644 index 229463cf0f..0000000000 --- a/src/Language/TypeScript/Syntax/JavaScript.hs +++ /dev/null @@ -1,117 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.TypeScript.Syntax.JavaScript where - -import Prologue - -import Control.Abstract.Heap -import Control.Abstract.ScopeGraph hiding (Import) -import Data.Abstract.Evaluatable -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.JSON.Fields -import qualified Data.Map.Strict as Map -import Diffing.Algorithm -import Language.TypeScript.Resolution - -newtype ImplementsClause a = ImplementsClause { implementsClauseTypes :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ImplementsClause - -instance Evaluatable ImplementsClause - -data OptionalParameter a = OptionalParameter { optionalParameterContext :: ![a], optionalParameterSubject :: !a, optionalParameterAccessControl :: AccessControl } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically OptionalParameter - -instance Evaluatable OptionalParameter - -data RequiredParameter a = RequiredParameter { requiredParameterContext :: [a], requiredParameterSubject :: a, requiredParameterValue :: a, requiredParameterAccessControl :: AccessControl } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically RequiredParameter - -instance Declarations1 RequiredParameter where - liftDeclaredName declaredName RequiredParameter{..} = declaredName requiredParameterSubject - -instance Evaluatable RequiredParameter where - eval eval ref RequiredParameter{..} = do - span <- ask @Span - _ <- declareMaybeName (declaredName requiredParameterSubject) Default Public span ScopeGraph.RequiredParameter Nothing - - lhs <- ref requiredParameterSubject - rhs <- eval requiredParameterValue - - case declaredName requiredParameterValue of - Just rhsName -> do - assocScope <- associatedScope (Declaration rhsName) - case assocScope of - Just assocScope' -> do - objectScope <- newScope (Map.singleton ScopeGraph.Import [ assocScope' ]) - putSlotDeclarationScope lhs (Just objectScope) -- TODO: not sure if this is right - Nothing -> - pure () - Nothing -> - pure () - assign lhs rhs - pure rhs - -data RestParameter a = RestParameter { restParameterContext :: ![a], restParameterSubject :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically RestParameter - -instance Evaluatable RestParameter - - -data JavaScriptRequire a = JavaScriptRequire { javascriptRequireIden :: !a, javascriptRequireFrom :: ImportPath } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically JavaScriptRequire - -instance Evaluatable JavaScriptRequire where - eval _ _ (JavaScriptRequire aliasTerm importPath) = do - modulePath <- resolveWithNodejsStrategy importPath javascriptExtensions - ((moduleScope, moduleFrame), _) <- require modulePath - - case declaredName aliasTerm of - Just alias -> do - span <- ask @Span - importScope <- newScope (Map.singleton ScopeGraph.Import [ moduleScope ]) - declare (Declaration alias) Default Public span ScopeGraph.UnqualifiedImport (Just importScope) - let scopeMap = Map.singleton moduleScope moduleFrame - aliasFrame <- newFrame importScope (Map.singleton ScopeGraph.Import scopeMap) - aliasSlot <- lookupSlot (Declaration alias) - assign aliasSlot =<< object aliasFrame - Nothing -> do - insertImportEdge moduleScope - insertFrameLink ScopeGraph.Import (Map.singleton moduleScope moduleFrame) - unit - -data Debugger a = Debugger - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Debugger - -instance Evaluatable Debugger - -data Super a = Super - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Super - -instance Evaluatable Super - -data Undefined a = Undefined - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Undefined - -instance Evaluatable Undefined - -data With a = With { withExpression :: !a, withBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically With - -instance Evaluatable With - --- | A sequence expression such as Javascript or C's comma operator. -data AnnotatedExpression a = AnnotatedExpression { expression :: !a, typeAnnotation :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, NFData1) - deriving (Eq1, Show1, Ord1) via Generically AnnotatedExpression - -instance Evaluatable AnnotatedExpression where - eval eval _ (AnnotatedExpression a b) = eval b >> eval a diff --git a/src/Language/TypeScript/Syntax/TypeScript.hs b/src/Language/TypeScript/Syntax/TypeScript.hs deleted file mode 100644 index 951beb39fa..0000000000 --- a/src/Language/TypeScript/Syntax/TypeScript.hs +++ /dev/null @@ -1,295 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields, TupleSections #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.TypeScript.Syntax.TypeScript where - -import Prologue - -import Control.Abstract hiding (Import) -import Data.Abstract.Evaluatable as Evaluatable -import Data.Abstract.ScopeGraph (AccessControl (..)) -import Data.JSON.Fields -import qualified Data.Map.Strict as Map -import Data.Semigroup.App -import Data.Semigroup.Foldable -import qualified Data.Text as T -import Diffing.Algorithm -import qualified Data.Abstract.ScopeGraph as ScopeGraph - --- | ShorthandPropertyIdentifier used in object patterns such as var baz = { foo } to mean var baz = { foo: foo } -newtype ShorthandPropertyIdentifier a = ShorthandPropertyIdentifier { contents :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ShorthandPropertyIdentifier - -instance Evaluatable ShorthandPropertyIdentifier - -data Union a = Union { unionLeft :: !a, unionRight :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Union - -instance Evaluatable Language.TypeScript.Syntax.TypeScript.Union - -data Intersection a = Intersection { intersectionLeft :: !a, intersectionRight :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Intersection - -instance Evaluatable Intersection - -data AmbientFunction a = AmbientFunction { ambientFunctionContext :: ![a], ambientFunctionIdentifier :: !a, ambientFunctionParameters :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically AmbientFunction - -instance Evaluatable AmbientFunction - -newtype Tuple a = Tuple { tupleElements :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Tuple - --- This is a tuple type, not a tuple value, so we can't lean on the shared Tuple value -instance Evaluatable Tuple - -data Constructor a = Constructor { constructorTypeParameters :: !a, constructorFormalParameters :: ![a], constructorType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Constructor - -instance Evaluatable Language.TypeScript.Syntax.TypeScript.Constructor - - -newtype Annotation a = Annotation { annotationType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Annotation - -instance Evaluatable Annotation - -newtype Decorator a = Decorator { decoratorTerm :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Decorator - -instance Evaluatable Decorator - -newtype ComputedPropertyName a = ComputedPropertyName { propertyName :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ComputedPropertyName - -instance Evaluatable ComputedPropertyName - -newtype Constraint a = Constraint { constraintType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Constraint - -instance Evaluatable Constraint - -data NestedIdentifier a = NestedIdentifier { left :: !a, right :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically NestedIdentifier - -instance Evaluatable NestedIdentifier - -newtype AmbientDeclaration a = AmbientDeclaration { ambientDeclarationBody :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically AmbientDeclaration - -instance Evaluatable AmbientDeclaration where - eval eval _ (AmbientDeclaration body) = eval body - -data EnumDeclaration a = EnumDeclaration { enumDeclarationIdentifier :: !a, enumDeclarationBody :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically EnumDeclaration - -instance Evaluatable EnumDeclaration - -instance Declarations a => Declarations (EnumDeclaration a) where - declaredName EnumDeclaration{..} = declaredName enumDeclarationIdentifier - -newtype ExtendsClause a = ExtendsClause { extendsClauses :: [a] } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ExtendsClause - -instance Declarations1 ExtendsClause where - liftDeclaredName _ (ExtendsClause []) = Nothing - liftDeclaredName declaredName (ExtendsClause (x : _)) = declaredName x - --- TODO: ExtendsClause shouldn't evaluate to an address in the heap? -instance Evaluatable ExtendsClause where - eval eval _ ExtendsClause{..} = do - -- Evaluate subterms - traverse_ eval extendsClauses - unit - -data PropertySignature a = PropertySignature { modifiers :: [a], propertySignaturePropertyName :: a, propertySignatureAccessControl :: AccessControl } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically PropertySignature - -instance Evaluatable PropertySignature - -data CallSignature a = CallSignature { callSignatureTypeParameters :: !a, callSignatureParameters :: ![a], callSignatureType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically CallSignature - -instance Evaluatable CallSignature - --- | Todo: Move type params and type to context -data ConstructSignature a = ConstructSignature { constructSignatureTypeParameters :: !a, constructSignatureParameters :: ![a], constructSignatureType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ConstructSignature - -instance Evaluatable ConstructSignature - -data IndexSignature a = IndexSignature { subject :: a, subjectType :: a, typeAnnotation :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically IndexSignature - -instance Evaluatable IndexSignature - -data AbstractMethodSignature a = AbstractMethodSignature { abstractMethodSignatureContext :: ![a], abstractMethodSignatureName :: a, abstractMethodSignatureParameters :: [a], abstractMethodAccessControl :: AccessControl } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically AbstractMethodSignature - -instance Evaluatable AbstractMethodSignature - -data ForOf a = ForOf { forOfBinding :: !a, forOfSubject :: !a, forOfBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ForOf - -instance Evaluatable ForOf - -data LabeledStatement a = LabeledStatement { labeledStatementIdentifier :: !a, labeledStatementSubject :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically LabeledStatement - -instance Evaluatable LabeledStatement - -newtype Update a = Update { updateSubject :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Update - -instance Evaluatable Update - -data Module a = Module { moduleIdentifier :: !a, moduleStatements :: ![a] } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically Module - -declareModule :: ( AbstractValue term address value m - , Carrier sig m - , Declarations term - , Member (Allocator address) sig - , Member (Deref value) sig - , Member (Object address value) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (EvalError term address value))) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member Fresh sig - , Member (Reader ModuleInfo) sig - , Member (Resumable (BaseError (AddressError address value))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Unit value) sig - , Ord address - ) - => (term -> Evaluator term address value m value) - -> term - -> [term] - -> Evaluator term address value m value -declareModule eval identifier statements = do - (name, relation) <- case declaredName identifier of - Just name -> pure (name, Default) - _ -> gensym >>= \name -> pure (name, Gensym) - span <- ask @Span - currentScope' <- currentScope - - let declaration = Declaration name - moduleBody = maybe unit (runApp . foldMap1 (App . eval)) (nonEmpty statements) - maybeSlot <- maybeLookupDeclaration declaration - - case maybeSlot of - Just slot -> do - moduleVal <- deref slot - maybeFrame <- scopedEnvironment moduleVal - case maybeFrame of - Just moduleFrame -> do - withScopeAndFrame moduleFrame moduleBody - Nothing -> throwEvalError (DerefError moduleVal) - Nothing -> do - let edges = Map.singleton Lexical [ currentScope' ] - childScope <- newScope edges - declare (Declaration name) relation Public span ScopeGraph.Module (Just childScope) - - currentFrame' <- currentFrame - let frameEdges = Map.singleton Lexical (Map.singleton currentScope' currentFrame') - childFrame <- newFrame childScope frameEdges - - withScopeAndFrame childFrame (void moduleBody) - - moduleSlot <- lookupSlot (Declaration name) - assign moduleSlot =<< namespace name childFrame - - unit - -instance Evaluatable Module where - eval eval _ Module{..} = declareModule eval moduleIdentifier moduleStatements - -instance Declarations1 Module where - liftDeclaredName declaredName = declaredName . moduleIdentifier - -data InternalModule a = InternalModule { internalModuleIdentifier :: !a, internalModuleStatements :: ![a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically InternalModule - -instance Evaluatable InternalModule where - eval eval _ InternalModule{..} = - declareModule eval internalModuleIdentifier internalModuleStatements - -instance Declarations a => Declarations (InternalModule a) where - declaredName InternalModule{..} = declaredName internalModuleIdentifier - -data ClassHeritage a = ClassHeritage { classHeritageExtendsClause :: !a, implementsClause :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ClassHeritage - -instance Evaluatable ClassHeritage - -data AbstractClass a = AbstractClass { abstractClassIdentifier :: !a, abstractClassTypeParameters :: !a, classHeritage :: ![a], classBody :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically AbstractClass - -instance Declarations a => Declarations (AbstractClass a) where - declaredName AbstractClass{..} = declaredName abstractClassIdentifier - -instance Evaluatable AbstractClass where - eval eval _ AbstractClass{..} = do - span <- ask @Span - currentScope' <- currentScope - - superScopes <- for classHeritage $ \superclass -> do - name <- maybeM (throwNoNameError superclass) (declaredName superclass) - scope <- associatedScope (Declaration name) - slot <- lookupSlot (Declaration name) - superclassFrame <- scopedEnvironment =<< deref slot - pure $ case (scope, superclassFrame) of - (Just scope, Just frame) -> Just (scope, frame) - _ -> Nothing - - let superclassEdges = (Superclass, ) . pure . fst <$> catMaybes superScopes - current = (Lexical, ) <$> pure (pure currentScope') - edges = Map.fromList (superclassEdges <> current) - classScope <- newScope edges - name <- declareMaybeName (declaredName abstractClassIdentifier) Default Public span ScopeGraph.AbstractClass (Just classScope) - - let frameEdges = Map.singleton Superclass (Map.fromList (catMaybes superScopes)) - childFrame <- newFrame classScope frameEdges - - withScopeAndFrame childFrame $ do - void $ eval classBody - - classSlot <- lookupSlot (Declaration name) - assign classSlot =<< klass (Declaration name) childFrame - - unit - -data MetaProperty a = MetaProperty - deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1, NFData1) - deriving (Eq1, Show1, Ord1) via Generically MetaProperty - -instance Evaluatable MetaProperty diff --git a/src/Language/TypeScript/Syntax/Types.hs b/src/Language/TypeScript/Syntax/Types.hs deleted file mode 100644 index 93f2440c8a..0000000000 --- a/src/Language/TypeScript/Syntax/Types.hs +++ /dev/null @@ -1,143 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingVia, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-missing-export-lists #-} -module Language.TypeScript.Syntax.Types where - -import Prologue - -import Control.Abstract hiding (Import) -import Data.Abstract.Evaluatable as Evaluatable -import Data.JSON.Fields -import qualified Data.Text as T -import Diffing.Algorithm -import qualified Data.Abstract.ScopeGraph as ScopeGraph - --- | Lookup type for a type-level key in a typescript map. -data LookupType a = LookupType { lookupTypeIdentifier :: a, lookupTypeKey :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically LookupType - -instance Evaluatable LookupType - -data FunctionType a = FunctionType { functionTypeParameters :: !a, functionFormalParameters :: ![a], functionType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically FunctionType - -instance Evaluatable FunctionType - -data TypeParameter a = TypeParameter { typeParameter :: !a, typeParameterConstraint :: !a, typeParameterDefaultType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeParameter - -instance Evaluatable TypeParameter - -data TypeAssertion a = TypeAssertion { typeAssertionParameters :: !a, typeAssertionExpression :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeAssertion - -instance Evaluatable TypeAssertion - -newtype DefaultType a = DefaultType { defaultType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically DefaultType - -instance Evaluatable DefaultType - -newtype ParenthesizedType a = ParenthesizedType { parenthesizedType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ParenthesizedType - -instance Evaluatable ParenthesizedType - -newtype PredefinedType a = PredefinedType { predefinedType :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically PredefinedType - --- TODO: Implement Eval instance for PredefinedType -instance Evaluatable PredefinedType - -newtype TypeIdentifier a = TypeIdentifier { contents :: T.Text } - deriving (Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeIdentifier - -instance Declarations1 TypeIdentifier where - liftDeclaredName _ (TypeIdentifier identifier) = Just (Evaluatable.name identifier) - --- TODO: TypeIdentifier shouldn't evaluate to an address in the heap? -instance Evaluatable TypeIdentifier where - eval _ _ TypeIdentifier{..} = do - -- Add a reference to the type identifier in the current scope. - span <- ask @Span - reference (Reference (Evaluatable.name contents)) span ScopeGraph.TypeIdentifier (Declaration (Evaluatable.name contents)) - unit - -data NestedTypeIdentifier a = NestedTypeIdentifier { left :: !a, right :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically NestedTypeIdentifier - -instance Evaluatable NestedTypeIdentifier - -data GenericType a = GenericType { genericTypeIdentifier :: !a, genericTypeArguments :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically GenericType - -instance Evaluatable GenericType - -data TypePredicate a = TypePredicate { typePredicateIdentifier :: !a, typePredicateType :: !a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypePredicate - -instance Evaluatable TypePredicate - -newtype ObjectType a = ObjectType { objectTypeElements :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ObjectType - -instance Evaluatable ObjectType - -newtype ArrayType a = ArrayType { arrayType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ArrayType - -instance Evaluatable ArrayType - -newtype FlowMaybeType a = FlowMaybeType { flowMaybeType :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically FlowMaybeType - -instance Evaluatable FlowMaybeType - -newtype TypeQuery a = TypeQuery { typeQuerySubject :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeQuery - -instance Evaluatable TypeQuery - -newtype IndexTypeQuery a = IndexTypeQuery { indexTypeQuerySubject :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically IndexTypeQuery - -instance Evaluatable IndexTypeQuery - -newtype TypeArguments a = TypeArguments { typeArguments :: [a] } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically TypeArguments - -instance Evaluatable TypeArguments - -newtype ThisType a = ThisType { contents :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ThisType - -instance Evaluatable ThisType - -newtype ExistentialType a = ExistentialType { contents :: T.Text } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically ExistentialType - -instance Evaluatable ExistentialType - -newtype LiteralType a = LiteralType { literalTypeSubject :: a } - deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, NFData1, Ord, Show, ToJSONFields1, Traversable) - deriving (Eq1, Show1, Ord1) via Generically LiteralType - -instance Evaluatable LiteralType diff --git a/src/Numeric/Exts.hs b/src/Numeric/Exts.hs deleted file mode 100644 index 990710c97c..0000000000 --- a/src/Numeric/Exts.hs +++ /dev/null @@ -1,82 +0,0 @@ -module Numeric.Exts - ( parseInteger - , hex - , oct - , bin - , attempt - , lengths - ) where - -import Control.Applicative -import Control.Monad hiding (fail) -import Data.Attoparsec.Text -import Data.Char (isDigit, isOctDigit, isHexDigit) -import Data.Text -import Numeric -import Prelude hiding (fail, filter) -import Prologue -import Text.Read (readMaybe) - --- The ending stanza. Note the explicit endOfInput call to ensure we haven't left any dangling input. -lengths :: Parser () -lengths = skipWhile (inClass "iIjJlL") *> endOfInput - -stripUnder :: Text -> Text -stripUnder = filter (/= '_') - --- Parse a hex value, leaning on the parser provided by Attoparsec. -hex :: Num a => Parser a -hex = do - void (char '0') - skip (inClass "xX") - let isHex c = isHexDigit c || (c == '_') - contents <- stripUnder <$> takeWhile1 isHex - let go = fromIntegral <$> hexadecimal @Integer <* lengths - either fail pure (parseOnly go contents) - --- We lean on Haskell's octal integer support, parsing --- the given string as an integer then coercing it to a Scientific. -oct :: Num a => Parser a -oct = do - void (char '0') - skipWhile (inClass "Oo") - let isOct c = isOctDigit c || c == '_' - digs <- stripUnder <$> (takeWhile1 isOct <* lengths) - fromIntegral <$> attempt @Integer (unpack ("0o" <> digs)) <* lengths - --- The case for binary literals is somewhat baroque. Despite having binary literal support, Integer's --- Read instance does not handle binary literals. So we have to shell out to Numeric.readInt, which --- is a very strange API, but works for our use case. The use of 'error' looks partial, but if Attoparsec --- and readInt do their jobs, it should never happen. -bin :: (Show a, Num a) => Parser a -bin = do - void (char '0') - skip (inClass "bB") - let isBin = inClass "01_" - digs <- unpack . stripUnder <$> (takeWhile1 isBin <* lengths) - let c2b c = case c of - '0' -> 0 - '1' -> 1 - x -> error ("Invariant violated: both Attoparsec and readInt let a bad digit through: " <> [x]) - let res = readInt 2 isBin c2b digs - case res of - [] -> fail ("No parse of binary literal: " <> digs) - [(x, "")] -> x <$ lengths - others -> fail ("Too many parses of binary literal: " <> show others) - --- Wrapper around readMaybe. -attempt :: Read a => String -> Parser a -attempt str = maybeM (fail ("No parse: " <> str)) (readMaybe str) - -parseInteger :: Text -> Either String Integer -parseInteger = parseOnly integerParser - --- | A simplified version of parseScientific. -integerParser :: Parser Integer -integerParser = signed (choice [hex, oct, bin, dec]) where - dec = do - let notUnder = filter (/= '_') - let decOrUnder c = isDigit c || (c == '_') - contents <- notUnder <$> takeWhile1 decOrUnder - void lengths - attempt (unpack contents) diff --git a/src/Parsing/CMark.hs b/src/Parsing/CMark.hs deleted file mode 100644 index 9587f76c80..0000000000 --- a/src/Parsing/CMark.hs +++ /dev/null @@ -1,93 +0,0 @@ -{-# LANGUAGE DataKinds, TypeOperators #-} -module Parsing.CMark -( Grammar(..) -, cmarkParser -, toGrammar -) where - -import CMarkGFM -import qualified Data.AST as A -import Data.Ix -import Data.Range -import Data.Location -import Data.Span -import Data.Source -import Data.Term -import TreeSitter.Language (Symbol(..), SymbolType(..)) - -data Grammar - = Document - | ThematicBreak - | Paragraph - | BlockQuote - | HTMLBlock - | CustomBlock - | CodeBlock - | Heading - | List - | Item - | Text - | SoftBreak - | LineBreak - | HTMLInline - | CustomInline - | Code - | Emphasis - | Strong - | Link - | Image - | Strikethrough - | Table - | TableRow - | TableCell - deriving (Bounded, Enum, Eq, Ix, Ord, Show) - -exts :: [CMarkExtension] -exts = [ - extStrikethrough - , extTable - , extAutolink - , extTagfilter - ] - -cmarkParser :: Source -> A.AST (TermF [] NodeType) Grammar -cmarkParser source = toTerm (totalRange source) (totalSpan source) $ commonmarkToNode [ optSourcePos ] exts (toText source) - where toTerm :: Range -> Span -> Node -> A.AST (TermF [] NodeType) Grammar - toTerm within withinSpan (Node position t children) = - let range = maybe within (spanToRangeInLineRanges lineRanges . toSpan) position - span = maybe withinSpan toSpan position - in termIn (A.Node (toGrammar t) (Location range span)) (In t (toTerm range span <$> children)) - - toSpan PosInfo{..} = Span (Pos startLine startColumn) (Pos (max startLine endLine) (succ (if endLine <= startLine then max startColumn endColumn else endColumn))) - - lineRanges = sourceLineRangesByLineNumber source - -toGrammar :: NodeType -> Grammar -toGrammar DOCUMENT{} = Document -toGrammar THEMATIC_BREAK{} = ThematicBreak -toGrammar PARAGRAPH{} = Paragraph -toGrammar BLOCK_QUOTE{} = BlockQuote -toGrammar HTML_BLOCK{} = HTMLBlock -toGrammar CUSTOM_BLOCK{} = CustomBlock -toGrammar CODE_BLOCK{} = CodeBlock -toGrammar HEADING{} = Heading -toGrammar LIST{} = List -toGrammar ITEM{} = Item -toGrammar TEXT{} = Text -toGrammar SOFTBREAK{} = SoftBreak -toGrammar LINEBREAK{} = LineBreak -toGrammar HTML_INLINE{} = HTMLInline -toGrammar CUSTOM_INLINE{} = CustomInline -toGrammar CODE{} = Code -toGrammar EMPH{} = Emphasis -toGrammar STRONG{} = Strong -toGrammar LINK{} = Link -toGrammar IMAGE{} = Image -toGrammar STRIKETHROUGH{} = Strikethrough -toGrammar TABLE{} = Table -toGrammar TABLE_ROW{} = TableRow -toGrammar TABLE_CELL{} = TableCell - - -instance Symbol Grammar where - symbolType _ = Regular diff --git a/src/Parsing/Parser.hs b/src/Parsing/Parser.hs deleted file mode 100644 index 5728befd2f..0000000000 --- a/src/Parsing/Parser.hs +++ /dev/null @@ -1,199 +0,0 @@ -{-# LANGUAGE AllowAmbiguousTypes, ConstraintKinds, GADTs, RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators #-} -module Parsing.Parser -( Parser(..) -, SomeTerm(..) -, withSomeTerm -, SomeAnalysisParser(..) -, SomeASTParser(..) -, someASTParser -, someAnalysisParser -, ApplyAll -, ApplyAll' --- Γ€ la carte parsers -, goParser -, goASTParser -, javaParser -, javaASTParser -, jsonParser -, jsonASTParser -, markdownParser -, pythonParser -, pythonASTParser -, rubyParser -, tsxParser -, typescriptParser -, typescriptASTParser -, phpParser -, haskellParser -) where - -import Assigning.Assignment -import qualified Assigning.Assignment.Deterministic as Deterministic -import qualified CMarkGFM -import Data.Abstract.Evaluatable (HasPrelude) -import Data.AST -import Data.Graph.ControlFlowVertex (VertexDeclaration') -import Data.Kind -import Data.Language -import Data.Sum -import qualified Data.Syntax as Syntax -import Data.Term -import Foreign.Ptr -import qualified Language.Go.Assignment as Go -import qualified Language.Haskell.Assignment as Haskell -import qualified Language.Java.Assignment as Java -import qualified Language.JSON.Assignment as JSON -import qualified Language.Markdown.Assignment as Markdown -import qualified Language.PHP.Assignment as PHP -import qualified Language.Python.Assignment as Python -import qualified Language.Ruby.Assignment as Ruby -import qualified Language.TSX.Assignment as TSX -import qualified Language.TypeScript.Assignment as TypeScript -import Prologue -import TreeSitter.Go -import TreeSitter.Haskell -import TreeSitter.Java -import TreeSitter.JSON -import qualified TreeSitter.Language as TS (Language, Symbol) -import TreeSitter.PHP -import TreeSitter.Python -import TreeSitter.Ruby -import TreeSitter.TSX -import TreeSitter.TypeScript - - -type family ApplyAll' (typeclasses :: [(* -> *) -> Constraint]) (fs :: [* -> *]) :: Constraint where - ApplyAll' (typeclass ': typeclasses) fs = (Apply typeclass fs, ApplyAll' typeclasses fs) - ApplyAll' '[] fs = () - --- | A parser, suitable for program analysis, for some specific language, producing 'Term's whose syntax satisfies a list of typeclass constraints. -data SomeAnalysisParser typeclasses ann where - SomeAnalysisParser :: ( ApplyAll' typeclasses fs - , Apply (VertexDeclaration' (Sum fs)) fs - , Element Syntax.Identifier fs - , HasPrelude lang - ) - => Parser (Term (Sum fs) ann) - -> Proxy lang - -> SomeAnalysisParser typeclasses ann - --- | A parser for some specific language, producing 'Term's whose syntax satisfies a list of typeclass constraints. -someAnalysisParser :: ( ApplyAll' typeclasses Go.Syntax - , ApplyAll' typeclasses Java.Syntax - , ApplyAll' typeclasses PHP.Syntax - , ApplyAll' typeclasses Python.Syntax - , ApplyAll' typeclasses Ruby.Syntax - , ApplyAll' typeclasses TypeScript.Syntax - , ApplyAll' typeclasses Haskell.Syntax - ) - => proxy typeclasses -- ^ A proxy for the list of typeclasses required, e.g. @(Proxy :: Proxy '[Show1])@. - -> Language -- ^ The 'Language' to select. - -> SomeAnalysisParser typeclasses Location -- ^ A 'SomeAnalysisParser' abstracting the syntax type to be produced. -someAnalysisParser _ Go = SomeAnalysisParser goParser (Proxy :: Proxy 'Go) -someAnalysisParser _ Haskell = SomeAnalysisParser haskellParser (Proxy :: Proxy 'Haskell) -someAnalysisParser _ Java = SomeAnalysisParser javaParser (Proxy :: Proxy 'Java) -someAnalysisParser _ JavaScript = SomeAnalysisParser typescriptParser (Proxy :: Proxy 'JavaScript) -someAnalysisParser _ PHP = SomeAnalysisParser phpParser (Proxy :: Proxy 'PHP) -someAnalysisParser _ Python = SomeAnalysisParser pythonParser (Proxy :: Proxy 'Python) -someAnalysisParser _ Ruby = SomeAnalysisParser rubyParser (Proxy :: Proxy 'Ruby) -someAnalysisParser _ TypeScript = SomeAnalysisParser typescriptParser (Proxy :: Proxy 'TypeScript) -someAnalysisParser _ TSX = SomeAnalysisParser typescriptParser (Proxy :: Proxy 'TSX) -someAnalysisParser _ l = error $ "Analysis not supported for: " <> show l - - --- | A parser from 'Source' onto some term type. -data Parser term where - -- | A parser producing 'AST' using a 'TS.Language'. - ASTParser :: (Bounded grammar, Enum grammar, Show grammar) => Ptr TS.Language -> Parser (AST [] grammar) - -- | A parser producing an Γ  la carte term given an 'AST'-producing parser and an 'Assignment' onto 'Term's in some syntax type. - AssignmentParser :: (Enum grammar, Ix grammar, Show grammar, TS.Symbol grammar, Syntax.Error :< fs, Eq1 ast, Apply Foldable fs, Apply Functor fs, Foldable ast, Functor ast) - => Parser (Term ast (Node grammar)) -- ^ A parser producing AST. - -> Assignment ast grammar (Term (Sum fs) Location) -- ^ An assignment from AST onto 'Term's. - -> Parser (Term (Sum fs) Location) -- ^ A parser producing 'Term's. - DeterministicParser :: (Enum grammar, Ord grammar, Show grammar, Element Syntax.Error syntaxes, Apply Foldable syntaxes, Apply Functor syntaxes) - => Parser (AST [] grammar) - -> Deterministic.Assignment grammar (Term (Sum syntaxes) Location) - -> Parser (Term (Sum syntaxes) Location) - -- | A parser for 'Markdown' using cmark. - MarkdownParser :: Parser (Term (TermF [] CMarkGFM.NodeType) (Node Markdown.Grammar)) - -- | An abstraction over parsers when we don’t know the details of the term type. - SomeParser :: ApplyAll typeclasses syntax => Parser (Term syntax ann) -> Parser (SomeTerm typeclasses ann) - --- | Apply all of a list of typeclasses to all of a list of functors using 'Apply'. Used by 'someParser' to constrain all of the language-specific syntax types to the typeclasses in question. -type family ApplyAll (typeclasses :: [(* -> *) -> Constraint]) (syntax :: * -> *) :: Constraint where - ApplyAll (typeclass ': typeclasses) syntax = (typeclass syntax, ApplyAll typeclasses syntax) - ApplyAll '[] syntax = () - - -goParser :: Parser Go.Term -goParser = AssignmentParser (ASTParser tree_sitter_go) Go.assignment - -goASTParser :: Parser (AST [] Go.Grammar) -goASTParser = ASTParser tree_sitter_go - -rubyParser :: Parser Ruby.Term -rubyParser = AssignmentParser (ASTParser tree_sitter_ruby) Ruby.assignment - -phpParser :: Parser PHP.Term -phpParser = AssignmentParser (ASTParser tree_sitter_php) PHP.assignment - -pythonParser :: Parser Python.Term -pythonParser = AssignmentParser (ASTParser tree_sitter_python) Python.assignment - -pythonASTParser :: Parser (AST [] Python.Grammar) -pythonASTParser = ASTParser tree_sitter_python - -javaParser :: Parser Java.Term -javaParser = AssignmentParser javaASTParser Java.assignment - -javaASTParser :: Parser (AST [] Java.Grammar) -javaASTParser = ASTParser tree_sitter_java - -jsonParser :: Parser JSON.Term -jsonParser = DeterministicParser jsonASTParser JSON.assignment - -jsonASTParser :: Parser (AST [] JSON.Grammar) -jsonASTParser = ASTParser tree_sitter_json - -typescriptParser :: Parser TypeScript.Term -typescriptParser = AssignmentParser (ASTParser tree_sitter_typescript) TypeScript.assignment - -tsxParser :: Parser TSX.Term -tsxParser = AssignmentParser (ASTParser tree_sitter_tsx) TSX.assignment - -typescriptASTParser :: Parser (AST [] TypeScript.Grammar) -typescriptASTParser = ASTParser tree_sitter_typescript - -haskellParser :: Parser Haskell.Term -haskellParser = AssignmentParser (ASTParser tree_sitter_haskell) Haskell.assignment - -markdownParser :: Parser Markdown.Term -markdownParser = AssignmentParser MarkdownParser Markdown.assignment - - -data SomeTerm typeclasses ann where - SomeTerm :: ApplyAll typeclasses syntax => Term syntax ann -> SomeTerm typeclasses ann - -withSomeTerm :: (forall syntax . ApplyAll typeclasses syntax => Term syntax ann -> a) -> SomeTerm typeclasses ann -> a -withSomeTerm with (SomeTerm term) = with term - --- | A parser for producing specialized (tree-sitter) ASTs. -data SomeASTParser where - SomeASTParser :: (Bounded grammar, Enum grammar, Show grammar) - => Parser (AST [] grammar) - -> SomeASTParser - -someASTParser :: Language -> Maybe SomeASTParser -someASTParser Go = Just (SomeASTParser (ASTParser tree_sitter_go :: Parser (AST [] Go.Grammar))) -someASTParser Haskell = Just (SomeASTParser (ASTParser tree_sitter_haskell :: Parser (AST [] Haskell.Grammar))) -someASTParser Java = Just (SomeASTParser (ASTParser tree_sitter_java :: Parser (AST [] Java.Grammar))) -someASTParser JavaScript = Just (SomeASTParser (ASTParser tree_sitter_typescript :: Parser (AST [] TypeScript.Grammar))) -someASTParser JSON = Just (SomeASTParser (ASTParser tree_sitter_json :: Parser (AST [] JSON.Grammar))) -someASTParser JSX = Just (SomeASTParser (ASTParser tree_sitter_typescript :: Parser (AST [] TypeScript.Grammar))) -someASTParser Python = Just (SomeASTParser (ASTParser tree_sitter_python :: Parser (AST [] Python.Grammar))) -someASTParser Ruby = Just (SomeASTParser (ASTParser tree_sitter_ruby :: Parser (AST [] Ruby.Grammar))) -someASTParser TypeScript = Just (SomeASTParser (ASTParser tree_sitter_typescript :: Parser (AST [] TypeScript.Grammar))) -someASTParser TSX = Just (SomeASTParser (ASTParser tree_sitter_tsx :: Parser (AST [] TSX.Grammar))) -someASTParser PHP = Just (SomeASTParser (ASTParser tree_sitter_php :: Parser (AST [] PHP.Grammar))) -someASTParser Markdown = Nothing -someASTParser Unknown = Nothing diff --git a/src/Parsing/TreeSitter.hs b/src/Parsing/TreeSitter.hs deleted file mode 100644 index e1c53dd50c..0000000000 --- a/src/Parsing/TreeSitter.hs +++ /dev/null @@ -1,99 +0,0 @@ -{-# LANGUAGE DataKinds, GADTs, ScopedTypeVariables, TypeOperators #-} -module Parsing.TreeSitter -( Duration(..) -, parseToAST -) where - -import Prologue hiding (bracket) - -import qualified Control.Exception as Exc (bracket) -import Control.Effect -import Control.Effect.Resource -import Control.Effect.Trace -import Data.ByteString.Unsafe (unsafeUseAsCStringLen) -import Foreign -import Foreign.C.Types (CBool (..)) -import Foreign.Marshal.Array (allocaArray) - -import Data.AST (AST, Node (Node)) -import Data.Blob -import Data.Duration -import Data.Location -import Data.Source -import Data.Span -import Data.Term - -import qualified TreeSitter.Language as TS -import qualified TreeSitter.Node as TS -import qualified TreeSitter.Parser as TS -import qualified TreeSitter.Tree as TS - -data Result grammar - = Failed - | Succeeded (AST [] grammar) - -runParser :: (Enum grammar, Bounded grammar) => Ptr TS.Parser -> Source -> IO (Result grammar) -runParser parser blobSource = unsafeUseAsCStringLen (sourceBytes blobSource) $ \ (source, len) -> do - alloca (\ rootPtr -> do - let acquire = do - -- Change this to TS.ts_parser_loop_until_cancelled if you want to test out cancellation - TS.ts_parser_parse_string parser nullPtr source len - - let release t - | t == nullPtr = pure () - | otherwise = TS.ts_tree_delete t - - let go treePtr = do - if treePtr == nullPtr - then pure Failed - else do - TS.ts_tree_root_node_p treePtr rootPtr - ptr <- peek rootPtr - Succeeded <$> anaM toAST ptr - Exc.bracket acquire release go) - --- | Parse 'Source' with the given 'TS.Language' and return its AST. --- Returns Nothing if the operation timed out. -parseToAST :: ( Bounded grammar - , Carrier sig m - , Enum grammar - , Member Resource sig - , Member Trace sig - , MonadIO m - ) - => Duration - -> Ptr TS.Language - -> Blob - -> m (Maybe (AST [] grammar)) -parseToAST parseTimeout language b@Blob{..} = bracket (liftIO TS.ts_parser_new) (liftIO . TS.ts_parser_delete) $ \ parser -> do - compatible <- liftIO $ do - let timeoutMicros = fromIntegral $ toMicroseconds parseTimeout - TS.ts_parser_set_timeout_micros parser timeoutMicros - TS.ts_parser_halt_on_error parser (CBool 1) - TS.ts_parser_set_language parser language - result <- if compatible then - liftIO $ runParser parser blobSource - else - Failed <$ trace "tree-sitter: incompatible versions" - case result of - Failed -> Nothing <$ trace ("tree-sitter: parsing failed " <> blobPath b) - (Succeeded ast) -> Just ast <$ trace ("tree-sitter: parsing succeeded " <> blobPath b) - -toAST :: forall grammar . (Bounded grammar, Enum grammar) => TS.Node -> IO (Base (AST [] grammar) TS.Node) -toAST node@TS.Node{..} = do - let count = fromIntegral nodeChildCount - children <- allocaArray count $ \ childNodesPtr -> do - _ <- with nodeTSNode (`TS.ts_node_copy_child_nodes` childNodesPtr) - peekArray count childNodesPtr - pure $! In (Node (toEnum (min (fromIntegral nodeSymbol) (fromEnum (maxBound :: grammar)))) (Location (nodeRange node) (nodeSpan node))) children - -anaM :: (Corecursive t, Monad m, Traversable (Base t)) => (a -> m (Base t a)) -> a -> m t -anaM g = a where a = pure . embed <=< traverse a <=< g - - -nodeRange :: TS.Node -> Range -nodeRange TS.Node{..} = Range (fromIntegral nodeStartByte) (fromIntegral nodeEndByte) - -nodeSpan :: TS.Node -> Span -nodeSpan TS.Node{..} = nodeStartPoint `seq` nodeEndPoint `seq` Span (pointPos nodeStartPoint) (pointPos nodeEndPoint) - where pointPos TS.TSPoint{..} = pointRow `seq` pointColumn `seq` Pos (1 + fromIntegral pointRow) (1 + fromIntegral pointColumn) diff --git a/src/Prologue.hs b/src/Prologue.hs deleted file mode 100644 index e144199243..0000000000 --- a/src/Prologue.hs +++ /dev/null @@ -1,86 +0,0 @@ -{-# LANGUAGE UndecidableInstances #-} -module Prologue - ( module X - , eitherM - , foldMapA - , maybeM - , maybeLast - , fromMaybeLast - ) where - - -import Debug.Trace as X (traceShowM, traceM) -import Control.DeepSeq as X -import Data.Bifunctor.Join as X -import Data.Bits as X -import Data.ByteString as X (ByteString) -import Data.Coerce as X -import Data.Int as X (Int8, Int16, Int32, Int64) -import Data.Functor.Both as X (Both (Both), runBothWith) -import Data.Either as X (fromLeft, fromRight) -import Data.IntMap as X (IntMap) -import Data.IntSet as X (IntSet) -import Data.Ix as X (Ix (..)) -import Data.List.NonEmpty as X (NonEmpty (..), nonEmpty, some1) -import Data.Map as X (Map) -import Data.Maybe as X -import Data.Monoid (Alt (..)) -import Data.Sequence as X (Seq) -import Data.Semilattice.Lower as X (Lower(..)) -import Data.Set as X (Set) -import Data.Sum as X (Sum, Element, Elements, (:<), (:<:), Apply (..), inject) -import Data.Text as X (Text) -import Data.These as X -import Data.Word as X (Word8, Word16, Word32, Word64) - -import Control.Exception as X hiding (Handler (..), assert, evaluate, throw, throwIO, throwTo) - --- Typeclasses -import Control.Applicative as X -import Control.Arrow as X ((&&&), (***)) -import Control.Monad as X hiding (fail, return) -import Control.Monad.Fail as X (MonadFail (..)) -import Control.Monad.IO.Class as X (MonadIO (..)) -import Data.Algebra as X -import Data.Bifoldable as X -import Data.Bifunctor as X (Bifunctor (..)) -import Data.Bitraversable as X -import Data.Foldable as X hiding (product, sum) -import Data.Function as X (fix, on, (&)) -import Data.Functor as X (void, ($>)) -import Data.Functor.Classes as X -import Data.Functor.Classes.Generic as X -import Data.Functor.Foldable as X (Base, Corecursive (..), Recursive (..)) -import Data.Hashable as X (Hashable, hash, hashUsing, hashWithSalt) -import Data.Hashable.Lifted as X (Hashable1(..), hashWithSalt1) -import Data.Monoid as X (First (..), Last (..), Monoid (..)) -import Data.Monoid.Generic as X -import Data.Proxy as X (Proxy (..)) -import Data.Semigroup as X (Semigroup (..)) -import Data.Traversable as X -import Data.Typeable as X (Typeable) - --- Generics -import GHC.Generics as X (Generic, Generic1) -import GHC.Stack as X - --- | Fold a collection by mapping each element onto an 'Alternative' action. -foldMapA :: (Alternative m, Foldable t) => (b -> m a) -> t b -> m a -foldMapA f = getAlt . foldMap (Alt . f) - - -maybeLast :: Foldable t => b -> (a -> b) -> t a -> b -maybeLast b f = maybe b f . getLast . foldMap (Last . Just) - -fromMaybeLast :: Foldable t => a -> t a -> a -fromMaybeLast b = fromMaybe b . getLast . foldMap (Last . Just) - --- | Extract the 'Just' of a 'Maybe' in an 'Applicative' context or, given 'Nothing', run the provided action. -maybeM :: Applicative f => f a -> Maybe a -> f a -maybeM f = maybe f pure -{-# INLINE maybeM #-} - --- Promote a function to either-applicatives. -eitherM :: Applicative f => (a -> f b) -> Either a b -> f b -eitherM f = either f pure -{-# INLINE eitherM #-} diff --git a/src/Rendering/Graph.hs b/src/Rendering/Graph.hs deleted file mode 100644 index 69fc940ff7..0000000000 --- a/src/Rendering/Graph.hs +++ /dev/null @@ -1,109 +0,0 @@ -{-# LANGUAGE FunctionalDependencies, MonoLocalBinds #-} -module Rendering.Graph -( renderTreeGraph -, termStyle -, diffStyle -, ToTreeGraph(..) -) where - -import Algebra.Graph.Export.Dot -import Analysis.ConstructorName -import Control.Effect -import Control.Effect.Fresh -import Control.Effect.Reader -import Control.Effect.State -import Data.Diff -import Data.Graph -import Data.Location -import Data.Patch -import Data.String (IsString (..)) -import Data.Term -import Prologue -import Semantic.Api.Bridge -import Semantic.Api.V1.CodeAnalysisPB - -import qualified Data.Text as T - --- TODO: rename as this isn't a render -renderTreeGraph :: (Ord vertex, Recursive t, ToTreeGraph vertex (Base t)) => t -> Graph vertex -renderTreeGraph = simplify . runGraph . cata toTreeGraph - -runGraph :: ReaderC (Graph vertex) - (FreshC PureC) (Graph vertex) - -> Graph vertex -runGraph = run . runFresh' . runReader mempty - where - -- NB: custom runFresh so that we count starting at 1 in order to avoid - -- default values for proto encoding. - runFresh' = evalState 1 . runFreshC - --- | GraphViz styling for terms -termStyle :: (IsString string, Monoid string) => String -> Style TermVertex string -termStyle name = (defaultStyle (fromString . show . vertexId)) - { graphName = fromString (quote name) - , vertexAttributes = vertexAttributes } - where quote a = "\"" <> a <> "\"" - vertexAttributes TermVertex{..} = ["label" := fromString name] - --- | Graphviz styling for diffs -diffStyle :: (IsString string, Monoid string) => String -> Style DiffTreeVertex string -diffStyle name = (defaultStyle (fromString . show . diffVertexId)) - { graphName = fromString (quote name) - , vertexAttributes = vertexAttributes } - where quote a = "\"" <> a <> "\"" - vertexAttributes (DiffTreeVertex _ (Just (Deleted (Just DeletedTerm{..})))) = [ "label" := fromString (T.unpack term), "color" := "red" ] - vertexAttributes (DiffTreeVertex _ (Just (Inserted (Just InsertedTerm{..})))) = [ "label" := fromString (T.unpack term), "color" := "green" ] - vertexAttributes (DiffTreeVertex _ (Just (Replaced (Just ReplacedTerm{..})))) = [ "label" := "Replacement", "color" := "orange", "style" := "dashed" ] - vertexAttributes (DiffTreeVertex _ (Just (Merged (Just MergedTerm{..})))) = [ "label" := fromString (T.unpack term) ] - vertexAttributes _ = [] - -class ToTreeGraph vertex t | t -> vertex where - toTreeGraph :: (Member Fresh sig, Member (Reader (Graph vertex)) sig, Carrier sig m) => t (m (Graph vertex)) -> m (Graph vertex) - -instance (ConstructorName syntax, Foldable syntax) => - ToTreeGraph TermVertex (TermF syntax Location) where - toTreeGraph = termAlgebra where - termAlgebra :: - ( ConstructorName syntax - , Foldable syntax - , Member Fresh sig - , Member (Reader (Graph TermVertex)) sig - , Carrier sig m - ) - => TermF syntax Location (m (Graph TermVertex)) - -> m (Graph TermVertex) - termAlgebra (In ann syntax) = do - i <- fresh - parent <- ask - let root = vertex $ TermVertex (fromIntegral i) (T.pack (constructorName syntax)) (converting #? locationSpan ann) - subGraph <- foldl' (\acc x -> overlay <$> acc <*> local (const root) x) (pure mempty) syntax - pure (parent `connect` root `overlay` subGraph) - -instance (ConstructorName syntax, Foldable syntax) => - ToTreeGraph DiffTreeVertex (DiffF syntax Location Location) where - toTreeGraph d = case d of - Merge t@(In (a1, a2) syntax) -> diffAlgebra t (Merged (Just (MergedTerm (T.pack (constructorName syntax)) (ann a1) (ann a2)))) - Patch (Delete t1@(In a1 syntax)) -> diffAlgebra t1 (Deleted (Just (DeletedTerm (T.pack (constructorName syntax)) (ann a1)))) - Patch (Insert t2@(In a2 syntax)) -> diffAlgebra t2 (Inserted (Just (InsertedTerm (T.pack (constructorName syntax)) (ann a2)))) - Patch (Replace t1@(In a1 syntax1) t2@(In a2 syntax2)) -> do - i <- fresh - parent <- ask - let (beforeName, beforeSpan) = (T.pack (constructorName syntax1), ann a1) - let (afterName, afterSpan) = (T.pack (constructorName syntax2), ann a2) - let replace = vertex (DiffTreeVertex (fromIntegral i) (Just (Replaced (Just (ReplacedTerm beforeName beforeSpan afterName afterSpan))))) - graph <- local (const replace) (overlay <$> diffAlgebra t1 (Deleted (Just (DeletedTerm beforeName beforeSpan))) <*> diffAlgebra t2 (Inserted (Just (InsertedTerm afterName afterSpan)))) - pure (parent `connect` replace `overlay` graph) - where - ann a = converting #? locationSpan a - diffAlgebra :: - ( Foldable f - , Member Fresh sig - , Member (Reader (Graph DiffTreeVertex)) sig - , Carrier sig m - ) => f (m (Graph DiffTreeVertex)) -> DiffTreeVertexDiffTerm -> m (Graph DiffTreeVertex) - diffAlgebra syntax a = do - i <- fresh - parent <- ask - let root = vertex (DiffTreeVertex (fromIntegral i) (Just a)) - subGraph <- foldl' (\acc x -> overlay <$> acc <*> local (const root) x) (pure mempty) syntax - pure (parent `connect` root `overlay` subGraph) diff --git a/src/Rendering/JSON.hs b/src/Rendering/JSON.hs deleted file mode 100644 index 3bf8669be4..0000000000 --- a/src/Rendering/JSON.hs +++ /dev/null @@ -1,124 +0,0 @@ -{-# LANGUAGE DataKinds, GADTs, GeneralizedNewtypeDeriving, KindSignatures, ScopedTypeVariables #-} -module Rendering.JSON -( JSON(..) -, renderJSONDiff -, renderJSONAdjDiff -, renderJSONTerm -, renderJSONAdjTerm -, renderJSONAST -, renderSymbolTerms -, renderJSONError -, renderJSONSymbolError -, renderJSONDiffError -, SomeJSON(..) -) where - -import Data.Aeson (ToJSON, toJSON, object, (.=)) -import Data.Aeson as A -import Data.JSON.Fields -import Data.Blob -import Data.Patch -import Data.Text (pack) -import GHC.TypeLits -import Prologue - -newtype JSON (key :: Symbol) a = JSON { unJSON :: [a] } - deriving (Eq, Monoid, Semigroup, Show) - -instance (KnownSymbol key, ToJSON a) => ToJSON (JSON key a) where - toJSON (JSON as) = object [ pack (symbolVal @key undefined) .= as ] - toEncoding (JSON as) = pairs (pack (symbolVal @key undefined) .= as) - - --- | Render a diff to a value representing its JSON. -renderJSONDiff :: ToJSON a => BlobPair -> a -> JSON "diffs" SomeJSON -renderJSONDiff blobs diff = JSON [ SomeJSON (JSONDiff (JSONStat blobs) diff) ] - -data JSONDiff a = JSONDiff { jsonDiffStat :: JSONStat, jsonDiff :: a } - deriving (Eq, Show) - -instance ToJSON a => ToJSON (JSONDiff a) where - toJSON JSONDiff{..} = object [ "diff" .= jsonDiff, "stat" .= jsonDiffStat ] - toEncoding JSONDiff{..} = pairs ("diff" .= jsonDiff <> "stat" .= jsonDiffStat) - --- | Render a diff to a value representing its JSON. -renderJSONAdjDiff :: ToJSON a => BlobPair -> a -> JSON "diffs" SomeJSON -renderJSONAdjDiff blobs diff = JSON [ SomeJSON (JSONAdjDiff (JSONStat blobs) diff) ] - -data JSONAdjDiff a = JSONAdjDiff { jsonAdjDiffStat :: JSONStat, jsonAdjDiff :: a } - deriving (Eq, Show) - -instance ToJSON a => ToJSON (JSONAdjDiff a) where - toJSON JSONAdjDiff{..} = object [ "graph" .= jsonAdjDiff, "stat" .= jsonAdjDiffStat ] - toEncoding JSONAdjDiff{..} = pairs ("graph" .= jsonAdjDiff <> "stat" .= jsonAdjDiffStat) - -newtype JSONStat = JSONStat { jsonStatBlobs :: BlobPair } - deriving (Eq, Show) - -instance ToJSON JSONStat where - toJSON JSONStat{..} = object ("path" .= pathKeyForBlobPair jsonStatBlobs : toJSONFields (these Delete Insert Replace (runJoin jsonStatBlobs))) - toEncoding JSONStat{..} = pairs (fold ("path" .= pathKeyForBlobPair jsonStatBlobs : toJSONFields (these Delete Insert Replace (runJoin jsonStatBlobs)))) - --- | Render a term to a value representing its JSON. -renderJSONTerm :: ToJSON a => Blob -> a -> JSON "trees" SomeJSON -renderJSONTerm blob content = JSON [ SomeJSON (JSONTerm blob content) ] - -data JSONTerm a = JSONTerm { jsonTermBlob :: Blob, jsonTerm :: a } - deriving (Eq, Show) - -instance ToJSON a => ToJSON (JSONTerm a) where - toJSON JSONTerm{..} = object ("tree" .= jsonTerm : toJSONFields jsonTermBlob) - toEncoding JSONTerm{..} = pairs (fold ("tree" .= jsonTerm : toJSONFields jsonTermBlob)) - -renderJSONAdjTerm :: ToJSON a => Blob -> a -> JSON "trees" SomeJSON -renderJSONAdjTerm blob content = JSON [ SomeJSON (JSONAdjTerm blob content) ] - -data JSONAdjTerm a = JSONAdjTerm { jsonAdjTermBlob :: Blob, jsonAdjTerm :: a } - deriving (Eq, Show) - -instance ToJSON a => ToJSON (JSONAdjTerm a) where - toJSON JSONAdjTerm{..} = object ("graph" .= jsonAdjTerm : toJSONFields jsonAdjTermBlob) - toEncoding JSONAdjTerm{..} = pairs (fold ("graph" .= jsonAdjTerm : toJSONFields jsonAdjTermBlob)) - -renderJSONAST :: ToJSON a => Blob -> a -> JSON "trees" SomeJSON -renderJSONAST blob content = JSON [ SomeJSON (JSONAST blob content) ] - -data JSONAST a = JSONAST { jsonASTBlob :: Blob, jsonAST :: a } - deriving (Eq, Show) - -instance ToJSON a => ToJSON (JSONAST a) where - toJSON JSONAST{..} = object ("ast" .= jsonAST : toJSONFields jsonASTBlob) - toEncoding JSONAST{..} = pairs (fold ("ast" .= jsonAST : toJSONFields jsonASTBlob)) - - --- | Render terms to final JSON structure. -renderSymbolTerms :: ToJSON a => [a] -> JSON "files" SomeJSON -renderSymbolTerms = JSON . map SomeJSON - --- | Render an error for symbols. -renderJSONSymbolError :: Blob -> String -> JSON "files" SomeJSON -renderJSONSymbolError blob e = JSON [ renderError blob e ] - --- | Render an error for terms. -renderJSONError :: Blob -> String -> JSON "trees" SomeJSON -renderJSONError blob e = JSON [ renderError blob e ] - --- | Render an error for a particular blob. -renderError :: ToJSON a => Blob -> a -> SomeJSON -renderError b e = SomeJSON $ object - [ "error" .= e - , "path" .= blobPath b - , "language" .= blobLanguage b - ] - --- | Render an error for diffs. -renderJSONDiffError :: BlobPair -> String -> JSON "diffs" SomeJSON -renderJSONDiffError pair e = JSON [ SomeJSON (object [ "error" .= err ]) ] - where err = object ["message" .= e, "stat" .= toJSON (JSONStat pair)] - -data SomeJSON where - SomeJSON :: ToJSON a => a -> SomeJSON - -instance ToJSON SomeJSON where - toJSON (SomeJSON a) = toJSON a - toEncoding (SomeJSON a) = toEncoding a diff --git a/src/Rendering/TOC.hs b/src/Rendering/TOC.hs deleted file mode 100644 index 6ece8e8807..0000000000 --- a/src/Rendering/TOC.hs +++ /dev/null @@ -1,161 +0,0 @@ -{-# LANGUAGE DerivingVia, RankNTypes, ScopedTypeVariables #-} -module Rendering.TOC -( renderToCDiff -, renderToCTerm -, diffTOC -, Summaries(..) -, TOCSummary(..) -, isValidSummary -, declaration -, Entry(..) -, tableOfContentsBy -, termTableOfContentsBy -, dedupe -, entrySummary -, toCategoryName -) where - -import Prologue -import Analysis.TOCSummary -import Data.Align (bicrosswalk) -import Data.Aeson -import Data.Blob -import Data.Diff -import Data.Language as Language -import Data.List (sortOn) -import qualified Data.List as List -import qualified Data.Map.Monoidal as Map -import Data.Patch -import Data.Location -import Data.Term -import qualified Data.Text as T - -data Summaries = Summaries { changes, errors :: Map.Map T.Text [Value] } - deriving stock (Eq, Show, Generic) - deriving Semigroup via GenericSemigroup Summaries - deriving Monoid via GenericMonoid Summaries - -instance ToJSON Summaries where - toJSON Summaries{..} = object [ "changes" .= changes, "errors" .= errors ] - -data TOCSummary - = TOCSummary - { summaryCategoryName :: T.Text - , summaryTermName :: T.Text - , summarySpan :: Span - , summaryChangeType :: T.Text - } - | ErrorSummary { errorText :: T.Text, errorSpan :: Span, errorLanguage :: Language } - deriving stock (Generic, Eq, Show) - -instance ToJSON TOCSummary where - toJSON TOCSummary{..} = object [ "changeType" .= summaryChangeType, "category" .= summaryCategoryName, "term" .= summaryTermName, "span" .= summarySpan ] - toJSON ErrorSummary{..} = object [ "error" .= errorText, "span" .= errorSpan, "language" .= errorLanguage ] - -isValidSummary :: TOCSummary -> Bool -isValidSummary ErrorSummary{} = False -isValidSummary _ = True - --- | Produce the annotations of nodes representing declarations. -declaration :: TermF f (Maybe Declaration) a -> Maybe Declaration -declaration (In annotation _) = annotation - - --- | An entry in a table of contents. -data Entry a - = Changed { entryPayload :: a } -- ^ An entry for a node containing changes. - | Inserted { entryPayload :: a } -- ^ An entry for a change occurring inside an 'Insert' 'Patch'. - | Deleted { entryPayload :: a } -- ^ An entry for a change occurring inside a 'Delete' 'Patch'. - | Replaced { entryPayload :: a } -- ^ An entry for a change occurring on the insertion side of a 'Replace' 'Patch'. - deriving (Eq, Show) - - --- | Compute a table of contents for a diff characterized by a function mapping relevant nodes onto values in Maybe. -tableOfContentsBy :: (Foldable f, Functor f) - => (forall b. TermF f ann b -> Maybe a) -- ^ A function mapping relevant nodes onto values in Maybe. - -> Diff f ann ann -- ^ The diff to compute the table of contents for. - -> [Entry a] -- ^ A list of entries for relevant changed nodes in the diff. -tableOfContentsBy selector = fromMaybe [] . cata (\ r -> case r of - Patch patch -> (pure . patchEntry <$> bicrosswalk selector selector patch) <> bifoldMap fold fold patch <> Just [] - Merge (In (_, ann2) r) -> case (selector (In ann2 r), fold r) of - (Just a, Just entries) -> Just (Changed a : entries) - (_ , entries) -> entries) - where patchEntry = patch Deleted Inserted (const Replaced) - -termTableOfContentsBy :: (Foldable f, Functor f) - => (forall b. TermF f annotation b -> Maybe a) - -> Term f annotation - -> [a] -termTableOfContentsBy selector = cata termAlgebra - where termAlgebra r | Just a <- selector r = a : fold r - | otherwise = fold r - -newtype DedupeKey = DedupeKey (T.Text, T.Text) deriving (Eq, Ord) - --- Dedupe entries in a final pass. This catches two specific scenarios with --- different behaviors: --- 1. Identical entries are in the list. --- Action: take the first one, drop all subsequent. --- 2. Two similar entries (defined by a case insensitive comparision of their --- identifiers) are in the list. --- Action: Combine them into a single Replaced entry. -dedupe :: [Entry Declaration] -> [Entry Declaration] -dedupe = let tuples = sortOn fst . Map.elems . snd . foldl' go (0, Map.empty) in (fmap . fmap) snd tuples - where - go :: (Int, Map.Map DedupeKey (Int, Entry Declaration)) - -> Entry Declaration - -> (Int, Map.Map DedupeKey (Int, Entry Declaration)) - go (index, m) x | Just (_, similar) <- Map.lookup (dedupeKey x) m - = if exactMatch similar x - then (succ index, m) - else - let replacement = Replaced (entryPayload similar) - in (succ index, Map.insert (dedupeKey replacement) (index, replacement) m) - | otherwise = (succ index, Map.insert (dedupeKey x) (index, x) m) - - dedupeKey entry = DedupeKey (toCategoryName (entryPayload entry), T.toLower (declarationIdentifier (entryPayload entry))) - exactMatch = (==) `on` entryPayload - --- | Construct a 'TOCSummary' from an 'Entry'. -entrySummary :: Entry Declaration -> TOCSummary -entrySummary entry = case entry of - Changed a -> recordSummary "modified" a - Deleted a -> recordSummary "removed" a - Inserted a -> recordSummary "added" a - Replaced a -> recordSummary "modified" a - --- | Construct a 'TOCSummary' from a node annotation and a change type label. -recordSummary :: T.Text -> Declaration -> TOCSummary -recordSummary changeText record = case record of - (ErrorDeclaration text _ srcSpan language) -> ErrorSummary text srcSpan language - decl-> TOCSummary (toCategoryName decl) (formatIdentifier decl) (declarationSpan decl) changeText - where - formatIdentifier (MethodDeclaration identifier _ _ Language.Go (Just receiver)) = "(" <> receiver <> ") " <> identifier - formatIdentifier (MethodDeclaration identifier _ _ _ (Just receiver)) = receiver <> "." <> identifier - formatIdentifier decl = declarationIdentifier decl - -renderToCDiff :: (Foldable f, Functor f) => BlobPair -> Diff f (Maybe Declaration) (Maybe Declaration) -> Summaries -renderToCDiff blobs = uncurry Summaries . bimap toMap toMap . List.partition isValidSummary . diffTOC - where toMap [] = mempty - toMap as = Map.singleton summaryKey (toJSON <$> as) - summaryKey = T.pack $ pathKeyForBlobPair blobs - -diffTOC :: (Foldable f, Functor f) => Diff f (Maybe Declaration) (Maybe Declaration) -> [TOCSummary] -diffTOC = fmap entrySummary . dedupe . tableOfContentsBy declaration - -renderToCTerm :: (Foldable f, Functor f) => Blob -> Term f (Maybe Declaration) -> Summaries -renderToCTerm b@Blob{..} = uncurry Summaries . bimap toMap toMap . List.partition isValidSummary . termToC - where - toMap [] = mempty - toMap as = Map.singleton (T.pack (blobPath b)) (toJSON <$> as) - - termToC :: (Foldable f, Functor f) => Term f (Maybe Declaration) -> [TOCSummary] - termToC = fmap (recordSummary "unchanged") . termTableOfContentsBy declaration - --- The user-facing category name -toCategoryName :: Declaration -> T.Text -toCategoryName declaration = case declaration of - FunctionDeclaration{} -> "Function" - MethodDeclaration{} -> "Method" - HeadingDeclaration _ _ _ _ l -> "Heading " <> T.pack (show l) - ErrorDeclaration{} -> "ParseError" diff --git a/src/Reprinting/Pipeline.hs b/src/Reprinting/Pipeline.hs deleted file mode 100644 index b28127b895..0000000000 --- a/src/Reprinting/Pipeline.hs +++ /dev/null @@ -1,177 +0,0 @@ -{- | - -This module represents the top-level interface for @semantic@'s -reprinting functionality. Reprinting here is defined as the -conversion, given some 'Source' code, of the parsed (and possibly -modified) syntax tree corresponding to that source, back into a -document representing that source code. - -The approach is based on techniques drawn from: - -* /A Pretty Good Formatting Pipeline/ by Bagge and Hasu (2010) -* /Scrap Your Reprinter/ by Orchard et al (2017) - -The reprinter was designed with the following goals in mind: - -* Laziness: a node that was unmodified in a refactoring pass - should draw its representation from the original source file, - rather than being explicitly pretty-printed. The only nodes - that do not consult the original document are those that were - synthesized during a refactoring operation. -* Generality: each syntax node should have one and only one - declaration that describes how reprinting takes place. No node - should be concerned with language-specific syntactic issues. -* Precedence-sensitivity: semantic syntax nodes do not contain - information about parenthesization of binary operators. - Binary operators should report their precedence and the - pipeline should insert parentheses as necessary. -* Modularity: each stage in the reprinting pipeline - should be testable independently. -* Time/space efficiency: the reprinting algorithm should scale - to trees with hundreds of thousands of nodes without linear - space usage. -* Roundtrip correctness: reprinting an unmodified syntax tree - should produce source text exactly corresponding to the original - file. - -The reprinter takes the form of a pipeline operating over a stream of -tokens. Each stage in the pipeline converts a given token to a -lower-level representation, ultimately resulting in a 'Doc' data type -from the @prettyprinter@ library (to which we defer the nitty-gritty -details of actually pretty-printing text). A representation of the -stages of the pipeline follows: - -@ - -[Start] - The Pipeline starts with a tree, where terms are annotated with 'History' to - denote what's been refactored. - (Language-agnostic) - | - | AST - | - v -[Tokenize] - A subterm algebra converting a tree (terms) to a stream of tokens. - (Language-agnostic) - | - | Seq Token - | - v -[Translate] - A stack machine interface through which tokens are interpreted to splices - (with context). A splice is a concrete representation of syntax, to which - additional language specific transformations can be applied. - (Language-agnostic) - | - | Seq Fragment - | - v -[PrettyPrint] --> --> --> <...> - A language specific stack machine interface allowing further refinement of the - sequence of splices. Language machines should emit specific keywords, - punctutation, and layout rules. Additional steps can be added for project - specific style, formatting, and even post-processing (minimizers, etc). - (Language-specific, Project-specific) - | - | Seq Splice - | - v -[Typeset] - A stack machine that converts splices to a Doc. (Language-agnostic) - | - | Doc - | - v -[Print] - A simple function that produces 'Text' or 'Source' with the desired layout - settings from a 'Doc'. (Language-agnostic) - | - | Text - | - v - -@ - --} - -{-# LANGUAGE AllowAmbiguousTypes, ScopedTypeVariables, RankNTypes #-} -module Reprinting.Pipeline - ( runReprinter - , runTokenizing - , runContextualizing - , runTranslating - ) where - -import Control.Effect as Effect -import Control.Effect.Error as Effect -import Control.Effect.State as Effect -import Data.Machine hiding (Source) -import Data.Machine.Runner -import Data.Text.Prettyprint.Doc -import Data.Text.Prettyprint.Doc.Render.Text - -import Data.Reprinting.Errors -import Data.Reprinting.Scope -import Data.Reprinting.Splice -import Data.Reprinting.Token -import qualified Data.Source as Source -import Data.Term -import Reprinting.Tokenize -import Reprinting.Translate -import Reprinting.Typeset - - --- | Run the reprinting pipeline given the original 'Source', a language --- specific machine (`ProcessT`) and the provided 'Term'. -runReprinter :: Tokenize a - => Source.Source - -> ProcessT Translator Fragment Splice - -> Term a History - -> Either TranslationError Source.Source -runReprinter src translating tree - = fmap go - . Effect.run - . Effect.runError - . fmap snd - . runState (mempty :: [Scope]) - . foldT $ source (tokenizing src tree) - ~> contextualizing - ~> translating - ~> typesetting - where go = Source.fromText . renderStrict . layoutPretty defaultLayoutOptions - --- | Run the reprinting pipeline up to tokenizing. -runTokenizing :: Tokenize a - => Source.Source - -> Term a History - -> [Token] -runTokenizing src tree - = Data.Machine.run $ source (tokenizing src tree) - --- | Run the reprinting pipeline up to contextualizing. -runContextualizing :: Tokenize a - => Source.Source - -> Term a History - -> Either TranslationError [Fragment] -runContextualizing src tree - = Effect.run - . Effect.runError - . fmap snd - . runState (mempty :: [Scope]) - . runT $ source (tokenizing src tree) - ~> contextualizing - -runTranslating :: Tokenize a - => Source.Source - -> ProcessT Translator Fragment Splice - -> Term a History - -> Either TranslationError [Splice] -runTranslating src translating tree - = Effect.run - . Effect.runError - . fmap snd - . runState (mempty :: [Scope]) - . runT $ source (tokenizing src tree) - ~> contextualizing - ~> translating diff --git a/src/Reprinting/Tokenize.hs b/src/Reprinting/Tokenize.hs deleted file mode 100644 index 5905ff99ef..0000000000 --- a/src/Reprinting/Tokenize.hs +++ /dev/null @@ -1,250 +0,0 @@ -{-# LANGUAGE GADTs, LambdaCase, RankNTypes, UndecidableInstances #-} - -module Reprinting.Tokenize - ( module Token - , module Scope - , module Operator - , History (..) - , mark - , remark - -- * The Reprinter monad - , Tokenizer - , yield - , control - , within - , within' - , log - , ignore - , sep - , sepTrailing - , list - , hash - , pair - , imperative - -- * Tokenize interface - , Tokenize (..) - -- * Invocation/results - , tokenizing - ) where - -import Prelude hiding (fail, log, filter) -import Prologue hiding (Element, hash) - -import Data.History -import Data.List (intersperse) -import qualified Data.Machine as Machine -import Data.Range -import Data.Reprinting.Scope (Scope) -import qualified Data.Reprinting.Scope as Scope -import Data.Reprinting.Token as Token -import Data.Reprinting.Operator as Operator -import Data.Source -import Data.Term - --- | The 'Tokenizer' monad represents a context in which 'Control' --- tokens and 'Element' tokens can be sent to some downstream --- consumer. Its primary interface is through the 'Tokenize' --- typeclass, and is compiled to a 'Data.Machine.Source' by --- 'tokenizing'. -data Tokenizer a where - Pure :: a -> Tokenizer a - Bind :: Tokenizer a -> (a -> Tokenizer b) -> Tokenizer b - - Tell :: Token -> Tokenizer () - - Get :: Tokenizer State - Put :: State -> Tokenizer () - --- Tokenizers are compiled into a Plan capable of being converted --- to a Source. Note that the state parameter is internal to the --- tokenizer being run: the invoker of 'tokenizing' doesn't need --- to keep track of it at all. -compile :: State -> Tokenizer a -> Machine.Plan k Token (State, a) -compile p = \case - Pure a -> pure (p, a) - Bind a f -> compile p a >>= (\(new, v) -> compile new (f v)) - Tell t -> Machine.yield t $> (p, ()) - Get -> pure (p, p) - Put p' -> pure (p', ()) - -instance Functor Tokenizer where fmap = liftA - -instance Applicative Tokenizer where - pure = Pure - (<*>) = ap - -instance Monad Tokenizer where (>>=) = Bind - -data Strategy - = Reprinting - | PrettyPrinting - deriving (Eq, Show) - -data Filter - = AllowAll - | ForbidData - deriving (Eq, Show) - -data State = State - { source :: Source -- We need to be able to slice - , history :: History -- What's the history of the term we're examining - , strategy :: Strategy -- What are we doing right now? - , cursor :: Int -- Where do we begin slices? - , filter :: Filter -- Should we ignore data tokens? - } deriving (Show, Eq) - --- Builtins - --- | Yield an 'Element' token in a 'Tokenizer' context. -yield :: Element -> Tokenizer () -yield e = do - on <- filter <$> Get - when (on == AllowAll) . Tell . Element $ e - --- | Yield a 'Control' token. -control :: Control -> Tokenizer () -control = Tell . Control - --- | Yield a 'Chunk' of some 'Source'. -chunk :: Source -> Tokenizer () -chunk = Tell . Chunk - --- | Ensures that the final chunk is emitted -finish :: Tokenizer () -finish = do - crs <- asks cursor - log ("Finishing, cursor is " <> show crs) - src <- asks source - chunk (dropSource crs src) - --- State handling - -asks :: (State -> a) -> Tokenizer a -asks f = f <$> Get - -modify :: (State -> State) -> Tokenizer () -modify f = Get >>= \x -> Put . f $! x - -allowAll, forbidData :: Tokenizer () -allowAll = modify (\x -> x { filter = AllowAll }) -forbidData = modify (\x -> x { filter = ForbidData }) - -move :: Int -> Tokenizer () -move c = modify (\x -> x { cursor = c }) - -withHistory :: Annotated t History - => t - -> Tokenizer a - -> Tokenizer a -withHistory t act = do - old <- asks history - modify (\x -> x { history = annotation t }) - act <* modify (\x -> x { history = old }) - -withStrategy :: Strategy -> Tokenizer a -> Tokenizer a -withStrategy s act = do - old <- Get - Put (old { strategy = s }) - res <- act - new <- Get - Put (new { strategy = strategy old }) - pure res - --- The reprinting algorithm. - --- | A subterm algebra inspired by the /Scrap Your Reprinter/ algorithm. -descend :: Tokenize constr => SubtermAlgebra constr (Term a History) (Tokenizer ()) -descend t = do - (State src hist strat crs _) <- asks id - let into s = withHistory (subterm s) (subtermRef s) - case (hist, strat) of - (Unmodified _, _) -> do - tokenize (fmap into t) - forbidData - (Refactored _, PrettyPrinting) -> do - allowAll - tokenize (fmap into t) - (Refactored r, Reprinting) -> do - allowAll - let delimiter = Range crs (start r) - unless (delimiter == Range 0 0) $ do - log ("slicing: " <> show delimiter) - chunk (slice delimiter src) - move (start r) - tokenize (fmap (withStrategy PrettyPrinting . into) t) - move (end r) - - --- Combinators - --- | Emit a log message to the token stream. Useful for debugging. -log :: String -> Tokenizer () -log = control . Log - --- | Emit an Enter for the given context, then run the provided --- action, then emit a corresponding Exit. -within :: Scope -> Tokenizer () -> Tokenizer () -within c r = control (Enter c) *> r <* control (Exit c) - --- | Like 'within', but adds 'Open' and 'Close' elements around the action. -within' :: Scope -> Tokenizer () -> Tokenizer () -within' c x = within c $ yield Token.Open *> x <* yield Token.Close - --- | Emit a sequence of tokens interspersed with 'Sep'. -sep :: Foldable t => t (Tokenizer ()) -> [Tokenizer ()] -sep = intersperse (yield Token.Sep) . toList - --- | Emit a sequence of tokens each with trailing 'Sep'. -sepTrailing :: Foldable t => t (Tokenizer ()) -> [Tokenizer ()] -sepTrailing = foldr (\x acc -> x : yield Token.Sep : acc) mempty - --- | Emit a sequence of tokens within a 'List' Scope with appropriate 'Open', --- 'TClose' tokens surrounding. -list :: Foldable t => t (Tokenizer ()) -> Tokenizer () -list = within' Scope.List . sequenceA_ . sep - --- | Emit a sequence of tokens within a 'Hash' Scope with appropriate --- 'Open', 'TClose' tokens surrounding and interspersing 'Sep'. -hash :: Foldable t => t (Tokenizer ()) -> Tokenizer () -hash = within' Scope.Hash . sequenceA_ . sep - --- | Emit key value tokens with a 'Sep' within a scoped 'Pair'. -pair :: Tokenizer () -> Tokenizer () -> Tokenizer () -pair k v = within Scope.Pair $ k *> yield Token.Sep <* v - --- | Emit a sequence of tokens within an 'Imperative' scope with --- appropriate 'Open', 'Close' tokens surrounding and interspersing --- 'Sep'. -imperative :: Foldable t => t (Tokenizer ()) -> Tokenizer () -imperative = within' Scope.Imperative . sequenceA_ . sep - --- | Shortcut for @const (pure ())@, useful for when no action --- should be taken. -ignore :: a -> Tokenizer () -ignore = const (pure ()) - --- | An instance of the 'Tokenize' typeclass describes how to emit tokens to --- pretty print the value of the supplied constructor in its AST context. -class (Show1 constr, Traversable constr) => Tokenize constr where - -- | Should emit control and data tokens. - tokenize :: FAlgebra constr (Tokenizer ()) - -tokenizing :: Tokenize a - => Source - -> Term a History - -> Machine.Source Token -tokenizing src term = pipe - where pipe = Machine.construct . fmap snd $ compile state go - state = State src (termAnnotation term) Reprinting 0 ForbidData - go = forbidData *> foldSubterms descend term <* finish - --- | Sums of reprintable terms are reprintable. -instance (Apply Show1 fs, Apply Functor fs, Apply Foldable fs, Apply Traversable fs, Apply Tokenize fs) => Tokenize (Sum fs) where - tokenize = apply @Tokenize tokenize - --- | Annotated terms are reprintable and operate in a context derived from the annotation. -instance Tokenize a => Tokenize (TermF a History) where - tokenize t = withHistory t (tokenize (termFOut t)) - -instance Tokenize [] where - tokenize = imperative diff --git a/src/Reprinting/Translate.hs b/src/Reprinting/Translate.hs deleted file mode 100644 index eb5208475a..0000000000 --- a/src/Reprinting/Translate.hs +++ /dev/null @@ -1,42 +0,0 @@ -{-# LANGUAGE LambdaCase #-} - -module Reprinting.Translate - ( Translator - , contextualizing - ) where - -import Control.Monad -import Control.Effect -import Control.Effect.Error -import Control.Effect.State -import Control.Monad.Trans -import Data.Machine - -import Data.Reprinting.Errors -import Data.Reprinting.Splice -import Data.Reprinting.Token -import Data.Reprinting.Scope -import qualified Data.Source as Source - -type Translator - = StateC [Scope] - ( ErrorC TranslationError PureC) - -contextualizing :: ProcessT Translator Token Fragment -contextualizing = repeatedly $ await >>= \case - Chunk source -> yield . Verbatim . Source.toText $ source - Element t -> case t of - Run f -> lift get >>= \c -> yield (New t c f) - _ -> lift get >>= yield . Defer t - Control ctl -> case ctl of - Enter c -> enterScope c - Exit c -> exitScope c - _ -> pure () - -enterScope, exitScope :: Scope -> PlanT k Fragment Translator () - -enterScope c = lift (modify (c :)) - -exitScope c = lift get >>= \case - (x:xs) -> when (x == c) (lift (modify (const xs))) - cs -> lift (throwError (UnbalancedPair c cs)) diff --git a/src/Reprinting/Typeset.hs b/src/Reprinting/Typeset.hs deleted file mode 100644 index 09ef1554e6..0000000000 --- a/src/Reprinting/Typeset.hs +++ /dev/null @@ -1,36 +0,0 @@ -module Reprinting.Typeset - ( typesetting - , typesettingWithVisualWhitespace - ) where - -import Prologue - -import Data.Machine -import Data.Reprinting.Splice hiding (space) -import Data.Text.Prettyprint.Doc - -typesetting :: Monad m => ProcessT m Splice (Doc a) -typesetting = auto step - -step :: Splice -> Doc a -step (Emit t) = pretty t -step (Layout SoftWrap) = softline -step (Layout HardWrap) = hardline -step (Layout Space) = space -step (Layout (Indent 0 Spaces)) = mempty -step (Layout (Indent n Spaces)) = stimes n space -step (Layout (Indent 0 Tabs)) = mempty -step (Layout (Indent n Tabs)) = stimes n "\t" - --- | Typeset, but show whitespace with printable characters for debugging purposes. -typesettingWithVisualWhitespace :: Monad m => ProcessT m Splice (Doc a) -typesettingWithVisualWhitespace = auto step where - step :: Splice -> Doc a - step (Emit t) = pretty t - step (Layout SoftWrap) = softline - step (Layout HardWrap) = "\\n" <> hardline - step (Layout Space) = "." - step (Layout (Indent 0 Spaces)) = mempty - step (Layout (Indent n Spaces)) = stimes n "." - step (Layout (Indent 0 Tabs)) = mempty - step (Layout (Indent n Tabs)) = stimes n "\t" diff --git a/src/Semantic/AST.hs b/src/Semantic/AST.hs deleted file mode 100644 index 5045b04a94..0000000000 --- a/src/Semantic/AST.hs +++ /dev/null @@ -1,49 +0,0 @@ -{-# LANGUAGE GADTs, RankNTypes #-} -module Semantic.AST - ( SomeAST (..) - , withSomeAST - , astParseBlob - , ASTFormat (..) - , runASTParse - ) where - -import Prologue - -import Data.ByteString.Builder -import Data.List (intersperse) - -import Control.Effect -import Control.Effect.Error -import Data.AST -import Data.Blob -import Parsing.Parser -import Rendering.JSON (renderJSONAST) -import Semantic.Task -import qualified Serializing.Format as F - -data SomeAST where - SomeAST :: Show grammar => AST [] grammar -> SomeAST - -withSomeAST :: (forall grammar . Show grammar => AST [] grammar -> a) -> SomeAST -> a -withSomeAST f (SomeAST ast) = f ast - -astParseBlob :: (Member (Error SomeException) sig, Member Task sig, Carrier sig m) => Blob -> m SomeAST -astParseBlob blob@Blob{..} - | Just (SomeASTParser parser) <- someASTParser (blobLanguage blob) = SomeAST <$> parse parser blob - | otherwise = noLanguageForBlob (blobPath blob) - - -data ASTFormat = SExpression | JSON | Show | Quiet - deriving (Show) - -runASTParse :: (Member Distribute sig, Member (Error SomeException) sig, Member Task sig, Carrier sig m, MonadIO m) => ASTFormat -> [Blob] -> m F.Builder -runASTParse SExpression = distributeFoldMap (astParseBlob >=> withSomeAST (serialize (F.SExpression F.ByShow))) -runASTParse Show = distributeFoldMap (astParseBlob >=> withSomeAST (serialize F.Show . fmap nodeSymbol)) -runASTParse JSON = distributeFoldMap (\ blob -> astParseBlob blob >>= withSomeAST (render (renderJSONAST blob))) >=> serialize F.JSON -runASTParse Quiet = distributeFoldMap $ \blob -> do - result <- time' ((Right <$> astParseBlob blob) `catchError` (pure . Left @SomeException)) - pure . mconcat . intersperse "\t" $ [ either (const "ERR") (const "OK") (fst result) - , stringUtf8 (show (blobLanguage blob)) - , stringUtf8 (blobPath blob) - , doubleDec (snd result) <> " ms\n" - ] diff --git a/src/Semantic/Analysis.hs b/src/Semantic/Analysis.hs deleted file mode 100644 index 9b01f737a6..0000000000 --- a/src/Semantic/Analysis.hs +++ /dev/null @@ -1,195 +0,0 @@ -{-# LANGUAGE TypeFamilies, TypeOperators #-} -module Semantic.Analysis -( evaluate -, runDomainEffects -, evalTerm -) where - -import Prologue - -import qualified Data.Map.Strict as Map - -import Control.Abstract as Abstract -import Control.Abstract.ScopeGraph (runAllocator) -import Control.Effect.Interpose -import Data.Abstract.Evaluatable -import Data.Abstract.Module -import Data.Abstract.ModuleTable as ModuleTable -import Data.Language (Language) -import Data.Span - -type ModuleC address value m - = ErrorC (LoopControl value) - ( ErrorC (Return value) - ( ReaderC (CurrentScope address) - ( ReaderC (CurrentFrame address) - (Β DerefC address value - ( AllocatorC address - ( ReaderC ModuleInfo - m)))))) - -type DomainC term address value m - = FunctionC term address value - ( WhileC value - ( BooleanC value - ( StringC value - ( NumericC value - ( BitwiseC value - ( ObjectC address value - ( ArrayC value - ( HashC value - ( UnitC value - ( InterposeC (Resumable (BaseError (UnspecializedError address value))) - m)))))))))) - --- | Evaluate a list of modules with the prelude for the passed language available, and applying the passed function to every module. -evaluate :: ( Carrier outerSig outer - , derefSig ~ (Deref value :+: allocatorSig) - , derefC ~ (DerefC address value allocatorC) - , Carrier derefSig derefC - , allocatorSig ~ (Allocator address :+: Reader ModuleInfo :+: outerSig) - , allocatorC ~ (AllocatorC address (ReaderC ModuleInfo outer)) - , Carrier allocatorSig allocatorC - , Effect outerSig - , Member Fresh outerSig - , Member (Reader (ModuleTable (Module (ModuleResult address value)))) outerSig - , Member (State (Heap address address value)) outerSig - , Member (State (ScopeGraph address)) outerSig - , Ord address - ) - => proxy (lang :: Language) - -> (Module (Either (proxy lang) term) -> Evaluator term address value (ModuleC address value outer) value) - -> [Module term] - -> Evaluator term address value outer (ModuleTable (Module (ModuleResult address value))) -evaluate lang runModule modules = do - let prelude = Module moduleInfoFromCallStack (Left lang) - ((preludeScopeAddress, preludeFrameAddress), _) <- evalModule Nothing Nothing prelude - foldr (run preludeScopeAddress preludeFrameAddress . fmap Right) ask modules - where run preludeScopeAddress preludeFrameAddress m rest = do - evaluated <- evalModule (Just preludeScopeAddress) (Just preludeFrameAddress) m - local (ModuleTable.insert (modulePath (moduleInfo m)) (evaluated <$ m)) rest - - -- Run the allocator and Reader ModuleInfo effects (Some allocator instances depend on Reader ModuleInfo) - -- after setting up the scope and frame for a module. - evalModule parentScope parentFrame m = raiseHandler (runReader (moduleInfo m)) . runAllocator $ do - let (scopeEdges, frameLinks) = case (parentScope, parentFrame) of - (Just parentScope, Just parentFrame) -> (Map.singleton Lexical [ parentScope ], Map.singleton Lexical (Map.singleton parentScope parentFrame)) - _ -> mempty - scopeAddress <- if Prologue.null scopeEdges then newPreludeScope scopeEdges else newScope scopeEdges - frameAddress <- newFrame scopeAddress frameLinks - val <- runInModule scopeAddress frameAddress m - pure ((scopeAddress, frameAddress), val) - where runInModule scopeAddress frameAddress - = runDeref - . raiseHandler (runReader (CurrentFrame frameAddress)) - . raiseHandler (runReader (CurrentScope scopeAddress)) - . runReturn - . runLoopControl - . runModule - -runDomainEffects :: ( AbstractValue term address value (DomainC term address value m) - , unitC ~ UnitC value (InterposeC (Resumable (BaseError (UnspecializedError address value))) m) - , unitSig ~ (Unit value :+: Interpose (Resumable (BaseError (UnspecializedError address value))) :+: sig) - , hashC ~ HashC value unitC - , hashSig ~ (Abstract.Hash value :+: unitSig) - , arrayC ~ ArrayC value hashC - , arraySig ~ (Abstract.Array value :+: hashSig) - , objectC ~ ObjectC address value arrayC - , objectSig ~ (Abstract.Object address value :+: arraySig) - , bitwiseC ~ BitwiseC value objectC - , bitwiseSig ~ (Abstract.Bitwise value :+: objectSig) - , numericC ~ NumericC value bitwiseC - , numericSig ~ (Abstract.Numeric value :+: bitwiseSig) - , stringC ~ StringC value numericC - , stringSig ~ (Abstract.String value :+: numericSig) - , booleanC ~ BooleanC value stringC - , booleanSig ~ (Boolean value :+: stringSig) - , whileC ~ WhileC value booleanC - , whileSig ~ (While value :+: booleanSig) - , functionC ~ FunctionC term address value whileC - , functionSig ~ (Function term address value :+: whileSig) - , Carrier functionSig functionC - , HasPrelude lang - , Member (Allocator address) sig - , Member (Deref value) sig - , Member Fresh sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (AddressError address value))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member Trace sig - , Ord address - , Show address - ) - => (term -> Evaluator term address value (DomainC term address value m) value) - -> Module (Either (proxy lang) term) - -> Evaluator term address value m value -runDomainEffects runTerm - = raiseHandler runInterpose - . runUnit - . runHash - . runArray - . runObject - . runBitwise - . runNumeric - . runString - . runBoolean - . runWhile - . runFunction runTerm - . either ((unit <*) . definePrelude) runTerm - . moduleBody - --- | Evaluate a term recursively, applying the passed function at every recursive position. --- --- This calls out to the 'Evaluatable' instances, and can have other functions composed after it to e.g. intercept effects arising in the evaluation of the term. -evalTerm :: ( Carrier sig m - , AbstractValue term address value m - , AccessControls term - , Declarations term - , Evaluatable (Base term) - , FreeVariables term - , HasSpan term - , Member (Allocator address) sig - , Member (Bitwise value) sig - , Member (Boolean value) sig - , Member (Deref value) sig - , Member (Error (LoopControl value)) sig - , Member (Error (Return value)) sig - , Member (Function term address value) sig - , Member (Modules address value) sig - , Member (Numeric value) sig - , Member (Object address value) sig - , Member (Array value) sig - , Member (Hash value) sig - , Member (Reader ModuleInfo) sig - , Member (Reader PackageInfo) sig - , Member (Reader Span) sig - , Member (Resumable (BaseError (AddressError address value))) sig - , Member (Resumable (BaseError (HeapError address))) sig - , Member (Resumable (BaseError (ScopeError address))) sig - , Member (Resumable (BaseError (UnspecializedError address value))) sig - , Member (Resumable (BaseError (EvalError term address value))) sig - , Member (Resumable (BaseError ResolutionError)) sig - , Member (State (Heap address address value)) sig - , Member (State (ScopeGraph address)) sig - , Member (Abstract.String value) sig - , Member (Reader (CurrentFrame address)) sig - , Member (Reader (CurrentScope address)) sig - , Member (State Span) sig - , Member (Unit value) sig - , Member (While value) sig - , Member Fresh sig - , Member Trace sig - , Ord address - , Show address - , Recursive term - ) - => Open (term -> Evaluator term address value m value) - -> term -> Evaluator term address value m value --- NB: We use a lazy pattern match for the lambda’s argument to postpone evaluating the pair until eval/ref is called. -evalTerm perTerm = fst (fix (\ ~(ev, re) -> (perTerm (eval ev re . project), ref ev re . project))) diff --git a/src/Semantic/Api.hs b/src/Semantic/Api.hs deleted file mode 100644 index 54d1861ee8..0000000000 --- a/src/Semantic/Api.hs +++ /dev/null @@ -1,14 +0,0 @@ -module Semantic.Api - ( - module DiffsAPI - , module SymbolsAPI - , module TermsAPI - , module TOCSummariesAPI - , module Types - ) where - -import Semantic.Api.Diffs as DiffsAPI -import Semantic.Api.Symbols as SymbolsAPI -import Semantic.Api.Terms as TermsAPI -import Semantic.Api.TOCSummaries as TOCSummariesAPI -import Semantic.Api.V1.CodeAnalysisPB as Types diff --git a/src/Semantic/Api/Bridge.hs b/src/Semantic/Api/Bridge.hs deleted file mode 100644 index 43c904598f..0000000000 --- a/src/Semantic/Api/Bridge.hs +++ /dev/null @@ -1,116 +0,0 @@ -{-# LANGUAGE FunctionalDependencies, LambdaCase #-} -module Semantic.Api.Bridge - ( APIBridge (..) - , APIConvert (..) - , (#?) - ) where - -import Control.Lens -import qualified Data.Blob as Data -import qualified Data.Language as Data -import Data.Source (fromText, toText) -import qualified Data.Span as Data -import qualified Data.Text as T -import qualified Semantic.Api.LegacyTypes as Legacy -import qualified Semantic.Api.V1.CodeAnalysisPB as API - --- | An @APIBridge x y@ instance describes an isomorphism between @x@ and @y@. --- This is suitable for types such as 'Pos' which are representationally equivalent --- in their API, legacy, and native forms. All 'Lens' laws apply. --- --- Foreign to native: @x^.bridging@ --- Native to foreign: @bridging # x@ --- Native to 'Just' foreign: @bridging #? x@. --- 'Maybe' foreign to 'Maybe' native: @x >>= preview bridging@ -class APIBridge api native | api -> native where - bridging :: Iso' api native - --- | An @APIConvert x y@ instance describes a partial isomorphism between @x@ and @y@. --- This is suitable for types containing nested records therein, such as 'Span'. --- (The isomorphism must be partial, given that a protobuf record can have Nothing --- for all its fields, which means we cannot convert to a native format.) --- --- Foreign to native: this is a type error, unless the native is a Monoid --- Foreign to 'Maybe' native: @x^?converting@ --- Native to foreign: @converting # x@ --- Native to 'Just' foreign: @converting #? x@ -class APIConvert api native | api -> native where - converting :: Prism' api native - --- | A helper function for turning 'bridging' around and --- extracting 'Just' values from it. -(#?) :: AReview t s -> s -> Maybe t -rev #? item = item ^? re rev -infixr 8 #? - -instance APIBridge Legacy.Position Data.Pos where - bridging = iso fromAPI toAPI where - toAPI Data.Pos{..} = Legacy.Position posLine posColumn - fromAPI Legacy.Position{..} = Data.Pos line column - -instance APIBridge API.Position Data.Pos where - bridging = iso fromAPI toAPI where - toAPI Data.Pos{..} = API.Position (fromIntegral posLine) (fromIntegral posColumn) - fromAPI API.Position{..} = Data.Pos (fromIntegral line) (fromIntegral column) - -instance APIConvert API.Span Data.Span where - converting = prism' toAPI fromAPI where - toAPI Data.Span{..} = API.Span (bridging #? spanStart) (bridging #? spanEnd) - fromAPI API.Span{..} = Data.Span <$> (start >>= preview bridging) <*> (end >>= preview bridging) - -instance APIConvert Legacy.Span Data.Span where - converting = prism' toAPI fromAPI where - toAPI Data.Span{..} = Legacy.Span (bridging #? spanStart) (bridging #? spanEnd) - fromAPI Legacy.Span {..} = Data.Span <$> (start >>= preview bridging) <*> (end >>= preview bridging) - -instance APIBridge T.Text Data.Language where - bridging = iso apiLanguageToLanguage languageToApiLanguage where - languageToApiLanguage :: Data.Language -> T.Text - languageToApiLanguage = \case - Data.Unknown -> "Unknown" - Data.Go -> "Go" - Data.Haskell -> "Haskell" - Data.Java -> "Java" - Data.JavaScript -> "JavaScript" - Data.JSON -> "JSON" - Data.JSX -> "JSX" - Data.Markdown -> "Markdown" - Data.Python -> "Python" - Data.Ruby -> "Ruby" - Data.TypeScript -> "TypeScript" - Data.TSX -> "TSX" - Data.PHP -> "PHP" - - apiLanguageToLanguage :: T.Text -> Data.Language - apiLanguageToLanguage = \case - "Go" -> Data.Go - "Haskell" -> Data.Haskell - "Java" -> Data.Java - "JavaScript" -> Data.JavaScript - "JSON" -> Data.JSON - "JSX" -> Data.JSX - "Markdown" -> Data.Markdown - "Python" -> Data.Python - "Ruby" -> Data.Ruby - "TypeScript" -> Data.TypeScript - "TSX" -> Data.TSX - "PHP" -> Data.PHP - _ -> Data.Unknown - -instance APIBridge API.Blob Data.Blob where - bridging = iso apiBlobToBlob blobToApiBlob where - blobToApiBlob b = API.Blob (toText (Data.blobSource b)) (T.pack (Data.blobPath b)) (bridging # Data.blobLanguage b) - apiBlobToBlob API.Blob{..} = Data.makeBlob (fromText content) (T.unpack path) (language ^. bridging) mempty - - -instance APIConvert API.BlobPair Data.BlobPair where - converting = prism' blobPairToApiBlobPair apiBlobPairToBlobPair where - - apiBlobPairToBlobPair (API.BlobPair (Just before) (Just after)) = Just $ Data.Diffing (before^.bridging) (after^.bridging) - apiBlobPairToBlobPair (API.BlobPair (Just before) Nothing) = Just $ Data.Deleting (before^.bridging) - apiBlobPairToBlobPair (API.BlobPair Nothing (Just after)) = Just $ Data.Inserting (after^.bridging) - apiBlobPairToBlobPair _ = Nothing - - blobPairToApiBlobPair (Data.Diffing before after) = API.BlobPair (bridging #? before) (bridging #? after) - blobPairToApiBlobPair (Data.Inserting after) = API.BlobPair Nothing (bridging #? after) - blobPairToApiBlobPair (Data.Deleting before) = API.BlobPair (bridging #? before) Nothing diff --git a/src/Semantic/Api/Diffs.hs b/src/Semantic/Api/Diffs.hs deleted file mode 100644 index 025d63af38..0000000000 --- a/src/Semantic/Api/Diffs.hs +++ /dev/null @@ -1,149 +0,0 @@ -{-# LANGUAGE GADTs, ConstraintKinds, TypeOperators, RankNTypes #-} -module Semantic.Api.Diffs - ( parseDiffBuilder - , DiffOutputFormat(..) - , diffGraph - - , doDiff - , DiffEffects - - , SomeTermPair(..) - , withSomeTermPair - ) where - -import Analysis.ConstructorName (ConstructorName) -import Analysis.TOCSummary (HasDeclaration) -import Control.Effect -import Control.Effect.Error -import Control.Exception -import Control.Lens -import Control.Monad.IO.Class -import Data.Blob -import Data.ByteString.Builder -import Data.Diff -import Data.Graph -import Data.JSON.Fields -import Data.Language -import Data.Location -import Data.Term -import qualified Data.Text as T -import qualified Data.Vector as V -import Diffing.Algorithm (Diffable) -import Parsing.Parser -import Prologue -import Rendering.Graph -import Rendering.JSON hiding (JSON) -import qualified Rendering.JSON -import Semantic.Api.Bridge -import Semantic.Api.V1.CodeAnalysisPB hiding (Blob, BlobPair) -import Semantic.Task as Task -import Semantic.Telemetry as Stat -import Serializing.Format hiding (JSON) -import qualified Serializing.Format as Format - -data DiffOutputFormat - = DiffJSONTree - | DiffJSONGraph - | DiffSExpression - | DiffShow - | DiffDotGraph - deriving (Eq, Show) - -parseDiffBuilder :: (Traversable t, DiffEffects sig m) => DiffOutputFormat -> t BlobPair -> m Builder -parseDiffBuilder DiffJSONTree = distributeFoldMap (jsonDiff renderJSONTree) >=> serialize Format.JSON -- NB: Serialize happens at the top level for these two JSON formats to collect results of multiple blob pairs. -parseDiffBuilder DiffJSONGraph = diffGraph >=> serialize Format.JSON -parseDiffBuilder DiffSExpression = distributeFoldMap sexpDiff -parseDiffBuilder DiffShow = distributeFoldMap showDiff -parseDiffBuilder DiffDotGraph = distributeFoldMap dotGraphDiff - -type RenderJSON m syntax = forall syntax . CanDiff syntax => BlobPair -> Diff syntax Location Location -> m (Rendering.JSON.JSON "diffs" SomeJSON) - -jsonDiff :: (DiffEffects sig m) => RenderJSON m syntax -> BlobPair -> m (Rendering.JSON.JSON "diffs" SomeJSON) -jsonDiff f blobPair = doDiff blobPair (const pure) f `catchError` jsonError blobPair - -jsonError :: Applicative m => BlobPair -> SomeException -> m (Rendering.JSON.JSON "diffs" SomeJSON) -jsonError blobPair (SomeException e) = pure $ renderJSONDiffError blobPair (show e) - -renderJSONTree :: (Applicative m, ToJSONFields1 syntax) => BlobPair -> Diff syntax Location Location -> m (Rendering.JSON.JSON "diffs" SomeJSON) -renderJSONTree blobPair = pure . renderJSONDiff blobPair - -diffGraph :: (Traversable t, DiffEffects sig m) => t BlobPair -> m DiffTreeGraphResponse -diffGraph blobs = DiffTreeGraphResponse . V.fromList . toList <$> distributeFor blobs go - where - go :: (DiffEffects sig m) => BlobPair -> m DiffTreeFileGraph - go blobPair = doDiff blobPair (const pure) render - `catchError` \(SomeException e) -> - pure (DiffTreeFileGraph path lang mempty mempty (V.fromList [ParseError (T.pack (show e))])) - where - path = T.pack $ pathForBlobPair blobPair - lang = bridging # languageForBlobPair blobPair - - render :: (Foldable syntax, Functor syntax, ConstructorName syntax, Applicative m) => BlobPair -> Diff syntax Location Location -> m DiffTreeFileGraph - render _ diff = - let graph = renderTreeGraph diff - toEdge (Edge (a, b)) = DiffTreeEdge (diffVertexId a) (diffVertexId b) - in pure $ DiffTreeFileGraph path lang (V.fromList (vertexList graph)) (V.fromList (fmap toEdge (edgeList graph))) mempty - - -sexpDiff :: (DiffEffects sig m) => BlobPair -> m Builder -sexpDiff blobPair = doDiff blobPair (const pure) (const (serialize (SExpression ByConstructorName))) - -showDiff :: (DiffEffects sig m) => BlobPair -> m Builder -showDiff blobPair = doDiff blobPair (const pure) (const (serialize Show)) - -dotGraphDiff :: (DiffEffects sig m) => BlobPair -> m Builder -dotGraphDiff blobPair = doDiff blobPair (const pure) render - where render _ = serialize (DOT (diffStyle "diffs")) . renderTreeGraph - -type DiffEffects sig m = (Member (Error SomeException) sig, Member Telemetry sig, Member Distribute sig, Member Task sig, Carrier sig m, MonadIO m) - -type CanDiff syntax = (ConstructorName syntax, Diffable syntax, Eq1 syntax, HasDeclaration syntax, Hashable1 syntax, Show1 syntax, ToJSONFields1 syntax, Traversable syntax) -type Decorate m a b = forall syntax . CanDiff syntax => Blob -> Term syntax a -> m (Term syntax b) - -type TermPairConstraints = - '[ ConstructorName - , Diffable - , Eq1 - , HasDeclaration - , Hashable1 - , Show1 - , Traversable - , ToJSONFields1 - ] - -doDiff :: (DiffEffects sig m) - => BlobPair -> Decorate m Location ann -> (forall syntax . CanDiff syntax => BlobPair -> Diff syntax ann ann -> m output) -> m output -doDiff blobPair decorate render = do - SomeTermPair terms <- doParse blobPair decorate - diff <- diffTerms blobPair terms - render blobPair diff - -diffTerms :: (CanDiff syntax, Member Task sig, Member Telemetry sig, Carrier sig m, MonadIO m) - => BlobPair -> Join These (Term syntax ann) -> m (Diff syntax ann ann) -diffTerms blobs terms = time "diff" languageTag $ do - diff <- diff (runJoin terms) - diff <$ writeStat (Stat.count "diff.nodes" (bilength diff) languageTag) - where languageTag = languageTagForBlobPair blobs - -doParse :: (Member (Error SomeException) sig, Member Distribute sig, Member Task sig, Carrier sig m) - => BlobPair -> Decorate m Location ann -> m (SomeTermPair TermPairConstraints ann) -doParse blobPair decorate = case languageForBlobPair blobPair of - Go -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse goParser blob >>= decorate blob) - Haskell -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse haskellParser blob >>= decorate blob) - Java -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse javaParser blob >>= decorate blob) - JavaScript -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse tsxParser blob >>= decorate blob) - JSON -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse jsonParser blob >>= decorate blob) - JSX -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse tsxParser blob >>= decorate blob) - Markdown -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse markdownParser blob >>= decorate blob) - Python -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse pythonParser blob >>= decorate blob) - Ruby -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse rubyParser blob >>= decorate blob) - TypeScript -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse typescriptParser blob >>= decorate blob) - TSX -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse tsxParser blob >>= decorate blob) - PHP -> SomeTermPair <$> distributeFor blobPair (\ blob -> parse phpParser blob >>= decorate blob) - _ -> noLanguageForBlob (pathForBlobPair blobPair) - -data SomeTermPair typeclasses ann where - SomeTermPair :: ApplyAll typeclasses syntax => Join These (Term syntax ann) -> SomeTermPair typeclasses ann - -withSomeTermPair :: (forall syntax . ApplyAll typeclasses syntax => Join These (Term syntax ann) -> a) -> SomeTermPair typeclasses ann -> a -withSomeTermPair with (SomeTermPair terms) = with terms diff --git a/src/Semantic/Api/LegacyTypes.hs b/src/Semantic/Api/LegacyTypes.hs deleted file mode 100644 index 51aa8ff7bd..0000000000 --- a/src/Semantic/Api/LegacyTypes.hs +++ /dev/null @@ -1,70 +0,0 @@ -{-# LANGUAGE DerivingVia, DeriveAnyClass, DuplicateRecordFields #-} -module Semantic.Api.LegacyTypes - ( DiffTreeRequest(..) - , ParseTreeRequest(..) - , ParseTreeSymbolResponse(..) - , File(..) - , Symbol(..) - , Span(..) - , Position(..) - ) where - -import Data.Aeson -import Data.Blob hiding (File(..)) -import Prologue - -newtype DiffTreeRequest = DiffTreeRequest { blobs :: [BlobPair] } - deriving stock (Eq, Show, Generic) - deriving anyclass (FromJSON) - --- --- Legacy Symbols API --- - -newtype ParseTreeRequest = ParseTreeRequest { blobs :: [Blob] } - deriving stock (Eq, Show, Generic) - deriving anyclass (FromJSON) - -newtype ParseTreeSymbolResponse = ParseTreeSymbolResponse { files :: [File] } - deriving stock (Eq, Show, Generic) - deriving anyclass (ToJSON) - -data File = File - { filePath :: Text - , fileLanguage :: Text - , fileSymbols :: [Symbol] - } - deriving stock (Generic, Eq, Show) - -instance ToJSON File where - toJSON File{..} - = object [ "path" .= filePath - , "language" .= fileLanguage - , "symbols" .= fileSymbols - ] - -data Symbol = Symbol - { symbolName :: Text - , symbolKind :: Text - , symbolLine :: Text - , symbolSpan :: Maybe Span - } - deriving stock (Generic, Eq, Show) - -instance ToJSON Symbol where - toJSON Symbol{..} - = object [ "symbol" .= symbolName - , "kind" .= symbolKind - , "line" .= symbolLine - , "span" .= symbolSpan - ] - -data Position = Position { line :: Int, column :: Int } - deriving stock (Eq, Ord, Show, Generic) - -instance ToJSON Position - where toJSON Position{..} = toJSON [line, column] - -data Span = Span { start :: Maybe Position, end :: Maybe Position } - deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (ToJSON) diff --git a/src/Semantic/Api/Symbols.hs b/src/Semantic/Api/Symbols.hs deleted file mode 100644 index f72d099a70..0000000000 --- a/src/Semantic/Api/Symbols.hs +++ /dev/null @@ -1,90 +0,0 @@ -{-# LANGUAGE GADTs, TypeOperators, DerivingStrategies #-} -module Semantic.Api.Symbols - ( legacyParseSymbols - , parseSymbols - , parseSymbolsBuilder - ) where - -import Prelude hiding (span) - -import Control.Effect -import Control.Effect.Error -import Control.Exception -import Control.Lens -import Data.Blob hiding (File (..)) -import Data.ByteString.Builder -import Data.Location -import Data.Maybe -import Data.Term -import qualified Data.Text as T -import qualified Data.Vector as V -import Data.Text (pack) -import Parsing.Parser -import Prologue -import Semantic.Api.Bridge -import qualified Semantic.Api.LegacyTypes as Legacy -import Semantic.Api.Terms (ParseEffects, doParse) -import Semantic.Api.V1.CodeAnalysisPB hiding (Blob) -import Semantic.Task -import Serializing.Format -import Tags.Taggable -import Tags.Tagging - -legacyParseSymbols :: (Member Distribute sig, ParseEffects sig m, Traversable t) => t Blob -> m Legacy.ParseTreeSymbolResponse -legacyParseSymbols blobs = Legacy.ParseTreeSymbolResponse <$> distributeFoldMap go blobs - where - go :: (Member (Error SomeException) sig, Member Task sig, Carrier sig m) => Blob -> m [Legacy.File] - go blob@Blob{..} = (doParse blob >>= withSomeTerm renderToSymbols) `catchError` (\(SomeException _) -> pure (pure emptyFile)) - where - emptyFile = tagsToFile [] - - -- Legacy symbols output doesn't include Function Calls. - symbolsToSummarize :: [Text] - symbolsToSummarize = ["Function", "Method", "Class", "Module"] - - renderToSymbols :: (IsTaggable f, Applicative m) => Term f Location -> m [Legacy.File] - renderToSymbols = pure . pure . tagsToFile . runTagging blob symbolsToSummarize - - tagsToFile :: [Tag] -> Legacy.File - tagsToFile tags = Legacy.File (pack (blobPath blob)) (pack (show (blobLanguage blob))) (fmap tagToSymbol tags) - - tagToSymbol :: Tag -> Legacy.Symbol - tagToSymbol Tag{..} - = Legacy.Symbol - { symbolName = name - , symbolKind = kind - , symbolLine = fromMaybe mempty line - , symbolSpan = converting #? span - } - -parseSymbolsBuilder :: (Member Distribute sig, ParseEffects sig m, Traversable t) => Format ParseTreeSymbolResponse -> t Blob -> m Builder -parseSymbolsBuilder format blobs = parseSymbols blobs >>= serialize format - -parseSymbols :: (Member Distribute sig, ParseEffects sig m, Traversable t) => t Blob -> m ParseTreeSymbolResponse -parseSymbols blobs = ParseTreeSymbolResponse . V.fromList . toList <$> distributeFor blobs go - where - go :: (Member (Error SomeException) sig, Member Task sig, Carrier sig m) => Blob -> m File - go blob@Blob{..} = (doParse blob >>= withSomeTerm renderToSymbols) `catchError` (\(SomeException e) -> pure $ errorFile (show e)) - where - blobLanguage' = blobLanguage blob - blobPath' = pack $ blobPath blob - errorFile e = File blobPath' (bridging # blobLanguage blob) mempty (V.fromList [ParseError (T.pack e)]) blobOid - - symbolsToSummarize :: [Text] - symbolsToSummarize = ["Function", "Method", "Class", "Module", "Call", "Send"] - - renderToSymbols :: (IsTaggable f, Applicative m) => Term f Location -> m File - renderToSymbols term = pure $ tagsToFile (runTagging blob symbolsToSummarize term) - - tagsToFile :: [Tag] -> File - tagsToFile tags = File blobPath' (bridging # blobLanguage') (V.fromList (fmap tagToSymbol tags)) mempty blobOid - - tagToSymbol :: Tag -> Symbol - tagToSymbol Tag{..} - = Symbol - { symbol = name - , kind = kind - , line = fromMaybe mempty line - , span = converting #? span - , docs = fmap Docstring docs - } diff --git a/src/Semantic/Api/TOCSummaries.hs b/src/Semantic/Api/TOCSummaries.hs deleted file mode 100644 index c3eaab26fc..0000000000 --- a/src/Semantic/Api/TOCSummaries.hs +++ /dev/null @@ -1,64 +0,0 @@ -{-# LANGUAGE GADTs, TypeOperators, DerivingStrategies, LambdaCase #-} -module Semantic.Api.TOCSummaries (diffSummary, legacyDiffSummary, diffSummaryBuilder) where - -import Analysis.TOCSummary (Declaration, declarationAlgebra) -import Control.Effect.Error -import Control.Lens -import Data.Aeson -import Data.Blob -import Data.ByteString.Builder -import Data.Diff -import qualified Data.Map.Monoidal as Map -import Data.Span (emptySpan) -import qualified Data.Text as T -import qualified Data.Vector as V -import Rendering.TOC -import Semantic.Api.Diffs -import Semantic.Api.Bridge -import Semantic.Api.V1.CodeAnalysisPB hiding (Blob, BlobPair) -import Semantic.Task as Task -import Serializing.Format - -diffSummaryBuilder :: (DiffEffects sig m) => Format DiffTreeTOCResponse -> [BlobPair] -> m Builder -diffSummaryBuilder format blobs = diffSummary blobs >>= serialize format - -legacyDiffSummary :: (DiffEffects sig m) => [BlobPair] -> m Summaries -legacyDiffSummary = distributeFoldMap go - where - go :: (DiffEffects sig m) => BlobPair -> m Summaries - go blobPair = doDiff blobPair (decorate . declarationAlgebra) render - `catchError` \(SomeException e) -> - pure $ Summaries mempty (Map.singleton path [toJSON (ErrorSummary (T.pack (show e)) emptySpan lang)]) - where path = T.pack $ pathKeyForBlobPair blobPair - lang = languageForBlobPair blobPair - - render :: (Foldable syntax, Functor syntax, Applicative m) => BlobPair -> Diff syntax (Maybe Declaration) (Maybe Declaration) -> m Summaries - render blobPair = pure . renderToCDiff blobPair - -diffSummary :: (DiffEffects sig m) => [BlobPair] -> m DiffTreeTOCResponse -diffSummary blobs = DiffTreeTOCResponse . V.fromList <$> distributeFor blobs go - where - go :: (DiffEffects sig m) => BlobPair -> m TOCSummaryFile - go blobPair = doDiff blobPair (decorate . declarationAlgebra) render - `catchError` \(SomeException e) -> - pure $ TOCSummaryFile path lang mempty (V.fromList [TOCSummaryError (T.pack (show e)) Nothing]) - where path = T.pack $ pathKeyForBlobPair blobPair - lang = bridging # languageForBlobPair blobPair - - render :: (Foldable syntax, Functor syntax, Applicative m) => BlobPair -> Diff syntax (Maybe Declaration) (Maybe Declaration) -> m TOCSummaryFile - render blobPair diff = pure $ foldr go (TOCSummaryFile path lang mempty mempty) (diffTOC diff) - where - path = T.pack $ pathKeyForBlobPair blobPair - lang = bridging # languageForBlobPair blobPair - - toChangeType = \case - "added" -> Added - "modified" -> Modified - "removed" -> Removed - _ -> None - - go :: TOCSummary -> TOCSummaryFile -> TOCSummaryFile - go TOCSummary{..} TOCSummaryFile{..} - = TOCSummaryFile path language (V.cons (TOCSummaryChange summaryCategoryName summaryTermName (converting #? summarySpan) (toChangeType summaryChangeType)) changes) errors - go ErrorSummary{..} TOCSummaryFile{..} - = TOCSummaryFile path language changes (V.cons (TOCSummaryError errorText (converting #? errorSpan)) errors) diff --git a/src/Semantic/Api/Terms.hs b/src/Semantic/Api/Terms.hs deleted file mode 100644 index b76bcb31ab..0000000000 --- a/src/Semantic/Api/Terms.hs +++ /dev/null @@ -1,129 +0,0 @@ -{-# LANGUAGE ConstraintKinds, GADTs, TypeOperators, DerivingStrategies #-} -module Semantic.Api.Terms - ( - termGraph - , parseTermBuilder - , TermOutputFormat(..) - - , doParse - , ParseEffects - , TermConstraints - - , SomeTerm(..) - , withSomeTerm - ) where - - -import Analysis.ConstructorName (ConstructorName) -import Control.Effect -import Control.Effect.Error -import Control.Lens -import Control.Monad -import Control.Monad.IO.Class -import Data.Abstract.Declarations -import Data.Blob -import Data.ByteString.Builder -import Data.Either -import Data.Graph -import Data.JSON.Fields -import Data.Language -import Data.Location -import Data.Quieterm -import Data.Term -import qualified Data.Text as T -import qualified Data.Vector as V -import Parsing.Parser -import Prologue -import Rendering.Graph -import Rendering.JSON hiding (JSON) -import qualified Rendering.JSON -import Semantic.Api.Bridge -import Semantic.Api.V1.CodeAnalysisPB hiding (Blob) -import Semantic.Task -import Serializing.Format hiding (JSON) -import qualified Serializing.Format as Format -import Tags.Taggable - -termGraph :: (Traversable t, Member Distribute sig, ParseEffects sig m) => t Blob -> m ParseTreeGraphResponse -termGraph blobs = ParseTreeGraphResponse . V.fromList . toList <$> distributeFor blobs go - where - go :: ParseEffects sig m => Blob -> m ParseTreeFileGraph - go blob = (doParse blob >>= withSomeTerm (pure . render)) - `catchError` \(SomeException e) -> - pure (ParseTreeFileGraph path lang mempty mempty (V.fromList [ParseError (T.pack (show e))])) - where - path = T.pack $ blobPath blob - lang = bridging # blobLanguage blob - - render :: (Foldable syntax, Functor syntax, ConstructorName syntax) => Term syntax Location -> ParseTreeFileGraph - render t = let graph = renderTreeGraph t - toEdge (Edge (a, b)) = TermEdge (vertexId a) (vertexId b) - in ParseTreeFileGraph path lang (V.fromList (vertexList graph)) (V.fromList (fmap toEdge (edgeList graph))) mempty - -data TermOutputFormat - = TermJSONTree - | TermJSONGraph - | TermSExpression - | TermDotGraph - | TermShow - | TermQuiet - deriving (Eq, Show) - -parseTermBuilder :: (Traversable t, Member Distribute sig, ParseEffects sig m, MonadIO m) - => TermOutputFormat-> t Blob -> m Builder -parseTermBuilder TermJSONTree = distributeFoldMap jsonTerm >=> serialize Format.JSON -- NB: Serialize happens at the top level for these two JSON formats to collect results of multiple blobs. -parseTermBuilder TermJSONGraph = termGraph >=> serialize Format.JSON -parseTermBuilder TermSExpression = distributeFoldMap sexpTerm -parseTermBuilder TermDotGraph = distributeFoldMap dotGraphTerm -parseTermBuilder TermShow = distributeFoldMap showTerm -parseTermBuilder TermQuiet = distributeFoldMap quietTerm - -jsonTerm :: (ParseEffects sig m) => Blob -> m (Rendering.JSON.JSON "trees" SomeJSON) -jsonTerm blob = (doParse blob >>= withSomeTerm (pure . renderJSONTerm blob)) `catchError` jsonError blob - -jsonError :: Applicative m => Blob -> SomeException -> m (Rendering.JSON.JSON "trees" SomeJSON) -jsonError blob (SomeException e) = pure $ renderJSONError blob (show e) - -sexpTerm :: (ParseEffects sig m) => Blob -> m Builder -sexpTerm = doParse >=> withSomeTerm (serialize (SExpression ByConstructorName)) - -dotGraphTerm :: (ParseEffects sig m) => Blob -> m Builder -dotGraphTerm = doParse >=> withSomeTerm (serialize (DOT (termStyle "terms")) . renderTreeGraph) - -showTerm :: (ParseEffects sig m) => Blob -> m Builder -showTerm = doParse >=> withSomeTerm (serialize Show . quieterm) - -quietTerm :: (ParseEffects sig m, MonadIO m) => Blob -> m Builder -quietTerm blob = showTiming blob <$> time' ( (doParse blob >>= withSomeTerm (fmap (const (Right ())) . serialize Show . quieterm)) `catchError` timingError ) - where - timingError (SomeException e) = pure (Left (show e)) - showTiming Blob{..} (res, duration) = - let status = if isLeft res then "ERR" else "OK" - in stringUtf8 (status <> "\t" <> show (blobLanguage blob) <> "\t" <> blobPath blob <> "\t" <> show duration <> " ms\n") - - -type ParseEffects sig m = (Member (Error SomeException) sig, Member Task sig, Carrier sig m) - -type TermConstraints = - '[ Taggable - , Declarations1 - , ConstructorName - , HasTextElement - , ToJSONFields1 - ] - -doParse :: (ParseEffects sig m) => Blob -> m (SomeTerm TermConstraints Location) -doParse blob = case blobLanguage blob of - Go -> SomeTerm <$> parse goParser blob - Haskell -> SomeTerm <$> parse haskellParser blob - Java -> SomeTerm <$> parse javaParser blob - JavaScript -> SomeTerm <$> parse tsxParser blob - JSON -> SomeTerm <$> parse jsonParser blob - JSX -> SomeTerm <$> parse tsxParser blob - Markdown -> SomeTerm <$> parse markdownParser blob - Python -> SomeTerm <$> parse pythonParser blob - Ruby -> SomeTerm <$> parse rubyParser blob - TypeScript -> SomeTerm <$> parse typescriptParser blob - TSX -> SomeTerm <$> parse tsxParser blob - PHP -> SomeTerm <$> parse phpParser blob - _ -> noLanguageForBlob (blobPath blob) diff --git a/src/Semantic/Api/V1/CodeAnalysisPB.hs b/src/Semantic/Api/V1/CodeAnalysisPB.hs deleted file mode 100644 index 6912350098..0000000000 --- a/src/Semantic/Api/V1/CodeAnalysisPB.hs +++ /dev/null @@ -1,1368 +0,0 @@ --- Code generated by protoc-gen-haskell 0.1.0, DO NOT EDIT. -{-# LANGUAGE DerivingVia, DeriveAnyClass, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-unused-imports -Wno-missing-export-lists #-} -module Semantic.Api.V1.CodeAnalysisPB where - -import Control.DeepSeq -import Control.Monad (msum) -import qualified Data.Aeson as A -import qualified Data.Aeson.Encoding as E -import Data.ByteString (ByteString) -import Data.Int -import Data.Text (Text) -import qualified Data.Text as T -import Data.Vector (Vector) -import Data.Word -import GHC.Generics -import Proto3.Suite (decodeMessageField, encodeMessageField, nestedvec, packedvec) -import qualified Proto3.Suite as Proto3 -import Proto3.Suite.JSONPB as JSONPB -import Proto3.Wire (at, oneof) - -data PingRequest = PingRequest - { service :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB PingRequest where - parseJSONPB = A.withObject "PingRequest" $ \obj -> PingRequest - <$> obj .: "service" - -instance ToJSONPB PingRequest where - toJSONPB PingRequest{..} = object - [ - "service" .= service - ] - toEncodingPB PingRequest{..} = pairs - [ - "service" .= service - ] - -instance FromJSON PingRequest where - parseJSON = parseJSONPB - -instance ToJSON PingRequest where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message PingRequest where - encodeMessage _ PingRequest{..} = mconcat - [ - encodeMessageField 1 service - ] - decodeMessage _ = PingRequest - <$> at decodeMessageField 1 - dotProto = undefined - -data PingResponse = PingResponse - { status :: Text - , hostname :: Text - , timestamp :: Text - , sha :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB PingResponse where - parseJSONPB = A.withObject "PingResponse" $ \obj -> PingResponse - <$> obj .: "status" - <*> obj .: "hostname" - <*> obj .: "timestamp" - <*> obj .: "sha" - -instance ToJSONPB PingResponse where - toJSONPB PingResponse{..} = object - [ - "status" .= status - , "hostname" .= hostname - , "timestamp" .= timestamp - , "sha" .= sha - ] - toEncodingPB PingResponse{..} = pairs - [ - "status" .= status - , "hostname" .= hostname - , "timestamp" .= timestamp - , "sha" .= sha - ] - -instance FromJSON PingResponse where - parseJSON = parseJSONPB - -instance ToJSON PingResponse where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message PingResponse where - encodeMessage _ PingResponse{..} = mconcat - [ - encodeMessageField 1 status - , encodeMessageField 2 hostname - , encodeMessageField 3 timestamp - , encodeMessageField 4 sha - ] - decodeMessage _ = PingResponse - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - <*> at decodeMessageField 4 - dotProto = undefined - -data ParseTreeRequest = ParseTreeRequest - { blobs :: Vector Blob - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ParseTreeRequest where - parseJSONPB = A.withObject "ParseTreeRequest" $ \obj -> ParseTreeRequest - <$> obj .: "blobs" - -instance ToJSONPB ParseTreeRequest where - toJSONPB ParseTreeRequest{..} = object - [ - "blobs" .= blobs - ] - toEncodingPB ParseTreeRequest{..} = pairs - [ - "blobs" .= blobs - ] - -instance FromJSON ParseTreeRequest where - parseJSON = parseJSONPB - -instance ToJSON ParseTreeRequest where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ParseTreeRequest where - encodeMessage _ ParseTreeRequest{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec blobs) - ] - decodeMessage _ = ParseTreeRequest - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data ParseTreeSymbolResponse = ParseTreeSymbolResponse - { files :: Vector File - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ParseTreeSymbolResponse where - parseJSONPB = A.withObject "ParseTreeSymbolResponse" $ \obj -> ParseTreeSymbolResponse - <$> obj .: "files" - -instance ToJSONPB ParseTreeSymbolResponse where - toJSONPB ParseTreeSymbolResponse{..} = object - [ - "files" .= files - ] - toEncodingPB ParseTreeSymbolResponse{..} = pairs - [ - "files" .= files - ] - -instance FromJSON ParseTreeSymbolResponse where - parseJSON = parseJSONPB - -instance ToJSON ParseTreeSymbolResponse where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ParseTreeSymbolResponse where - encodeMessage _ ParseTreeSymbolResponse{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec files) - ] - decodeMessage _ = ParseTreeSymbolResponse - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data ParseTreeGraphResponse = ParseTreeGraphResponse - { files :: Vector ParseTreeFileGraph - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ParseTreeGraphResponse where - parseJSONPB = A.withObject "ParseTreeGraphResponse" $ \obj -> ParseTreeGraphResponse - <$> obj .: "files" - -instance ToJSONPB ParseTreeGraphResponse where - toJSONPB ParseTreeGraphResponse{..} = object - [ - "files" .= files - ] - toEncodingPB ParseTreeGraphResponse{..} = pairs - [ - "files" .= files - ] - -instance FromJSON ParseTreeGraphResponse where - parseJSON = parseJSONPB - -instance ToJSON ParseTreeGraphResponse where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ParseTreeGraphResponse where - encodeMessage _ ParseTreeGraphResponse{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec files) - ] - decodeMessage _ = ParseTreeGraphResponse - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data ParseTreeFileGraph = ParseTreeFileGraph - { path :: Text - , language :: Text - , vertices :: Vector TermVertex - , edges :: Vector TermEdge - , errors :: Vector ParseError - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ParseTreeFileGraph where - parseJSONPB = A.withObject "ParseTreeFileGraph" $ \obj -> ParseTreeFileGraph - <$> obj .: "path" - <*> obj .: "language" - <*> obj .: "vertices" - <*> obj .: "edges" - <*> obj .: "errors" - -instance ToJSONPB ParseTreeFileGraph where - toJSONPB ParseTreeFileGraph{..} = object - [ - "path" .= path - , "language" .= language - , "vertices" .= vertices - , "edges" .= edges - , "errors" .= errors - ] - toEncodingPB ParseTreeFileGraph{..} = pairs - [ - "path" .= path - , "language" .= language - , "vertices" .= vertices - , "edges" .= edges - , "errors" .= errors - ] - -instance FromJSON ParseTreeFileGraph where - parseJSON = parseJSONPB - -instance ToJSON ParseTreeFileGraph where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ParseTreeFileGraph where - encodeMessage _ ParseTreeFileGraph{..} = mconcat - [ - encodeMessageField 1 path - , encodeMessageField 2 language - , encodeMessageField 3 (Proto3.NestedVec vertices) - , encodeMessageField 4 (Proto3.NestedVec edges) - , encodeMessageField 5 (Proto3.NestedVec errors) - ] - decodeMessage _ = ParseTreeFileGraph - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> (nestedvec <$> at decodeMessageField 3) - <*> (nestedvec <$> at decodeMessageField 4) - <*> (nestedvec <$> at decodeMessageField 5) - dotProto = undefined - -data TermEdge = TermEdge - { source :: Int32 - , target :: Int32 - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB TermEdge where - parseJSONPB = A.withObject "TermEdge" $ \obj -> TermEdge - <$> obj .: "source" - <*> obj .: "target" - -instance ToJSONPB TermEdge where - toJSONPB TermEdge{..} = object - [ - "source" .= source - , "target" .= target - ] - toEncodingPB TermEdge{..} = pairs - [ - "source" .= source - , "target" .= target - ] - -instance FromJSON TermEdge where - parseJSON = parseJSONPB - -instance ToJSON TermEdge where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message TermEdge where - encodeMessage _ TermEdge{..} = mconcat - [ - encodeMessageField 1 source - , encodeMessageField 2 target - ] - decodeMessage _ = TermEdge - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data TermVertex = TermVertex - { vertexId :: Int32 - , term :: Text - , span :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB TermVertex where - parseJSONPB = A.withObject "TermVertex" $ \obj -> TermVertex - <$> obj .: "vertexId" - <*> obj .: "term" - <*> obj .: "span" - -instance ToJSONPB TermVertex where - toJSONPB TermVertex{..} = object - [ - "vertexId" .= vertexId - , "term" .= term - , "span" .= span - ] - toEncodingPB TermVertex{..} = pairs - [ - "vertexId" .= vertexId - , "term" .= term - , "span" .= span - ] - -instance FromJSON TermVertex where - parseJSON = parseJSONPB - -instance ToJSON TermVertex where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message TermVertex where - encodeMessage _ TermVertex{..} = mconcat - [ - encodeMessageField 1 vertexId - , encodeMessageField 2 term - , encodeMessageField 3 (Proto3.Nested span) - ] - decodeMessage _ = TermVertex - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - dotProto = undefined - -data ParseError = ParseError - { error :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ParseError where - parseJSONPB = A.withObject "ParseError" $ \obj -> ParseError - <$> obj .: "error" - -instance ToJSONPB ParseError where - toJSONPB ParseError{..} = object - [ - "error" .= error - ] - toEncodingPB ParseError{..} = pairs - [ - "error" .= error - ] - -instance FromJSON ParseError where - parseJSON = parseJSONPB - -instance ToJSON ParseError where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ParseError where - encodeMessage _ ParseError{..} = mconcat - [ - encodeMessageField 1 error - ] - decodeMessage _ = ParseError - <$> at decodeMessageField 1 - dotProto = undefined - -data DiffTreeRequest = DiffTreeRequest - { blobs :: Vector BlobPair - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeRequest where - parseJSONPB = A.withObject "DiffTreeRequest" $ \obj -> DiffTreeRequest - <$> obj .: "blobs" - -instance ToJSONPB DiffTreeRequest where - toJSONPB DiffTreeRequest{..} = object - [ - "blobs" .= blobs - ] - toEncodingPB DiffTreeRequest{..} = pairs - [ - "blobs" .= blobs - ] - -instance FromJSON DiffTreeRequest where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeRequest where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeRequest where - encodeMessage _ DiffTreeRequest{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec blobs) - ] - decodeMessage _ = DiffTreeRequest - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data DiffTreeTOCResponse = DiffTreeTOCResponse - { files :: Vector TOCSummaryFile - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeTOCResponse where - parseJSONPB = A.withObject "DiffTreeTOCResponse" $ \obj -> DiffTreeTOCResponse - <$> obj .: "files" - -instance ToJSONPB DiffTreeTOCResponse where - toJSONPB DiffTreeTOCResponse{..} = object - [ - "files" .= files - ] - toEncodingPB DiffTreeTOCResponse{..} = pairs - [ - "files" .= files - ] - -instance FromJSON DiffTreeTOCResponse where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeTOCResponse where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeTOCResponse where - encodeMessage _ DiffTreeTOCResponse{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec files) - ] - decodeMessage _ = DiffTreeTOCResponse - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data TOCSummaryFile = TOCSummaryFile - { path :: Text - , language :: Text - , changes :: Vector TOCSummaryChange - , errors :: Vector TOCSummaryError - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB TOCSummaryFile where - parseJSONPB = A.withObject "TOCSummaryFile" $ \obj -> TOCSummaryFile - <$> obj .: "path" - <*> obj .: "language" - <*> obj .: "changes" - <*> obj .: "errors" - -instance ToJSONPB TOCSummaryFile where - toJSONPB TOCSummaryFile{..} = object - [ - "path" .= path - , "language" .= language - , "changes" .= changes - , "errors" .= errors - ] - toEncodingPB TOCSummaryFile{..} = pairs - [ - "path" .= path - , "language" .= language - , "changes" .= changes - , "errors" .= errors - ] - -instance FromJSON TOCSummaryFile where - parseJSON = parseJSONPB - -instance ToJSON TOCSummaryFile where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message TOCSummaryFile where - encodeMessage _ TOCSummaryFile{..} = mconcat - [ - encodeMessageField 1 path - , encodeMessageField 2 language - , encodeMessageField 3 (Proto3.NestedVec changes) - , encodeMessageField 4 (Proto3.NestedVec errors) - ] - decodeMessage _ = TOCSummaryFile - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> (nestedvec <$> at decodeMessageField 3) - <*> (nestedvec <$> at decodeMessageField 4) - dotProto = undefined - -data TOCSummaryChange = TOCSummaryChange - { category :: Text - , term :: Text - , span :: Maybe Span - , changeType :: ChangeType - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB TOCSummaryChange where - parseJSONPB = A.withObject "TOCSummaryChange" $ \obj -> TOCSummaryChange - <$> obj .: "category" - <*> obj .: "term" - <*> obj .: "span" - <*> obj .: "changeType" - -instance ToJSONPB TOCSummaryChange where - toJSONPB TOCSummaryChange{..} = object - [ - "category" .= category - , "term" .= term - , "span" .= span - , "changeType" .= changeType - ] - toEncodingPB TOCSummaryChange{..} = pairs - [ - "category" .= category - , "term" .= term - , "span" .= span - , "changeType" .= changeType - ] - -instance FromJSON TOCSummaryChange where - parseJSON = parseJSONPB - -instance ToJSON TOCSummaryChange where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message TOCSummaryChange where - encodeMessage _ TOCSummaryChange{..} = mconcat - [ - encodeMessageField 1 category - , encodeMessageField 2 term - , encodeMessageField 3 (Proto3.Nested span) - , encodeMessageField 4 changeType - ] - decodeMessage _ = TOCSummaryChange - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - <*> at decodeMessageField 4 - dotProto = undefined - -data TOCSummaryError = TOCSummaryError - { error :: Text - , span :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB TOCSummaryError where - parseJSONPB = A.withObject "TOCSummaryError" $ \obj -> TOCSummaryError - <$> obj .: "error" - <*> obj .: "span" - -instance ToJSONPB TOCSummaryError where - toJSONPB TOCSummaryError{..} = object - [ - "error" .= error - , "span" .= span - ] - toEncodingPB TOCSummaryError{..} = pairs - [ - "error" .= error - , "span" .= span - ] - -instance FromJSON TOCSummaryError where - parseJSON = parseJSONPB - -instance ToJSON TOCSummaryError where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message TOCSummaryError where - encodeMessage _ TOCSummaryError{..} = mconcat - [ - encodeMessageField 1 error - , encodeMessageField 2 (Proto3.Nested span) - ] - decodeMessage _ = TOCSummaryError - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data DiffTreeGraphResponse = DiffTreeGraphResponse - { files :: Vector DiffTreeFileGraph - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeGraphResponse where - parseJSONPB = A.withObject "DiffTreeGraphResponse" $ \obj -> DiffTreeGraphResponse - <$> obj .: "files" - -instance ToJSONPB DiffTreeGraphResponse where - toJSONPB DiffTreeGraphResponse{..} = object - [ - "files" .= files - ] - toEncodingPB DiffTreeGraphResponse{..} = pairs - [ - "files" .= files - ] - -instance FromJSON DiffTreeGraphResponse where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeGraphResponse where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeGraphResponse where - encodeMessage _ DiffTreeGraphResponse{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec files) - ] - decodeMessage _ = DiffTreeGraphResponse - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data DiffTreeFileGraph = DiffTreeFileGraph - { path :: Text - , language :: Text - , vertices :: Vector DiffTreeVertex - , edges :: Vector DiffTreeEdge - , errors :: Vector ParseError - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeFileGraph where - parseJSONPB = A.withObject "DiffTreeFileGraph" $ \obj -> DiffTreeFileGraph - <$> obj .: "path" - <*> obj .: "language" - <*> obj .: "vertices" - <*> obj .: "edges" - <*> obj .: "errors" - -instance ToJSONPB DiffTreeFileGraph where - toJSONPB DiffTreeFileGraph{..} = object - [ - "path" .= path - , "language" .= language - , "vertices" .= vertices - , "edges" .= edges - , "errors" .= errors - ] - toEncodingPB DiffTreeFileGraph{..} = pairs - [ - "path" .= path - , "language" .= language - , "vertices" .= vertices - , "edges" .= edges - , "errors" .= errors - ] - -instance FromJSON DiffTreeFileGraph where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeFileGraph where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeFileGraph where - encodeMessage _ DiffTreeFileGraph{..} = mconcat - [ - encodeMessageField 1 path - , encodeMessageField 2 language - , encodeMessageField 3 (Proto3.NestedVec vertices) - , encodeMessageField 4 (Proto3.NestedVec edges) - , encodeMessageField 5 (Proto3.NestedVec errors) - ] - decodeMessage _ = DiffTreeFileGraph - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> (nestedvec <$> at decodeMessageField 3) - <*> (nestedvec <$> at decodeMessageField 4) - <*> (nestedvec <$> at decodeMessageField 5) - dotProto = undefined - -data DiffTreeEdge = DiffTreeEdge - { source :: Int32 - , target :: Int32 - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeEdge where - parseJSONPB = A.withObject "DiffTreeEdge" $ \obj -> DiffTreeEdge - <$> obj .: "source" - <*> obj .: "target" - -instance ToJSONPB DiffTreeEdge where - toJSONPB DiffTreeEdge{..} = object - [ - "source" .= source - , "target" .= target - ] - toEncodingPB DiffTreeEdge{..} = pairs - [ - "source" .= source - , "target" .= target - ] - -instance FromJSON DiffTreeEdge where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeEdge where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeEdge where - encodeMessage _ DiffTreeEdge{..} = mconcat - [ - encodeMessageField 1 source - , encodeMessageField 2 target - ] - decodeMessage _ = DiffTreeEdge - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data DiffTreeVertexDiffTerm - = Deleted (Maybe DeletedTerm) - | Inserted (Maybe InsertedTerm) - | Replaced (Maybe ReplacedTerm) - | Merged (Maybe MergedTerm) - deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Message, Proto3.Named, NFData) - -instance FromJSONPB DiffTreeVertexDiffTerm where - parseJSONPB = A.withObject "DiffTreeVertexDiffTerm" $ \obj -> msum - [ - Deleted <$> parseField obj "deleted" - , Inserted <$> parseField obj "inserted" - , Replaced <$> parseField obj "replaced" - , Merged <$> parseField obj "merged" - ] - -instance ToJSONPB DiffTreeVertexDiffTerm where - toJSONPB (Deleted x) = object [ "deleted" .= x ] - toJSONPB (Inserted x) = object [ "inserted" .= x ] - toJSONPB (Replaced x) = object [ "replaced" .= x ] - toJSONPB (Merged x) = object [ "merged" .= x ] - toEncodingPB (Deleted x) = pairs [ "deleted" .= x ] - toEncodingPB (Inserted x) = pairs [ "inserted" .= x ] - toEncodingPB (Replaced x) = pairs [ "replaced" .= x ] - toEncodingPB (Merged x) = pairs [ "merged" .= x ] - -instance FromJSON DiffTreeVertexDiffTerm where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeVertexDiffTerm where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -data DiffTreeVertex = DiffTreeVertex - { diffVertexId :: Int32 - , diffTerm :: Maybe DiffTreeVertexDiffTerm - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeVertex where - parseJSONPB = A.withObject "DiffTreeVertex" $ \obj -> DiffTreeVertex - <$> obj .: "diffVertexId" - <*> obj .: "diffTerm" - -instance ToJSONPB DiffTreeVertex where - toJSONPB DiffTreeVertex{..} = object - [ - "diffVertexId" .= diffVertexId - , "diffTerm" .= diffTerm - ] - toEncodingPB DiffTreeVertex{..} = pairs - [ - "diffVertexId" .= diffVertexId - , "diffTerm" .= diffTerm - ] - -instance FromJSON DiffTreeVertex where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeVertex where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeVertex where - encodeMessage _ DiffTreeVertex{..} = mconcat - [ - encodeMessageField 1 diffVertexId - , case diffTerm of - Nothing -> mempty - Just (Deleted deleted) -> encodeMessageField 2 deleted - Just (Inserted inserted) -> encodeMessageField 3 inserted - Just (Replaced replaced) -> encodeMessageField 4 replaced - Just (Merged merged) -> encodeMessageField 5 merged - ] - decodeMessage _ = DiffTreeVertex - <$> at decodeMessageField 1 - <*> oneof - Nothing - [ - (2, Just . Deleted <$> decodeMessageField) - , (3, Just . Inserted <$> decodeMessageField) - , (4, Just . Replaced <$> decodeMessageField) - , (5, Just . Merged <$> decodeMessageField) - ] - dotProto = undefined - -data DeletedTerm = DeletedTerm - { term :: Text - , span :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DeletedTerm where - parseJSONPB = A.withObject "DeletedTerm" $ \obj -> DeletedTerm - <$> obj .: "term" - <*> obj .: "span" - -instance ToJSONPB DeletedTerm where - toJSONPB DeletedTerm{..} = object - [ - "term" .= term - , "span" .= span - ] - toEncodingPB DeletedTerm{..} = pairs - [ - "term" .= term - , "span" .= span - ] - -instance FromJSON DeletedTerm where - parseJSON = parseJSONPB - -instance ToJSON DeletedTerm where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DeletedTerm where - encodeMessage _ DeletedTerm{..} = mconcat - [ - encodeMessageField 1 term - , encodeMessageField 2 (Proto3.Nested span) - ] - decodeMessage _ = DeletedTerm - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data InsertedTerm = InsertedTerm - { term :: Text - , span :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB InsertedTerm where - parseJSONPB = A.withObject "InsertedTerm" $ \obj -> InsertedTerm - <$> obj .: "term" - <*> obj .: "span" - -instance ToJSONPB InsertedTerm where - toJSONPB InsertedTerm{..} = object - [ - "term" .= term - , "span" .= span - ] - toEncodingPB InsertedTerm{..} = pairs - [ - "term" .= term - , "span" .= span - ] - -instance FromJSON InsertedTerm where - parseJSON = parseJSONPB - -instance ToJSON InsertedTerm where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message InsertedTerm where - encodeMessage _ InsertedTerm{..} = mconcat - [ - encodeMessageField 1 term - , encodeMessageField 2 (Proto3.Nested span) - ] - decodeMessage _ = InsertedTerm - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data ReplacedTerm = ReplacedTerm - { beforeTerm :: Text - , beforeSpan :: Maybe Span - , afterTerm :: Text - , afterSpan :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ReplacedTerm where - parseJSONPB = A.withObject "ReplacedTerm" $ \obj -> ReplacedTerm - <$> obj .: "beforeTerm" - <*> obj .: "beforeSpan" - <*> obj .: "afterTerm" - <*> obj .: "afterSpan" - -instance ToJSONPB ReplacedTerm where - toJSONPB ReplacedTerm{..} = object - [ - "beforeTerm" .= beforeTerm - , "beforeSpan" .= beforeSpan - , "afterTerm" .= afterTerm - , "afterSpan" .= afterSpan - ] - toEncodingPB ReplacedTerm{..} = pairs - [ - "beforeTerm" .= beforeTerm - , "beforeSpan" .= beforeSpan - , "afterTerm" .= afterTerm - , "afterSpan" .= afterSpan - ] - -instance FromJSON ReplacedTerm where - parseJSON = parseJSONPB - -instance ToJSON ReplacedTerm where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ReplacedTerm where - encodeMessage _ ReplacedTerm{..} = mconcat - [ - encodeMessageField 1 beforeTerm - , encodeMessageField 2 (Proto3.Nested beforeSpan) - , encodeMessageField 3 afterTerm - , encodeMessageField 4 (Proto3.Nested afterSpan) - ] - decodeMessage _ = ReplacedTerm - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - <*> at decodeMessageField 4 - dotProto = undefined - -data MergedTerm = MergedTerm - { term :: Text - , beforeSpan :: Maybe Span - , afterSpan :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB MergedTerm where - parseJSONPB = A.withObject "MergedTerm" $ \obj -> MergedTerm - <$> obj .: "term" - <*> obj .: "beforeSpan" - <*> obj .: "afterSpan" - -instance ToJSONPB MergedTerm where - toJSONPB MergedTerm{..} = object - [ - "term" .= term - , "beforeSpan" .= beforeSpan - , "afterSpan" .= afterSpan - ] - toEncodingPB MergedTerm{..} = pairs - [ - "term" .= term - , "beforeSpan" .= beforeSpan - , "afterSpan" .= afterSpan - ] - -instance FromJSON MergedTerm where - parseJSON = parseJSONPB - -instance ToJSON MergedTerm where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message MergedTerm where - encodeMessage _ MergedTerm{..} = mconcat - [ - encodeMessageField 1 term - , encodeMessageField 2 (Proto3.Nested beforeSpan) - , encodeMessageField 3 (Proto3.Nested afterSpan) - ] - decodeMessage _ = MergedTerm - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - dotProto = undefined - -data Blob = Blob - { content :: Text - , path :: Text - , language :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB Blob where - parseJSONPB = A.withObject "Blob" $ \obj -> Blob - <$> obj .: "content" - <*> obj .: "path" - <*> obj .: "language" - -instance ToJSONPB Blob where - toJSONPB Blob{..} = object - [ - "content" .= content - , "path" .= path - , "language" .= language - ] - toEncodingPB Blob{..} = pairs - [ - "content" .= content - , "path" .= path - , "language" .= language - ] - -instance FromJSON Blob where - parseJSON = parseJSONPB - -instance ToJSON Blob where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message Blob where - encodeMessage _ Blob{..} = mconcat - [ - encodeMessageField 1 content - , encodeMessageField 2 path - , encodeMessageField 3 language - ] - decodeMessage _ = Blob - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - dotProto = undefined - -data BlobPair = BlobPair - { before :: Maybe Blob - , after :: Maybe Blob - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB BlobPair where - parseJSONPB = A.withObject "BlobPair" $ \obj -> BlobPair - <$> obj .: "before" - <*> obj .: "after" - -instance ToJSONPB BlobPair where - toJSONPB BlobPair{..} = object - [ - "before" .= before - , "after" .= after - ] - toEncodingPB BlobPair{..} = pairs - [ - "before" .= before - , "after" .= after - ] - -instance FromJSON BlobPair where - parseJSON = parseJSONPB - -instance ToJSON BlobPair where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message BlobPair where - encodeMessage _ BlobPair{..} = mconcat - [ - encodeMessageField 1 (Proto3.Nested before) - , encodeMessageField 2 (Proto3.Nested after) - ] - decodeMessage _ = BlobPair - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data File = File - { path :: Text - , language :: Text - , symbols :: Vector Symbol - , errors :: Vector ParseError - , blobOid :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB File where - parseJSONPB = A.withObject "File" $ \obj -> File - <$> obj .: "path" - <*> obj .: "language" - <*> obj .: "symbols" - <*> obj .: "errors" - <*> obj .: "blobOid" - -instance ToJSONPB File where - toJSONPB File{..} = object - [ - "path" .= path - , "language" .= language - , "symbols" .= symbols - , "errors" .= errors - , "blobOid" .= blobOid - ] - toEncodingPB File{..} = pairs - [ - "path" .= path - , "language" .= language - , "symbols" .= symbols - , "errors" .= errors - , "blobOid" .= blobOid - ] - -instance FromJSON File where - parseJSON = parseJSONPB - -instance ToJSON File where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message File where - encodeMessage _ File{..} = mconcat - [ - encodeMessageField 1 path - , encodeMessageField 2 language - , encodeMessageField 3 (Proto3.NestedVec symbols) - , encodeMessageField 4 (Proto3.NestedVec errors) - , encodeMessageField 5 blobOid - ] - decodeMessage _ = File - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> (nestedvec <$> at decodeMessageField 3) - <*> (nestedvec <$> at decodeMessageField 4) - <*> at decodeMessageField 5 - dotProto = undefined - -data Symbol = Symbol - { symbol :: Text - , kind :: Text - , line :: Text - , span :: Maybe Span - , docs :: Maybe Docstring - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB Symbol where - parseJSONPB = A.withObject "Symbol" $ \obj -> Symbol - <$> obj .: "symbol" - <*> obj .: "kind" - <*> obj .: "line" - <*> obj .: "span" - <*> obj .: "docs" - -instance ToJSONPB Symbol where - toJSONPB Symbol{..} = object - [ - "symbol" .= symbol - , "kind" .= kind - , "line" .= line - , "span" .= span - , "docs" .= docs - ] - toEncodingPB Symbol{..} = pairs - [ - "symbol" .= symbol - , "kind" .= kind - , "line" .= line - , "span" .= span - , "docs" .= docs - ] - -instance FromJSON Symbol where - parseJSON = parseJSONPB - -instance ToJSON Symbol where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message Symbol where - encodeMessage _ Symbol{..} = mconcat - [ - encodeMessageField 1 symbol - , encodeMessageField 2 kind - , encodeMessageField 3 line - , encodeMessageField 4 (Proto3.Nested span) - , encodeMessageField 5 (Proto3.Nested docs) - ] - decodeMessage _ = Symbol - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - <*> at decodeMessageField 4 - <*> at decodeMessageField 5 - dotProto = undefined - -data Docstring = Docstring - { docstring :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB Docstring where - parseJSONPB = A.withObject "Docstring" $ \obj -> Docstring - <$> obj .: "docstring" - -instance ToJSONPB Docstring where - toJSONPB Docstring{..} = object - [ - "docstring" .= docstring - ] - toEncodingPB Docstring{..} = pairs - [ - "docstring" .= docstring - ] - -instance FromJSON Docstring where - parseJSON = parseJSONPB - -instance ToJSON Docstring where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message Docstring where - encodeMessage _ Docstring{..} = mconcat - [ - encodeMessageField 1 docstring - ] - decodeMessage _ = Docstring - <$> at decodeMessageField 1 - dotProto = undefined - -data Position = Position - { line :: Int32 - , column :: Int32 - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB Position where - parseJSONPB = A.withObject "Position" $ \obj -> Position - <$> obj .: "line" - <*> obj .: "column" - -instance ToJSONPB Position where - toJSONPB Position{..} = object - [ - "line" .= line - , "column" .= column - ] - toEncodingPB Position{..} = pairs - [ - "line" .= line - , "column" .= column - ] - -instance FromJSON Position where - parseJSON = parseJSONPB - -instance ToJSON Position where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message Position where - encodeMessage _ Position{..} = mconcat - [ - encodeMessageField 1 line - , encodeMessageField 2 column - ] - decodeMessage _ = Position - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data Span = Span - { start :: Maybe Position - , end :: Maybe Position - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB Span where - parseJSONPB = A.withObject "Span" $ \obj -> Span - <$> obj .: "start" - <*> obj .: "end" - -instance ToJSONPB Span where - toJSONPB Span{..} = object - [ - "start" .= start - , "end" .= end - ] - toEncodingPB Span{..} = pairs - [ - "start" .= start - , "end" .= end - ] - -instance FromJSON Span where - parseJSON = parseJSONPB - -instance ToJSON Span where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message Span where - encodeMessage _ Span{..} = mconcat - [ - encodeMessageField 1 (Proto3.Nested start) - , encodeMessageField 2 (Proto3.Nested end) - ] - decodeMessage _ = Span - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data ChangeType - = None - | Added - | Removed - | Modified - deriving stock (Eq, Ord, Show, Enum, Bounded, Generic) - deriving anyclass (Proto3.Named, Proto3.MessageField, NFData) - deriving Proto3.Primitive via Proto3.PrimitiveEnum ChangeType - -instance Proto3.HasDefault ChangeType where def = None - -instance FromJSONPB ChangeType where - parseJSONPB (JSONPB.String "NONE") = pure None - parseJSONPB (JSONPB.String "ADDED") = pure Added - parseJSONPB (JSONPB.String "REMOVED") = pure Removed - parseJSONPB (JSONPB.String "MODIFIED") = pure Modified - parseJSONPB x = typeMismatch "ChangeType" x - -instance ToJSONPB ChangeType where - toJSONPB x _ = A.String . T.toUpper . T.pack $ show x - toEncodingPB x _ = E.text . T.toUpper . T.pack $ show x - -instance FromJSON ChangeType where - parseJSON = parseJSONPB - -instance ToJSON ChangeType where - toJSON = toAesonValue - toEncoding = toAesonEncoding diff --git a/src/Semantic/CLI.hs b/src/Semantic/CLI.hs deleted file mode 100644 index 52dac1fd0b..0000000000 --- a/src/Semantic/CLI.hs +++ /dev/null @@ -1,186 +0,0 @@ -{-# LANGUAGE ApplicativeDo, RankNTypes #-} -module Semantic.CLI (main) where - -import Control.Exception as Exc (displayException) -import Data.Blob -import Data.Blob.IO -import Data.Handle -import Data.Language (languageForFilePath, parseLanguage) -import Data.List (intercalate, uncons) -import Data.List.Split (splitWhen) -import Data.Project -import qualified Data.Text as T -import qualified Data.Flag as Flag -import Options.Applicative hiding (style) -import Prologue -import Semantic.Api hiding (File) -import qualified Semantic.AST as AST -import Semantic.Config -import qualified Semantic.Graph as Graph -import qualified Semantic.Task as Task -import qualified Semantic.Git as Git -import Semantic.Task.Files -import Semantic.Telemetry -import qualified Semantic.Telemetry.Log as Log -import Semantic.Version -import Serializing.Format hiding (Options) -import System.Exit (die) -import System.FilePath - -import Control.Concurrent (mkWeakThreadId, myThreadId) -import Control.Exception (Exception(..), throwTo) -import Data.Typeable (Typeable) -import System.Posix.Signals -import System.Mem.Weak (deRefWeak) - -newtype SignalException = SignalException Signal - deriving (Show, Typeable) -instance Exception SignalException - -installSignalHandlers :: IO () -installSignalHandlers = do - mainThreadId <- myThreadId - weakTid <- mkWeakThreadId mainThreadId - for_ [ sigABRT, sigBUS, sigHUP, sigILL, sigQUIT, sigSEGV, - sigSYS, sigTERM, sigUSR1, sigUSR2, sigXCPU, sigXFSZ ] $ \sig -> - installHandler sig (Catch $ sendException weakTid sig) Nothing - where - sendException weakTid sig = do - m <- deRefWeak weakTid - case m of - Nothing -> pure () - Just tid -> throwTo tid (toException $ SignalException sig) - -main :: IO () -main = do - installSignalHandlers - (options, task) <- customExecParser (prefs showHelpOnEmpty) arguments - config <- defaultConfig options - res <- withTelemetry config $ \ (TelemetryQueues logger statter _) -> - Task.runTask (Task.TaskSession config "-" False logger statter) task - either (die . displayException) pure res - --- | A parser for the application's command-line arguments. --- --- Returns a 'Task' to read the input, run the requested operation, and write the output to the specified output path or stdout. -arguments :: ParserInfo (Options, Task.TaskEff ()) -arguments = info (version <*> helper <*> ((,) <$> optionsParser <*> argumentsParser)) description - where - version = infoOption versionString (long "version" <> short 'v' <> help "Output the version of the program") - versionString = "semantic version " <> buildVersion <> " (" <> buildSHA <> ")" - description = fullDesc <> header "semantic -- Semantic (syntax-aware) diffs, program analysis toolkit" - -optionsParser :: Parser Options -optionsParser = do - logLevel <- options [ ("error", Just Log.Error) , ("warning", Just Log.Warning) , ("info", Just Log.Info) , ("debug", Just Log.Debug) , ("none", Nothing)] - (long "log-level" <> value (Just Log.Warning) <> help "Log messages at or above this level, or disable logging entirely.") - failOnWarning <- switch (long "fail-on-warning" <> help "Fail on assignment warnings.") - failOnParseError <- switch (long "fail-on-parse-error" <> help "Fail on tree-sitter parse errors.") - pure $ Options logLevel (Flag.flag FailOnWarning failOnWarning) (Flag.flag FailOnParseError failOnParseError) - -argumentsParser :: Parser (Task.TaskEff ()) -argumentsParser = do - subparser <- hsubparser (diffCommand <> parseCommand <> tsParseCommand <> graphCommand) - output <- ToPath <$> strOption (long "output" <> short 'o' <> help "Output path, defaults to stdout") <|> pure (ToHandle stdout) - pure $ subparser >>= Task.write output - -diffCommand :: Mod CommandFields (Task.TaskEff Builder) -diffCommand = command "diff" (info diffArgumentsParser (progDesc "Compute changes between paths")) - where - diffArgumentsParser = do - renderer <- flag (parseDiffBuilder DiffSExpression) (parseDiffBuilder DiffSExpression) (long "sexpression" <> help "Output s-expression diff tree (default)") - <|> flag' (parseDiffBuilder DiffJSONTree) (long "json" <> help "Output JSON diff trees") - <|> flag' (parseDiffBuilder DiffJSONGraph) (long "json-graph" <> help "Output JSON diff trees") - <|> flag' (diffSummaryBuilder JSON) (long "toc" <> help "Output JSON table of contents diff summary") - <|> flag' (parseDiffBuilder DiffDotGraph) (long "dot" <> help "Output the diff as a DOT graph") - <|> flag' (parseDiffBuilder DiffShow) (long "show" <> help "Output using the Show instance (debug only, format subject to change without notice)") - filesOrStdin <- Right <$> some (Both <$> argument filePathReader (metavar "FILE_A") <*> argument filePathReader (metavar "FILE_B")) <|> pure (Left stdin) - pure $ Task.readBlobPairs filesOrStdin >>= renderer - -parseCommand :: Mod CommandFields (Task.TaskEff Builder) -parseCommand = command "parse" (info parseArgumentsParser (progDesc "Generate parse trees for path(s)")) - where - parseArgumentsParser = do - renderer <- flag (parseTermBuilder TermSExpression) (parseTermBuilder TermSExpression) (long "sexpression" <> help "Output s-expression parse trees (default)") - <|> flag' (parseTermBuilder TermJSONTree) (long "json" <> help "Output JSON parse trees") - <|> flag' (parseTermBuilder TermJSONGraph) (long "json-graph" <> help "Output JSON adjacency list") - <|> flag' (parseSymbolsBuilder JSON) (long "symbols" <> help "Output JSON symbol list") - <|> flag' (parseSymbolsBuilder JSON) (long "json-symbols" <> help "Output JSON symbol list") - <|> flag' (parseSymbolsBuilder Proto) (long "proto-symbols" <> help "Output JSON symbol list") - <|> flag' (parseTermBuilder TermDotGraph) (long "dot" <> help "Output DOT graph parse trees") - <|> flag' (parseTermBuilder TermShow) (long "show" <> help "Output using the Show instance (debug only, format subject to change without notice)") - <|> flag' (parseTermBuilder TermQuiet) (long "quiet" <> help "Don't produce output, but show timing stats") - filesOrStdin <- FilesFromGitRepo - <$> option str (long "gitDir" <> help "A .git directory to read from") - <*> option shaReader (long "sha" <> help "The commit SHA1 to read from") - <*> ( ExcludePaths <$> many (option str (long "exclude" <> short 'x' <> help "Paths to exclude")) - <|> ExcludeFromHandle <$> flag' stdin (long "exclude-stdin" <> help "Exclude paths given to stdin")) - <|> FilesFromPaths <$> some (argument filePathReader (metavar "FILES...")) - <|> pure (FilesFromHandle stdin) - pure $ Task.readBlobs filesOrStdin >>= renderer - -tsParseCommand :: Mod CommandFields (Task.TaskEff Builder) -tsParseCommand = command "ts-parse" (info tsParseArgumentsParser (progDesc "Generate raw tree-sitter parse trees for path(s)")) - where - tsParseArgumentsParser = do - format <- flag AST.SExpression AST.SExpression (long "sexpression" <> help "Output s-expression ASTs (default)") - <|> flag' AST.JSON (long "json" <> help "Output JSON ASTs") - <|> flag' AST.Quiet (long "quiet" <> help "Don't produce output, but show timing stats") - <|> flag' AST.Show (long "show" <> help "Output using the Show instance (debug only, format subject to change without notice)") - filesOrStdin <- FilesFromGitRepo - <$> option str (long "gitDir" <> help "A .git directory to read from") - <*> option shaReader (long "sha" <> help "The commit SHA1 to read from") - <*> ( ExcludePaths <$> many (option str (long "exclude" <> short 'x' <> help "Paths to exclude")) - <|> ExcludeFromHandle <$> flag' stdin (long "exclude-stdin" <> help "Exclude paths given to stdin")) - <|> FilesFromPaths <$> some (argument filePathReader (metavar "FILES...")) - <|> pure (FilesFromHandle stdin) - pure $ Task.readBlobs filesOrStdin >>= AST.runASTParse format - -graphCommand :: Mod CommandFields (Task.TaskEff Builder) -graphCommand = command "graph" (info graphArgumentsParser (progDesc "Compute a graph for a directory or from a top-level entry point module")) - where - graphArgumentsParser = makeGraphTask - <$> graphType - <*> switch (long "packages" <> help "Include a vertex for the package, with edges from it to each module") - <*> serializer - <*> (readProjectRecursively <|> readProjectFromPaths) - graphType = flag Graph.ImportGraph Graph.ImportGraph (long "imports" <> help "Compute an import graph (default)") - <|> flag' Graph.CallGraph (long "calls" <> help "Compute a call graph") - serializer = flag (Task.serialize (DOT Graph.style)) (Task.serialize (DOT Graph.style)) (long "dot" <> help "Output in DOT graph format (default)") - <|> flag' (Task.serialize JSON) (long "json" <> help "Output JSON graph") - <|> flag' (Task.serialize Show) (long "show" <> help "Output using the Show instance (debug only, format subject to change without notice)") - readProjectFromPaths = makeReadProjectFromPathsTask - <$> option auto (long "language" <> help "The language for the analysis.") - <*> ( Just <$> some (strArgument (metavar "FILES...")) - <|> flag' Nothing (long "stdin" <> help "Read a list of newline-separated paths to analyze from stdin.")) - makeReadProjectFromPathsTask language maybePaths = do - paths <- maybeM (liftIO (many getLine)) maybePaths - blobs <- traverse readBlobFromFile' (flip File language <$> paths) - pure $! Project (takeDirectory (maybe "/" fst (uncons paths))) blobs language [] - readProjectRecursively = makeReadProjectRecursivelyTask - <$> optional (strOption (long "root" <> help "Root directory of project. Optional, defaults to entry file/directory." <> metavar "DIR")) - <*> many (strOption (long "exclude-dir" <> help "Exclude a directory (e.g. vendor)" <> metavar "DIR")) - <*> argument filePathReader (metavar "DIR:LANGUAGE | FILE") - makeReadProjectRecursivelyTask rootDir excludeDirs File{..} = Task.readProject rootDir filePath fileLanguage excludeDirs - makeGraphTask graphType includePackages serializer projectTask = projectTask >>= Graph.runGraph graphType includePackages >>= serializer - -shaReader :: ReadM Git.OID -shaReader = eitherReader parseSha - where parseSha arg = if length arg == 40 || arg == "HEAD" - then Right (Git.OID (T.pack arg)) - else Left (arg <> " is not a valid sha1") - -filePathReader :: ReadM File -filePathReader = eitherReader parseFilePath - where - parseFilePath arg = case splitWhen (== ':') arg of - [a, b] | Just lang <- parseLanguage (T.pack b) -> Right (File a lang) - | Just lang <- parseLanguage (T.pack a) -> Right (File b lang) - [path] -> Right (File path (languageForFilePath path)) - _ -> Left ("cannot parse `" <> arg <> "`\nexpecting FILE:LANGUAGE or just FILE") - -options :: Eq a => [(String, a)] -> Mod OptionFields a -> Parser a -options options fields = option (optionsReader options) (fields <> showDefaultWith (findOption options) <> metavar (intercalate "|" (fmap fst options))) - where - optionsReader options = eitherReader $ \ str -> maybe (Left ("expected one of: " <> intercalate ", " (fmap fst options))) (Right . snd) (find ((== str) . fst) options) - findOption options value = maybe "" fst (find ((== value) . snd) options) diff --git a/src/Semantic/Config.hs b/src/Semantic/Config.hs deleted file mode 100644 index 09407e4bd7..0000000000 --- a/src/Semantic/Config.hs +++ /dev/null @@ -1,157 +0,0 @@ -module Semantic.Config - ( Config (..) - , defaultConfig - , Options (..) - , defaultOptions - , debugOptions - , infoOptions - , lookupStatsAddr - , withErrorReporterFromConfig - , logOptionsFromConfig - , withLoggerFromConfig - , withStatterFromConfig - , withTelemetry - -- * Flags - , IsTerminal (..) - , LogPrintSource (..) - , FailTestParsing (..) - , FailOnWarning (..) - , FailOnParseError (..) - ) where - -import Data.Duration -import Data.Error (LogPrintSource(..)) -import Data.Flag -import Network.HostName -import Network.URI -import Prologue -import Semantic.Env -import Semantic.Telemetry -import qualified Semantic.Telemetry.Error as Error -import qualified Semantic.Telemetry.Stat as Stat -import System.Environment -import System.IO (hIsTerminalDevice, stdout) -import System.Posix.Process -import System.Posix.Types - -data IsTerminal = IsTerminal -data FailTestParsing = FailTestParsing -data FailOnWarning = FailOnWarning -data FailOnParseError = FailOnParseError - -data Config - = Config - { configAppName :: String -- ^ Application name ("semantic") - , configHostName :: String -- ^ HostName from getHostName - , configProcessID :: ProcessID -- ^ ProcessID from getProcessID - , configStatsHost :: Stat.Host -- ^ Host of statsd/datadog (default: "127.0.0.1") - , configStatsPort :: Stat.Port -- ^ Port of statsd/datadog (default: "28125") - , configTreeSitterParseTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter parsing (default: 6000). - , configAssignmentTimeout :: Duration -- ^ Millisecond timeout for assignment (default: 4000) - , configMaxTelemetyQueueSize :: Int -- ^ Max size of telemetry queues before messages are dropped (default: 1000). - , configIsTerminal :: Flag IsTerminal -- ^ Whether a terminal is attached (set automaticaly at runtime). - , configLogPrintSource :: Flag LogPrintSource -- ^ Whether to print the source reference when logging errors (set automatically at runtime). - , configLogFormatter :: LogFormatter -- ^ Log formatter to use (set automatically at runtime). - , configSHA :: Maybe String -- ^ Optional SHA to include in log messages. - , configFailParsingForTesting :: Flag FailTestParsing -- ^ Simulate internal parse failure for testing (default: False). - , configOptions :: Options -- ^ Options configurable via command line arguments. - } - --- Options configurable via command line arguments. -data Options - = Options - { optionsLogLevel :: Maybe Level -- ^ What level of messages to log. 'Nothing' disables logging. - , optionsFailOnWarning :: Flag FailOnWarning -- ^ Should semantic fail fast on assignment warnings (for testing) - , optionsFailOnParseError :: Flag FailOnParseError -- ^ Should semantic fail fast on tree-sitter parser errors (for testing) - } - -defaultOptions :: Options -defaultOptions = Options (Just Warning) (flag FailOnWarning False) (flag FailOnParseError False) - -debugOptions :: Options -debugOptions = defaultOptions { optionsLogLevel = Just Debug } - -infoOptions :: Options -infoOptions = defaultOptions { optionsLogLevel = Just Info } - -defaultConfig :: Options -> IO Config -defaultConfig options@Options{..} = do - pid <- getProcessID - hostName <- getHostName - isTerminal <- hIsTerminalDevice stdout - (statsHost, statsPort) <- lookupStatsAddr - size <- envLookupNum 1000 "MAX_TELEMETRY_QUEUE_SIZE" - parseTimeout <- envLookupNum 6000 "TREE_SITTER_PARSE_TIMEOUT" - assignTimeout <- envLookupNum 4000 "SEMANTIC_ASSIGNMENT_TIMEOUT" - pure Config - { configAppName = "semantic" - , configHostName = hostName - , configProcessID = pid - , configStatsHost = statsHost - , configStatsPort = statsPort - - , configTreeSitterParseTimeout = fromMilliseconds parseTimeout - , configAssignmentTimeout = fromMilliseconds assignTimeout - , configMaxTelemetyQueueSize = size - , configIsTerminal = flag IsTerminal isTerminal - , configLogPrintSource = flag LogPrintSource isTerminal - , configLogFormatter = if isTerminal then terminalFormatter else logfmtFormatter - , configSHA = Nothing - , configFailParsingForTesting = flag FailTestParsing False - - , configOptions = options - } - -withTelemetry :: Config -> (TelemetryQueues -> IO c) -> IO c -withTelemetry config action = - withLoggerFromConfig config $ \logger -> - withErrorReporterFromConfig config (queueLogMessage logger Error) $ \errorReporter -> - withStatterFromConfig config $ \statter -> - action (TelemetryQueues logger statter errorReporter) - -logOptionsFromConfig :: Config -> LogOptions -logOptionsFromConfig Config{..} = LogOptions - { logOptionsLevel = optionsLogLevel configOptions - , logOptionsFormatter = configLogFormatter - , logOptionsContext = logOptionsContext' - } - where logOptionsContext' - | toBool IsTerminal configIsTerminal = [] - | otherwise = [ ("app", configAppName) - , ("pid", show configProcessID) - , ("hostname", configHostName) - , ("sha", fromMaybe "development" configSHA) - ] - - -withLoggerFromConfig :: Config -> (LogQueue -> IO c) -> IO c -withLoggerFromConfig config = withLogger (logOptionsFromConfig config) (configMaxTelemetyQueueSize config) - - -withErrorReporterFromConfig :: Config -> Error.ErrorLogger -> (ErrorQueue -> IO c) -> IO c -withErrorReporterFromConfig Config{..} errorLogger = - withErrorReporter (nullErrorReporter errorLogger) configMaxTelemetyQueueSize - -withStatterFromConfig :: Config -> (StatQueue -> IO c) -> IO c -withStatterFromConfig Config{..} = - withStatter configStatsHost configStatsPort configAppName configMaxTelemetyQueueSize - -lookupStatsAddr :: IO (Stat.Host, Stat.Port) -lookupStatsAddr = do - addr <- lookupEnv "STATS_ADDR" - let (host', port) = parseAddr (fmap ("statsd://" <>) addr) - - -- When running in Kubes, DOGSTATSD_HOST is set with the dogstatsd host. - kubesHost <- lookupEnv "DOGSTATSD_HOST" - let host = fromMaybe host' kubesHost - - pure (host, port) - where - defaultHost = "127.0.0.1" - defaultPort = "28125" - parseAddr a | Just s <- a - , Just (Just (URIAuth _ host port)) <- uriAuthority <$> parseURI s - = (parseHost host, parsePort port) - | otherwise = (defaultHost, defaultPort) - parseHost s = if null s then defaultHost else s - parsePort s = if null s then defaultPort else dropWhile (':' ==) s diff --git a/src/Semantic/Distribute.hs b/src/Semantic/Distribute.hs deleted file mode 100644 index be57768e11..0000000000 --- a/src/Semantic/Distribute.hs +++ /dev/null @@ -1,72 +0,0 @@ -{-# LANGUAGE ExistentialQuantification, GeneralizedNewtypeDeriving, TypeOperators, UndecidableInstances #-} -module Semantic.Distribute -( distribute -, distributeFor -, distributeFoldMap -, Distribute -, runDistribute -, withDistribute -, DistributeC(..) -) where - -import qualified Control.Concurrent.Async as Async -import Control.Effect -import Control.Effect.Carrier -import Control.Effect.Reader -import Control.Effect.Sum -import Control.Monad.IO.Unlift -import Control.Parallel.Strategies -import Prologue - --- | Distribute a 'Traversable' container of tasks over the available cores (i.e. execute them concurrently), collecting their results. --- --- This is a concurrent analogue of 'sequenceA'. -distribute :: (Member Distribute sig, Traversable t, Carrier sig m) => t (m output) -> m (t output) -distribute = fmap (withStrategy (parTraversable rseq)) <$> traverse (send . flip Distribute pure) - --- | Distribute the application of a function to each element of a 'Traversable' container of inputs over the available cores (i.e. perform the function concurrently for each element), collecting the results. --- --- This is a concurrent analogue of 'for' or 'traverse' (with the arguments flipped). -distributeFor :: (Member Distribute sig, Traversable t, Carrier sig m) => t a -> (a -> m output) -> m (t output) -distributeFor inputs toTask = distribute (fmap toTask inputs) - --- | Distribute the application of a function to each element of a 'Traversable' container of inputs over the available cores (i.e. perform the function concurrently for each element), combining the results 'Monoid'ally into a final value. --- --- This is a concurrent analogue of 'foldMap'. -distributeFoldMap :: (Member Distribute sig, Monoid output, Traversable t, Carrier sig m) => (a -> m output) -> t a -> m output -distributeFoldMap toTask inputs = fmap fold (distribute (fmap toTask inputs)) - - --- | Distribute effects run tasks concurrently. -data Distribute m k - = forall a . Distribute (m a) (a -> k) - -deriving instance Functor (Distribute m) - -instance HFunctor Distribute where - hmap f (Distribute m k) = Distribute (f m) k - -instance Effect Distribute where - handle state handler (Distribute task k) = Distribute (handler (task <$ state)) (handler . fmap k) - - --- | Evaluate a 'Distribute' effect concurrently. -runDistribute :: UnliftIO m -> DistributeC m a -> IO a -runDistribute u@(UnliftIO unlift) = unlift . runReader u . runDistributeC - -withDistribute :: MonadUnliftIO m => DistributeC m a -> m a -withDistribute r = withUnliftIO (`runDistribute` r) - -newtype DistributeC m a = DistributeC { runDistributeC :: ReaderC (UnliftIO m) m a } - deriving (Functor, Applicative, Monad, MonadIO) - --- This can be simpler if we add an instance to fused-effects that takes --- care of this folderol for us (then we can justt derive the MonadUnliftIO instance) -instance (MonadIO m, Carrier sig m) => MonadUnliftIO (DistributeC m) where - askUnliftIO = DistributeC . ReaderC $ \ u -> pure (UnliftIO (runDistribute u)) - -instance (Carrier sig m, MonadIO m) => Carrier (Distribute :+: sig) (DistributeC m) where - eff (L (Distribute task k)) = do - handler <- DistributeC ask - liftIO (Async.runConcurrently (Async.Concurrently (runDistribute handler task))) >>= k - eff (R other) = DistributeC (eff (R (handleCoercible other))) diff --git a/src/Semantic/Env.hs b/src/Semantic/Env.hs deleted file mode 100644 index 8243d6fb4b..0000000000 --- a/src/Semantic/Env.hs +++ /dev/null @@ -1,18 +0,0 @@ -{-# OPTIONS_GHC -Wno-redundant-constraints #-} -module Semantic.Env - ( envLookupNum - , envLookupString - ) where - -import Prologue -import System.Environment -import Text.Read (readMaybe) - -envLookupString :: MonadIO io => String -> String -> io String -envLookupString defaultVal k = liftIO $ fromMaybe defaultVal <$> lookupEnv k - --- | Although the `Num a` constraint is redundant (hence -Wno-redundant-constraints), we use this constraint to communicate this function is meant to read Num values. -envLookupNum :: (MonadIO io, Num a, Read a) => a -> String -> io a -envLookupNum defaultVal k = liftIO $ parse <$> lookupEnv k - where parse x | Just s <- x, Just p <- readMaybe s = p - | otherwise = defaultVal diff --git a/src/Semantic/Git.hs b/src/Semantic/Git.hs deleted file mode 100644 index c6dad92141..0000000000 --- a/src/Semantic/Git.hs +++ /dev/null @@ -1,90 +0,0 @@ -module Semantic.Git - ( -- Primary (partial) API for cmd line git - clone - , lsTree - , catFile - - -- Intermediate datatypes - , TreeEntry(..) - , ObjectType(..) - , ObjectMode(..) - , OID(..) - - -- Testing Purposes - , parseEntries - , parseEntry - ) where - -import Control.Monad.IO.Class -import Data.Attoparsec.Text (Parser) -import Data.Attoparsec.Text as AP -import Data.Char -import Data.Text as Text -import Shelly hiding (FilePath) -import System.IO (hSetBinaryMode) - --- | git clone --bare -clone :: Text -> FilePath -> IO () -clone url path = sh $ do - run_ "git" ["clone", "--bare", url, pack path] - --- | git cat-file -p -catFile :: FilePath -> OID -> IO Text -catFile gitDir (OID oid) = sh $ do - run "git" ["-C", pack gitDir, "cat-file", "-p", oid] - --- | git ls-tree -rz -lsTree :: FilePath -> OID -> IO [TreeEntry] -lsTree gitDir (OID sha) = sh $ parseEntries <$> run "git" ["-C", pack gitDir, "ls-tree", "-rz", sha] - -sh :: MonadIO m => Sh a -> m a -sh = shelly . silently . onCommandHandles (initOutputHandles (`hSetBinaryMode` True)) - --- | Parses an list of entries separated by \NUL, and on failure return [] -parseEntries :: Text -> [TreeEntry] -parseEntries = either (const []) id . AP.parseOnly everything - where - everything = AP.sepBy entryParser "\NUL" <* "\NUL\n" <* AP.endOfInput - --- | Parse the entire input with entryParser, and on failure return a default --- For testing purposes only -parseEntry :: Text -> Either String TreeEntry -parseEntry = AP.parseOnly (entryParser <* AP.endOfInput) - --- | Parses a TreeEntry -entryParser :: Parser TreeEntry -entryParser = TreeEntry - <$> modeParser <* AP.char ' ' - <*> typeParser <* AP.char ' ' - <*> oidParser <* AP.char '\t' - <*> (unpack <$> AP.takeWhile (/= '\NUL')) - where - typeParser = AP.choice [BlobObject <$ "blob", TreeObject <$ "tree"] - modeParser = AP.choice [NormalMode <$ "100644", ExecutableMode <$ "100755", SymlinkMode <$ "120000", TreeMode <$ "040000"] - oidParser = OID <$> AP.takeWhile isHexDigit - -newtype OID = OID Text - deriving (Eq, Show, Ord) - -data ObjectMode - = NormalMode - | ExecutableMode - | SymlinkMode - | TreeMode - | OtherMode - deriving (Eq, Show) - -data ObjectType - = BlobObject - | TreeObject - | OtherObjectType - deriving (Eq, Show) - -data TreeEntry - = TreeEntry - { treeEntryMode :: ObjectMode - , treeEntryType :: ObjectType - , treeEntryOid :: OID - , treeEntryPath :: FilePath - } deriving (Eq, Show) - diff --git a/src/Semantic/Graph.hs b/src/Semantic/Graph.hs deleted file mode 100644 index 3d23df5609..0000000000 --- a/src/Semantic/Graph.hs +++ /dev/null @@ -1,486 +0,0 @@ -{-# LANGUAGE GADTs, ScopedTypeVariables, TypeOperators #-} -module Semantic.Graph -( runGraph -, runCallGraph -, runImportGraph -, runImportGraphToModules -, runImportGraphToModuleInfos -, GraphType(..) -, Graph -, ControlFlowVertex -, style -, runHeap -, runScopeGraph -, runModuleTable -, parsePackage -, parsePythonPackage -, withTermSpans -, resumingResolutionError -, resumingLoadError -, resumingEvalError -, resumingUnspecialized -, resumingAddressError -, resumingValueError -, resumingHeapError -, resumingScopeError -, resumingTypeError -) where - - -import Prelude hiding (readFile) - -import Analysis.Abstract.Caching.FlowInsensitive -import Analysis.Abstract.Collecting -import Analysis.Abstract.Graph as Graph -import Control.Abstract hiding (String) -import Control.Abstract.PythonPackage as PythonPackage -import Data.Abstract.Address.Hole as Hole -import Data.Abstract.Address.Monovariant as Monovariant -import Data.Abstract.Address.Precise as Precise -import Data.Abstract.BaseError (BaseError (..)) -import Data.Abstract.Evaluatable -import Data.Abstract.Heap -import Data.Abstract.Module -import qualified Data.Abstract.ModuleTable as ModuleTable -import Data.Abstract.Package as Package -import Data.Abstract.Value.Abstract as Abstract -import Data.Abstract.Value.Concrete as Concrete - (Value, ValueError (..), runValueErrorWith) -import Data.Abstract.Value.Type as Type -import Data.Abstract.AccessControls.Instances () -import Data.Blob -import Data.Graph -import Data.Graph.ControlFlowVertex (VertexDeclarationStrategy, VertexDeclarationWithStrategy) -import Data.Language as Language -import Data.List (isPrefixOf, isSuffixOf) -import Data.Project -import Data.Location -import Data.Span -import Data.Term -import Data.Text (pack, unpack) -import Language.Haskell.HsColour -import Language.Haskell.HsColour.Colourise -import Parsing.Parser -import Prologue hiding (TypeError (..)) -import Semantic.Analysis -import Semantic.Task as Task -import System.FilePath.Posix (takeDirectory, ()) -import Text.Show.Pretty (ppShow) - -data GraphType = ImportGraph | CallGraph - -type AnalysisClasses = '[ Declarations1, Eq1, Evaluatable, FreeVariables1, AccessControls1, Foldable, Functor, Ord1, Show1 ] - -runGraph :: ( Member Distribute sig - , Member (Error SomeException) sig - , Member Resolution sig - , Member Task sig - , Member Trace sig - , Carrier sig m - , Effect sig - ) - => GraphType - -> Bool - -> Project - -> m (Graph ControlFlowVertex) -runGraph ImportGraph _ project - | SomeAnalysisParser parser (lang' :: Proxy lang) <- someAnalysisParser (Proxy :: Proxy AnalysisClasses) (projectLanguage project) = do - let parse = if projectLanguage project == Language.Python then parsePythonPackage parser else fmap (fmap snd) . parsePackage parser - package <- parse project - runImportGraphToModuleInfos lang' package -runGraph CallGraph includePackages project - | SomeAnalysisParser parser lang <- someAnalysisParser (Proxy :: Proxy AnalysisClasses) (projectLanguage project) = do - let parse = if projectLanguage project == Language.Python then parsePythonPackage parser else fmap (fmap snd) . parsePackage parser - package <- parse project - modules <- topologicalSort <$> runImportGraphToModules lang package - runCallGraph lang includePackages modules package - -runCallGraph :: ( VertexDeclarationWithStrategy (VertexDeclarationStrategy syntax) syntax syntax - , Declarations1 syntax - , AccessControls1 syntax - , Ord1 syntax - , Functor syntax - , Evaluatable syntax - , term ~ Term syntax Location - , FreeVariables1 syntax - , HasPrelude lang - , Member Trace sig - , Carrier sig m - , Effect sig - ) - => Proxy lang - -> Bool - -> [Module term] - -> Package term - -> m (Graph ControlFlowVertex) -runCallGraph lang includePackages modules package - = fmap (simplify . fst) - . runEvaluator - . graphing @_ @_ @_ @(Hole (Maybe Name) Monovariant) @Abstract - . runHeap - . runScopeGraph - . caching - . raiseHandler runFresh - . resumingLoadError - . resumingUnspecialized - . resumingScopeError - . resumingHeapError - . resumingEvalError - . resumingResolutionError - . resumingAddressError - . raiseHandler (runReader (packageInfo package)) - . raiseHandler (runReader (lowerBound @Span)) - . raiseHandler (runState (lowerBound @Span)) - . raiseHandler (runReader (lowerBound @ControlFlowVertex)) - . providingLiveSet - . runModuleTable - . runModules (ModuleTable.modulePaths (packageModules package)) - $ evaluate lang perModule modules - where perTerm = evalTerm (withTermSpans . graphingTerms . cachingTerms) - perModule = (if includePackages then graphingPackages else id) . convergingModules . graphingModules $ runDomainEffects perTerm - - -runModuleTable :: Evaluator term address value (ReaderC (ModuleTable (Module (ModuleResult address value))) m) a - -> Evaluator term address value m a -runModuleTable = raiseHandler $ runReader lowerBound - -runImportGraphToModuleInfos :: ( Declarations term - , Evaluatable (Base term) - , FreeVariables term - , AccessControls term - , HasSpan term - , HasPrelude lang - , Member Trace sig - , Recursive term - , Carrier sig m - , Show term - , Effect sig - ) - => Proxy lang - -> Package term - -> m (Graph ControlFlowVertex) -runImportGraphToModuleInfos lang (package :: Package term) = runImportGraph lang package allModuleInfos - where allModuleInfos info = vertex (maybe (unknownModuleVertex info) (moduleVertex . moduleInfo) (ModuleTable.lookup (modulePath info) (packageModules package))) - -runImportGraphToModules :: ( Declarations term - , Evaluatable (Base term) - , FreeVariables term - , AccessControls term - , HasSpan term - , HasPrelude lang - , Member Trace sig - , Recursive term - , Carrier sig m - , Show term - , Effect sig - ) - => Proxy lang - -> Package term - -> m (Graph (Module term)) -runImportGraphToModules lang (package :: Package term) = runImportGraph lang package resolveOrLowerBound - where resolveOrLowerBound info = maybe lowerBound vertex (ModuleTable.lookup (modulePath info) (packageModules package)) - -runImportGraph :: ( AccessControls term - , Evaluatable (Base term) - , FreeVariables term - , HasSpan term - , Declarations term - , HasPrelude lang - , Member Trace sig - , Recursive term - , Carrier sig m - , Show term - , Effect sig - ) - => Proxy lang - -> Package term - -> (ModuleInfo -> Graph vertex) - -> m (Graph vertex) -runImportGraph lang (package :: Package term) f - = fmap (fst >=> f) - . runEvaluator @_ @_ @(Value _ (Hole (Maybe Name) Precise)) - . raiseHandler (runState lowerBound) - . runHeap - . raiseHandler runFresh - . resumingLoadError - . resumingUnspecialized - . resumingScopeError - . resumingHeapError - . resumingEvalError - . resumingResolutionError - . resumingAddressError - . resumingValueError - . runModuleTable - . runModules (ModuleTable.modulePaths (packageModules package)) - . raiseHandler (runReader (packageInfo package)) - . raiseHandler (runState (lowerBound @Span)) - . raiseHandler (runReader (lowerBound @Span)) - . raiseHandler (runState (lowerBound @(ScopeGraph (Hole (Maybe Name) Precise)))) - . runAllocator - $ evaluate lang (graphingModuleInfo (runDomainEffects (evalTerm id))) (snd <$> ModuleTable.toPairs (packageModules package)) - -runHeap :: Evaluator term address value (StateC (Heap address address value) m) a - -> Evaluator term address value m (Heap address address value, a) -runHeap = raiseHandler (runState lowerBound) - -runScopeGraph :: Ord address - => Evaluator term address value (StateC (ScopeGraph address) m) a - -> Evaluator term address value m (ScopeGraph address, a) -runScopeGraph = raiseHandler (runState lowerBound) - --- | Parse a list of files into a 'Package'. -parsePackage :: (Member Distribute sig, Member (Error SomeException) sig, Member Resolution sig, Member Task sig, Member Trace sig, Carrier sig m) - => Parser term -- ^ A parser. - -> Project -- ^ Project to parse into a package. - -> m (Package (Blob, term)) -parsePackage parser project = do - p <- parseModules parser project - resMap <- Task.resolutionMap project - let pkg = Package.fromModules n p resMap - pkg <$ trace ("project: " <> prettyShow (() <$ pkg)) - - where - n = Data.Abstract.Evaluatable.name (projectName project) -- TODO: Confirm this is the right `name`. - --- | Parse all files in a project into 'Module's. -parseModules :: (Member Distribute sig, Member (Error SomeException) sig, Member Task sig, Carrier sig m) => Parser term -> Project -> m [Module (Blob, term)] -parseModules parser p@Project{..} = distributeFor (projectFiles p) (parseModule p parser) - - --- | Parse a list of packages from a python project. -parsePythonPackage :: forall syntax sig m term. - ( Declarations1 syntax - , Evaluatable syntax - , FreeVariables1 syntax - , AccessControls1 syntax - , Functor syntax - , term ~ Term syntax Location - , Member (Error SomeException) sig - , Member Distribute sig - , Member Resolution sig - , Member Trace sig - , Member Task sig - , Carrier sig m - , Effect sig - ) - => Parser term -- ^ A parser. - -> Project -- ^ Project to parse into a package. - -> m (Package term) -parsePythonPackage parser project = do - let runAnalysis = runEvaluator @_ @_ @(Value term (Hole (Maybe Name) Precise)) - . raiseHandler (runState PythonPackage.Unknown) - . raiseHandler (runState (lowerBound @(Heap (Hole (Maybe Name) Precise) (Hole (Maybe Name) Precise) (Value term (Hole (Maybe Name) Precise))))) - . raiseHandler runFresh - . resumingLoadError - . resumingUnspecialized - -- . resumingEnvironmentError -- TODO: Fix me. Replace with `resumineScopeGraphError`? - . resumingScopeError - . resumingHeapError - . resumingEvalError - . resumingResolutionError - . resumingAddressError - . resumingValueError - . runModuleTable - . runModules lowerBound - . raiseHandler (runReader (PackageInfo (Data.Abstract.Evaluatable.name "setup") lowerBound)) - . raiseHandler (runState (lowerBound @Span)) - . raiseHandler (runReader (lowerBound @Span)) - . raiseHandler (runState (lowerBound @(ScopeGraph (Hole (Maybe Name) Precise)))) - . runAllocator - - strat <- case find ((== (projectRootDir project "setup.py")) . filePath) (projectFiles project) of - Just setupFile -> do - setupModule <- fmap snd <$> parseModule project parser setupFile - fst <$> runAnalysis (evaluate (Proxy @'Language.Python) (runDomainEffects (runPythonPackaging . evalTerm id)) [ setupModule ]) - Nothing -> pure PythonPackage.Unknown - case strat of - PythonPackage.Unknown -> do - modules <- fmap (fmap snd) <$> parseModules parser project - resMap <- Task.resolutionMap project - pure (Package.fromModules (Data.Abstract.Evaluatable.name (projectName project)) modules resMap) -- TODO: Confirm this is the right `name`. - PythonPackage.Packages dirs -> do - filteredBlobs <- for dirs $ \dir -> do - let packageDir = projectRootDir project unpack dir - let paths = filter ((packageDir `isPrefixOf`) . filePath) (projectFiles project) - traverse (readFile project) paths - packageFromProject project filteredBlobs - PythonPackage.FindPackages excludeDirs -> do - trace "In Graph.FindPackages" - let initFiles = filter (("__init__.py" `isSuffixOf`) . filePath) (projectFiles project) - let packageDirs = filter (`notElem` ((projectRootDir project ) . unpack <$> excludeDirs)) (takeDirectory . filePath <$> initFiles) - filteredBlobs <- for packageDirs $ \dir -> do - let paths = filter ((dir `isPrefixOf`) . filePath) (projectFiles project) - traverse (readFile project) paths - packageFromProject project filteredBlobs - where - packageFromProject project filteredBlobs = do - let p = project { projectBlobs = catMaybes $ join filteredBlobs } - modules <- fmap (fmap snd) <$> parseModules parser p - resMap <- Task.resolutionMap p - pure (Package.fromModules (Data.Abstract.Evaluatable.name $ projectName p) modules resMap) -- TODO: Confirm this is the right `name`. - -parseModule :: (Member (Error SomeException) sig, Member Task sig, Carrier sig m) - => Project - -> Parser term - -> File - -> m (Module (Blob, term)) -parseModule proj parser file = do - mBlob <- readFile proj file - case mBlob of - Just blob -> moduleForBlob (Just (projectRootDir proj)) blob . (,) blob <$> parse parser blob - Nothing -> throwError (SomeException (FileNotFound (filePath file))) - -withTermSpans :: ( Member (Reader Span) sig - , Member (State Span) sig -- last evaluated child's span - , Recursive term - , Carrier sig m - , Base term ~ TermF syntax Location - ) - => Open (term -> Evaluator term address value m a) -withTermSpans recur term = let - span = locationSpan (termFAnnotation (project term)) - updatedSpanAlg = withCurrentSpan span (recur term) - in modifyChildSpan span updatedSpanAlg - -resumingResolutionError :: ( Member Trace sig - , Carrier sig m - ) - => Evaluator term address value (ResumableWithC (BaseError ResolutionError) m) a - -> Evaluator term address value m a -resumingResolutionError = runResolutionErrorWith $ \ baseError -> do - traceError "ResolutionError" baseError - case baseErrorException baseError of - NotFoundError nameToResolve _ _ -> pure nameToResolve - GoImportError pathToResolve -> pure [pathToResolve] - -resumingLoadError :: ( Carrier sig m - , Member Trace sig - , AbstractHole value - , AbstractHole address - ) - => Evaluator term address value (ResumableWithC (BaseError (LoadError address value)) m) a - -> Evaluator term address value m a -resumingLoadError = runLoadErrorWith (\ baseError -> traceError "LoadError" baseError *> case baseErrorException baseError of - ModuleNotFoundError _ -> pure ((hole, hole), hole)) - -resumingEvalError :: ( Carrier sig m - , Member Fresh sig - , Member Trace sig - , Show value - , Show term - , AbstractHole address - , AbstractHole value - ) - => Evaluator term address value (ResumableWithC (BaseError (EvalError term address value)) m) a - -> Evaluator term address value m a -resumingEvalError = runEvalErrorWith (\ baseError -> traceError "EvalError" baseError *> case baseErrorException baseError of - AccessControlError{} -> pure hole - ConstructorError{} -> pure hole - DefaultExportError{} -> pure () - DerefError{} -> pure hole - ExportError{} -> pure () - FloatFormatError{} -> pure 0 - IntegerFormatError{} -> pure 0 - NoNameError{} -> gensym - RationalFormatError{} -> pure 0 - ReferenceError{} -> pure hole - ScopedEnvError{} -> pure hole) - -resumingUnspecialized :: ( AbstractHole address - , AbstractHole value - , Carrier sig m - , Member Trace sig - ) - => Evaluator term address value (ResumableWithC (BaseError (UnspecializedError address value)) m) a - -> Evaluator term address value m a -resumingUnspecialized = runUnspecializedWith (\ baseError -> traceError "UnspecializedError" baseError *> case baseErrorException baseError of - UnspecializedError _ -> pure hole - RefUnspecializedError _ -> pure hole) - -resumingAddressError :: ( AbstractHole value - , Carrier sig m - , Member Trace sig - , Show address - ) - => Evaluator term address value (ResumableWithC (BaseError (AddressError address value)) m) a - -> Evaluator term address value m a -resumingAddressError = runAddressErrorWith $ \ baseError -> do - traceError "AddressError" baseError - case baseErrorException baseError of - UnallocatedSlot _ -> pure lowerBound - UninitializedSlot _ -> pure hole - -resumingValueError :: ( Carrier sig m - , Member Trace sig - , Show address - , Show term - ) - => Evaluator term address (Value term address) (ResumableWithC (BaseError (ValueError term address)) m) a - -> Evaluator term address (Value term address) m a -resumingValueError = runValueErrorWith (\ baseError -> traceError "ValueError" baseError *> case baseErrorException baseError of - CallError{} -> pure hole - StringError val -> pure (pack (prettyShow val)) - BoolError{} -> pure True - BoundsError{} -> pure hole - IndexError{} -> pure hole - NumericError{} -> pure hole - Numeric2Error{} -> pure hole - ComparisonError{} -> pure hole - BitwiseError{} -> pure hole - Bitwise2Error{} -> pure hole - KeyValueError{} -> pure (hole, hole) - ArrayError{} -> pure lowerBound - ArithmeticError{} -> pure hole) - -resumingHeapError :: ( Carrier sig m - , AbstractHole address - , Member Trace sig - , Show address - ) - => Evaluator term address value (ResumableWithC (BaseError (HeapError address)) m) a - -> Evaluator term address value m a -resumingHeapError = runHeapErrorWith (\ baseError -> traceError "ScopeError" baseError *> case baseErrorException baseError of - CurrentFrameError -> pure hole - LookupAddressError _ -> pure hole - -- FIXME: this is clearly bogus - LookupFrameError addr -> pure (Frame addr lowerBound lowerBound) - LookupLinksError _ -> pure mempty - LookupLinkError _ -> pure hole) - -resumingScopeError :: ( Carrier sig m - , Member Trace sig - , AbstractHole (Slot address) - , AbstractHole (Scope address) - , AbstractHole (Path address) - , AbstractHole (Info address) - , AbstractHole address - ) - => Evaluator term address value (ResumableWithC (BaseError (ScopeError address)) m) a - -> Evaluator term address value m a -resumingScopeError = runScopeErrorWith (\ baseError -> traceError "ScopeError" baseError *> case baseErrorException baseError of - ScopeError _ _ -> pure hole - ImportReferenceError -> pure hole - LookupScopeError -> pure hole - LookupPathError _ -> pure hole - CurrentScopeError -> pure hole - LookupDeclarationScopeError _ -> pure hole - DeclarationByNameError _ -> pure hole) - -resumingTypeError :: ( Carrier sig m - , Member Trace sig - , Effect sig - , Alternative m - ) - => Evaluator term address Type (ResumableWithC (BaseError TypeError) - (StateC TypeMap - m)) a - -> Evaluator term address Type m a -resumingTypeError = runTypesWith (\ baseError -> traceError "TypeError" baseError *> case baseErrorException baseError of - UnificationError l r -> pure l <|> pure r - InfiniteType _ r -> pure r) - -prettyShow :: Show a => a -> String -prettyShow = hscolour TTY defaultColourPrefs False False "" False . ppShow - -traceError :: (Member Trace sig, Show (exc resume), Carrier sig m) => String -> BaseError exc resume -> Evaluator term address value m () -traceError prefix baseError = trace $ prefix <> ": " <> prettyShow baseError diff --git a/src/Semantic/IO.hs b/src/Semantic/IO.hs deleted file mode 100644 index 3c7b8ddcb6..0000000000 --- a/src/Semantic/IO.hs +++ /dev/null @@ -1,42 +0,0 @@ -{-# LANGUAGE DuplicateRecordFields, GADTs, ScopedTypeVariables, TypeOperators, UndecidableInstances #-} -module Semantic.IO - ( isDirectory - , findFilesInDir - ) where - -import Prelude hiding (readFile) -import Prologue - -import Data.Language -import System.Directory (doesDirectoryExist) -import System.Directory.Tree (AnchoredDirTree (..)) -import qualified System.Directory.Tree as Tree -import System.FilePath - -isDirectory :: MonadIO m => FilePath -> m Bool -isDirectory path = liftIO (doesDirectoryExist path) - --- Recursively find files in a directory. -findFilesInDir :: MonadIO m => FilePath -> [String] -> [FilePath] -> m [FilePath] -findFilesInDir path exts excludeDirs = do - _:/dir <- liftIO $ Tree.build path - pure $ (onlyFiles . Tree.filterDir (withExtensions exts) . Tree.filterDir (notIn excludeDirs)) dir - where - -- Build a list of only FilePath's (remove directories and failures) - onlyFiles (Tree.Dir _ fs) = concatMap onlyFiles fs - onlyFiles (Tree.Failed _ _) = [] - onlyFiles (Tree.File _ f) = [f] - - -- Predicate for Files with one of the extensions in 'exts'. - withExtensions exts (Tree.File n _) - | pathIsMinified n = False - | takeExtension n `elem` exts = True - | otherwise = False - withExtensions _ _ = True - - -- Predicate for contents NOT in a directory - notIn dirs (Tree.Dir n _) - | (x:_) <- n, x == '.' = False -- Don't include directories that start with '.'. - | n `elem` dirs = False - | otherwise = True - notIn _ _ = True diff --git a/src/Semantic/REPL.hs b/src/Semantic/REPL.hs deleted file mode 100644 index 7389423937..0000000000 --- a/src/Semantic/REPL.hs +++ /dev/null @@ -1,217 +0,0 @@ -{-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, TypeOperators, UndecidableInstances #-} -{-# OPTIONS_GHC -Wno-missing-signatures -O0 #-} -module Semantic.REPL -( rubyREPL -) where - -import Control.Abstract hiding (Continue, List, string) -import Control.Abstract.ScopeGraph (runScopeError) -import Control.Abstract.Heap (runHeapError) -import Control.Effect.Carrier -import Control.Effect.Catch -import Control.Effect.Resource -import Control.Effect.Sum -import Control.Effect.REPL -import Data.Abstract.Address.Precise as Precise -import Data.Abstract.Evaluatable hiding (string) -import Data.Abstract.Module -import Data.Abstract.ModuleTable as ModuleTable -import Data.Abstract.Package -import Data.Abstract.Value.Concrete as Concrete -import Data.Blob (File(..), Blob(..)) -import Data.Error (Colourize (..), showExcerpt) -import Data.Blob.IO (readBlobFromFile) -import Data.Flag (flag) -import Data.Graph (topologicalSort) -import Data.Language as Language -import Data.List (uncons) -import Data.Project -import Data.Quieterm -import Data.Span -import qualified Data.Text as T -import qualified Data.Time.Clock.POSIX as Time (getCurrentTime) -import qualified Data.Time.LocalTime as LocalTime -import Numeric (readDec) -import Parsing.Parser (rubyParser) -import Prologue -import Semantic.Analysis -import Semantic.Config (logOptionsFromConfig) -import Semantic.Distribute -import Semantic.Graph -import Semantic.Resolution -import Semantic.Task hiding (Error) -import qualified Semantic.Task.Files as Files -import Semantic.Telemetry -import Semantic.Timeout -import Semantic.Telemetry.Log (LogOptions, Message(..), writeLogMessage) -import Semantic.Util -import System.Console.Haskeline -import System.Directory (createDirectoryIfMissing, getHomeDirectory) -import System.FilePath - -data Quit = Quit - deriving Show - -instance Exception Quit - -rubyREPL = repl (Proxy @'Language.Ruby) rubyParser - -repl proxy parser paths = - withOptions debugOptions $ \config logger statter -> - runM - . withDistribute - . withCatch - . withResource - . withTimeout - . runError @SomeException - . runTelemetryIgnoringStat (logOptionsFromConfig config) - . runTraceInTelemetry - . runReader (TaskSession config "-" False logger statter) - . Files.runFiles - . runResolution - . runTaskF $ do - blobs <- catMaybes <$> traverse readBlobFromFile (flip File (Language.reflect proxy) <$> paths) - package <- fmap (fmap quieterm) <$> parsePackage parser (Project (takeDirectory (maybe "/" fst (uncons paths))) blobs (Language.reflect proxy) []) - modules <- topologicalSort <$> runImportGraphToModules proxy (snd <$> package) - homeDir <- liftIO getHomeDirectory - prefs <- liftIO (readPrefs (homeDir <> "/.haskeline")) - let settingsDir = homeDir <> "/.local/semantic" - liftIO $ createDirectoryIfMissing True settingsDir - let settings = Settings - { complete = noCompletion - , historyFile = Just (settingsDir <> "/repl_history") - , autoAddHistory = True - } - runEvaluator - . runREPL prefs settings - . fmap snd - . runState ([] @Breakpoint) - . runReader Step - . runEvaluator - . id @(Evaluator _ Precise (Value _ Precise) _ _) - . raiseHandler runTraceByPrinting - . runHeap - . runScopeGraph - . raiseHandler runFresh - . fmap reassociate - . runLoadError - . runUnspecialized - . runScopeError - . runHeapError - . runEvalError - . runResolutionError - . runAddressError - . runValueError - . runModuleTable - . runModules (ModuleTable.modulePaths (packageModules (snd <$> package))) - . raiseHandler (runReader (packageInfo package)) - . raiseHandler (runState (lowerBound @Span)) - . raiseHandler (runReader (lowerBound @Span)) - $ evaluate proxy (runDomainEffects (evalTerm (withTermSpans . step (fmap moduleBody <$> ModuleTable.toPairs (packageModules (fst <$> package)))))) modules - --- TODO: REPL for typechecking/abstract semantics --- TODO: drive the flow from within the REPL instead of from without - - -runTelemetryIgnoringStat :: LogOptions -> TelemetryIgnoringStatC m a -> m a -runTelemetryIgnoringStat logOptions = runReader logOptions . runTelemetryIgnoringStatC - -newtype TelemetryIgnoringStatC m a = TelemetryIgnoringStatC { runTelemetryIgnoringStatC :: ReaderC LogOptions m a } - deriving (Applicative, Functor, Monad, MonadIO) - -instance (Carrier sig m, MonadIO m) => Carrier (Telemetry :+: sig) (TelemetryIgnoringStatC m) where - eff (R other) = TelemetryIgnoringStatC . eff . R . handleCoercible $ other - eff (L op) = do - logOptions <- TelemetryIgnoringStatC ask - case op of - WriteStat _ k -> k - WriteLog level message pairs k -> do - time <- liftIO Time.getCurrentTime - zonedTime <- liftIO (LocalTime.utcToLocalZonedTime time) - writeLogMessage logOptions (Message level message pairs zonedTime) - k - -step :: ( Member (Error SomeException) sig - , Member REPL sig - , Member (Reader ModuleInfo) sig - , Member (Reader Span) sig - , Member (Reader Step) sig - , Member (State [Breakpoint]) sig - , Carrier sig m - ) - => [(ModulePath, Blob)] - -> Open (term -> Evaluator term address value m a) -step blobs recur term = do - break <- shouldBreak - if break then do - list - runCommands (recur term) - else - recur term - where list = do - path <- asks modulePath - span <- ask - maybe (pure ()) (\ blob -> output (T.pack (showExcerpt (flag Colourize True) span blob ""))) (Prelude.lookup path blobs) - help = do - output "Commands available from the prompt:" - output "" - output " :help, :? display this list of commands" - output " :list show the source code around current breakpoint" - output " :step single-step after stopping at a breakpoint" - output " :continue continue evaluation until the next breakpoint" - output " :show bindings show the current bindings" - output " :quit, :q, :abandon abandon the current evaluation and exit the repl" - -- TODO: showScopeGraph option for REPL. - -- showBindings = do - -- bindings <- Env.head <$> getEnv - -- output . T.pack $ unlines (uncurry showBinding <$> Env.pairs bindings) - -- showBinding name addr = show name <> " = " <> show addr - runCommand run [":step"] = local (const Step) run - runCommand run [":continue"] = local (const Continue) run - runCommand run [":break", s] - | [(i, "")] <- readDec (T.unpack s) = modify (OnLine i :) >> runCommands run - -- TODO: :show breakpoints - -- TODO: :delete breakpoints - runCommand run [":list"] = list >> runCommands run - -- TODO: Show the scope graph - -- runCommand run [":show", "bindings"] = showBindings >> runCommands run - -- TODO: show the value(s) in the heap - -- TODO: can we call functions somehow? Maybe parse expressions with the current parser? - runCommand _ [quit] | quit `elem` [":quit", ":q", ":abandon"] = throwError (SomeException Quit) - runCommand run [":help"] = help >> runCommands run - runCommand run [":?"] = help >> runCommands run - runCommand run [] = runCommands run - runCommand run other = output ("unknown command '" <> T.unwords other <> "'") >> output "use :? for help" >> runCommands run - runCommands run = do - str <- prompt "repl: " - maybe (runCommands run) (runCommand run . T.words) str - - -newtype Breakpoint - = OnLine Int - deriving Show - --- FIXME: OnLine should take a module, defaulting to the current module --- TODO: OnPos, taking a column number as well as line number and module --- TODO: OnSymbol, taking a function/method name? This could be tricky to implement cross-language - -data Step - = Step - | Continue - deriving Show - --- TODO: StepLocal/StepModule - -shouldBreak :: (Member (State [Breakpoint]) sig, Member (Reader Span) sig, Member (Reader Step) sig, Carrier sig m) => Evaluator term address value m Bool -shouldBreak = do - step <- ask - case step of - Step -> pure True - Continue -> do - breakpoints <- get - span <- ask - pure (any @[] (matching span) breakpoints) - where matching Span{..} (OnLine n) - | n >= posLine spanStart - , n <= posLine spanEnd = True - | otherwise = False diff --git a/src/Semantic/Resolution.hs b/src/Semantic/Resolution.hs deleted file mode 100644 index 5fa83a67da..0000000000 --- a/src/Semantic/Resolution.hs +++ /dev/null @@ -1,62 +0,0 @@ -{-# LANGUAGE ConstraintKinds, DeriveAnyClass, DerivingStrategies, GADTs, GeneralizedNewtypeDeriving, KindSignatures, ScopedTypeVariables, TypeOperators, UndecidableInstances #-} -module Semantic.Resolution - ( Resolution (..) - , nodeJSResolutionMap - , resolutionMap - , runResolution - , ResolutionC(..) - ) where - -import Control.Effect -import Control.Effect.Carrier -import Control.Effect.Sum -import Data.Aeson -import Data.Aeson.Types (parseMaybe) -import Data.Blob -import Data.Project -import qualified Data.Map as Map -import Data.Source -import Data.Language -import Prologue -import Semantic.Task.Files -import System.FilePath.Posix - - -nodeJSResolutionMap :: (Member Files sig, Carrier sig m, MonadIO m) => FilePath -> Text -> [FilePath] -> m (Map FilePath FilePath) -nodeJSResolutionMap rootDir prop excludeDirs = do - files <- findFiles rootDir [".json"] excludeDirs - let packageFiles = fileForPath <$> filter ((==) "package.json" . takeFileName) files - blobs <- readBlobs (FilesFromPaths packageFiles) - pure $ fold (mapMaybe (lookup prop) blobs) - where - lookup :: Text -> Blob -> Maybe (Map FilePath FilePath) - lookup k b@Blob{..} = decodeStrict (sourceBytes blobSource) >>= lookupProp (blobPath b) k - - lookupProp :: FilePath -> Text -> Object -> Maybe (Map FilePath FilePath) - lookupProp path k res = flip parseMaybe res $ \obj -> Map.singleton relPkgDotJSONPath . relEntryPath <$> obj .: k - where relPkgDotJSONPath = makeRelative rootDir path - relEntryPath x = takeDirectory relPkgDotJSONPath x - -resolutionMap :: (Member Resolution sig, Carrier sig m) => Project -> m (Map FilePath FilePath) -resolutionMap Project{..} = case projectLanguage of - TypeScript -> send (NodeJSResolution projectRootDir "types" projectExcludeDirs pure) - JavaScript -> send (NodeJSResolution projectRootDir "main" projectExcludeDirs pure) - _ -> send (NoResolution pure) - -data Resolution (m :: * -> *) k - = NodeJSResolution FilePath Text [FilePath] (Map FilePath FilePath -> k) - | NoResolution (Map FilePath FilePath -> k) - deriving stock Functor - deriving anyclass (HFunctor, Effect) - -runResolution :: ResolutionC m a -> m a -runResolution = runResolutionC - -newtype ResolutionC m a = ResolutionC { runResolutionC :: m a } - deriving newtype (Applicative, Functor, Monad, MonadIO) - -instance (Member Files sig, Carrier sig m, MonadIO m) => Carrier (Resolution :+: sig) (ResolutionC m) where - eff (R other) = ResolutionC . eff . handleCoercible $ other - eff (L op) = case op of - NodeJSResolution dir prop excludeDirs k -> nodeJSResolutionMap dir prop excludeDirs >>= k - NoResolution k -> k Map.empty diff --git a/src/Semantic/Task.hs b/src/Semantic/Task.hs deleted file mode 100644 index be66a55547..0000000000 --- a/src/Semantic/Task.hs +++ /dev/null @@ -1,349 +0,0 @@ -{-# LANGUAGE ConstraintKinds, ExistentialQuantification, GADTs, GeneralizedNewtypeDeriving, KindSignatures, ScopedTypeVariables, StandaloneDeriving, TypeOperators, UndecidableInstances #-} -module Semantic.Task -( Task -, TaskEff -, Level(..) -, RAlgebra --- * I/O -, Files.readBlob -, Files.readBlobs -, Files.readBlobPairs -, Files.readProject -, Files.findFiles -, Files.write -, Files.FilesArg(..) --- * Module Resolution -, resolutionMap -, Resolution --- * Telemetry -, writeLog -, writeStat -, time -, time' --- * High-level flow -, parse -, analyze -, decorate -, diff -, render -, serialize --- * Concurrency -, distribute -, distributeFor -, distributeFoldMap --- * Configuration -, debugOptions -, defaultOptions -, defaultConfig -, terminalFormatter -, logfmtFormatter --- * Interpreting -, runTask -, runTaskWithOptions -, withOptions -, TaskSession(..) -, runTraceInTelemetry -, runTaskF --- * Exceptions -, ParserCancelled(..) --- * Re-exports -, Distribute -, Error -, Lift -, throwError -, SomeException(..) -, Telemetry -) where - -import Analysis.Decorator (decoratorWithAlgebra) -import qualified Assigning.Assignment as Assignment -import qualified Assigning.Assignment.Deterministic as Deterministic -import qualified Control.Abstract as Analysis -import Control.Effect -import Control.Effect.Carrier -import Control.Effect.Catch -import Control.Effect.Error -import Control.Effect.Reader -import Control.Effect.Resource -import Control.Effect.Sum -import Control.Effect.Trace -import Control.Monad -import Control.Monad.IO.Class -import Data.Blob -import Data.ByteString.Builder -import Data.Coerce -import Data.Diff -import qualified Data.Error as Error -import qualified Data.Flag as Flag -import Data.Location -import Data.Source (Source) -import Data.Sum -import qualified Data.Syntax as Syntax -import Data.Term -import Diffing.Algorithm (Diffable) -import Diffing.Interpreter -import Parsing.CMark -import Parsing.Parser -import Parsing.TreeSitter -import Prologue hiding (project) -import Semantic.Config -import Semantic.Distribute -import qualified Semantic.Task.Files as Files -import Semantic.Timeout -import Semantic.Resolution -import Semantic.Telemetry -import Serializing.Format hiding (Options) - --- | A high-level task producing some result, e.g. parsing, diffing, rendering. 'Task's can also specify explicit concurrency via 'distribute', 'distributeFor', and 'distributeFoldMap' -type TaskEff - = TaskC - ( ResolutionC - ( Files.FilesC - ( ReaderC TaskSession - ( TraceInTelemetryC - ( TelemetryC - ( ErrorC SomeException - ( TimeoutC - ( ResourceC - ( CatchC - ( DistributeC - ( LiftC IO))))))))))) - --- | A function to render terms or diffs. -type Renderer i o = i -> o - --- | A task which parses a 'Blob' with the given 'Parser'. -parse :: (Member Task sig, Carrier sig m) - => Parser term - -> Blob - -> m term -parse parser blob = send (Parse parser blob pure) - --- | A task running some 'Analysis.Evaluator' to completion. -analyze :: (Member Task sig, Carrier sig m) - => (Analysis.Evaluator term address value m a -> result) - -> Analysis.Evaluator term address value m a - -> m result -analyze interpret analysis = send (Analyze interpret analysis pure) - --- | A task which decorates a 'Term' with values computed using the supplied 'RAlgebra' function. -decorate :: (Functor f, Member Task sig, Carrier sig m) - => RAlgebra (TermF f Location) (Term f Location) field - -> Term f Location - -> m (Term f field) -decorate algebra term = send (Decorate algebra term pure) - --- | A task which diffs a pair of terms using the supplied 'Differ' function. -diff :: (Diffable syntax, Eq1 syntax, Hashable1 syntax, Traversable syntax, Member Task sig, Carrier sig m) - => These (Term syntax ann) (Term syntax ann) - -> m (Diff syntax ann ann) -diff terms = send (Semantic.Task.Diff terms pure) - --- | A task which renders some input using the supplied 'Renderer' function. -render :: (Member Task sig, Carrier sig m) - => Renderer input output - -> input - -> m output -render renderer input = send (Render renderer input pure) - -serialize :: (Member Task sig, Carrier sig m) - => Format input - -> input - -> m Builder -serialize format input = send (Serialize format input pure) - -data TaskSession - = TaskSession - { config :: Config - , requestID :: String - , isPublic :: Bool - , logger :: LogQueue - , statter :: StatQueue - } - --- | Execute a 'TaskEff' yielding its result value in 'IO'. -runTask :: TaskSession -> TaskEff a -> IO (Either SomeException a) -runTask taskSession@TaskSession{..} task = do - (result, stat) <- withTiming "run" [] $ do - let run :: TaskEff a -> IO (Either SomeException a) - run - = runM - . withDistribute - . withCatch - . withResource - . withTimeout - . runError - . runTelemetry logger statter - . runTraceInTelemetry - . runReader taskSession - . Files.runFiles - . runResolution - . runTaskF - run task - queueStat statter stat - pure result - --- | Execute a 'TaskEff' yielding its result value in 'IO' using all default options and configuration. -runTaskWithOptions :: Options -> TaskEff a -> IO (Either SomeException a) -runTaskWithOptions options task = withOptions options $ \ config logger statter -> - runTask (TaskSession config "-" False logger statter) task - --- | Yield config and telemetry queues for options. -withOptions :: Options -> (Config -> LogQueue -> StatQueue -> IO a) -> IO a -withOptions options with = do - config <- defaultConfig options - withTelemetry config (\ (TelemetryQueues logger statter _) -> with config logger statter) - -runTraceInTelemetry :: TraceInTelemetryC m a - -> m a -runTraceInTelemetry = runTraceInTelemetryC - -newtype TraceInTelemetryC m a = TraceInTelemetryC { runTraceInTelemetryC :: m a } - deriving (Applicative, Functor, Monad, MonadIO) - -instance (Member Telemetry sig, Carrier sig m) => Carrier (Trace :+: sig) (TraceInTelemetryC m) where - eff (R other) = TraceInTelemetryC . eff . handleCoercible $ other - eff (L (Trace str k)) = writeLog Debug str [] >> k - - --- | An effect describing high-level tasks to be performed. -data Task (m :: * -> *) k - = forall term . Parse (Parser term) Blob (term -> k) - | forall term address value m a result . Analyze (Analysis.Evaluator term address value m a -> result) (Analysis.Evaluator term address value m a) (result -> k) - | forall f field . Functor f => Decorate (RAlgebra (TermF f Location) (Term f Location) field) (Term f Location) (Term f field -> k) - | forall syntax ann . (Diffable syntax, Eq1 syntax, Hashable1 syntax, Traversable syntax) => Diff (These (Term syntax ann) (Term syntax ann)) (Diff syntax ann ann -> k) - | forall input output . Render (Renderer input output) input (output -> k) - | forall input . Serialize (Format input) input (Builder -> k) - -deriving instance Functor (Task m) - -instance HFunctor Task where - hmap _ = coerce - -instance Effect Task where - handle state handler (Parse parser blob k) = Parse parser blob (handler . (<$ state) . k) - handle state handler (Analyze run analysis k) = Analyze run analysis (handler . (<$ state) . k) - handle state handler (Decorate decorator term k) = Decorate decorator term (handler . (<$ state) . k) - handle state handler (Semantic.Task.Diff terms k) = Semantic.Task.Diff terms (handler . (<$ state) . k) - handle state handler (Render renderer input k) = Render renderer input (handler . (<$ state) . k) - handle state handler (Serialize format input k) = Serialize format input (handler . (<$ state) . k) - --- | Run a 'Task' effect by performing the actions in 'IO'. -runTaskF :: TaskC m a -> m a -runTaskF = runTaskC - -newtype TaskC m a = TaskC { runTaskC :: m a } - deriving (Applicative, Functor, Monad, MonadIO) - -instance (Member (Error SomeException) sig, Member (Lift IO) sig, Member (Reader TaskSession) sig, Member Resource sig, Member Telemetry sig, Member Timeout sig, Member Trace sig, Carrier sig m, MonadIO m) => Carrier (Task :+: sig) (TaskC m) where - eff (R other) = TaskC . eff . handleCoercible $ other - eff (L op) = case op of - Parse parser blob k -> runParser blob parser >>= k - Analyze interpret analysis k -> k . interpret $ analysis - Decorate algebra term k -> k (decoratorWithAlgebra algebra term) - Semantic.Task.Diff terms k -> k (diffTermPair terms) - Render renderer input k -> k (renderer input) - Serialize format input k -> do - formatStyle <- asks (Flag.choose IsTerminal Plain Colourful . configIsTerminal . config) - k (runSerialize formatStyle format input) - - --- | Log an 'Error.Error' at the specified 'Level'. -logError :: (Member Telemetry sig, Carrier sig m) - => TaskSession - -> Level - -> Blob - -> Error.Error String - -> [(String, String)] - -> m () -logError TaskSession{..} level blob err = - let shouldLogSource = configLogPrintSource config - shouldColorize = Flag.switch IsTerminal Error.Colourize $ configIsTerminal config - in writeLog level (Error.formatError shouldLogSource shouldColorize blob err) - -data ParserCancelled = ParserTimedOut | AssignmentTimedOut - deriving (Show, Typeable) - -instance Exception ParserCancelled - --- | Parse a 'Blob' in 'IO'. -runParser :: (Member (Error SomeException) sig, Member (Lift IO) sig, Member (Reader TaskSession) sig, Member Resource sig, Member Telemetry sig, Member Timeout sig, Member Trace sig, Carrier sig m, MonadIO m) - => Blob - -> Parser term - -> m term -runParser blob@Blob{..} parser = case parser of - ASTParser language -> - time "parse.tree_sitter_ast_parse" languageTag $ do - config <- asks config - parseToAST (configTreeSitterParseTimeout config) language blob - >>= maybeM (throwError (SomeException ParserTimedOut)) - - AssignmentParser parser assignment -> runAssignment Assignment.assign parser assignment - DeterministicParser parser assignment -> runAssignment Deterministic.assign parser assignment - - MarkdownParser -> - time "parse.cmark_parse" languageTag $ - let term = cmarkParser blobSource - in length term `seq` pure term - SomeParser parser -> SomeTerm <$> runParser blob parser - where languageTag = pure . (,) ("language" :: String) . show $ blobLanguage blob - errors :: (Syntax.Error :< fs, Apply Foldable fs, Apply Functor fs) => Term (Sum fs) Assignment.Location -> [Error.Error String] - errors = cata $ \ (In Assignment.Location{..} syntax) -> case syntax of - _ | Just err@Syntax.Error{} <- project syntax -> [Syntax.unError locationSpan err] - _ -> fold syntax - runAssignment :: ( Apply Foldable syntaxes - , Apply Functor syntaxes - , Element Syntax.Error syntaxes - , Member (Error SomeException) sig - , Member (Lift IO) sig - , Member (Reader TaskSession) sig - , Member Resource sig - , Member Telemetry sig - , Member Timeout sig - , Member Trace sig - , Carrier sig m - , MonadIO m - ) - => (Source -> assignment (Term (Sum syntaxes) Assignment.Location) -> ast -> Either (Error.Error String) (Term (Sum syntaxes) Assignment.Location)) - -> Parser ast - -> assignment (Term (Sum syntaxes) Assignment.Location) - -> m (Term (Sum syntaxes) Assignment.Location) - runAssignment assign parser assignment = do - taskSession <- ask - let requestID' = ("github_request_id", requestID taskSession) - let isPublic' = ("github_is_public", show (isPublic taskSession)) - let logPrintFlag = configLogPrintSource . config $ taskSession - let blobFields = ("path", if isPublic taskSession || Flag.toBool LogPrintSource logPrintFlag then blobPath blob else "") - let logFields = requestID' : isPublic' : blobFields : languageTag - let shouldFailForTesting = configFailParsingForTesting $ config taskSession - let shouldFailOnParsing = optionsFailOnParseError . configOptions $ config taskSession - let shouldFailOnWarning = optionsFailOnWarning . configOptions $ config taskSession - - ast <- runParser blob parser `catchError` \ (SomeException err) -> do - writeStat (increment "parse.parse_failures" languageTag) - writeLog Error "failed parsing" (("task", "parse") : logFields) - throwError (toException err) - - res <- timeout (configAssignmentTimeout (config taskSession)) . time "parse.assign" languageTag $ - case assign blobSource assignment ast of - Left err -> do - writeStat (increment "parse.assign_errors" languageTag) - logError taskSession Error blob err (("task", "assign") : logFields) - throwError (toException err) - Right term -> do - for_ (zip (errors term) [(0::Integer)..]) $ \ (err, i) -> case Error.errorActual err of - Just "ParseError" -> do - when (i == 0) $ writeStat (increment "parse.parse_errors" languageTag) - logError taskSession Warning blob err (("task", "parse") : logFields) - when (Flag.toBool FailOnParseError shouldFailOnParsing) (throwError (toException err)) - _ -> do - when (i == 0) $ writeStat (increment "parse.assign_warnings" languageTag) - logError taskSession Warning blob err (("task", "assign") : logFields) - when (Flag.toBool FailOnWarning shouldFailOnWarning) (throwError (toException err)) - term <$ writeStat (count "parse.nodes" (length term) languageTag) - case res of - Just r | not (Flag.toBool FailTestParsing shouldFailForTesting) -> pure r - _ -> do - writeStat (increment "assign.assign_timeouts" languageTag) - writeLog Error "assignment timeout" (("task", "assign") : logFields) - throwError (SomeException AssignmentTimedOut) diff --git a/src/Semantic/Task/Files.hs b/src/Semantic/Task/Files.hs deleted file mode 100644 index 14a4599679..0000000000 --- a/src/Semantic/Task/Files.hs +++ /dev/null @@ -1,121 +0,0 @@ -{-# LANGUAGE ExistentialQuantification, GADTs, GeneralizedNewtypeDeriving, KindSignatures, TypeOperators, UndecidableInstances #-} - -module Semantic.Task.Files - ( Files - , Destination (..) - , Source (..) - , runFiles - , readBlob - , readBlobs - , readBlobPairs - , readProject - , findFiles - , write - , Handle (..) - , FilesC(..) - , FilesArg(..) - , Excludes(..) - ) where - -import Control.Effect -import Control.Effect.Carrier -import Control.Effect.Catch -import Control.Effect.Error -import Control.Effect.Sum -import Data.Blob -import Data.Blob.IO -import qualified Data.ByteString.Builder as B -import Data.Handle -import Data.Language -import Data.Project hiding (readFile) -import Prelude hiding (readFile) -import Prologue hiding (catch) -import qualified Semantic.Git as Git -import Semantic.IO -import qualified System.IO as IO - -data Source blob where - FromPath :: File -> Source Blob - FromHandle :: Handle 'IO.ReadMode -> Source [Blob] - FromDir :: FilePath -> Source [Blob] - FromGitRepo :: FilePath -> Git.OID -> Excludes -> Source [Blob] - FromPathPair :: Both File -> Source BlobPair - FromPairHandle :: Handle 'IO.ReadMode -> Source [BlobPair] - -data Destination = ToPath FilePath | ToHandle (Handle 'IO.WriteMode) - -data Excludes - = ExcludePaths [FilePath] - | ExcludeFromHandle (Handle 'IO.ReadMode) - --- | An effect to read/write 'Blob's from 'Handle's or 'FilePath's. -data Files (m :: * -> *) k - = forall a . Read (Source a) (a -> k) - | ReadProject (Maybe FilePath) FilePath Language [FilePath] (Project -> k) - | FindFiles FilePath [String] [FilePath] ([FilePath] -> k) - | Write Destination B.Builder k - -deriving instance Functor (Files m) -instance HFunctor Files -instance Effect Files - --- | Run a 'Files' effect in 'IO' -runFiles :: FilesC m a -> m a -runFiles = runFilesC - -newtype FilesC m a = FilesC { runFilesC :: m a } - deriving (Functor, Applicative, Monad, MonadIO) - -instance (Member (Error SomeException) sig, Member Catch sig, MonadIO m, Carrier sig m) => Carrier (Files :+: sig) (FilesC m) where - eff (R other) = FilesC (eff (handleCoercible other)) - eff (L op) = case op of - Read (FromPath path) k -> rethrowing (readBlobFromFile' path) >>= k - Read (FromHandle handle) k -> rethrowing (readBlobsFromHandle handle) >>= k - Read (FromDir dir) k -> rethrowing (readBlobsFromDir dir) >>= k - Read (FromGitRepo path sha (ExcludePaths excludePaths)) k -> rethrowing (readBlobsFromGitRepo path sha excludePaths) >>= k - Read (FromGitRepo path sha (ExcludeFromHandle handle)) k -> rethrowing (readPathsFromHandle handle >>= readBlobsFromGitRepo path sha) >>= k - Read (FromPathPair paths) k -> rethrowing (runBothWith readFilePair paths) >>= k - Read (FromPairHandle handle) k -> rethrowing (readBlobPairsFromHandle handle) >>= k - ReadProject rootDir dir language excludeDirs k -> rethrowing (readProjectFromPaths rootDir dir language excludeDirs) >>= k - FindFiles dir exts excludeDirs k -> rethrowing (findFilesInDir dir exts excludeDirs) >>= k - Write (ToPath path) builder k -> rethrowing (liftIO (IO.withBinaryFile path IO.WriteMode (`B.hPutBuilder` builder))) >> k - Write (ToHandle (WriteHandle handle)) builder k -> rethrowing (liftIO (B.hPutBuilder handle builder)) >> k - -readBlob :: (Member Files sig, Carrier sig m) => File -> m Blob -readBlob file = send (Read (FromPath file) pure) - --- Various ways to read in files -data FilesArg - = FilesFromHandle (Handle 'IO.ReadMode) - | FilesFromPaths [File] - | FilesFromGitRepo FilePath Git.OID Excludes - --- | A task which reads a list of 'Blob's from a 'Handle' or a list of 'FilePath's optionally paired with 'Language's. -readBlobs :: (Member Files sig, Carrier sig m, MonadIO m) => FilesArg -> m [Blob] -readBlobs (FilesFromHandle handle) = send (Read (FromHandle handle) pure) -readBlobs (FilesFromPaths [path]) = do - isDir <- isDirectory (filePath path) - if isDir - then send (Read (FromDir (filePath path)) pure) - else pure <$> send (Read (FromPath path) pure) -readBlobs (FilesFromPaths paths) = traverse (send . flip Read pure . FromPath) paths -readBlobs (FilesFromGitRepo path sha excludes) = send (Read (FromGitRepo path sha excludes) pure) - --- | A task which reads a list of pairs of 'Blob's from a 'Handle' or a list of pairs of 'FilePath's optionally paired with 'Language's. -readBlobPairs :: (Member Files sig, Carrier sig m) => Either (Handle 'IO.ReadMode) [Both File] -> m [BlobPair] -readBlobPairs (Left handle) = send (Read (FromPairHandle handle) pure) -readBlobPairs (Right paths) = traverse (send . flip Read pure . FromPathPair) paths - -readProject :: (Member Files sig, Carrier sig m) => Maybe FilePath -> FilePath -> Language -> [FilePath] -> m Project -readProject rootDir dir lang excludeDirs = send (ReadProject rootDir dir lang excludeDirs pure) - -findFiles :: (Member Files sig, Carrier sig m) => FilePath -> [String] -> [FilePath] -> m [FilePath] -findFiles dir exts paths = send (FindFiles dir exts paths pure) - --- | A task which writes a 'B.Builder' to a 'Handle' or a 'FilePath'. -write :: (Member Files sig, Carrier sig m) => Destination -> B.Builder -> m () -write dest builder = send (Write dest builder (pure ())) - --- | Catch synchronous exceptions thrown in 'IO' and rethrow them in an 'Error' effect. -rethrowing :: (Member Catch sig, Member (Error SomeException) sig, MonadIO m, Carrier sig m) => m a -> m a -rethrowing act = act `catchSync` throwError @SomeException diff --git a/src/Semantic/Telemetry.hs b/src/Semantic/Telemetry.hs deleted file mode 100644 index 089dcc31d2..0000000000 --- a/src/Semantic/Telemetry.hs +++ /dev/null @@ -1,170 +0,0 @@ -{-# LANGUAGE DeriveAnyClass, DerivingStrategies, GADTs, GeneralizedNewtypeDeriving, KindSignatures, RankNTypes, TypeOperators, UndecidableInstances #-} -module Semantic.Telemetry -( - -- Async telemetry interface - withLogger -, withErrorReporter -, withStatter -, LogQueue -, StatQueue -, ErrorQueue -, TelemetryQueues(..) -, queueLogMessage -, queueErrorReport -, queueStat - --- Create stats -, Stat.increment -, Stat.decrement -, Stat.count -, Stat.gauge -, Stat.timing -, Stat.withTiming -, Stat.histogram -, Stat.set - --- Statsd client -, statsClient -, StatsClient - --- Error reporters -, nullErrorReporter - --- Logging options and formatters -, Level(..) -, LogOptions(..) -, logfmtFormatter -, terminalFormatter -, LogFormatter - --- Eff interface for telemetry -, writeLog -, writeStat -, time -, time' -, Telemetry(..) -, runTelemetry -, TelemetryC(..) -, ignoreTelemetry -, IgnoreTelemetryC(..) -) where - -import Control.Effect -import Control.Effect.Carrier -import Control.Effect.Reader -import Control.Effect.Sum -import Control.Exception -import Control.Monad.IO.Class -import qualified Data.Time.Clock.POSIX as Time (getCurrentTime) -import qualified Data.Time.LocalTime as LocalTime -import Semantic.Telemetry.AsyncQueue -import Semantic.Telemetry.Error -import Semantic.Telemetry.Log -import Semantic.Telemetry.Stat as Stat - -type LogQueue = AsyncQueue Message LogOptions -type StatQueue = AsyncQueue Stat StatsClient -type ErrorQueue = AsyncQueue ErrorReport ErrorReporter - -data TelemetryQueues - = TelemetryQueues - { telemetryLogger :: LogQueue - , telemetryStatter :: StatQueue - , telemetryErrorReporter :: ErrorQueue - } - --- | Execute an action in IO with access to a logger (async log queue). -withLogger :: LogOptions -- ^ Log options - -> Int -- ^ Max stats queue size before dropping stats - -> (LogQueue -> IO c) -- ^ Action in IO - -> IO c -withLogger options size = bracket setup closeAsyncQueue - where setup = newAsyncQueue size writeLogMessage options - --- | Execute an action in IO with access to an error reporter (async error reporting queue). -withErrorReporter :: IO ErrorReporter -> Int -> (ErrorQueue -> IO c) -> IO c -withErrorReporter errorReporter size = bracket setup closeAsyncQueue - where setup = errorReporter >>= newAsyncQueue size ($) - --- | Execute an action in IO with access to a statter (async stat queue). --- Handles the bracketed setup and teardown of the underlying 'AsyncQueue' and --- 'StatsClient'. -withStatter :: Host -- ^ Statsd host - -> Port -- ^ Statsd port - -> Namespace -- ^ Namespace prefix for stats - -> Int -- ^ Max stats queue size before dropping stats - -> (StatQueue -> IO c) -- ^ Action in IO - -> IO c -withStatter host port ns size = bracket setup teardown - where setup = statsClient host port ns >>= newAsyncQueue size sendStat - teardown statter = closeAsyncQueue statter >> Stat.closeStatClient (asyncQueueExtra statter) - --- | Queue a message to be logged. -queueLogMessage :: MonadIO io => LogQueue -> Level -> String -> [(String, String)] -> io () -queueLogMessage q@AsyncQueue{..} level message pairs - | Just logLevel <- logOptionsLevel asyncQueueExtra - , level <= logLevel = liftIO Time.getCurrentTime >>= liftIO . LocalTime.utcToLocalZonedTime >>= liftIO . writeAsyncQueue q . Message level message pairs - | otherwise = pure () - --- | Queue an error to be reported. -queueErrorReport :: MonadIO io => ErrorQueue -> SomeException -> [(String, String)] -> io () -queueErrorReport q@AsyncQueue{..} message = liftIO . writeAsyncQueue q . ErrorReport message - --- | Queue a stat to be sent to statsd. -queueStat :: MonadIO io => StatQueue -> Stat -> io () -queueStat q = liftIO . writeAsyncQueue q - - --- Eff interface - --- | A task which logs a message at a specific log level to stderr. -writeLog :: (Member Telemetry sig, Carrier sig m) => Level -> String -> [(String, String)] -> m () -writeLog level message pairs = send (WriteLog level message pairs (pure ())) - --- | A task which writes a stat. -writeStat :: (Member Telemetry sig, Carrier sig m) => Stat -> m () -writeStat stat = send (WriteStat stat (pure ())) - --- | A task which measures and stats the timing of another task. -time :: (Member Telemetry sig, Carrier sig m, MonadIO m) => String -> [(String, String)] -> m output -> m output -time statName tags task = do - (a, stat) <- withTiming statName tags task - a <$ writeStat stat - --- | A task which measures and returns the timing of another task. -time' :: MonadIO m => m output -> m (output, Double) -time' = withTiming' - --- | Statting and logging effects. -data Telemetry (m :: * -> *) k - = WriteStat Stat k - | WriteLog Level String [(String, String)] k - deriving stock Functor - deriving anyclass (HFunctor, Effect) - --- | Run a 'Telemetry' effect by expecting a 'Reader' of 'Queue's to write stats and logs to. -runTelemetry :: LogQueue -> StatQueue -> TelemetryC m a -> m a -runTelemetry logger statter = runReader (logger, statter) . runTelemetryC - -newtype TelemetryC m a = TelemetryC { runTelemetryC :: ReaderC (LogQueue, StatQueue) m a } - deriving newtype (Applicative, Functor, Monad, MonadIO) - -instance (Carrier sig m, MonadIO m) => Carrier (Telemetry :+: sig) (TelemetryC m) where - eff (L op) = do - queues <- TelemetryC ask - case op of - WriteStat stat k -> queueStat (snd queues) stat *> k - WriteLog level message pairs k -> queueLogMessage (fst queues) level message pairs *> k - eff (R other) = TelemetryC (eff (R (handleCoercible other))) - --- | Run a 'Telemetry' effect by ignoring statting/logging. -ignoreTelemetry :: IgnoreTelemetryC m a -> m a -ignoreTelemetry = runIgnoreTelemetryC - -newtype IgnoreTelemetryC m a = IgnoreTelemetryC { runIgnoreTelemetryC :: m a } - deriving newtype (Applicative, Functor, Monad) - -instance Carrier sig m => Carrier (Telemetry :+: sig) (IgnoreTelemetryC m) where - eff (R other) = IgnoreTelemetryC . eff . handleCoercible $ other - eff (L (WriteStat _ k)) = k - eff (L (WriteLog _ _ _ k)) = k diff --git a/src/Semantic/Telemetry/Error.hs b/src/Semantic/Telemetry/Error.hs deleted file mode 100644 index 2b546180a9..0000000000 --- a/src/Semantic/Telemetry/Error.hs +++ /dev/null @@ -1,27 +0,0 @@ -module Semantic.Telemetry.Error - ( ErrorLogger - , ErrorReport (..) - , ErrorReporter - , nullErrorReporter - ) where - -import Control.Exception - -data ErrorReport - = ErrorReport - { errorReportException :: SomeException - , errorReportContext :: [(String, String)] - } deriving (Show) - --- | Function to log if there are errors reporting an error. -type ErrorLogger = String -> [(String, String)] -> IO () - -type ErrorReporter = ErrorReport -> IO () - --- | Doesn't send error reports anywhere. Useful in tests or for basic command-line usage. -nullErrorReporter :: ErrorLogger -> IO ErrorReporter -nullErrorReporter logger = pure reportError - where - reportError ErrorReport{..} = let - msg = takeWhile (/= '\n') (displayException errorReportException) - in logger msg errorReportContext diff --git a/src/Semantic/Timeout.hs b/src/Semantic/Timeout.hs deleted file mode 100644 index 00d7410415..0000000000 --- a/src/Semantic/Timeout.hs +++ /dev/null @@ -1,68 +0,0 @@ -{-# LANGUAGE ExistentialQuantification, GeneralizedNewtypeDeriving, TypeOperators, RankNTypes, UndecidableInstances #-} -module Semantic.Timeout -( timeout -, Timeout -, runTimeout -, withTimeout -, TimeoutC(..) -, Duration(..) -) where - -import Control.Effect -import Control.Effect.Carrier -import Control.Effect.Reader -import Control.Effect.Sum -import Control.Monad.IO.Class -import Control.Monad.IO.Unlift -import Data.Duration -import qualified System.Timeout as System - --- | Run an action with a timeout. Returns 'Nothing' when no result is available --- within the specified duration. Uses 'System.Timeout.timeout' so all caveats --- about not operating over FFI boundaries apply. -timeout :: (Member Timeout sig, Carrier sig m) => Duration -> m output -> m (Maybe output) -timeout n = send . flip (Timeout n) pure - --- | 'Timeout' effects run other effects, aborting them if they exceed the --- specified duration. -data Timeout m k - = forall a . Timeout Duration (m a) (Maybe a -> k) - -deriving instance Functor (Timeout m) - -instance HFunctor Timeout where - hmap f (Timeout n task k) = Timeout n (f task) k - -instance Effect Timeout where - handle state handler (Timeout n task k) = Timeout n (handler (task <$ state)) (handler . maybe (k Nothing <$ state) (fmap (k . Just))) - --- | Evaulate a 'Timeout' effect. -runTimeout :: (forall x . m x -> IO x) - -> TimeoutC m a - -> m a -runTimeout handler = runReader (Handler handler) . runTimeoutC - --- | A helper for 'runTimeout' that uses 'withRunInIO' to automatically --- select a correct unlifting function. -withTimeout :: MonadUnliftIO m - => TimeoutC m a - -> m a -withTimeout r = withRunInIO (\f -> runHandler (Handler f) r) - -newtype Handler m = Handler (forall x . m x -> IO x) - -runHandler :: Handler m -> TimeoutC m a -> IO a -runHandler h@(Handler handler) = handler . runReader h . runTimeoutC - -newtype TimeoutC m a = TimeoutC { runTimeoutC :: ReaderC (Handler m) m a } - deriving (Functor, Applicative, Monad, MonadIO) - -instance MonadUnliftIO m => MonadUnliftIO (TimeoutC m) where - askUnliftIO = TimeoutC . ReaderC $ \(Handler h) -> - withUnliftIO $ \u -> pure (UnliftIO $ \r -> unliftIO u (runTimeout h r)) - -instance (Carrier sig m, MonadIO m) => Carrier (Timeout :+: sig) (TimeoutC m) where - eff (L (Timeout n task k)) = do - handler <- TimeoutC ask - liftIO (System.timeout (toMicroseconds n) (runHandler handler task)) >>= k - eff (R other) = TimeoutC (eff (R (handleCoercible other))) diff --git a/src/Semantic/Util.hs b/src/Semantic/Util.hs deleted file mode 100644 index 70c0f731f3..0000000000 --- a/src/Semantic/Util.hs +++ /dev/null @@ -1,231 +0,0 @@ -{-# LANGUAGE CPP, ConstraintKinds, Rank2Types, ScopedTypeVariables, TypeFamilies, TypeOperators #-} -{-# OPTIONS_GHC -Wno-missing-signatures -O0 #-} -module Semantic.Util - ( evalGoProject - , evalPHPProject - , evalPythonProject - , evalRubyProject - , evalTypeScriptProject - , evaluateProject' - , mergeErrors - , reassociate - , parseFile - ) where - -import Prelude hiding (readFile) - -import Control.Abstract -import Control.Abstract.Heap (runHeapError) -import Control.Abstract.ScopeGraph (runScopeError) -import Control.Effect.Trace (runTraceByPrinting) -import Control.Exception (displayException) -import Data.Abstract.Address.Precise as Precise -import Data.Abstract.Evaluatable -import Data.Abstract.Module -import qualified Data.Abstract.ModuleTable as ModuleTable -import Data.Abstract.Package -import Data.Abstract.Value.Concrete as Concrete -import Data.Blob -import Data.Blob.IO -import Data.Graph (topologicalSort) -import qualified Data.Language as Language -import Data.List (uncons) -import Data.Project hiding (readFile) -import Data.Quieterm (Quieterm, quieterm) -import Data.Sum (weaken) -import qualified Language.Go.Assignment -import qualified Language.PHP.Assignment -import qualified Language.Python.Assignment -import qualified Language.Ruby.Assignment -import qualified Language.TypeScript.Assignment -import Parsing.Parser -import Prologue -import Semantic.Analysis -import Semantic.Config -import Semantic.Graph -import Semantic.Task -import System.Exit (die) -import System.FilePath.Posix (takeDirectory) - -import Data.Location - --- The type signatures in these functions are pretty gnarly, but these functions --- are hit sufficiently often in the CLI and test suite so as to merit avoiding --- the overhead of repeated type inference. If you have to hack on these functions, --- it's recommended to remove all the type signatures and add them back when you --- are done (type holes in GHCi will help here). - -justEvaluating :: Evaluator - term - Precise - (Value term Precise) - (ResumableC - (BaseError (ValueError term Precise)) - (ResumableC - (BaseError (AddressError Precise (Value term Precise))) - (ResumableC - (BaseError ResolutionError) - (ResumableC - (BaseError - (EvalError term Precise (Value term Precise))) - (ResumableC - (BaseError (HeapError Precise)) - (ResumableC - (BaseError (ScopeError Precise)) - (ResumableC - (BaseError - (UnspecializedError - Precise (Value term Precise))) - (ResumableC - (BaseError - (LoadError - Precise - (Value term Precise))) - (FreshC - (StateC - (ScopeGraph - Precise) - (StateC - (Heap - Precise - Precise - (Value - term - Precise)) - (TraceByPrintingC - (LiftC - IO))))))))))))) - result - -> IO - (Heap Precise Precise (Value term Precise), - (ScopeGraph Precise, - Either - (SomeError - (Sum - '[BaseError (ValueError term Precise), - BaseError (AddressError Precise (Value term Precise)), - BaseError ResolutionError, - BaseError (EvalError term Precise (Value term Precise)), - BaseError (HeapError Precise), - BaseError (ScopeError Precise), - BaseError (UnspecializedError Precise (Value term Precise)), - BaseError (LoadError Precise (Value term Precise))])) - result)) -justEvaluating - = runM - . runEvaluator - . raiseHandler runTraceByPrinting - . runHeap - . runScopeGraph - . raiseHandler runFresh - . fmap reassociate - . runLoadError - . runUnspecialized - . runScopeError - . runHeapError - . runEvalError - . runResolutionError - . runAddressError - . runValueError - -type FileEvaluator syntax = - [FilePath] - -> IO - (Heap - Precise - Precise - (Value - (Quieterm (Sum syntax) Location) Precise), - (ScopeGraph Precise, - Either - (SomeError - (Sum - '[BaseError - (ValueError - (Quieterm (Sum syntax) Location) - Precise), - BaseError - (AddressError - Precise - (Value - (Quieterm - (Sum syntax) Location) - Precise)), - BaseError ResolutionError, - BaseError - (EvalError - (Quieterm (Sum syntax) Location) - Precise - (Value - (Quieterm - (Sum syntax) Location) - Precise)), - BaseError (HeapError Precise), - BaseError (ScopeError Precise), - BaseError - (UnspecializedError - Precise - (Value - (Quieterm - (Sum syntax) Location) - Precise)), - BaseError - (LoadError - Precise - (Value - (Quieterm - (Sum syntax) Location) - Precise))])) - (ModuleTable - (Module - (ModuleResult - Precise - (Value - (Quieterm (Sum syntax) Location) - Precise)))))) - -evalGoProject :: FileEvaluator Language.Go.Assignment.Syntax -evalGoProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.Go) goParser - -evalRubyProject :: FileEvaluator Language.Ruby.Assignment.Syntax -evalRubyProject = justEvaluating <=< evaluateProject (Proxy @'Language.Ruby) rubyParser - -evalPHPProject :: FileEvaluator Language.PHP.Assignment.Syntax -evalPHPProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.PHP) phpParser - -evalPythonProject :: FileEvaluator Language.Python.Assignment.Syntax -evalPythonProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.Python) pythonParser - -evalTypeScriptProject :: FileEvaluator Language.TypeScript.Assignment.Syntax -evalTypeScriptProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.TypeScript) typescriptParser - -evaluateProject proxy parser paths = withOptions debugOptions $ \ config logger statter -> - evaluateProject' (TaskSession config "-" False logger statter) proxy parser paths - --- Evaluate a project consisting of the listed paths. -evaluateProject' session proxy parser paths = do - res <- runTask session $ do - blobs <- catMaybes <$> traverse readBlobFromFile (flip File (Language.reflect proxy) <$> paths) - package <- fmap (quieterm . snd) <$> parsePackage parser (Project (takeDirectory (maybe "/" fst (uncons paths))) blobs (Language.reflect proxy) []) - modules <- topologicalSort <$> runImportGraphToModules proxy package - trace $ "evaluating with load order: " <> show (map (modulePath . moduleInfo) modules) - pure (id @(Evaluator _ Precise (Value _ Precise) _ _) - (runModuleTable - (runModules (ModuleTable.modulePaths (packageModules package)) - (raiseHandler (runReader (packageInfo package)) - (raiseHandler (evalState (lowerBound @Span)) - (raiseHandler (runReader (lowerBound @Span)) - (evaluate proxy (runDomainEffects (evalTerm withTermSpans)) modules))))))) - either (die . displayException) pure res - -parseFile :: Parser term -> FilePath -> IO term -parseFile parser = runTask' . (parse parser <=< readBlob . fileForPath) - -runTask' :: TaskEff a -> IO a -runTask' task = runTaskWithOptions debugOptions task >>= either (die . displayException) pure - -mergeErrors :: Either (SomeError (Sum errs)) (Either (SomeError err) result) -> Either (SomeError (Sum (err ': errs))) result -mergeErrors = either (\ (SomeError sum) -> Left (SomeError (weaken sum))) (either (\ (SomeError err) -> Left (SomeError (inject err))) Right) - -reassociate :: Either (SomeError err1) (Either (SomeError err2) (Either (SomeError err3) (Either (SomeError err4) (Either (SomeError err5) (Either (SomeError err6) (Either (SomeError err7) (Either (SomeError err8) result))))))) -> Either (SomeError (Sum '[err8, err7, err6, err5, err4, err3, err2, err1])) result -reassociate = mergeErrors . mergeErrors . mergeErrors . mergeErrors . mergeErrors . mergeErrors . mergeErrors . mergeErrors . Right diff --git a/src/Semantic/UtilDisabled.hs b/src/Semantic/UtilDisabled.hs deleted file mode 100644 index e12b82e627..0000000000 --- a/src/Semantic/UtilDisabled.hs +++ /dev/null @@ -1,407 +0,0 @@ -{-# LANGUAGE CPP, ConstraintKinds, Rank2Types, ScopedTypeVariables, TypeFamilies, TypeOperators #-} -{-# OPTIONS_GHC -Wno-missing-signatures -Wno-missing-export-lists #-} - --- This module is *NOT* included in any build targets It is where we --- store code that is useful for debugging in GHCi but that takes too --- much time to build regularly. If you need one of these functions, --- copy it temporarily to Util or some other appropriate place. Be aware --- that these functions put tremendous strain on the typechecker. - -module Semantic.UtilDisabled where - -import Prelude hiding (readFile) - -import Analysis.Abstract.Caching.FlowSensitive -import Analysis.Abstract.Collecting -import Control.Abstract -import Control.Abstract.Heap (runHeapError) -import Control.Abstract.ScopeGraph (runScopeError) -import Control.Effect.Trace (runTraceByPrinting) -import Control.Exception (displayException) -import Data.Abstract.Address.Hole as Hole -import Data.Abstract.Address.Monovariant as Monovariant -import Data.Abstract.Address.Precise as Precise -import Data.Abstract.Evaluatable -import Data.Abstract.Module -import qualified Data.Abstract.ModuleTable as ModuleTable -import Data.Abstract.Package -import Data.Abstract.Value.Concrete as Concrete -import Data.Abstract.Value.Type as Type -import Data.Blob -import Data.Blob.IO -import Data.Graph (topologicalSort) -import Data.Graph.ControlFlowVertex -import qualified Data.Language as Language -import Data.List (uncons) -import Data.Project hiding (readFile) -import Data.Quieterm (Quieterm, quieterm) -import Data.Sum (weaken) -import Data.Term -import qualified Language.Go.Assignment -import qualified Language.PHP.Assignment -import qualified Language.Python.Assignment -import qualified Language.Ruby.Assignment -import qualified Language.TypeScript.Assignment -import Parsing.Parser -import Prologue -import Semantic.Analysis -import Semantic.Config -import Semantic.Graph -import Semantic.Task -import System.Exit (die) -import System.FilePath.Posix (takeDirectory) - -import Data.Location - -type ProjectEvaluator syntax = - Project - -> IO - (Heap - (Hole (Maybe Name) Precise) - (Hole (Maybe Name) Precise) - (Value - (Quieterm (Sum syntax) Location) - (Hole (Maybe Name) Precise)), - (ScopeGraph (Hole (Maybe Name) Precise), - ModuleTable - (Module - (ModuleResult - (Hole (Maybe Name) Precise) - (Value - (Quieterm (Sum syntax) Location) - (Hole (Maybe Name) Precise)))))) - -type FileTypechecker (syntax :: [* -> *]) qterm value address result - = FilePath - -> IO - (Heap - address - address - value, - (ScopeGraph - address, - (Cache - qterm - address - value, - [Either - (SomeError - (Sum - '[BaseError - Type.TypeError, - BaseError - (AddressError - address - value), - BaseError - (EvalError - qterm - address - value), - BaseError - ResolutionError, - BaseError - (HeapError address), - BaseError - (ScopeError - address), - BaseError - (UnspecializedError - address - value), - BaseError - (LoadError - address - value)])) - result]))) - -type EvalEffects qterm err = ResumableC (BaseError err) - (ResumableC (BaseError (AddressError Precise (Value qterm Precise))) - (ResumableC (BaseError ResolutionError) - (ResumableC (BaseError (EvalError qterm Precise (Value qterm Precise))) - (ResumableC (BaseError (HeapError Precise)) - (ResumableC (BaseError (ScopeError Precise)) - (ResumableC (BaseError (UnspecializedError Precise (Value qterm Precise))) - (ResumableC (BaseError (LoadError Precise (Value qterm Precise))) - (FreshC - (StateC (ScopeGraph Precise) - (StateC (Heap Precise Precise (Value qterm Precise)) - (TraceByPrintingC - (LiftC IO)))))))))))) - --- We can't go with the inferred type because this needs to be --- polymorphic in @lang@. -justEvaluatingCatchingErrors :: ( hole ~ Hole (Maybe Name) Precise - , term ~ Quieterm (Sum lang) Location - , value ~ Concrete.Value term hole - , Apply Show1 lang - ) - => Evaluator term hole - value - (ResumableWithC - (BaseError (ValueError term hole)) - (ResumableWithC (BaseError (AddressError hole value)) - (ResumableWithC (BaseError ResolutionError) - (ResumableWithC (BaseError (EvalError term hole value)) - (ResumableWithC (BaseError (HeapError hole)) - (ResumableWithC (BaseError (ScopeError hole)) - (ResumableWithC (BaseError (UnspecializedError hole value)) - (ResumableWithC (BaseError (LoadError hole value)) - (FreshC - (StateC (ScopeGraph hole) - (StateC (Heap hole hole (Concrete.Value (Quieterm (Sum lang) Location) (Hole (Maybe Name) Precise))) - (TraceByPrintingC - (LiftC IO))))))))))))) a - -> IO (Heap hole hole value, (ScopeGraph hole, a)) -justEvaluatingCatchingErrors - = runM - . runEvaluator @_ @_ @(Value _ (Hole.Hole (Maybe Name) Precise)) - . raiseHandler runTraceByPrinting - . runHeap - . runScopeGraph - . raiseHandler runFresh - . resumingLoadError - . resumingUnspecialized - . resumingScopeError - . resumingHeapError - . resumingEvalError - . resumingResolutionError - . resumingAddressError - . resumingValueError - -checking - = runM - . runEvaluator - . raiseHandler runTraceByPrinting - . runHeap - . runScopeGraph - . raiseHandler runFresh - . caching - . providingLiveSet - . fmap reassociate - . runLoadError - . runUnspecialized - . runScopeError - . runHeapError - . runResolutionError - . runEvalError - . runAddressError - . runTypes - -callGraphProject - :: (Language.SLanguage lang, Ord1 syntax, - Declarations1 syntax, - Evaluatable syntax, - FreeVariables1 syntax, - AccessControls1 syntax, - HasPrelude lang, Functor syntax, - VertexDeclarationWithStrategy - (VertexDeclarationStrategy syntax) - syntax - syntax) => - Parser - (Term syntax Location) - -> Proxy lang - -> [FilePath] - -> IO - (Graph ControlFlowVertex, - [Module ()]) -callGraphProject parser proxy paths = runTask' $ do - blobs <- catMaybes <$> traverse readBlobFromFile (flip File (Language.reflect proxy) <$> paths) - package <- fmap snd <$> parsePackage parser (Project (takeDirectory (maybe "/" fst (uncons paths))) blobs (Language.reflect proxy) []) - modules <- topologicalSort <$> runImportGraphToModules proxy package - x <- runCallGraph proxy False modules package - pure (x, (() <$) <$> modules) - -scopeGraphRubyProject :: ProjectEvaluator Language.Ruby.Assignment.Syntax -scopeGraphRubyProject = justEvaluatingCatchingErrors <=< evaluateProjectForScopeGraph (Proxy @'Language.Ruby) rubyParser - -scopeGraphPHPProject :: ProjectEvaluator Language.PHP.Assignment.Syntax -scopeGraphPHPProject = justEvaluatingCatchingErrors <=< evaluateProjectForScopeGraph (Proxy @'Language.PHP) phpParser - -scopeGraphPythonProject :: ProjectEvaluator Language.Python.Assignment.Syntax -scopeGraphPythonProject = justEvaluatingCatchingErrors <=< evaluateProjectForScopeGraph (Proxy @'Language.Python) pythonParser - -scopeGraphGoProject :: ProjectEvaluator Language.Go.Assignment.Syntax -scopeGraphGoProject = justEvaluatingCatchingErrors <=< evaluateProjectForScopeGraph (Proxy @'Language.Go) goParser - -scopeGraphTypeScriptProject :: ProjectEvaluator Language.TypeScript.Assignment.Syntax -scopeGraphTypeScriptProject = justEvaluatingCatchingErrors <=< evaluateProjectForScopeGraph (Proxy @'Language.TypeScript) typescriptParser - -scopeGraphJavaScriptProject :: ProjectEvaluator Language.TypeScript.Assignment.Syntax -scopeGraphJavaScriptProject = justEvaluatingCatchingErrors <=< evaluateProjectForScopeGraph (Proxy @'Language.TypeScript) typescriptParser - -callGraphRubyProject :: [FilePath] -> IO (Graph ControlFlowVertex, [Module ()]) -callGraphRubyProject = callGraphProject rubyParser (Proxy @'Language.Ruby) - -evalJavaScriptProject :: FileEvaluator Language.TypeScript.Assignment.Syntax -evalJavaScriptProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.JavaScript) typescriptParser - -typecheckGoFile :: ( syntax ~ Language.Go.Assignment.Syntax - , qterm ~ Quieterm (Sum syntax) Location - , value ~ Type - , address ~ Monovariant - , result ~ (ModuleTable (Module (ModuleResult address value)))) - => FileTypechecker syntax qterm value address result -typecheckGoFile = checking <=< evaluateProjectWithCaching (Proxy :: Proxy 'Language.Go) goParser - -typecheckRubyFile :: ( syntax ~ Language.Ruby.Assignment.Syntax - , qterm ~ Quieterm (Sum syntax) Location - , value ~ Type - , address ~ Monovariant - , result ~ (ModuleTable (Module (ModuleResult address value)))) - => FileTypechecker syntax qterm value address result -typecheckRubyFile = checking <=< evaluateProjectWithCaching (Proxy :: Proxy 'Language.Ruby) rubyParser - -evaluateProjectForScopeGraph :: ( term ~ Term (Sum syntax) Location - , qterm ~ Quieterm (Sum syntax) Location - , address ~ Hole (Maybe Name) Precise - , LanguageSyntax lang syntax - ) - => Proxy (lang :: Language.Language) - -> Parser term - -> Project - -> IO (Evaluator qterm address - (Value qterm address) - (ResumableWithC (BaseError (ValueError qterm address)) - (ResumableWithC (BaseError (AddressError address (Value qterm address))) - (ResumableWithC (BaseError ResolutionError) - (ResumableWithC (BaseError (EvalError qterm address (Value qterm address))) - (ResumableWithC (BaseError (HeapError address)) - (ResumableWithC (BaseError (ScopeError address)) - (ResumableWithC (BaseError (UnspecializedError address (Value qterm address))) - (ResumableWithC (BaseError (LoadError address (Value qterm address))) - (FreshC - (StateC (ScopeGraph address) - (StateC (Heap address address (Value qterm address)) - (TraceByPrintingC - (LiftC IO))))))))))))) - (ModuleTable (Module - (ModuleResult address (Value qterm address))))) -evaluateProjectForScopeGraph proxy parser project = runTask' $ do - package <- fmap quieterm <$> parsePythonPackage parser project - modules <- topologicalSort <$> runImportGraphToModules proxy package - trace $ "evaluating with load order: " <> show (map (modulePath . moduleInfo) modules) - pure (id @(Evaluator _ (Hole.Hole (Maybe Name) Precise) (Value _ (Hole.Hole (Maybe Name) Precise)) _ _) - (runModuleTable - (runModules (ModuleTable.modulePaths (packageModules package)) - (raiseHandler (runReader (packageInfo package)) - (raiseHandler (evalState (lowerBound @Span)) - (raiseHandler (runReader (lowerBound @Span)) - (evaluate proxy (runDomainEffects (evalTerm withTermSpans)) modules))))))) - -evaluateProjectWithCaching :: ( term ~ Term (Sum syntax) Location - , qterm ~ Quieterm (Sum syntax) Location - , LanguageSyntax lang syntax - ) - => Proxy (lang :: Language.Language) - -> Parser term - -> FilePath - -> IO (Evaluator qterm Monovariant Type - (ResumableC (BaseError Type.TypeError) - (StateC TypeMap - (ResumableC (BaseError (AddressError Monovariant Type)) - (ResumableC (BaseError (EvalError qterm Monovariant Type)) - (ResumableC (BaseError ResolutionError) - (ResumableC (BaseError (HeapError Monovariant)) - (ResumableC (BaseError (ScopeError Monovariant)) - (ResumableC (BaseError (UnspecializedError Monovariant Type)) - (ResumableC (BaseError (LoadError Monovariant Type)) - (ReaderC (Live Monovariant) - (NonDetC - (ReaderC (Analysis.Abstract.Caching.FlowSensitive.Cache (Data.Quieterm.Quieterm (Sum syntax) Data.Location.Location) Monovariant Type) - (StateC (Analysis.Abstract.Caching.FlowSensitive.Cache (Data.Quieterm.Quieterm (Sum syntax) Data.Location.Location) Monovariant Type) - (FreshC - (StateC (ScopeGraph Monovariant) - (StateC (Heap Monovariant Monovariant Type) - (TraceByPrintingC - (LiftC IO)))))))))))))))))) - (ModuleTable (Module (ModuleResult Monovariant Type)))) -evaluateProjectWithCaching proxy parser path = runTask' $ do - project <- readProject Nothing path (Language.reflect proxy) [] - package <- fmap (quieterm . snd) <$> parsePackage parser project - modules <- topologicalSort <$> runImportGraphToModules proxy package - pure (id @(Evaluator _ Monovariant _ _ _) - (raiseHandler (runReader (packageInfo package)) - (raiseHandler (evalState (lowerBound @Span)) - (raiseHandler (runReader (lowerBound @Span)) - (runModuleTable - (runModules (ModuleTable.modulePaths (packageModules package)) - (evaluate proxy (runDomainEffects (evalTerm withTermSpans)) modules))))))) - -type LanguageSyntax lang syntax = ( Language.SLanguage lang - , HasPrelude lang - , Apply Eq1 syntax - , Apply Ord1 syntax - , Apply Show1 syntax - , Apply Functor syntax - , Apply Foldable syntax - , Apply Evaluatable syntax - , Apply Declarations1 syntax - , Apply AccessControls1 syntax - , Apply FreeVariables1 syntax) - -evaluatePythonProjects :: ( term ~ Term (Sum Language.Python.Assignment.Syntax) Location - , qterm ~ Quieterm (Sum Language.Python.Assignment.Syntax) Location - ) - => Proxy 'Language.Python - -> Parser term - -> Language.Language - -> FilePath - -> IO (Evaluator qterm Precise - (Value qterm Precise) - (EvalEffects qterm (ValueError qterm Precise)) - (ModuleTable (Module (ModuleResult Precise (Value qterm Precise))))) -evaluatePythonProjects proxy parser lang path = runTask' $ do - project <- readProject Nothing path lang [] - package <- fmap quieterm <$> parsePythonPackage parser project - modules <- topologicalSort <$> runImportGraphToModules proxy package - trace $ "evaluating with load order: " <> show (map (modulePath . moduleInfo) modules) - pure (id @(Evaluator _ Precise (Value _ Precise) _ _) - (runModuleTable - (runModules (ModuleTable.modulePaths (packageModules package)) - (raiseHandler (runReader (packageInfo package)) - (raiseHandler (evalState (lowerBound @Span)) - (raiseHandler (runReader (lowerBound @Span)) - (evaluate proxy (runDomainEffects (evalTerm withTermSpans)) modules))))))) - -evaluatePythonProject :: ( syntax ~ Language.Python.Assignment.Syntax - , qterm ~ Quieterm (Sum syntax) Location - , value ~ (Concrete.Value qterm address) - , address ~ Precise - , result ~ (ModuleTable (Module (ModuleResult address value)))) => FilePath - -> IO - (Heap address address value, - (ScopeGraph address, - Either - (SomeError - (Sum - '[BaseError - (ValueError qterm address), - BaseError - (AddressError - address - value), - BaseError - ResolutionError, - BaseError - (EvalError - qterm - address - value), - BaseError - (HeapError - address), - BaseError - (ScopeError - address), - BaseError - (UnspecializedError - address - value), - BaseError - (LoadError - address - value)])) - result)) -evaluatePythonProject = justEvaluating <=< evaluatePythonProjects (Proxy @'Language.Python) pythonParser Language.Python diff --git a/src/Semantic/Version.hs b/src/Semantic/Version.hs deleted file mode 100644 index 6a71f534f0..0000000000 --- a/src/Semantic/Version.hs +++ /dev/null @@ -1,28 +0,0 @@ -{-# LANGUAGE CPP #-} -#ifdef COMPUTE_GIT_SHA -{-# OPTIONS_GHC -fforce-recomp #-} -- So that gitHash is correct. -{-# LANGUAGE TemplateHaskell #-} -#endif -module Semantic.Version - ( buildSHA - , buildVersion - ) where - -import Data.Version (showVersion) -#ifdef COMPUTE_GIT_SHA -import Development.GitRev -#endif -import Paths_semantic (version) - --- The SHA1 hash of this build of semantic. --- If compiled as a development build, this will be @@. -buildSHA :: String -#ifdef COMPUTE_GIT_SHA -buildSHA = $(gitHash) -#else -buildSHA = "" -#endif - --- The version string of this build of semantic. -buildVersion :: String -buildVersion = showVersion version diff --git a/src/Serializing/Format.hs b/src/Serializing/Format.hs deleted file mode 100644 index 8cbaa2157d..0000000000 --- a/src/Serializing/Format.hs +++ /dev/null @@ -1,36 +0,0 @@ -{-# LANGUAGE GADTs #-} -module Serializing.Format -( Format(..) -, FormatStyle(..) -, Builder -, runSerialize -, Options(..) -) where - -import Algebra.Graph.Export.Dot -import Algebra.Graph.ToGraph -import Data.Aeson (ToJSON (..), fromEncoding) -import Data.ByteString.Builder -import Language.Haskell.HsColour -import Language.Haskell.HsColour.Colourise -import Prologue -import Proto3.Suite as Proto3 -import Serializing.SExpression -import Text.Show.Pretty - -data Format input where - DOT :: (Ord vertex, ToGraph graph, ToVertex graph ~ vertex) => Style vertex Builder -> Format graph - JSON :: ToJSON input => Format input - SExpression :: (Recursive input, ToSExpression (Base input)) => Options -> Format input - Show :: Show input => Format input - Proto :: Message input => Format input - -data FormatStyle = Colourful | Plain - -runSerialize :: FormatStyle -> Format input -> input -> Builder -runSerialize _ (DOT style) = export style -runSerialize _ JSON = (<> "\n") . fromEncoding . toEncoding -runSerialize _ (SExpression opts) = serializeSExpression opts -runSerialize Colourful Show = (<> "\n") . stringUtf8 . hscolour TTY defaultColourPrefs False False "" False . ppShow -runSerialize Plain Show = (<> "\n") . stringUtf8 . show -runSerialize _ Proto = lazyByteString . Proto3.toLazyByteString diff --git a/src/Serializing/SExpression.hs b/src/Serializing/SExpression.hs deleted file mode 100644 index 96d94f0b1e..0000000000 --- a/src/Serializing/SExpression.hs +++ /dev/null @@ -1,48 +0,0 @@ -{-# LANGUAGE GADTs, RankNTypes, ScopedTypeVariables #-} -module Serializing.SExpression -( serializeSExpression -, ToSExpression(..) -, Options(..) -) where - -import Analysis.ConstructorName -import Data.ByteString.Builder -import Data.Diff -import Data.Patch -import Data.Term -import Prelude -import Prologue - -data Options = ByShow | ByConstructorName - -serializeSExpression :: (Recursive t, ToSExpression (Base t)) => Options -> t -> Builder -serializeSExpression options t = cata (toSExpression options) t 0 <> "\n" - -branch :: Foldable syntax => String -> syntax (Int -> Builder) -> Int -> Builder -branch name syntax n = "(" <> stringUtf8 name <> foldMap ($ (n + 1)) syntax <> ")" - -namedBranch :: (ConstructorName syntax, Foldable syntax, Show ann) => Options -> TermF syntax ann (Int -> Builder) -> Int -> Builder -namedBranch ByShow (In ann syntax) = branch (show ann) syntax -namedBranch ByConstructorName (In _ syntax) = branch (constructorName syntax) syntax - -nl :: Int -> Builder -nl n | n <= 0 = "" - | otherwise = "\n" - -pad :: Int -> Builder -pad n = stringUtf8 (replicate (2 * n) ' ') - - -class ToSExpression base where - toSExpression :: Options -> base (Int -> Builder) -> (Int -> Builder) - -instance (ConstructorName syntax, Foldable syntax, Show ann) => ToSExpression (TermF syntax ann) where - toSExpression options term n = nl n <> pad n <> namedBranch options term n - -instance (ConstructorName syntax, Foldable syntax, Show ann1, Show ann2) => ToSExpression (DiffF syntax ann1 ann2) where - toSExpression options diff n = case diff of - Patch (Delete term) -> nl n <> pad (n - 1) <> "{-" <> namedBranch options term n <> "-}" - Patch (Insert term) -> nl n <> pad (n - 1) <> "{+" <> namedBranch options term n <> "+}" - Patch (Replace term1 term2) -> nl n <> pad (n - 1) <> "{ " <> namedBranch options term1 n - <> nl (n + 1) <> pad (n - 1) <> "->" <> namedBranch options term2 n <> " }" - Merge term -> nl n <> pad n <> namedBranch options term n diff --git a/src/Tags/Taggable.hs b/src/Tags/Taggable.hs deleted file mode 100644 index 7bb8e1e898..0000000000 --- a/src/Tags/Taggable.hs +++ /dev/null @@ -1,680 +0,0 @@ -{- | - -Taggable allows projecting syntax terms to a list of named symbols. In order to -identify a new syntax as Taggable, you need to: - -1. Give that syntax a non-derived Taggable instance and implement at least the -'symbolName' method. - -2. Make sure that 'symbolsToSummarize' in Tagging.hs includes the string -constructor name of this syntax. - --} -{-# LANGUAGE AllowAmbiguousTypes, GADTs, ConstraintKinds, RankNTypes, TypeFamilies, TypeOperators, UndecidableInstances #-} -module Tags.Taggable -( Tagger -, Token(..) -, Taggable(..) -, IsTaggable -, HasTextElement -, tagging -) -where - -import Prologue - -import Analysis.ConstructorName -import Analysis.HasTextElement -import Data.Abstract.Declarations -import Data.Abstract.Name -import Data.Blob -import Data.Functor.Identity -import Data.Language -import Data.Location -import Data.Machine as Machine -import Data.Range -import Data.Term -import Data.Text hiding (empty) - -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Directive as Directive -import qualified Data.Syntax.Expression as Expression -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Statement as Statement -import qualified Data.Syntax.Type as Type -import qualified Language.Go.Syntax as Go -import qualified Language.Go.Type as Go -import qualified Language.Haskell.Syntax as Haskell -import qualified Language.Java.Syntax as Java -import qualified Language.Markdown.Syntax as Markdown -import qualified Language.PHP.Syntax as PHP -import qualified Language.Python.Syntax as Python -import qualified Language.Ruby.Syntax as Ruby -import qualified Language.TSX.Syntax as TSX -import qualified Language.TypeScript.Syntax as TypeScript - - - -- TODO: Move to src/Data -data Token - = Enter { tokenName :: Text, tokenSnippetRange :: Maybe Range } - | Exit { tokenName :: Text, tokenSnippetRange :: Maybe Range} - | Iden { identifierName :: Text, tokenSpan :: Span, docsLiteralRange :: Maybe Range } - deriving (Eq, Show) - -type Tagger k a = PlanT k Token Identity a - -enter, exit :: String -> Maybe Range -> Tagger k () -enter c = yield . Enter (pack c) -exit c = yield . Exit (pack c) - -emitIden :: Span -> Maybe Range -> Name -> Tagger k () -emitIden span docsLiteralRange name = yield (Iden (formatName name) span docsLiteralRange) - -class (Show1 constr, Traversable constr) => Taggable constr where - docsLiteral :: - ( Functor syntax - , Foldable syntax - , HasTextElement syntax - ) - => Language -> constr (Term syntax Location) -> Maybe Range - docsLiteral _ _ = Nothing - - snippet :: (Foldable syntax) => Location -> constr (Term syntax Location) -> Maybe Range - snippet _ _ = Nothing - - symbolName :: Declarations1 syntax => constr (Term syntax Location) -> Maybe Name - symbolName _ = Nothing - -type IsTaggable syntax = - ( Functor syntax - , Foldable syntax - , Traversable syntax - , Show1 syntax - , Taggable syntax - , ConstructorName syntax - , Declarations1 syntax - , HasTextElement syntax - ) - -tagging :: (IsTaggable syntax) - => Blob - -> Term syntax Location - -> Machine.MachineT Identity k Token -tagging b = Machine.construct . foldSubterms (descend (blobLanguage b)) - -descend :: - ( Taggable (TermF syntax Location) - , ConstructorName (TermF syntax Location) - , Functor syntax - , Foldable syntax - , HasTextElement syntax - , Declarations1 syntax - ) - => Language -> SubtermAlgebra (TermF syntax Location) (Term syntax Location) (Tagger k ()) -descend lang t@(In loc _) = do - let term = fmap subterm t - let snippetRange = snippet loc term - let litRange = docsLiteral lang term - - enter (constructorName term) snippetRange - maybe (pure ()) (emitIden (locationSpan loc) litRange) (symbolName term) - traverse_ subtermRef t - exit (constructorName term) snippetRange - -subtractLocation :: Location -> Location -> Range -subtractLocation a b = subtractRange (locationByteRange a) (locationByteRange b) - --- Instances - -instance ( Apply Show1 fs, Apply Functor fs, Apply Foldable fs, Apply Traversable fs, Apply Taggable fs) => Taggable (Sum fs) where - docsLiteral a = apply @Taggable (docsLiteral a) - snippet x = apply @Taggable (snippet x) - symbolName = apply @Taggable symbolName - -instance (Taggable a) => Taggable (TermF a Location) where - docsLiteral l t = docsLiteral l (termFOut t) - snippet ann t = snippet ann (termFOut t) - symbolName t = symbolName (termFOut t) - -instance Taggable Syntax.Context where - snippet ann (Syntax.Context _ (Term (In subj _))) = Just (subtractLocation ann subj) - -instance Taggable Declaration.Function where - docsLiteral Python (Declaration.Function _ _ _ (Term (In _ bodyF))) - | (Term (In exprAnn exprF):_) <- toList bodyF - , isTextElement exprF = Just (locationByteRange exprAnn) - | otherwise = Nothing - docsLiteral _ _ = Nothing - snippet ann (Declaration.Function _ _ _ (Term (In body _))) = Just $ subtractLocation ann body - symbolName = declaredName . Declaration.functionName - -instance Taggable Declaration.Method where - docsLiteral Python (Declaration.Method _ _ _ _ (Term (In _ bodyF)) _) - | (Term (In exprAnn exprF):_) <- toList bodyF - , isTextElement exprF = Just (locationByteRange exprAnn) - | otherwise = Nothing - docsLiteral _ _ = Nothing - snippet ann (Declaration.Method _ _ _ _ (Term (In body _)) _) = Just $ subtractLocation ann body - symbolName = declaredName . Declaration.methodName - -instance Taggable Declaration.Class where - docsLiteral Python (Declaration.Class _ _ _ (Term (In _ bodyF))) - | (Term (In exprAnn exprF):_) <- toList bodyF - , isTextElement exprF = Just (locationByteRange exprAnn) - | otherwise = Nothing - docsLiteral _ _ = Nothing - snippet ann (Declaration.Class _ _ _ (Term (In body _))) = Just $ subtractLocation ann body - symbolName = declaredName . Declaration.classIdentifier - -instance Taggable Ruby.Class where - snippet ann (Ruby.Class _ _ (Term (In body _))) = Just $ subtractLocation ann body - symbolName = declaredName . Ruby.classIdentifier - -instance Taggable Ruby.Module where - snippet ann (Ruby.Module _ (Term (In body _):_)) = Just $ subtractLocation ann body - snippet ann (Ruby.Module _ _) = Just $ locationByteRange ann - symbolName = declaredName . Ruby.moduleIdentifier - -instance Taggable TypeScript.Module where - snippet ann (TypeScript.Module _ (Term (In body _):_)) = Just $ subtractLocation ann body - snippet ann (TypeScript.Module _ _ ) = Just $ locationByteRange ann - symbolName = declaredName . TypeScript.moduleIdentifier - -instance Taggable Expression.Call where - snippet ann (Expression.Call _ _ _ (Term (In body _))) = Just $ subtractLocation ann body - symbolName = declaredName . Expression.callFunction - -instance Taggable Ruby.Send where - snippet ann (Ruby.Send _ _ _ (Just (Term (In body _)))) = Just $ subtractLocation ann body - snippet ann _ = Just $ locationByteRange ann - symbolName Ruby.Send{..} = maybe Nothing declaredName sendSelector - -instance Taggable [] -instance Taggable Comment.Comment -instance Taggable Comment.HashBang - -instance Taggable Expression.And -instance Taggable Expression.Await -instance Taggable Expression.BAnd -instance Taggable Expression.BOr -instance Taggable Expression.BXOr -instance Taggable Expression.Cast -instance Taggable Expression.Comparison -instance Taggable Expression.Complement -instance Taggable Expression.Delete -instance Taggable Expression.DividedBy -instance Taggable Expression.Enumeration -instance Taggable Expression.Equal -instance Taggable Expression.FloorDivision -instance Taggable Expression.GreaterThan -instance Taggable Expression.GreaterThanEqual -instance Taggable Expression.InstanceOf -instance Taggable Expression.LessThan -instance Taggable Expression.LessThanEqual -instance Taggable Expression.LShift -instance Taggable Expression.Matches -instance Taggable Expression.Member -instance Taggable Expression.MemberAccess -instance Taggable Expression.Minus -instance Taggable Expression.Modulo -instance Taggable Expression.Negate -instance Taggable Expression.New -instance Taggable Expression.NonNullExpression -instance Taggable Expression.Not -instance Taggable Expression.NotMatches -instance Taggable Expression.Or -instance Taggable Expression.Plus -instance Taggable Expression.Power -instance Taggable Expression.RShift -instance Taggable Expression.ScopeResolution -instance Taggable Expression.SequenceExpression -instance Taggable Expression.StrictEqual -instance Taggable Expression.Subscript -instance Taggable Expression.Super -instance Taggable Expression.This -instance Taggable Expression.Times -instance Taggable Expression.Typeof -instance Taggable Expression.UnsignedRShift -instance Taggable Expression.Void -instance Taggable Expression.XOr - -instance Taggable Literal.Boolean -instance Taggable Literal.Integer -instance Taggable Literal.Float -instance Taggable Literal.Rational -instance Taggable Literal.Complex -instance Taggable Literal.String -instance Taggable Literal.Character -instance Taggable Literal.InterpolationElement -instance Taggable Literal.TextElement -instance Taggable Literal.EscapeSequence -instance Taggable Literal.Symbol -instance Taggable Literal.SymbolElement -instance Taggable Literal.Regex -instance Taggable Literal.Array -instance Taggable Literal.Hash -instance Taggable Literal.Tuple -instance Taggable Literal.Set -instance Taggable Literal.Pointer -instance Taggable Literal.Reference -instance Taggable Literal.Null -instance Taggable Literal.KeyValue - -instance Taggable Statement.Assignment -instance Taggable Statement.Break -instance Taggable Statement.Catch -instance Taggable Statement.Continue -instance Taggable Statement.DoWhile -instance Taggable Statement.Else -instance Taggable Statement.Finally -instance Taggable Statement.For -instance Taggable Statement.ForEach -instance Taggable Statement.Goto -instance Taggable Statement.If -instance Taggable Statement.Let -instance Taggable Statement.Match -instance Taggable Statement.NoOp -instance Taggable Statement.Pattern -instance Taggable Statement.PostDecrement -instance Taggable Statement.PostIncrement -instance Taggable Statement.PreDecrement -instance Taggable Statement.PreIncrement -instance Taggable Statement.Retry -instance Taggable Statement.Return -instance Taggable Statement.ScopeEntry -instance Taggable Statement.ScopeExit -instance Taggable Statement.StatementBlock -instance Taggable Statement.Statements -instance Taggable Statement.Throw -instance Taggable Statement.Try -instance Taggable Statement.While -instance Taggable Statement.Yield - -instance Taggable Syntax.Empty -instance Taggable Syntax.Error -instance Taggable Syntax.Identifier -instance Taggable Syntax.AccessibilityModifier - -instance Taggable Type.Annotation -instance Taggable Type.Array -instance Taggable Type.Bool -instance Taggable Type.Double -instance Taggable Type.Float -instance Taggable Type.Function -instance Taggable Type.Int -instance Taggable Type.Interface -instance Taggable Type.Map -instance Taggable Type.Parenthesized -instance Taggable Type.Pointer -instance Taggable Type.Product -instance Taggable Type.Readonly -instance Taggable Type.Slice -instance Taggable Type.TypeParameters -instance Taggable Type.Void - -instance Taggable Declaration.Comprehension -instance Taggable Declaration.Constructor -instance Taggable Declaration.Datatype -instance Taggable Declaration.Decorator -instance Taggable Declaration.InterfaceDeclaration -instance Taggable Declaration.MethodSignature -instance Taggable Declaration.OptionalParameter -instance Taggable Declaration.PublicFieldDefinition -instance Taggable Declaration.RequiredParameter -instance Taggable Declaration.Type -instance Taggable Declaration.TypeAlias -instance Taggable Declaration.Variable -instance Taggable Declaration.VariableDeclaration - -instance Taggable Directive.File -instance Taggable Directive.Line - -instance Taggable Haskell.UnitConstructor -instance Taggable Haskell.ListConstructor -instance Taggable Haskell.FunctionConstructor -instance Taggable Haskell.RecordDataConstructor -instance Taggable Haskell.AllConstructors -instance Taggable Haskell.GADTConstructor -instance Taggable Haskell.LabeledConstruction -instance Taggable Haskell.InfixDataConstructor -instance Taggable Haskell.TupleConstructor -instance Taggable Haskell.TypeConstructorExport -instance Taggable Haskell.KindParenthesizedConstructor -instance Taggable Haskell.ConstructorSymbol -instance Taggable Haskell.Module -instance Taggable Haskell.Field -instance Taggable Haskell.GADT -instance Taggable Haskell.InfixOperatorPattern -instance Taggable Haskell.NewType -instance Taggable Haskell.ImportDeclaration -instance Taggable Haskell.QualifiedImportDeclaration -instance Taggable Haskell.ImportAlias -instance Taggable Haskell.App -instance Taggable Haskell.InfixOperatorApp -instance Taggable Haskell.ListComprehension -instance Taggable Haskell.Generator -instance Taggable Haskell.ArithmeticSequence -instance Taggable Haskell.RightOperatorSection -instance Taggable Haskell.LeftOperatorSection -instance Taggable Haskell.BindPattern -instance Taggable Haskell.Lambda -instance Taggable Haskell.FixityAlt -instance Taggable Haskell.RecordWildCards -instance Taggable Haskell.Wildcard -instance Taggable Haskell.Let -instance Taggable Haskell.FieldBind -instance Taggable Haskell.Pragma -instance Taggable Haskell.Deriving -instance Taggable Haskell.ContextAlt -instance Taggable Haskell.Class -instance Taggable Haskell.Export -instance Taggable Haskell.ModuleExport -instance Taggable Haskell.QuotedName -instance Taggable Haskell.ScopedTypeVariables -instance Taggable Haskell.DefaultDeclaration -instance Taggable Haskell.VariableOperator -instance Taggable Haskell.ConstructorOperator -instance Taggable Haskell.TypeOperator -instance Taggable Haskell.PromotedTypeOperator -instance Taggable Haskell.VariableSymbol -instance Taggable Haskell.Import -instance Taggable Haskell.HiddenImport -instance Taggable Haskell.TypeApp -instance Taggable Haskell.TupleExpression -instance Taggable Haskell.TuplePattern -instance Taggable Haskell.ConstructorPattern -instance Taggable Haskell.Do -instance Taggable Haskell.PrefixNegation -instance Taggable Haskell.CPPDirective -instance Taggable Haskell.NamedFieldPun -instance Taggable Haskell.NegativeLiteral -instance Taggable Haskell.LambdaCase -instance Taggable Haskell.LabeledUpdate -instance Taggable Haskell.QualifiedTypeClassIdentifier -instance Taggable Haskell.QualifiedTypeConstructorIdentifier -instance Taggable Haskell.QualifiedConstructorIdentifier -instance Taggable Haskell.QualifiedInfixVariableIdentifier -instance Taggable Haskell.QualifiedModuleIdentifier -instance Taggable Haskell.QualifiedVariableIdentifier -instance Taggable Haskell.TypeVariableIdentifier -instance Taggable Haskell.TypeConstructorIdentifier -instance Taggable Haskell.ModuleIdentifier -instance Taggable Haskell.ConstructorIdentifier -instance Taggable Haskell.ImplicitParameterIdentifier -instance Taggable Haskell.InfixConstructorIdentifier -instance Taggable Haskell.InfixVariableIdentifier -instance Taggable Haskell.TypeClassIdentifier -instance Taggable Haskell.VariableIdentifier -instance Taggable Haskell.PrimitiveConstructorIdentifier -instance Taggable Haskell.PrimitiveVariableIdentifier -instance Taggable Haskell.AsPattern -instance Taggable Haskell.FieldPattern -instance Taggable Haskell.ViewPattern -instance Taggable Haskell.PatternGuard -instance Taggable Haskell.StrictPattern -instance Taggable Haskell.ListPattern -instance Taggable Haskell.TypePattern -instance Taggable Haskell.IrrefutablePattern -instance Taggable Haskell.CaseGuardPattern -instance Taggable Haskell.FunctionGuardPattern -instance Taggable Haskell.LabeledPattern -instance Taggable Haskell.Guard -instance Taggable Haskell.QuasiQuotation -instance Taggable Haskell.QuasiQuotationPattern -instance Taggable Haskell.QuasiQuotationType -instance Taggable Haskell.QuasiQuotationDeclaration -instance Taggable Haskell.QuasiQuotationExpression -instance Taggable Haskell.QuasiQuotationExpressionBody -instance Taggable Haskell.QuasiQuotationQuoter -instance Taggable Haskell.Splice -instance Taggable Haskell.StrictType -instance Taggable Haskell.Type -instance Taggable Haskell.TypeSynonym -instance Taggable Haskell.AnnotatedTypeVariable -instance Taggable Haskell.StandaloneDerivingInstance -instance Taggable Haskell.FunctionType -instance Taggable Haskell.TypeSignature -instance Taggable Haskell.ExpressionTypeSignature -instance Taggable Haskell.KindFunctionType -instance Taggable Haskell.Star -instance Taggable Haskell.EqualityConstraint -instance Taggable Haskell.TypeInstance -instance Taggable Haskell.TypeClassInstance -instance Taggable Haskell.TypeClass -instance Taggable Haskell.DefaultSignature -instance Taggable Haskell.TypeFamily -instance Taggable Haskell.StrictTypeVariable -instance Taggable Haskell.KindSignature -instance Taggable Haskell.Kind -instance Taggable Haskell.KindListType -instance Taggable Haskell.Instance -instance Taggable Haskell.KindTupleType -instance Taggable Haskell.FunctionalDependency - - -instance Taggable Java.Import -instance Taggable Java.Package -instance Taggable Java.CatchType -instance Taggable Java.SpreadParameter -instance Taggable Java.StaticInitializer -instance Taggable Java.LambdaBody -instance Taggable Java.ClassBody -instance Taggable Java.ClassLiteral -instance Taggable Java.DefaultValue -instance Taggable Java.Module -instance Taggable Java.EnumDeclaration -instance Taggable Java.Variable -instance Taggable Java.Synchronized -instance Taggable Java.New -instance Taggable Java.Asterisk -instance Taggable Java.Constructor -instance Taggable Java.TypeParameter -instance Taggable Java.Annotation -instance Taggable Java.AnnotationField -instance Taggable Java.GenericType -instance Taggable Java.AnnotatedType -instance Taggable Java.TypeWithModifiers -instance Taggable Java.Wildcard -instance Taggable Java.WildcardBounds -instance Taggable Java.MethodReference -instance Taggable Java.NewKeyword -instance Taggable Java.Lambda -instance Taggable Java.ArrayCreationExpression -instance Taggable Java.DimsExpr -instance Taggable Java.TryWithResources -instance Taggable Java.AssertStatement -instance Taggable Java.AnnotationTypeElement - -instance Taggable Python.Alias -instance Taggable Python.Ellipsis -instance Taggable Python.FutureImport -instance Taggable Python.Import -instance Taggable Python.QualifiedAliasedImport -instance Taggable Python.QualifiedImport -instance Taggable Python.Redirect - -instance Taggable Go.BidirectionalChannel -instance Taggable Go.ReceiveChannel -instance Taggable Go.SendChannel -instance Taggable Go.Import -instance Taggable Go.QualifiedImport -instance Taggable Go.SideEffectImport -instance Taggable Go.Composite -instance Taggable Go.Label -instance Taggable Go.Send -instance Taggable Go.Slice -instance Taggable Go.TypeSwitch -instance Taggable Go.Receive -instance Taggable Go.Field -instance Taggable Go.Package -instance Taggable Go.TypeAssertion -instance Taggable Go.TypeConversion -instance Taggable Go.Variadic -instance Taggable Go.DefaultPattern -instance Taggable Go.Defer -instance Taggable Go.Go -instance Taggable Go.Rune -instance Taggable Go.Select -instance Taggable Go.TypeSwitchGuard -instance Taggable Go.ReceiveOperator - -instance Taggable Markdown.Document -instance Taggable Markdown.Paragraph -instance Taggable Markdown.UnorderedList -instance Taggable Markdown.OrderedList -instance Taggable Markdown.BlockQuote -instance Taggable Markdown.HTMLBlock -instance Taggable Markdown.Table -instance Taggable Markdown.TableRow -instance Taggable Markdown.TableCell -instance Taggable Markdown.Strong -instance Taggable Markdown.Emphasis -instance Taggable Markdown.Text -instance Taggable Markdown.Strikethrough -instance Taggable Markdown.Heading -instance Taggable Markdown.ThematicBreak -instance Taggable Markdown.Link -instance Taggable Markdown.Image -instance Taggable Markdown.Code -instance Taggable Markdown.LineBreak - -instance Taggable PHP.Text -instance Taggable PHP.VariableName -instance Taggable PHP.Require -instance Taggable PHP.RequireOnce -instance Taggable PHP.Include -instance Taggable PHP.IncludeOnce -instance Taggable PHP.ArrayElement -instance Taggable PHP.GlobalDeclaration -instance Taggable PHP.SimpleVariable -instance Taggable PHP.CastType -instance Taggable PHP.ErrorControl -instance Taggable PHP.Clone -instance Taggable PHP.ShellCommand -instance Taggable PHP.Update -instance Taggable PHP.NewVariable -instance Taggable PHP.RelativeScope -instance Taggable PHP.NamespaceName -instance Taggable PHP.ConstDeclaration -instance Taggable PHP.ClassInterfaceClause -instance Taggable PHP.ClassBaseClause -instance Taggable PHP.UseClause -instance Taggable PHP.ReturnType -instance Taggable PHP.TypeDeclaration -instance Taggable PHP.BaseTypeDeclaration -instance Taggable PHP.ScalarType -instance Taggable PHP.EmptyIntrinsic -instance Taggable PHP.ExitIntrinsic -instance Taggable PHP.IssetIntrinsic -instance Taggable PHP.EvalIntrinsic -instance Taggable PHP.PrintIntrinsic -instance Taggable PHP.NamespaceAliasingClause -instance Taggable PHP.NamespaceUseDeclaration -instance Taggable PHP.NamespaceUseClause -instance Taggable PHP.NamespaceUseGroupClause -instance Taggable PHP.TraitUseSpecification -instance Taggable PHP.Static -instance Taggable PHP.ClassModifier -instance Taggable PHP.InterfaceBaseClause -instance Taggable PHP.Echo -instance Taggable PHP.Unset -instance Taggable PHP.DeclareDirective -instance Taggable PHP.LabeledStatement -instance Taggable PHP.QualifiedName -instance Taggable PHP.ClassConstDeclaration -instance Taggable PHP.Namespace -instance Taggable PHP.TraitDeclaration -instance Taggable PHP.AliasAs -instance Taggable PHP.InsteadOf -instance Taggable PHP.TraitUseClause -instance Taggable PHP.DestructorDeclaration -instance Taggable PHP.ConstructorDeclaration -instance Taggable PHP.PropertyDeclaration -instance Taggable PHP.PropertyModifier -instance Taggable PHP.InterfaceDeclaration -instance Taggable PHP.Declare - -instance Taggable Ruby.Require -instance Taggable Ruby.Load -instance Taggable Ruby.LowPrecedenceAnd -instance Taggable Ruby.LowPrecedenceOr -instance Taggable Ruby.Assignment -instance Taggable Ruby.ZSuper - -instance Taggable TSX.JsxElement -instance Taggable TSX.JsxOpeningElement -instance Taggable TSX.JsxSelfClosingElement -instance Taggable TSX.JsxAttribute -instance Taggable TSX.JsxText -instance Taggable TSX.JsxExpression -instance Taggable TSX.JsxClosingElement -instance Taggable TSX.JsxFragment -instance Taggable TSX.JsxNamespaceName - -instance Taggable TypeScript.JavaScriptRequire -instance Taggable TypeScript.Debugger -instance Taggable TypeScript.Super -instance Taggable TypeScript.Undefined -instance Taggable TypeScript.With -instance Taggable TypeScript.OptionalParameter -instance Taggable TypeScript.RequiredParameter -instance Taggable TypeScript.RestParameter -instance Taggable TypeScript.ImplementsClause -instance Taggable TypeScript.Import -instance Taggable TypeScript.QualifiedAliasedImport -instance Taggable TypeScript.QualifiedExportFrom -instance Taggable TypeScript.LookupType -instance Taggable TypeScript.Union -instance Taggable TypeScript.Intersection -instance Taggable TypeScript.FunctionType -instance Taggable TypeScript.AmbientFunction -instance Taggable TypeScript.ImportRequireClause -instance Taggable TypeScript.Constructor -instance Taggable TypeScript.TypeParameter -instance Taggable TypeScript.TypeAssertion -instance Taggable TypeScript.NestedIdentifier -instance Taggable TypeScript.NestedTypeIdentifier -instance Taggable TypeScript.GenericType -instance Taggable TypeScript.TypePredicate -instance Taggable TypeScript.EnumDeclaration -instance Taggable TypeScript.PropertySignature -instance Taggable TypeScript.CallSignature -instance Taggable TypeScript.ConstructSignature -instance Taggable TypeScript.IndexSignature -instance Taggable TypeScript.AbstractMethodSignature -instance Taggable TypeScript.ForOf -instance Taggable TypeScript.LabeledStatement -instance Taggable TypeScript.InternalModule -instance Taggable TypeScript.ImportAlias -instance Taggable TypeScript.ClassHeritage -instance Taggable TypeScript.AbstractClass -instance Taggable TypeScript.SideEffectImport -instance Taggable TypeScript.QualifiedExport -instance Taggable TypeScript.DefaultExport -instance Taggable TypeScript.ShorthandPropertyIdentifier -instance Taggable TypeScript.ImportClause -instance Taggable TypeScript.Tuple -instance Taggable TypeScript.Annotation -instance Taggable TypeScript.Decorator -instance Taggable TypeScript.ComputedPropertyName -instance Taggable TypeScript.Constraint -instance Taggable TypeScript.DefaultType -instance Taggable TypeScript.ParenthesizedType -instance Taggable TypeScript.PredefinedType -instance Taggable TypeScript.TypeIdentifier -instance Taggable TypeScript.ObjectType -instance Taggable TypeScript.AmbientDeclaration -instance Taggable TypeScript.ExtendsClause -instance Taggable TypeScript.ArrayType -instance Taggable TypeScript.FlowMaybeType -instance Taggable TypeScript.TypeQuery -instance Taggable TypeScript.IndexTypeQuery -instance Taggable TypeScript.TypeArguments -instance Taggable TypeScript.ThisType -instance Taggable TypeScript.ExistentialType -instance Taggable TypeScript.LiteralType -instance Taggable TypeScript.Update -instance Taggable TypeScript.MetaProperty -instance Taggable TypeScript.AnnotatedExpression diff --git a/src/Tags/Tagging.hs b/src/Tags/Tagging.hs deleted file mode 100644 index 3f50c3f0af..0000000000 --- a/src/Tags/Tagging.hs +++ /dev/null @@ -1,65 +0,0 @@ -{-# LANGUAGE GADTs, LambdaCase, RankNTypes, TypeOperators, ScopedTypeVariables, UndecidableInstances #-} -module Tags.Tagging -( runTagging -, Tag(..) -) -where - -import Prelude hiding (fail, filter, log) -import Prologue hiding (Element, hash) - -import Control.Effect as Eff -import Control.Effect.State -import Control.Monad.Trans -import Data.Blob -import Data.Location -import Data.Machine as Machine -import qualified Data.Source as Source -import Data.Tag -import Data.Term -import Data.Text as T hiding (empty) -import Tags.Taggable - -runTagging :: (IsTaggable syntax) - => Blob - -> [Text] - -> Term syntax Location - -> [Tag] -runTagging blob symbolsToSummarize tree - = Eff.run - . evalState @[ContextToken] [] - . runT $ source (tagging blob tree) - ~> contextualizing blob symbolsToSummarize - -type ContextToken = (Text, Maybe Range) - -contextualizing :: ( Member (State [ContextToken]) sig - , Carrier sig m - ) - => Blob - -> [Text] - -> Machine.ProcessT m Token Tag -contextualizing Blob{..} symbolsToSummarize = repeatedly $ await >>= \case - Enter x r -> lift (enterScope (x, r)) - Exit x r -> lift (exitScope (x, r)) - Iden iden span docsLiteralRange -> lift (get @[ContextToken]) >>= \case - ((x, r):("Context", cr):xs) | x `elem` symbolsToSummarize - -> yield $ Tag iden x span (fmap fst xs) (firstLine (slice r)) (slice cr) - ((x, r):xs) | x `elem` symbolsToSummarize - -> yield $ Tag iden x span (fmap fst xs) (firstLine (slice r)) (slice docsLiteralRange) - _ -> pure () - where - slice = fmap (stripEnd . Source.toText . flip Source.slice blobSource) - firstLine = fmap (T.take 180 . fst . breakOn "\n") - -enterScope, exitScope :: ( Member (State [ContextToken]) sig - , Carrier sig m - ) - => ContextToken - -> m () -enterScope c = modify @[ContextToken] (c :) -exitScope c = get @[ContextToken] >>= \case - x:xs -> when (x == c) (put xs) - -- If we run out of scopes to match, we've hit a tag balance issue; - -- just continue onwards. - [] -> pure () diff --git a/stack-snapshot.yaml b/stack-snapshot.yaml new file mode 100644 index 0000000000..d5953c3aa1 --- /dev/null +++ b/stack-snapshot.yaml @@ -0,0 +1,12 @@ +resolver: nightly-2020-08-16 +packages: + - Interpolation-0.3.0 + - fused-effects-1.1.0.0 + - fused-effects-exceptions-1.1.0.0 + - fused-effects-readline-0.1.0.0 + - haskeline-0.8.0.0 + - lingo-0.5.0.1 + - proto-lens-jsonpb-0.2.0.2 + - semilattices-0.0.0.4 + - tree-sitter-0.9.0.2 + - unliftio-core-0.2.0.1 diff --git a/stackage_snapshot.json b/stackage_snapshot.json new file mode 100644 index 0000000000..8eb407d2f1 --- /dev/null +++ b/stackage_snapshot.json @@ -0,0 +1,197 @@ +{ + "__GENERATED_FILE_DO_NOT_MODIFY_MANUALLY": 1264514574, + "all-cabal-hashes": "https://raw.githubusercontent.com/commercialhaskell/all-cabal-hashes/bc8207695b49b91c30534145bb60fe75189f605d", + "resolved": { + "Cabal": {"dependencies":[],"location":{"type":"core"},"name":"Cabal","version":"3.2.0.0"}, + "Glob": {"dependencies":["base","containers","directory","dlist","filepath","transformers","transformers-compat"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/Glob-0.10.1/Glob-0.10.1.tar.gz"},"name":"Glob","pinned":{"url":["https://hackage.haskell.org/package/Glob-0.10.1/Glob-0.10.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/Glob-0.10.1.tar.gz"],"sha256":"cae4476d944947010705e0b00cf3e36c90ef407f968861f6771b931056b6d315","cabal-sha256":"17cbe8f4f023d3288d168f5eb34f9fd1125348ece2682bad2137ed8a06d5d0d6"},"version":"0.10.1"}, + "HUnit": {"dependencies":["base","call-stack","deepseq"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/HUnit-1.6.0.0/HUnit-1.6.0.0.tar.gz"},"name":"HUnit","pinned":{"url":["https://hackage.haskell.org/package/HUnit-1.6.0.0/HUnit-1.6.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/HUnit-1.6.0.0.tar.gz"],"sha256":"7448e6b966e98e84b7627deba23f71b508e9a61e7bc571d74304a25d30e6d0de","cabal-sha256":"50227a528dca2c0d1fc8b14f8d7f4613d374cc1a525e955ebe9283823dad93a3"},"version":"1.6.0.0"}, + "Only": {"dependencies":["base","deepseq"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/Only-0.1/Only-0.1.tar.gz"},"name":"Only","pinned":{"url":["https://hackage.haskell.org/package/Only-0.1/Only-0.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/Only-0.1.tar.gz"],"sha256":"ab7aa193e8c257d3bda6b0b3c1cbcf74cdaa85ab08cb20c2dd62ba248c1ab265","cabal-sha256":"f92f5da97e647451f1ee7f5bf44914fb75062d08ccd3f36b2000d649c63d13aa"},"version":"0.1"}, + "QuickCheck": {"dependencies":["base","containers","deepseq","random","splitmix","template-haskell","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/QuickCheck-2.13.2/QuickCheck-2.13.2.tar.gz"},"name":"QuickCheck","pinned":{"url":["https://hackage.haskell.org/package/QuickCheck-2.13.2/QuickCheck-2.13.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/QuickCheck-2.13.2.tar.gz"],"sha256":"7b560baa5853de777702dc23a6f2126ae4adbfdab163295bc56323a706914610","cabal-sha256":"636e7265bf75122e7e2f97627c47aad3b772ee3b35b134cafb6095116ce8d07a"},"version":"2.13.2"}, + "StateVar": {"dependencies":["base","stm","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/StateVar-1.2/StateVar-1.2.tar.gz"},"name":"StateVar","pinned":{"url":["https://hackage.haskell.org/package/StateVar-1.2/StateVar-1.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/StateVar-1.2.tar.gz"],"sha256":"afc036021fcd38f15fcc4af392a3e57017d5ddcc926e99391dbfc8c4e6375f8b","cabal-sha256":"9ab3e4a0e252d28bc2f799c83e0725c3e23e8d3b722cff0fdb9822e64b6c16ac"},"version":"1.2"}, + "adjunctions": {"dependencies":["array","base","comonad","containers","contravariant","distributive","free","mtl","profunctors","semigroupoids","semigroups","tagged","transformers","transformers-compat","void"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/adjunctions-4.4/adjunctions-4.4.tar.gz"},"name":"adjunctions","pinned":{"url":["https://hackage.haskell.org/package/adjunctions-4.4/adjunctions-4.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/adjunctions-4.4.tar.gz"],"sha256":"507c2ef55337ae61c805f8cbc1213dfd7d2b85187342675d662254b8d8a16ae9","cabal-sha256":"2738dd5f5d5e93749adb14a05472e58a96a75d0f299e46371c6f46dc4e97daf9"},"version":"4.4"}, + "aeson": {"dependencies":["attoparsec","base","base-compat-batteries","bytestring","containers","data-fix","deepseq","dlist","ghc-prim","hashable","primitive","scientific","strict","tagged","template-haskell","text","th-abstraction","these","time","time-compat","unordered-containers","uuid-types","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/aeson-1.5.3.0/aeson-1.5.3.0.tar.gz"},"name":"aeson","pinned":{"url":["https://hackage.haskell.org/package/aeson-1.5.3.0/aeson-1.5.3.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/aeson-1.5.3.0.tar.gz"],"sha256":"958ef96a31ad0807e307f92d61a2b51827f7b06afed52cf06f76c64c6aed986a","cabal-sha256":"05496710de6ae694e55dc77dbdaf7503f56c24e4aecc06045e42e75a02df8bc4"},"version":"1.5.3.0"}, + "aeson-pretty": {"dependencies":["aeson","attoparsec","base","base-compat","bytestring","cmdargs","scientific","text","unordered-containers","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/aeson-pretty-0.8.8/aeson-pretty-0.8.8.tar.gz"},"name":"aeson-pretty","pinned":{"url":["https://hackage.haskell.org/package/aeson-pretty-0.8.8/aeson-pretty-0.8.8.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/aeson-pretty-0.8.8.tar.gz"],"sha256":"81cea61cb6dcf32c3f0529ea5cfc98dbea3894152d7f2d9fe1cb051f927ec726","cabal-sha256":"9924a16d0c362ff59dd6d5b875749ff5d599d2688f89d080388a0014714441ef"},"version":"0.8.8"}, + "algebraic-graphs": {"dependencies":["array","base","containers","deepseq","mtl","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/algebraic-graphs-0.5/algebraic-graphs-0.5.tar.gz"},"name":"algebraic-graphs","pinned":{"url":["https://hackage.haskell.org/package/algebraic-graphs-0.5/algebraic-graphs-0.5.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/algebraic-graphs-0.5.tar.gz"],"sha256":"89b9fecf8245476ec823355125fcb95decf41fd9784e807d7bd0d09f0a79c50b","cabal-sha256":"6eeec5ed1687ff7aa916e7bf9f02f51aaabde6f314dc0b7b1a84156974d7da73"},"version":"0.5"}, + "ansi-terminal": {"dependencies":["base","colour"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/ansi-terminal-0.10.3/ansi-terminal-0.10.3.tar.gz"},"name":"ansi-terminal","pinned":{"url":["https://hackage.haskell.org/package/ansi-terminal-0.10.3/ansi-terminal-0.10.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/ansi-terminal-0.10.3.tar.gz"],"sha256":"fa2e2e32dfad29835aa7fd442bbe233e07d97e933223a001fe5efa562535b57c","cabal-sha256":"e2fbcef5f980dc234c7ad8e2fa433b0e8109132c9e643bc40ea5608cd5697797"},"version":"0.10.3"}, + "ansi-wl-pprint": {"dependencies":["ansi-terminal","base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/ansi-wl-pprint-0.6.9/ansi-wl-pprint-0.6.9.tar.gz"},"name":"ansi-wl-pprint","pinned":{"url":["https://hackage.haskell.org/package/ansi-wl-pprint-0.6.9/ansi-wl-pprint-0.6.9.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/ansi-wl-pprint-0.6.9.tar.gz"],"sha256":"a7b2e8e7cd3f02f2954e8b17dc60a0ccd889f49e2068ebb15abfa1d42f7a4eac","cabal-sha256":"20d30674f137d43aa0279c2c2cc5e45a5f1c3c57e301852494906158b6313bf7"},"version":"0.6.9"}, + "array": {"dependencies":[],"location":{"type":"core"},"name":"array","version":"0.5.4.0"}, + "assoc": {"dependencies":["base","bifunctors","tagged"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/assoc-1.0.2/assoc-1.0.2.tar.gz"},"name":"assoc","pinned":{"url":["https://hackage.haskell.org/package/assoc-1.0.2/assoc-1.0.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/assoc-1.0.2.tar.gz"],"sha256":"d8988dc6e8718c7a3456515b769c9336aeeec730cf86fc5175247969ff8f144f","cabal-sha256":"a824e4f615469a27ad949dbf4907ba258bd6b459deebec00524c7bcb3f65cc9f"},"version":"1.0.2"}, + "async": {"dependencies":["base","hashable","stm"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/async-2.2.2/async-2.2.2.tar.gz"},"name":"async","pinned":{"url":["https://hackage.haskell.org/package/async-2.2.2/async-2.2.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/async-2.2.2.tar.gz"],"sha256":"4b4ab1ac82c45144d82c6daf6cb6ba45eab9957dad44787fa5e869e23d73bbff","cabal-sha256":"a178c166856da7ff22fe4500337b54812e94fd2059409452187d72e057ede9cd"},"version":"2.2.2"}, + "attoparsec": {"dependencies":["array","base","bytestring","containers","deepseq","scientific","text","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/attoparsec-0.13.2.4/attoparsec-0.13.2.4.tar.gz"},"name":"attoparsec","pinned":{"url":["https://hackage.haskell.org/package/attoparsec-0.13.2.4/attoparsec-0.13.2.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/attoparsec-0.13.2.4.tar.gz"],"sha256":"ba66cd6de1749ec92568db1b9c905b43a849f0ad918d45d7b594407a02ebefb2","cabal-sha256":"5941a05141a61239e8d6c4f2c9876bec3765d786766721b8474b8625febf914a"},"version":"0.13.2.4"}, + "base": {"dependencies":[],"location":{"type":"core"},"name":"base","version":"4.14.0.0"}, + "base-compat": {"dependencies":["base","unix"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/base-compat-0.11.1/base-compat-0.11.1.tar.gz"},"name":"base-compat","pinned":{"url":["https://hackage.haskell.org/package/base-compat-0.11.1/base-compat-0.11.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/base-compat-0.11.1.tar.gz"],"sha256":"356f1542ec93e7192a9073d32a8ef1e48194275495dcec7fb0d241f4baaf6d36","cabal-sha256":"e49c1ce84f556621ef1142a169e4349049c516f5b3e3c3ec6830be503e7d4a93"},"version":"0.11.1"}, + "base-compat-batteries": {"dependencies":["base","base-compat"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/base-compat-batteries-0.11.1/base-compat-batteries-0.11.1.tar.gz"},"name":"base-compat-batteries","pinned":{"url":["https://hackage.haskell.org/package/base-compat-batteries-0.11.1/base-compat-batteries-0.11.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/base-compat-batteries-0.11.1.tar.gz"],"sha256":"caf66fed3c0a3b0437692cad18c93a7074e8524a86b8be1ce04d0a18cbf6aed8","cabal-sha256":"2763af26f6bd118dc278b805988acc792443f08bd77da03ac5c438c2b1ab4aab"},"version":"0.11.1"}, + "base-orphans": {"dependencies":["base","ghc-prim"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/base-orphans-0.8.2/base-orphans-0.8.2.tar.gz"},"name":"base-orphans","pinned":{"url":["https://hackage.haskell.org/package/base-orphans-0.8.2/base-orphans-0.8.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/base-orphans-0.8.2.tar.gz"],"sha256":"2a8062385e5d5dee418428a22c72b9391557bc1fe2f93bd643f7754b36b9eb01","cabal-sha256":"40ef37ed043aac2cbb6c538fdebfc62e601ee65ee161e4a6327452133b574d7e"},"version":"0.8.2"}, + "base-prelude": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/base-prelude-1.4/base-prelude-1.4.tar.gz"},"name":"base-prelude","pinned":{"url":["https://hackage.haskell.org/package/base-prelude-1.4/base-prelude-1.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/base-prelude-1.4.tar.gz"],"sha256":"3a7fc639f3e5293509369d0b217f9d9b9662373b151411841df1d099bcd8c55a","cabal-sha256":"feea99326853023fa9f908308383a7f9802e40f2d241b83dac57b266b202bda6"},"version":"1.4"}, + "base64-bytestring": {"dependencies":["base","bytestring"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/base64-bytestring-1.1.0.0/base64-bytestring-1.1.0.0.tar.gz"},"name":"base64-bytestring","pinned":{"url":["https://hackage.haskell.org/package/base64-bytestring-1.1.0.0/base64-bytestring-1.1.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/base64-bytestring-1.1.0.0.tar.gz"],"sha256":"210d6c9042241ca52ee5d89cf221dbeb4d0e64b37391345369035ad2d9b4aca9","cabal-sha256":"190264fef9e65d9085f00ccda419137096d1dc94777c58272bc96821dc7f37c3"},"version":"1.1.0.0"}, + "basement": {"dependencies":["base","ghc-prim"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/basement-0.0.11/basement-0.0.11.tar.gz"},"name":"basement","pinned":{"url":["https://hackage.haskell.org/package/basement-0.0.11/basement-0.0.11.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/basement-0.0.11.tar.gz"],"sha256":"67582b3475a5547925399f719df21f8bbbd0ca4d4db27795c22a474f8ee6346b","cabal-sha256":"b685783bd7eeed832c47ebbd48599d9c45dccbc2380dd9295e137a30b37ecdc6"},"version":"0.0.11"}, + "bazel-runfiles": {"dependencies":["base","directory","filepath","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/bazel-runfiles-0.12/bazel-runfiles-0.12.tar.gz"},"name":"bazel-runfiles","pinned":{"url":["https://hackage.haskell.org/package/bazel-runfiles-0.12/bazel-runfiles-0.12.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/bazel-runfiles-0.12.tar.gz"],"sha256":"758abec4b6d9256dd17a3d9d3de1279e01f04a8662ef5fbd523d83e58b343cf5","cabal-sha256":"ea0e555a0c3fa67b0009a5f97d72cb1a0e9f03fe20ee2f6025b49a8117537298"},"version":"0.12"}, + "bifunctors": {"dependencies":["base","base-orphans","comonad","containers","tagged","template-haskell","th-abstraction","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/bifunctors-5.5.7/bifunctors-5.5.7.tar.gz"},"name":"bifunctors","pinned":{"url":["https://hackage.haskell.org/package/bifunctors-5.5.7/bifunctors-5.5.7.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/bifunctors-5.5.7.tar.gz"],"sha256":"88b3a2d4504e1139a3aef7027913faa0870631477d0a2ebb6fa67d494cdb3532","cabal-sha256":"19d907460f166ade334e9d85d7c0bcc58b57da5e8f802b28bba6d8d81fd3ee70"},"version":"5.5.7"}, + "binary": {"dependencies":[],"location":{"type":"core"},"name":"binary","version":"0.8.8.0"}, + "blaze-builder": {"dependencies":["base","bytestring","deepseq","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/blaze-builder-0.4.1.0/blaze-builder-0.4.1.0.tar.gz"},"name":"blaze-builder","pinned":{"url":["https://hackage.haskell.org/package/blaze-builder-0.4.1.0/blaze-builder-0.4.1.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/blaze-builder-0.4.1.0.tar.gz"],"sha256":"91fc8b966f3e9dc9461e1675c7566b881740f99abc906495491a3501630bc814","cabal-sha256":"3231635f58df8f62a4e791d3ccade450d07dd370bf97729a8d0fabf113acc6dc"},"version":"0.4.1.0"}, + "blaze-html": {"dependencies":["base","blaze-builder","blaze-markup","bytestring","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/blaze-html-0.9.1.2/blaze-html-0.9.1.2.tar.gz"},"name":"blaze-html","pinned":{"url":["https://hackage.haskell.org/package/blaze-html-0.9.1.2/blaze-html-0.9.1.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/blaze-html-0.9.1.2.tar.gz"],"sha256":"60503f42546c6c1b954014d188ea137e43d74dcffd2bf6157c113fd91a0c394c","cabal-sha256":"49db3eb70fa93fb572f3a9233b542b59e7f766a2b95c92d01d95a596c7727473"},"version":"0.9.1.2"}, + "blaze-markup": {"dependencies":["base","blaze-builder","bytestring","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/blaze-markup-0.8.2.7/blaze-markup-0.8.2.7.tar.gz"},"name":"blaze-markup","pinned":{"url":["https://hackage.haskell.org/package/blaze-markup-0.8.2.7/blaze-markup-0.8.2.7.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/blaze-markup-0.8.2.7.tar.gz"],"sha256":"8b6489ed422d98e4372f41be1f40f772b8d4ed925f3203b36be4078d918c8ee4","cabal-sha256":"66a4a250ef6597e3d147256ee3f3123d3b4848f2d2494f676ec293267e286f63"},"version":"0.8.2.7"}, + "bytestring": {"dependencies":[],"location":{"type":"core"},"name":"bytestring","version":"0.10.10.0"}, + "cabal-doctest": {"dependencies":["Cabal","base","directory","filepath"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/cabal-doctest-1.0.8/cabal-doctest-1.0.8.tar.gz"},"name":"cabal-doctest","pinned":{"url":["https://hackage.haskell.org/package/cabal-doctest-1.0.8/cabal-doctest-1.0.8.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/cabal-doctest-1.0.8.tar.gz"],"sha256":"2026a6a87d410202ce091412ca6bc33c5aca787025326b4a3d13425a23392e0e","cabal-sha256":"8bd1d614fb65f0d52609da30bf8e5ec71a4b6adf8ff5610edb3cb4d114576117"},"version":"1.0.8"}, + "call-stack": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/call-stack-0.2.0/call-stack-0.2.0.tar.gz"},"name":"call-stack","pinned":{"url":["https://hackage.haskell.org/package/call-stack-0.2.0/call-stack-0.2.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/call-stack-0.2.0.tar.gz"],"sha256":"95c693c93958758d714dee22edc56d4ebb2dcefa4412264e941e32ccd6e4e0c7","cabal-sha256":"5ce796b78d5f964468ec6fe0717b4e7d0430817f37370c47b3e6b38e345b6643"},"version":"0.2.0"}, + "case-insensitive": {"dependencies":["base","bytestring","deepseq","hashable","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/case-insensitive-1.2.1.0/case-insensitive-1.2.1.0.tar.gz"},"name":"case-insensitive","pinned":{"url":["https://hackage.haskell.org/package/case-insensitive-1.2.1.0/case-insensitive-1.2.1.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/case-insensitive-1.2.1.0.tar.gz"],"sha256":"296dc17e0c5f3dfb3d82ced83e4c9c44c338ecde749b278b6eae512f1d04e406","cabal-sha256":"9dfd3171fc7698cf8d931727d3af3a7b389135b583e46b5adac1f9d2026fff61"},"version":"1.2.1.0"}, + "charset": {"dependencies":["array","base","bytestring","containers","semigroups","unordered-containers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/charset-0.3.7.1/charset-0.3.7.1.tar.gz"},"name":"charset","pinned":{"url":["https://hackage.haskell.org/package/charset-0.3.7.1/charset-0.3.7.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/charset-0.3.7.1.tar.gz"],"sha256":"3d415d2883bd7bf0cc9f038e8323f19c71e07dd12a3c712f449ccb8b4daac0be","cabal-sha256":"3fc49b320dd636a476110262de6e49f541b6f9704781c91fb6629863951f5d00"},"version":"0.3.7.1"}, + "clock": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/clock-0.8/clock-0.8.tar.gz"},"name":"clock","pinned":{"url":["https://hackage.haskell.org/package/clock-0.8/clock-0.8.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/clock-0.8.tar.gz"],"sha256":"08a35c5294009040f1e5eb721a21b60df7af6584092bb3d376ab1b2e57e26914","cabal-sha256":"b4ae207e2d3761450060a0d0feb873269233898039c76fceef9cc1a544067767"},"version":"0.8"}, + "cmdargs": {"dependencies":["base","filepath","process","template-haskell","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/cmdargs-0.10.20/cmdargs-0.10.20.tar.gz"},"name":"cmdargs","pinned":{"url":["https://hackage.haskell.org/package/cmdargs-0.10.20/cmdargs-0.10.20.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/cmdargs-0.10.20.tar.gz"],"sha256":"0e269dc48c3d4c0447c96ffd772a6fe69dfa1260c323f4cd7bf171cbf2ab7331","cabal-sha256":"76cf238367e669833929dd264b4fc2278145ddf5b743624f2d5558cca16a08a9"},"version":"0.10.20"}, + "code-page": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/code-page-0.2/code-page-0.2.tar.gz"},"name":"code-page","pinned":{"url":["https://hackage.haskell.org/package/code-page-0.2/code-page-0.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/code-page-0.2.tar.gz"],"sha256":"bfe32a8c4be9cf0d5a088267bf3fdf4adda8ba3f109e85675c93e70d575e1844","cabal-sha256":"3192a458e76673b258c2696c8d429118741fee3c7cb6af2614f75b0101641b92"},"version":"0.2"}, + "colour": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/colour-2.3.5/colour-2.3.5.tar.gz"},"name":"colour","pinned":{"url":["https://hackage.haskell.org/package/colour-2.3.5/colour-2.3.5.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/colour-2.3.5.tar.gz"],"sha256":"3b8d471979617dce7c193523743c9782df63433d8e87e3ef6d97922e0da104e7","cabal-sha256":"b27db0a3ad40d70bdbd8510a104269f8707592e80757a1abc66a22ba25e5a42f"},"version":"2.3.5"}, + "comonad": {"dependencies":["Cabal","base","cabal-doctest","containers","distributive","tagged","transformers","transformers-compat"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/comonad-5.0.6/comonad-5.0.6.tar.gz"},"name":"comonad","pinned":{"url":["https://hackage.haskell.org/package/comonad-5.0.6/comonad-5.0.6.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/comonad-5.0.6.tar.gz"],"sha256":"77cfb016acd1747b892c31b82daf0de93f508ba775d62562d376b354adb88fae","cabal-sha256":"fdf1b529a79765a8549ac7e9d439b769cca852778742db8702a9d9b2dc27e4a4"},"version":"5.0.6"}, + "concurrent-output": {"dependencies":["ansi-terminal","async","base","directory","exceptions","process","stm","terminal-size","text","transformers","unix"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/concurrent-output-1.10.12/concurrent-output-1.10.12.tar.gz"},"name":"concurrent-output","pinned":{"url":["https://hackage.haskell.org/package/concurrent-output-1.10.12/concurrent-output-1.10.12.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/concurrent-output-1.10.12.tar.gz"],"sha256":"87f8a1cf54e6eaf146750fa6bf11aa2620da496073cb6c3dc8f697169eba3c20","cabal-sha256":"50e14131c486611055e2fa4f01a2ed03e63051e6d6707650f0a8f2f4ca618477"},"version":"1.10.12"}, + "conduit": {"dependencies":["base","bytestring","directory","exceptions","filepath","mono-traversable","mtl","primitive","resourcet","text","transformers","unix","unliftio-core","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/conduit-1.3.2/conduit-1.3.2.tar.gz"},"name":"conduit","pinned":{"url":["https://hackage.haskell.org/package/conduit-1.3.2/conduit-1.3.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/conduit-1.3.2.tar.gz"],"sha256":"e3d97970f9bdead7e9e5a71b6f6c32d5d08c1551d5b36b28350b20e146f4ac6e","cabal-sha256":"f85b5dc1d7d30e9122ac15975e7f59fe846b42ef952e2beddd32520a753c2fc4"},"version":"1.3.2"}, + "constraints": {"dependencies":["base","binary","deepseq","ghc-prim","hashable","mtl","semigroups","transformers","transformers-compat","type-equality"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/constraints-0.12/constraints-0.12.tar.gz"},"name":"constraints","pinned":{"url":["https://hackage.haskell.org/package/constraints-0.12/constraints-0.12.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/constraints-0.12.tar.gz"],"sha256":"f26b531a15f013f15b4b5df46c4f89b13927253a4195494c50320adf05760223","cabal-sha256":"71c7999d7fa01d8941f08d37d4c107c6b1bcbd0306e234157557b9b096b7f1be"},"version":"0.12"}, + "containers": {"dependencies":[],"location":{"type":"core"},"name":"containers","version":"0.6.2.1"}, + "contravariant": {"dependencies":["StateVar","base","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/contravariant-1.5.2/contravariant-1.5.2.tar.gz"},"name":"contravariant","pinned":{"url":["https://hackage.haskell.org/package/contravariant-1.5.2/contravariant-1.5.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/contravariant-1.5.2.tar.gz"],"sha256":"c4262c24e3dcc2ba8ca221ed52a6390818a715301e4f13135d8d732e0c7dc60c","cabal-sha256":"853259271870000c007a281f0bf0bf6e1aaa97c5fd5cd5734d7b0d79b9de2af5"},"version":"1.5.2"}, + "data-default-class": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/data-default-class-0.1.2.0/data-default-class-0.1.2.0.tar.gz"},"name":"data-default-class","pinned":{"url":["https://hackage.haskell.org/package/data-default-class-0.1.2.0/data-default-class-0.1.2.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/data-default-class-0.1.2.0.tar.gz"],"sha256":"4f01b423f000c3e069aaf52a348564a6536797f31498bb85c3db4bd2d0973e56","cabal-sha256":"63e62120b7efd733a5a17cf59ceb43268e9a929c748127172d7d42f4a336e327"},"version":"0.1.2.0"}, + "data-fix": {"dependencies":["base","deepseq","hashable"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/data-fix-0.3.0/data-fix-0.3.0.tar.gz"},"name":"data-fix","pinned":{"url":["https://hackage.haskell.org/package/data-fix-0.3.0/data-fix-0.3.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/data-fix-0.3.0.tar.gz"],"sha256":"9e59b3ed694b5139316093b3767842e60ad4821858459e7cd763e5773dfa99a0","cabal-sha256":"058a266d1e658500e0ffb8babe68195b0ce06a081dcfc3814afc784b083fd9a5"},"version":"0.3.0"}, + "deepseq": {"dependencies":[],"location":{"type":"core"},"name":"deepseq","version":"1.4.4.0"}, + "directory": {"dependencies":[],"location":{"type":"core"},"name":"directory","version":"1.3.6.0"}, + "directory-tree": {"dependencies":["base","directory","filepath"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/directory-tree-0.12.1/directory-tree-0.12.1.tar.gz"},"name":"directory-tree","pinned":{"url":["https://hackage.haskell.org/package/directory-tree-0.12.1/directory-tree-0.12.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/directory-tree-0.12.1.tar.gz"],"sha256":"e2084495b3a226cf54d949635c86fc14e89daa09d86cce39e3c3cf898ae6e517","cabal-sha256":"6f24ee1eca965a199a96f853582e61a338f1a529c87bc02c7f1451e2f2ed03fe"},"version":"0.12.1"}, + "distributive": {"dependencies":["Cabal","base","base-orphans","cabal-doctest","tagged","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/distributive-0.6.2/distributive-0.6.2.tar.gz"},"name":"distributive","pinned":{"url":["https://hackage.haskell.org/package/distributive-0.6.2/distributive-0.6.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/distributive-0.6.2.tar.gz"],"sha256":"824ee271ded433ce6c61fe890c784642b7e20ffa4082fca609da54e7dcfc23c9","cabal-sha256":"2ace9babcdbd1c2db28638c200405fb85e3660fe19ceae4f03082590adc2c487"},"version":"0.6.2"}, + "dlist": {"dependencies":["base","deepseq"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/dlist-0.8.0.8/dlist-0.8.0.8.tar.gz"},"name":"dlist","pinned":{"url":["https://hackage.haskell.org/package/dlist-0.8.0.8/dlist-0.8.0.8.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/dlist-0.8.0.8.tar.gz"],"sha256":"7129cf18068d3384e305708a10426ab8f573bee1030b023a114f45f1d0ec496d","cabal-sha256":"90ca348bffdc62d7070bcf0e97c728f8d01b24fbc7ea08d2909157d0da76534c"},"version":"0.8.0.8"}, + "doctest": {"dependencies":["base","base-compat","code-page","deepseq","directory","filepath","ghc","ghc-paths","process","syb","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/doctest-0.16.3/doctest-0.16.3.tar.gz"},"name":"doctest","pinned":{"url":["https://hackage.haskell.org/package/doctest-0.16.3/doctest-0.16.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/doctest-0.16.3.tar.gz"],"sha256":"cfe9629f9c4d0aa24a11b5c4dd216fb5b9ebce7b3f6a8a7e58716280943a34f8","cabal-sha256":"a4d5e71440a95034ad206eb9f3a27b2f5253896a15124574a00fea98c5b2f5c1"},"version":"0.16.3"}, + "erf": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/erf-2.0.0.0/erf-2.0.0.0.tar.gz"},"name":"erf","pinned":{"url":["https://hackage.haskell.org/package/erf-2.0.0.0/erf-2.0.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/erf-2.0.0.0.tar.gz"],"sha256":"24f0b79c7e1d25cb2cd44c2258d7a464bf6db8079775b50b60b54a254616b337","cabal-sha256":"11c5d3747d17b589009cbe9656ca792e4b5b2560d4aa44f6f1e80044794b1a8b"},"version":"2.0.0.0"}, + "exceptions": {"dependencies":["base","mtl","stm","template-haskell","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/exceptions-0.10.4/exceptions-0.10.4.tar.gz"},"name":"exceptions","pinned":{"url":["https://hackage.haskell.org/package/exceptions-0.10.4/exceptions-0.10.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/exceptions-0.10.4.tar.gz"],"sha256":"4d0bfb4355cffcd67d300811df9d5fe44ea3594ed63750795bfc1f797abd84cf","cabal-sha256":"d2546046d7ba4b460d3bc7fd269cd2c52d0b7fb3cfecc038715dd0881b78a484"},"version":"0.10.4"}, + "fail": {"dependencies":[],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/fail-4.9.0.0/fail-4.9.0.0.tar.gz"},"name":"fail","pinned":{"url":["https://hackage.haskell.org/package/fail-4.9.0.0/fail-4.9.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/fail-4.9.0.0.tar.gz"],"sha256":"6d5cdb1a5c539425a9665f740e364722e1d9d6ae37fbc55f30fe3dbbbb91d4a2","cabal-sha256":"35d1ee29364447c1b7d616bb1ee31f162b73e85fea91d7ca6441cf901398f572"},"version":"4.9.0.0"}, + "filepath": {"dependencies":[],"location":{"type":"core"},"name":"filepath","version":"1.4.2.1"}, + "fingertree": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/fingertree-0.1.4.2/fingertree-0.1.4.2.tar.gz"},"name":"fingertree","pinned":{"url":["https://hackage.haskell.org/package/fingertree-0.1.4.2/fingertree-0.1.4.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/fingertree-0.1.4.2.tar.gz"],"sha256":"95a948341570bad5a9b2468c388c0eb2c20c57e10dd8fbfc994c7b8764b36a7f","cabal-sha256":"b368fda61b14073bd798f45c8fa91e1c5331628193a8b88d93fb5a4341849c64"},"version":"0.1.4.2"}, + "foldl": {"dependencies":["base","bytestring","comonad","containers","contravariant","hashable","mwc-random","primitive","profunctors","semigroupoids","text","transformers","unordered-containers","vector","vector-builder"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/foldl-1.4.8/foldl-1.4.8.tar.gz"},"name":"foldl","pinned":{"url":["https://hackage.haskell.org/package/foldl-1.4.8/foldl-1.4.8.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/foldl-1.4.8.tar.gz"],"sha256":"ed1a59f210d4e732dc5b0a0dbe7e60348ea87e74df196f75a6bc236c936499ca","cabal-sha256":"2f6611b3a2ce92d2279c93a60cd8ef3bed98c17bd814e5b943ede53578005f26"},"version":"1.4.8"}, + "free": {"dependencies":["base","comonad","containers","distributive","exceptions","mtl","profunctors","semigroupoids","template-haskell","transformers","transformers-base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/free-5.1.3/free-5.1.3.tar.gz"},"name":"free","pinned":{"url":["https://hackage.haskell.org/package/free-5.1.3/free-5.1.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/free-5.1.3.tar.gz"],"sha256":"2c70d66e3a1ad52ce4b22d5510ffc6d7b3db950bd7f43bc61801cfe7b24c2e2d","cabal-sha256":"604c27b6ba0a560c8a1377ad76e5bbb8528e924d6b0590215d815faddbec0b70"},"version":"5.1.3"}, + "fused-effects": {"dependencies":["base","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/fused-effects-1.1.0.0/fused-effects-1.1.0.0.tar.gz"},"name":"fused-effects","pinned":{"url":["https://hackage.haskell.org/package/fused-effects-1.1.0.0/fused-effects-1.1.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/fused-effects-1.1.0.0.tar.gz"],"sha256":"9de604f9bbae418ff81767c173933945d1dd61c2889c124775dcbfa90780415b","cabal-sha256":"29d03c73b585920c0999a18b73c9a0bf9e61e1fa58c5c2bed3f89423c8078f4a"},"version":"1.1.0.0"}, + "fused-effects-exceptions": {"dependencies":["base","fused-effects","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/fused-effects-exceptions-1.1.0.0/fused-effects-exceptions-1.1.0.0.tar.gz"},"name":"fused-effects-exceptions","pinned":{"url":["https://hackage.haskell.org/package/fused-effects-exceptions-1.1.0.0/fused-effects-exceptions-1.1.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/fused-effects-exceptions-1.1.0.0.tar.gz"],"sha256":"51d67c952b4d0799fe99f6b82d6e534b9fd26447ea321c7710bfdbc9ca76bd64","cabal-sha256":"c1880f55360deaa4441bda9ff09a4ce6dbd63df8c175c7ada16a5d67a3717bee"},"version":"1.1.0.0"}, + "fused-effects-readline": {"dependencies":["base","directory","exceptions","filepath","fused-effects","haskeline","prettyprinter","prettyprinter-ansi-terminal","terminal-size","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/fused-effects-readline-0.1.0.0/fused-effects-readline-0.1.0.0.tar.gz"},"name":"fused-effects-readline","pinned":{"url":["https://hackage.haskell.org/package/fused-effects-readline-0.1.0.0/fused-effects-readline-0.1.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/fused-effects-readline-0.1.0.0.tar.gz"],"sha256":"5514b7022231fc2e040bbdc7550cb080a03ebdf567e16719f0443f20572b3ae9","cabal-sha256":"668b390d418baf0e4f611a021e92a12b9bdebbab2e6a75a8b6c7434cfd019856"},"version":"0.1.0.0"}, + "gauge": {"dependencies":["base","basement","deepseq","directory","process","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/gauge-0.2.5/gauge-0.2.5.tar.gz"},"name":"gauge","pinned":{"url":["https://hackage.haskell.org/package/gauge-0.2.5/gauge-0.2.5.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/gauge-0.2.5.tar.gz"],"sha256":"d520fd677890c1bf2b1601331d003f976d85420811c3db4a72cff4d3bdb7f5a7","cabal-sha256":"8d60450bdec985c146d5632d4f5a8d60cec27d71ba6787ed1ee64d945d4c7c33"},"version":"0.2.5"}, + "generic-lens": {"dependencies":["base","generic-lens-core","profunctors","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/generic-lens-2.0.0.0/generic-lens-2.0.0.0.tar.gz"},"name":"generic-lens","pinned":{"url":["https://hackage.haskell.org/package/generic-lens-2.0.0.0/generic-lens-2.0.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/generic-lens-2.0.0.0.tar.gz"],"sha256":"b816e55dbdf96ed04b7ad01193fce3dec36397aff3036e34a89ee2884b02093a","cabal-sha256":"7409fa0ce540d0bd41acf596edd1c5d0c0ab1cd1294d514cf19c5c24e8ef2550"},"version":"2.0.0.0"}, + "generic-lens-core": {"dependencies":["base","indexed-profunctors","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/generic-lens-core-2.0.0.0/generic-lens-core-2.0.0.0.tar.gz"},"name":"generic-lens-core","pinned":{"url":["https://hackage.haskell.org/package/generic-lens-core-2.0.0.0/generic-lens-core-2.0.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/generic-lens-core-2.0.0.0.tar.gz"],"sha256":"51628204350380be7d46a53a9e3e47d9d6f5c4797cf0215b9d93a2f90794ee40","cabal-sha256":"40b063c4a1399b3cdb19f2df1fae5a1a82f3313015c7c3e47fc23b8ef1b3e443"},"version":"2.0.0.0"}, + "generic-monoid": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/generic-monoid-0.1.0.1/generic-monoid-0.1.0.1.tar.gz"},"name":"generic-monoid","pinned":{"url":["https://hackage.haskell.org/package/generic-monoid-0.1.0.1/generic-monoid-0.1.0.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/generic-monoid-0.1.0.1.tar.gz"],"sha256":"cfd072ad70af41c1b94ac24e42e2635f37ed2a54e8f4be871be78b18b66b2adf","cabal-sha256":"78e2d99cb083607b2ba4010af576ed364cc296c6722ca95e46519bbd6c56ae9d"},"version":"0.1.0.1"}, + "ghc": {"dependencies":[],"location":{"type":"core"},"name":"ghc","version":"8.10.1"}, + "ghc-paths": {"dependencies":["Cabal","base","directory"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/ghc-paths-0.1.0.12/ghc-paths-0.1.0.12.tar.gz"},"name":"ghc-paths","pinned":{"url":["https://hackage.haskell.org/package/ghc-paths-0.1.0.12/ghc-paths-0.1.0.12.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/ghc-paths-0.1.0.12.tar.gz"],"sha256":"6ecbe676d073cb07989c61ce4c5709c4e67cbefdd2d55a4095f9388b6fe2c484","cabal-sha256":"afdfdb6584f39e821b2b7130e12007bf3ad87401d86f5105eead059c150dc81d"},"version":"0.1.0.12"}, + "ghc-prim": {"dependencies":[],"location":{"type":"core"},"name":"ghc-prim","version":"0.6.1"}, + "happy": {"dependencies":["array","base","containers","mtl"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/happy-1.19.12/happy-1.19.12.tar.gz"},"name":"happy","pinned":{"url":["https://hackage.haskell.org/package/happy-1.19.12/happy-1.19.12.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/happy-1.19.12.tar.gz"],"sha256":"fb9a23e41401711a3b288f93cf0a66db9f97da1ce32ec4fffea4b78a0daeb40f","cabal-sha256":"acc67bfbf3af87892766781dd064c9447181ea81269a7a1e5fc9ace4a8fa4768"},"version":"1.19.12"}, + "hashable": {"dependencies":["base","bytestring","deepseq","ghc-prim","integer-gmp","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/hashable-1.3.0.0/hashable-1.3.0.0.tar.gz"},"name":"hashable","pinned":{"url":["https://hackage.haskell.org/package/hashable-1.3.0.0/hashable-1.3.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/hashable-1.3.0.0.tar.gz"],"sha256":"822e5413fbccca6ae884d3aba4066422c8b5d58d23d18b9ecb5c03273bb19ab4","cabal-sha256":"d60cad00223d46172020c136e68acef0481a47d0302b2e74b1805b4f3a446a9b"},"version":"1.3.0.0"}, + "haskeline": {"dependencies":["base","bytestring","containers","directory","exceptions","filepath","process","stm","terminfo","transformers","unix"],"location":{"type":"core"},"name":"haskeline","version":"0.8.0.0"}, + "haskell-lexer": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/haskell-lexer-1.1/haskell-lexer-1.1.tar.gz"},"name":"haskell-lexer","pinned":{"url":["https://hackage.haskell.org/package/haskell-lexer-1.1/haskell-lexer-1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/haskell-lexer-1.1.tar.gz"],"sha256":"313a15cc643322c8badd148867ce25ca1ffc191df9e7eeec5b10bc08c4b563d5","cabal-sha256":"9e0a7633f6bdb59004c6f3144ebfad1edb9e440fc6a94215c3a1d11bcd8656ef"},"version":"1.1"}, + "hedgehog": {"dependencies":["ansi-terminal","async","base","bytestring","concurrent-output","containers","deepseq","directory","erf","exceptions","fail","lifted-async","mmorph","monad-control","mtl","pretty-show","primitive","random","resourcet","semigroups","stm","template-haskell","text","time","transformers","transformers-base","wl-pprint-annotated"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/hedgehog-1.0.3/hedgehog-1.0.3.tar.gz"},"name":"hedgehog","pinned":{"url":["https://hackage.haskell.org/package/hedgehog-1.0.3/hedgehog-1.0.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/hedgehog-1.0.3.tar.gz"],"sha256":"35f9e96578c09734243a4e423d367083e08937f863101b3f6ef48744c8299b82","cabal-sha256":"12d8626145a34f8d4f64120807d26e723f139b448f1c7960adfa7c1d647c1c6c"},"version":"1.0.3"}, + "hostname": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/hostname-1.0/hostname-1.0.tar.gz"},"name":"hostname","pinned":{"url":["https://hackage.haskell.org/package/hostname-1.0/hostname-1.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/hostname-1.0.tar.gz"],"sha256":"9b43dab1b6da521f35685b20555da00738c8e136eb972458c786242406a9cf5c","cabal-sha256":"8203b6ecd14ca1ef12f73a471b0a6a4be3ad4568d8b84f2bc4bc9e0abb8c4153"},"version":"1.0"}, + "hscolour": {"dependencies":["base","containers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/hscolour-1.24.4/hscolour-1.24.4.tar.gz"},"name":"hscolour","pinned":{"url":["https://hackage.haskell.org/package/hscolour-1.24.4/hscolour-1.24.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/hscolour-1.24.4.tar.gz"],"sha256":"243332b082294117f37b2c2c68079fa61af68b36223b3fc07594f245e0e5321d","cabal-sha256":"3a329fa0ea9138f651088f1fa25522aabeab0eb591932d3fd56c66736bbe78be"},"version":"1.24.4"}, + "hspec": {"dependencies":["QuickCheck","base","hspec-core","hspec-discover","hspec-expectations"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/hspec-2.7.2/hspec-2.7.2.tar.gz"},"name":"hspec","pinned":{"url":["https://hackage.haskell.org/package/hspec-2.7.2/hspec-2.7.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/hspec-2.7.2.tar.gz"],"sha256":"a97ebd050d5667d78dbe83348b8b1b4f579c2ea71ccfcc3eea9e9fbe0b5a697d","cabal-sha256":"4758e1af9cf534429cde9f5f6495e5922ad1c05ca5b8344a0a459d320cd1cd28"},"version":"2.7.2"}, + "hspec-core": {"dependencies":["HUnit","QuickCheck","ansi-terminal","array","base","call-stack","clock","deepseq","directory","filepath","hspec-expectations","quickcheck-io","random","setenv","stm","tf-random","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/hspec-core-2.7.2/hspec-core-2.7.2.tar.gz"},"name":"hspec-core","pinned":{"url":["https://hackage.haskell.org/package/hspec-core-2.7.2/hspec-core-2.7.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/hspec-core-2.7.2.tar.gz"],"sha256":"d33afadc5602545c832bf5a7d73815ee9cc6c50e4b17847b35d7e5f11eeffa6f","cabal-sha256":"9553efd731cde4e5cf061d2caedea7eb113a0b785305f86f7a4e9af112e33a1c"},"version":"2.7.2"}, + "hspec-discover": {"dependencies":["base","directory","filepath"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/hspec-discover-2.7.2/hspec-discover-2.7.2.tar.gz"},"name":"hspec-discover","pinned":{"url":["https://hackage.haskell.org/package/hspec-discover-2.7.2/hspec-discover-2.7.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/hspec-discover-2.7.2.tar.gz"],"sha256":"888604783e48c6a5f49f3de5eb8c4f83841119b13d99144283f9e56a7fdb7458","cabal-sha256":"9b21f4211c0553f2f50e50b2231dbdc89e37acb0fbb60b91b890cc2ec81e7bf7"},"version":"2.7.2"}, + "hspec-expectations": {"dependencies":["HUnit","base","call-stack"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/hspec-expectations-0.8.2/hspec-expectations-0.8.2.tar.gz"},"name":"hspec-expectations","pinned":{"url":["https://hackage.haskell.org/package/hspec-expectations-0.8.2/hspec-expectations-0.8.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/hspec-expectations-0.8.2.tar.gz"],"sha256":"819607ea1faf35ce5be34be61c6f50f3389ea43892d56fb28c57a9f5d54fb4ef","cabal-sha256":"e2db24881baadc2d9d23b03cb629e80dcbda89a6b04ace9adb5f4d02ef8b31aa"},"version":"0.8.2"}, + "indexed-profunctors": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/indexed-profunctors-0.1/indexed-profunctors-0.1.tar.gz"},"name":"indexed-profunctors","pinned":{"url":["https://hackage.haskell.org/package/indexed-profunctors-0.1/indexed-profunctors-0.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/indexed-profunctors-0.1.tar.gz"],"sha256":"31dfb4319dff84199344000b1efad75158eeac17ddcbb27f91735e958591bb65","cabal-sha256":"ddf618d0d4c58319c1e735e746bc69a1021f13b6f475dc9614b80af03432e6d4"},"version":"0.1"}, + "integer-gmp": {"dependencies":[],"location":{"type":"core"},"name":"integer-gmp","version":"1.0.3.0"}, + "integer-logarithms": {"dependencies":["array","base","ghc-prim","integer-gmp"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/integer-logarithms-1.0.3/integer-logarithms-1.0.3.tar.gz"},"name":"integer-logarithms","pinned":{"url":["https://hackage.haskell.org/package/integer-logarithms-1.0.3/integer-logarithms-1.0.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/integer-logarithms-1.0.3.tar.gz"],"sha256":"5ae262018698af35bb74916fad170d96d3eb44669c72ed36db9a19a3392cec16","cabal-sha256":"63d42595ec92b71ac98a07b984b0a2eb3d4956f4ad2d856c3bf6fc3dc218d228"},"version":"1.0.3"}, + "invariant": {"dependencies":["StateVar","array","base","bifunctors","comonad","containers","contravariant","ghc-prim","profunctors","stm","tagged","template-haskell","th-abstraction","transformers","transformers-compat","unordered-containers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/invariant-0.5.3/invariant-0.5.3.tar.gz"},"name":"invariant","pinned":{"url":["https://hackage.haskell.org/package/invariant-0.5.3/invariant-0.5.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/invariant-0.5.3.tar.gz"],"sha256":"d73e5def38da9fdd85def073857aa5f4b1d3b0c2df05c43d58a677cca02d440c","cabal-sha256":"5b74af0b909c44b17298a9c04bcd0aea030f36a869da9112b103890f3aa2516f"},"version":"0.5.3"}, + "kan-extensions": {"dependencies":["adjunctions","array","base","comonad","containers","contravariant","distributive","free","invariant","mtl","profunctors","semigroupoids","tagged","transformers","transformers-compat"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/kan-extensions-5.2/kan-extensions-5.2.tar.gz"},"name":"kan-extensions","pinned":{"url":["https://hackage.haskell.org/package/kan-extensions-5.2/kan-extensions-5.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/kan-extensions-5.2.tar.gz"],"sha256":"6b727e586f744b96529415eeabc745dfe05feea61f6b6bad90c224c879f4dbd3","cabal-sha256":"c427da993336606ece009744e6403782f1e8625cc62588aa825190a693ff2ace"},"version":"5.2"}, + "lens": {"dependencies":["Cabal","array","base","base-orphans","bifunctors","bytestring","cabal-doctest","call-stack","comonad","containers","contravariant","distributive","exceptions","filepath","free","ghc-prim","hashable","kan-extensions","mtl","parallel","profunctors","reflection","semigroupoids","tagged","template-haskell","text","th-abstraction","transformers","transformers-compat","unordered-containers","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/lens-4.19.2/lens-4.19.2.tar.gz"},"name":"lens","pinned":{"url":["https://hackage.haskell.org/package/lens-4.19.2/lens-4.19.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/lens-4.19.2.tar.gz"],"sha256":"52f858ae3971a5104cdba5e81a27d154fda11fe65a54a4ac328c85904bdec23b","cabal-sha256":"d4d704141d7c322bbfb746157b0709f3b966dfec92421f571c34069893af08cc"},"version":"4.19.2"}, + "lens-family": {"dependencies":["base","containers","lens-family-core","mtl","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/lens-family-2.0.0/lens-family-2.0.0.tar.gz"},"name":"lens-family","pinned":{"url":["https://hackage.haskell.org/package/lens-family-2.0.0/lens-family-2.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/lens-family-2.0.0.tar.gz"],"sha256":"6793f2a5c5030f02258532043d57eac42318cd7f9cef47f6720a7b99276f03db","cabal-sha256":"fc0f45b5e61bb8ef829639e4326c16e3acf436c3b6c6395825e54dcc61ffc0d9"},"version":"2.0.0"}, + "lens-family-core": {"dependencies":["base","containers","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/lens-family-core-2.0.0/lens-family-core-2.0.0.tar.gz"},"name":"lens-family-core","pinned":{"url":["https://hackage.haskell.org/package/lens-family-core-2.0.0/lens-family-core-2.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/lens-family-core-2.0.0.tar.gz"],"sha256":"19b4fcd3bd37dd0056c112a9b16cf405644fabd6652013c61a5078380ed2265a","cabal-sha256":"645b0553e16a3857b08fa44f11f0664296e1db5d6494a83634711c7f4f1707a7"},"version":"2.0.0"}, + "libyaml": {"dependencies":["base","bytestring","conduit","resourcet"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/libyaml-0.1.2/libyaml-0.1.2.tar.gz"},"name":"libyaml","pinned":{"url":["https://hackage.haskell.org/package/libyaml-0.1.2/libyaml-0.1.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/libyaml-0.1.2.tar.gz"],"sha256":"8f42d66f199fcaee255326f8f770d88b0670df56b5eb78002d6058f3a45e97b5","cabal-sha256":"7f14f69ceb14659699974e8e47e1ea6f226ea21ff42a802db03e721c319d201d"},"version":"0.1.2"}, + "lifted-async": {"dependencies":["async","base","constraints","lifted-base","monad-control","transformers-base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/lifted-async-0.10.1.2/lifted-async-0.10.1.2.tar.gz"},"name":"lifted-async","pinned":{"url":["https://hackage.haskell.org/package/lifted-async-0.10.1.2/lifted-async-0.10.1.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/lifted-async-0.10.1.2.tar.gz"],"sha256":"bd24cb197953701507680893b84df505eb58d1c31e1d45f9a0edae43cd965713","cabal-sha256":"525946f7f54feca4cf5207aaf56452be08a2b0d12e04e5fb5770a98b5a56b9fc"},"version":"0.10.1.2"}, + "lifted-base": {"dependencies":["base","monad-control","transformers-base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/lifted-base-0.2.3.12/lifted-base-0.2.3.12.tar.gz"},"name":"lifted-base","pinned":{"url":["https://hackage.haskell.org/package/lifted-base-0.2.3.12/lifted-base-0.2.3.12.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/lifted-base-0.2.3.12.tar.gz"],"sha256":"c134a95f56750aae806e38957bb03c59627cda16034af9e00a02b699474317c5","cabal-sha256":"e94ad0692c9c5d85c373e508f23654f2da8ac8c3e475c2b65ffbc04fb165ad69"},"version":"0.2.3.12"}, + "lingo": {"dependencies":["base","bytestring","containers","directory","filepath","raw-strings-qq","text","yaml"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/lingo-0.5.0.1/lingo-0.5.0.1.tar.gz"},"name":"lingo","pinned":{"url":["https://hackage.haskell.org/package/lingo-0.5.0.1/lingo-0.5.0.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/lingo-0.5.0.1.tar.gz"],"sha256":"1a354e753c18ee5c6fceed0acfd0b5b80c5bcb4536df32ba5608272bb279a740","cabal-sha256":"e57deaf3353725bbb84d5e7426d9b7039f191e46779c590f236851c75e94751a"},"version":"0.5.0.1"}, + "logict": {"dependencies":["base","mtl"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/logict-0.7.0.2/logict-0.7.0.2.tar.gz"},"name":"logict","pinned":{"url":["https://hackage.haskell.org/package/logict-0.7.0.2/logict-0.7.0.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/logict-0.7.0.2.tar.gz"],"sha256":"ccc198a05563a4d8fc145ecde8b43a83599b3bcb032d2614a8e852f0ba6ecff5","cabal-sha256":"fd3e3a64a0152aa921ad761ca0fabe3be7837e006efc3b15cb1a7283f1e0f5f1"},"version":"0.7.0.2"}, + "math-functions": {"dependencies":["base","data-default-class","deepseq","primitive","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/math-functions-0.3.4.1/math-functions-0.3.4.1.tar.gz"},"name":"math-functions","pinned":{"url":["https://hackage.haskell.org/package/math-functions-0.3.4.1/math-functions-0.3.4.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/math-functions-0.3.4.1.tar.gz"],"sha256":"e20a0afc03d3431610d5f4e57ec3a71822bf6cb1c598e8f2ad1b336533e4a48f","cabal-sha256":"a6e458d2a78f03e83440062e8803c0baf7c1474dc2687489661690f4c6d46416"},"version":"0.3.4.1"}, + "megaparsec": {"dependencies":["base","bytestring","case-insensitive","containers","deepseq","mtl","parser-combinators","scientific","text","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/megaparsec-8.0.0/megaparsec-8.0.0.tar.gz"},"name":"megaparsec","pinned":{"url":["https://hackage.haskell.org/package/megaparsec-8.0.0/megaparsec-8.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/megaparsec-8.0.0.tar.gz"],"sha256":"b5d7c64646016d12f540a6948396a86e0cd39865569d68fe2018fe9e3fce6318","cabal-sha256":"362f85e243ecbcb550e1de6e5c74ba5a50c09edaa1208c99bc5b9fd242227fc6"},"version":"8.0.0"}, + "mmorph": {"dependencies":["base","mtl","transformers","transformers-compat"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/mmorph-1.1.3/mmorph-1.1.3.tar.gz"},"name":"mmorph","pinned":{"url":["https://hackage.haskell.org/package/mmorph-1.1.3/mmorph-1.1.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/mmorph-1.1.3.tar.gz"],"sha256":"7923f7ad6260a05aaa8175b9f2a250f5bb63187427681171bd36d29a6cf2da65","cabal-sha256":"abfc95648fef0008f984b94137ce8e1635fb071c7bfaaa7393ba175a1b3bb12f"},"version":"1.1.3"}, + "monad-control": {"dependencies":["base","stm","transformers","transformers-base","transformers-compat"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/monad-control-1.0.2.3/monad-control-1.0.2.3.tar.gz"},"name":"monad-control","pinned":{"url":["https://hackage.haskell.org/package/monad-control-1.0.2.3/monad-control-1.0.2.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/monad-control-1.0.2.3.tar.gz"],"sha256":"6c1034189d237ae45368c70f0e68f714dd3beda715dd265b6c8a99fcc64022b1","cabal-sha256":"a3ae888d2fed2e2a0ca33ae11e2480219e07312bccf1a02ffe2ba2e3ec5913ee"},"version":"1.0.2.3"}, + "mono-traversable": {"dependencies":["base","bytestring","containers","hashable","split","text","transformers","unordered-containers","vector","vector-algorithms"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/mono-traversable-1.0.15.1/mono-traversable-1.0.15.1.tar.gz"},"name":"mono-traversable","pinned":{"url":["https://hackage.haskell.org/package/mono-traversable-1.0.15.1/mono-traversable-1.0.15.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/mono-traversable-1.0.15.1.tar.gz"],"sha256":"c2df5b79ed2f88f2ee313e57c1d591d4463788e20d39e439297eec5ba5835ddf","cabal-sha256":"9ea638260fb4ea04ef138b9954922531f61e50df427565ed6969138cac77ffaf"},"version":"1.0.15.1"}, + "mtl": {"dependencies":[],"location":{"type":"core"},"name":"mtl","version":"2.2.2"}, + "mwc-random": {"dependencies":["base","math-functions","primitive","time","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/mwc-random-0.14.0.0/mwc-random-0.14.0.0.tar.gz"},"name":"mwc-random","pinned":{"url":["https://hackage.haskell.org/package/mwc-random-0.14.0.0/mwc-random-0.14.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/mwc-random-0.14.0.0.tar.gz"],"sha256":"00370edaa60a51c86663868ecc2b1995824970001875cec458e9acc13511efa2","cabal-sha256":"6ae33e246e91f66f621caabb2323b431c8dab57427a417a98f5cac3d82eb7b21"},"version":"0.14.0.0"}, + "neat-interpolation": {"dependencies":["base","megaparsec","template-haskell","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/neat-interpolation-0.5.1.1/neat-interpolation-0.5.1.1.tar.gz"},"name":"neat-interpolation","pinned":{"url":["https://hackage.haskell.org/package/neat-interpolation-0.5.1.1/neat-interpolation-0.5.1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/neat-interpolation-0.5.1.1.tar.gz"],"sha256":"a4af35abf3f31168f7478eb334592b90e9a658efd26a5702e6780ab2c61454ae","cabal-sha256":"55f45d1737bcdf57dc9753996dd61819df335a542d8bad61b72b3700261c5b70"},"version":"0.5.1.1"}, + "network": {"dependencies":["base","bytestring","deepseq"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/network-3.1.1.1/network-3.1.1.1.tar.gz"},"name":"network","pinned":{"url":["https://hackage.haskell.org/package/network-3.1.1.1/network-3.1.1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/network-3.1.1.1.tar.gz"],"sha256":"d7ef590173fff2ab522fbc167f3fafb867e4ecfca279eb3ef0d137b51f142c9a","cabal-sha256":"b704cb6676c03e98267190df797497587576a2e96094550ea143415239bbe66e"},"version":"3.1.1.1"}, + "network-uri": {"dependencies":["base","deepseq","parsec","template-haskell"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/network-uri-2.6.3.0/network-uri-2.6.3.0.tar.gz"},"name":"network-uri","pinned":{"url":["https://hackage.haskell.org/package/network-uri-2.6.3.0/network-uri-2.6.3.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/network-uri-2.6.3.0.tar.gz"],"sha256":"a01c1389f15d2cc2e847914737f706133bb11f0c5f8ee89711a36a25b7afa723","cabal-sha256":"43727dafd00531c8c9df1ed4ee1cf363d76111f8e841193a3397a2a4c5f79b3f"},"version":"2.6.3.0"}, + "optparse-applicative": {"dependencies":["ansi-wl-pprint","base","process","transformers","transformers-compat"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/optparse-applicative-0.15.1.0/optparse-applicative-0.15.1.0.tar.gz"},"name":"optparse-applicative","pinned":{"url":["https://hackage.haskell.org/package/optparse-applicative-0.15.1.0/optparse-applicative-0.15.1.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/optparse-applicative-0.15.1.0.tar.gz"],"sha256":"4db3675fd1e0594afdf079db46f4cd412d483835d703e7c07e1a1a37d6f046f3","cabal-sha256":"29ff6146aabf54d46c4c8788e8d1eadaea27c94f6d360c690c5f6c93dac4b07e"},"version":"0.15.1.0"}, + "optparse-generic": {"dependencies":["Only","base","bytestring","optparse-applicative","system-filepath","text","time","transformers","void"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/optparse-generic-1.4.2/optparse-generic-1.4.2.tar.gz"},"name":"optparse-generic","pinned":{"url":["https://hackage.haskell.org/package/optparse-generic-1.4.2/optparse-generic-1.4.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/optparse-generic-1.4.2.tar.gz"],"sha256":"26fb7261cef593dd7c9534614dc858894e9f29148975a1505f13c43aec356401","cabal-sha256":"c019eb6dfc83476b8afb520afae6b3a6f95c8061a745fbe272a8e043cc7b3dc9"},"version":"1.4.2"}, + "parallel": {"dependencies":["array","base","containers","deepseq","ghc-prim"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/parallel-3.2.2.0/parallel-3.2.2.0.tar.gz"},"name":"parallel","pinned":{"url":["https://hackage.haskell.org/package/parallel-3.2.2.0/parallel-3.2.2.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/parallel-3.2.2.0.tar.gz"],"sha256":"170453a71a2a8b31cca63125533f7771d7debeb639700bdabdd779c34d8a6ef6","cabal-sha256":"421ce1717610bab82969572b96be89d83ea8d8afe7751cb54d80b996fff063d3"},"version":"3.2.2.0"}, + "parsec": {"dependencies":[],"location":{"type":"core"},"name":"parsec","version":"3.1.14.0"}, + "parser-combinators": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/parser-combinators-1.2.1/parser-combinators-1.2.1.tar.gz"},"name":"parser-combinators","pinned":{"url":["https://hackage.haskell.org/package/parser-combinators-1.2.1/parser-combinators-1.2.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/parser-combinators-1.2.1.tar.gz"],"sha256":"03162e40cde50253529fa452165b681d5064d03ad07992800702156adfb6254d","cabal-sha256":"16c3490e007ec10b1255a2b36fb483d000156d555269107131241d9e0fa96412"},"version":"1.2.1"}, + "parsers": {"dependencies":["attoparsec","base","base-orphans","binary","charset","containers","mtl","parsec","scientific","semigroups","text","transformers","unordered-containers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/parsers-0.12.10/parsers-0.12.10.tar.gz"},"name":"parsers","pinned":{"url":["https://hackage.haskell.org/package/parsers-0.12.10/parsers-0.12.10.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/parsers-0.12.10.tar.gz"],"sha256":"17b91f1318ca54679395b382a056df633fdb44fbb962eca66b1787f957af1a6c","cabal-sha256":"6367145ea9cdb8382f407548a25d20d4435f437baef76f27e56cd5f1a3c1ec96"},"version":"0.12.10"}, + "pathtype": {"dependencies":["QuickCheck","base","deepseq","directory","semigroups","tagged","time","transformers","utility-ht"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/pathtype-0.8.1.1/pathtype-0.8.1.1.tar.gz"},"name":"pathtype","pinned":{"url":["https://hackage.haskell.org/package/pathtype-0.8.1.1/pathtype-0.8.1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/pathtype-0.8.1.1.tar.gz"],"sha256":"c7dce1871e65c6447bbe138d6ccecd5abcde84aba6fac7003e7755d238c2420c","cabal-sha256":"8561fa48933c1ebd53b48a37806e4d72de31fee0bca4794cb1cd486468987a30"},"version":"0.8.1.1"}, + "pretty": {"dependencies":[],"location":{"type":"core"},"name":"pretty","version":"1.1.3.6"}, + "pretty-show": {"dependencies":["array","base","filepath","ghc-prim","happy","haskell-lexer","pretty","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/pretty-show-1.10/pretty-show-1.10.tar.gz"},"name":"pretty-show","pinned":{"url":["https://hackage.haskell.org/package/pretty-show-1.10/pretty-show-1.10.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/pretty-show-1.10.tar.gz"],"sha256":"307f9086e0b063d439dc4f513e36a145e8a57f23de448aefae2a6c00f6da6fd2","cabal-sha256":"bfef8da0ac4db4fc7f41edfec9e9a701ac206418d70702bff1e40f20d6a2b1f1"},"version":"1.10"}, + "pretty-simple": {"dependencies":["Cabal","ansi-terminal","base","cabal-doctest","containers","mtl","text","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/pretty-simple-3.3.0.0/pretty-simple-3.3.0.0.tar.gz"},"name":"pretty-simple","pinned":{"url":["https://hackage.haskell.org/package/pretty-simple-3.3.0.0/pretty-simple-3.3.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/pretty-simple-3.3.0.0.tar.gz"],"sha256":"d01637fcfb61911bdd7e85127d79a3e862634c05b5402a3ec64ce36b5149033d","cabal-sha256":"c74f9c3c7234daddddfe2f0567adaced9c40e7c72c24abc3224fc2dcb5a350a2"},"version":"3.3.0.0"}, + "prettyprinter": {"dependencies":["base","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/prettyprinter-1.6.2/prettyprinter-1.6.2.tar.gz"},"name":"prettyprinter","pinned":{"url":["https://hackage.haskell.org/package/prettyprinter-1.6.2/prettyprinter-1.6.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/prettyprinter-1.6.2.tar.gz"],"sha256":"d193f1902630d0a652a7043aa37069224ea56a3ff0fa1b57f57ebf5ece777008","cabal-sha256":"d9fa76aebce33c5c179a66128dfb5639e9257325d11c68569c6574dd8e112cde"},"version":"1.6.2"}, + "prettyprinter-ansi-terminal": {"dependencies":["ansi-terminal","base","prettyprinter","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/prettyprinter-ansi-terminal-1.1.2/prettyprinter-ansi-terminal-1.1.2.tar.gz"},"name":"prettyprinter-ansi-terminal","pinned":{"url":["https://hackage.haskell.org/package/prettyprinter-ansi-terminal-1.1.2/prettyprinter-ansi-terminal-1.1.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/prettyprinter-ansi-terminal-1.1.2.tar.gz"],"sha256":"e26b7338b90830a126e210ec164426bd3da7d099a319d1287a40e3efce2a1799","cabal-sha256":"90b3b7650bc5b9f0e58da43621d23c817acfc0cf5ce71244b9bd11b8c9f95e3a"},"version":"1.1.2"}, + "primitive": {"dependencies":["base","deepseq","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/primitive-0.7.1.0/primitive-0.7.1.0.tar.gz"},"name":"primitive","pinned":{"url":["https://hackage.haskell.org/package/primitive-0.7.1.0/primitive-0.7.1.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/primitive-0.7.1.0.tar.gz"],"sha256":"6bebecfdf2a57787d9fd5231bfd612b65a92edd7b33a973b2a0f11312b89a3f0","cabal-sha256":"29de6bfd0cf8ba023ceb806203dfbec0e51e3524e75ffe41056f70b4229c6f0f"},"version":"0.7.1.0"}, + "process": {"dependencies":[],"location":{"type":"core"},"name":"process","version":"1.6.8.2"}, + "profunctors": {"dependencies":["base","base-orphans","bifunctors","comonad","contravariant","distributive","tagged","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/profunctors-5.5.2/profunctors-5.5.2.tar.gz"},"name":"profunctors","pinned":{"url":["https://hackage.haskell.org/package/profunctors-5.5.2/profunctors-5.5.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/profunctors-5.5.2.tar.gz"],"sha256":"5f1579aab8afae377c7c7c0d0ed95b0bc58003b6dad2d494045f7472a398af7c","cabal-sha256":"0d824ae4b7cdde33ec4c677ded9e373e057c3a8e2c6b0532c183f9413db6e32c"},"version":"5.5.2"}, + "proto-lens": {"dependencies":["base","bytestring","containers","deepseq","ghc-prim","lens-family","parsec","pretty","primitive","profunctors","tagged","text","transformers","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/proto-lens-0.7.0.0/proto-lens-0.7.0.0.tar.gz"},"name":"proto-lens","pinned":{"url":["https://hackage.haskell.org/package/proto-lens-0.7.0.0/proto-lens-0.7.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/proto-lens-0.7.0.0.tar.gz"],"sha256":"3aa3b6aa1a1fa51cc2b7a60dde79112a7d87d6846cc8d65f3c3ad6c4b81ce7b5","cabal-sha256":"2c44a62375f7712f9381f84b1d30cee2f94384f1c98801db2f4450359a8e5036"},"version":"0.7.0.0"}, + "proto-lens-jsonpb": {"dependencies":["aeson","attoparsec","base","base64-bytestring","bytestring","proto-lens-runtime","text","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/proto-lens-jsonpb-0.2.0.2/proto-lens-jsonpb-0.2.0.2.tar.gz"},"name":"proto-lens-jsonpb","pinned":{"url":["https://hackage.haskell.org/package/proto-lens-jsonpb-0.2.0.2/proto-lens-jsonpb-0.2.0.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/proto-lens-jsonpb-0.2.0.2.tar.gz"],"sha256":"a2b6085c73d1315ee34a62be9131321d44536c093c4b1f482a6f76bf024128e5","cabal-sha256":"a361759d615e54a58a2f92eecd991ec8ad563dfdf0169bef2ea02054cf581da1"},"version":"0.2.0.2"}, + "proto-lens-runtime": {"dependencies":["base","bytestring","containers","deepseq","filepath","lens-family","proto-lens","text","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/proto-lens-runtime-0.7.0.0/proto-lens-runtime-0.7.0.0.tar.gz"},"name":"proto-lens-runtime","pinned":{"url":["https://hackage.haskell.org/package/proto-lens-runtime-0.7.0.0/proto-lens-runtime-0.7.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/proto-lens-runtime-0.7.0.0.tar.gz"],"sha256":"4dc1aebe1755c0b831d3cb029c7bfea04f252d0b1cee8653dded37baeab3aa63","cabal-sha256":"d6cfab159a63f5c42a1a507638c674a714dfa5f69a06f559e8da840eaafde3ab"},"version":"0.7.0.0"}, + "quickcheck-io": {"dependencies":["HUnit","QuickCheck","base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/quickcheck-io-0.2.0/quickcheck-io-0.2.0.tar.gz"},"name":"quickcheck-io","pinned":{"url":["https://hackage.haskell.org/package/quickcheck-io-0.2.0/quickcheck-io-0.2.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/quickcheck-io-0.2.0.tar.gz"],"sha256":"fb779119d79fe08ff4d502fb6869a70c9a8d5fd8ae0959f605c3c937efd96422","cabal-sha256":"7bf0b68fb90873825eb2e5e958c1b76126dcf984debb998e81673e6d837e0b2d"},"version":"0.2.0"}, + "random": {"dependencies":["base","time"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/random-1.1/random-1.1.tar.gz"},"name":"random","pinned":{"url":["https://hackage.haskell.org/package/random-1.1/random-1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/random-1.1.tar.gz"],"sha256":"b718a41057e25a3a71df693ab0fe2263d492e759679b3c2fea6ea33b171d3a5a","cabal-sha256":"7b67624fd76ddf97c206de0801dc7e888097e9d572974be9b9ea6551d76965df"},"version":"1.1"}, + "raw-strings-qq": {"dependencies":["base","template-haskell"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/raw-strings-qq-1.1/raw-strings-qq-1.1.tar.gz"},"name":"raw-strings-qq","pinned":{"url":["https://hackage.haskell.org/package/raw-strings-qq-1.1/raw-strings-qq-1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/raw-strings-qq-1.1.tar.gz"],"sha256":"2e011ec26aeaa53ab43c30b7d9b5b0f661f24b4ebef8884c12c571353c0fbed3","cabal-sha256":"3ea0f14f036649e3576749aef0db4dd0b1102c5331f2e0e2551250e2030ce669"},"version":"1.1"}, + "recursion-schemes": {"dependencies":["base","base-orphans","comonad","free","template-haskell","th-abstraction","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/recursion-schemes-5.1.3/recursion-schemes-5.1.3.tar.gz"},"name":"recursion-schemes","pinned":{"url":["https://hackage.haskell.org/package/recursion-schemes-5.1.3/recursion-schemes-5.1.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/recursion-schemes-5.1.3.tar.gz"],"sha256":"b21736e54b1d5fb0149624e95f2d8d8fd3413bb0972eda6a70e5753d3c9f1528","cabal-sha256":"cbcf3c36e1733a83fb8cda305bde2de18a2fbab53692e3301263964def430107"},"version":"5.1.3"}, + "reducers": {"dependencies":["array","base","bytestring","containers","fingertree","hashable","semigroupoids","semigroups","text","transformers","unordered-containers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/reducers-3.12.3/reducers-3.12.3.tar.gz"},"name":"reducers","pinned":{"url":["https://hackage.haskell.org/package/reducers-3.12.3/reducers-3.12.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/reducers-3.12.3.tar.gz"],"sha256":"7186733767405984c1eda96b18908f458b379f116a1589cd66f4319fe8458e27","cabal-sha256":"3a8d397f9a1dad4bbf8a83cf1ffc5cd9d4479d8573cf0d6702b443019345a3cd"},"version":"3.12.3"}, + "reflection": {"dependencies":["base","template-haskell"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/reflection-2.1.6/reflection-2.1.6.tar.gz"},"name":"reflection","pinned":{"url":["https://hackage.haskell.org/package/reflection-2.1.6/reflection-2.1.6.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/reflection-2.1.6.tar.gz"],"sha256":"bf3e14917ebb329a53701a3cce0afe670f20037a0148dbfa5cbfa574ed6ba6cd","cabal-sha256":"044acb7caf41a9d8246878f849baed2dffbc4582d0a1e5c7c079d4287239e970"},"version":"2.1.6"}, + "resourcet": {"dependencies":["base","containers","exceptions","mtl","primitive","transformers","unliftio-core"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/resourcet-1.2.4.2/resourcet-1.2.4.2.tar.gz"},"name":"resourcet","pinned":{"url":["https://hackage.haskell.org/package/resourcet-1.2.4.2/resourcet-1.2.4.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/resourcet-1.2.4.2.tar.gz"],"sha256":"17f20842043ad199961a801b6efb1233b9098eb3537f8395844268f6a223eb87","cabal-sha256":"d57516781d1721f70aa0b9ec8ea9200ab02bf76349cb76d73ad57729302289cc"},"version":"1.2.4.2"}, + "safe-exceptions": {"dependencies":["base","deepseq","exceptions","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/safe-exceptions-0.1.7.0/safe-exceptions-0.1.7.0.tar.gz"},"name":"safe-exceptions","pinned":{"url":["https://hackage.haskell.org/package/safe-exceptions-0.1.7.0/safe-exceptions-0.1.7.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/safe-exceptions-0.1.7.0.tar.gz"],"sha256":"18cddc587b52b6faa0287fb6ad6c964d1562571ea2c8ff57a194dd54b5fba069","cabal-sha256":"416cad3470889813fbffd9dce83c7610268a4a52acadeb87a66e388e09a90275"},"version":"0.1.7.0"}, + "scientific": {"dependencies":["base","binary","bytestring","containers","deepseq","hashable","integer-gmp","integer-logarithms","primitive","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/scientific-0.3.6.2/scientific-0.3.6.2.tar.gz"},"name":"scientific","pinned":{"url":["https://hackage.haskell.org/package/scientific-0.3.6.2/scientific-0.3.6.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/scientific-0.3.6.2.tar.gz"],"sha256":"278d0afc87450254f8a76eab21b5583af63954efc9b74844a17a21a68013140f","cabal-sha256":"dd49abc76bd8e2b57e7a057dc2bb742a00527b4bf9350f9374be03b5934e55d8"},"version":"0.3.6.2"}, + "semigroupoids": {"dependencies":["Cabal","base","base-orphans","bifunctors","cabal-doctest","comonad","containers","contravariant","distributive","hashable","tagged","template-haskell","transformers","transformers-compat","unordered-containers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/semigroupoids-5.3.4/semigroupoids-5.3.4.tar.gz"},"name":"semigroupoids","pinned":{"url":["https://hackage.haskell.org/package/semigroupoids-5.3.4/semigroupoids-5.3.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/semigroupoids-5.3.4.tar.gz"],"sha256":"00d2e48973c3ab0a5d52616728ed63d0509454c8328148f698720014d7c58964","cabal-sha256":"120873dfa8084ec92745c766336e90d648c347ab99ce55329d5af36dbd3732ba"},"version":"5.3.4"}, + "semigroups": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/semigroups-0.19.1/semigroups-0.19.1.tar.gz"},"name":"semigroups","pinned":{"url":["https://hackage.haskell.org/package/semigroups-0.19.1/semigroups-0.19.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/semigroups-0.19.1.tar.gz"],"sha256":"79e761e64b862564a3470d5d356cb6b060b14452d675859aed3b2d1e14646648","cabal-sha256":"cd827aaba0c2b57727dedecdfcc7eec5f14719b73c7675037c73c74f642c1782"},"version":"0.19.1"}, + "semilattices": {"dependencies":["base","containers","hashable","unordered-containers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/semilattices-0.0.0.4/semilattices-0.0.0.4.tar.gz"},"name":"semilattices","pinned":{"url":["https://hackage.haskell.org/package/semilattices-0.0.0.4/semilattices-0.0.0.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/semilattices-0.0.0.4.tar.gz"],"sha256":"f2a2a40ea0ef2e0f0aebcb64c74897c5060a74234988535266d98dd79f406191","cabal-sha256":"333707e460923711d1edbdd02ebe1c3957d4e0808eab9886747b52ee3e443639"},"version":"0.0.0.4"}, + "setenv": {"dependencies":["base","unix"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/setenv-0.1.1.3/setenv-0.1.1.3.tar.gz"},"name":"setenv","pinned":{"url":["https://hackage.haskell.org/package/setenv-0.1.1.3/setenv-0.1.1.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/setenv-0.1.1.3.tar.gz"],"sha256":"e358df39afc03d5a39e2ec650652d845c85c80cc98fe331654deafb4767ecb32","cabal-sha256":"c5916ac0d2a828473cd171261328a290afe0abd799db1ac8c310682fe778c45b"},"version":"0.1.1.3"}, + "smallcheck": {"dependencies":["base","logict","mtl","pretty"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/smallcheck-1.2.0/smallcheck-1.2.0.tar.gz"},"name":"smallcheck","pinned":{"url":["https://hackage.haskell.org/package/smallcheck-1.2.0/smallcheck-1.2.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/smallcheck-1.2.0.tar.gz"],"sha256":"d6c79227c6138b287ee8113d2cb95b15a6487d3abb7531309629c57b5e80d9f8","cabal-sha256":"f4cee52bf8363364724d3451cc0a9187be34b1f57c5c478e13a5b464c0fe5f6c"},"version":"1.2.0"}, + "split": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/split-0.2.3.4/split-0.2.3.4.tar.gz"},"name":"split","pinned":{"url":["https://hackage.haskell.org/package/split-0.2.3.4/split-0.2.3.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/split-0.2.3.4.tar.gz"],"sha256":"271fe5104c9f40034aa9a1aad6269bcecc9454bc5a57c247e69e17de996c1f2a","cabal-sha256":"048c75891d63a03828f97667214aaaf0e67b7dcbfec297753e39939ffda6f51a"},"version":"0.2.3.4"}, + "splitmix": {"dependencies":["base","deepseq","random","time"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/splitmix-0.0.5/splitmix-0.0.5.tar.gz"},"name":"splitmix","pinned":{"url":["https://hackage.haskell.org/package/splitmix-0.0.5/splitmix-0.0.5.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/splitmix-0.0.5.tar.gz"],"sha256":"19f2987ba707c935656371776639588c3252cbb44b66cae16107b13e73b4cd52","cabal-sha256":"4a49661be63f5aea0e132e9ab51be918789bb4dceb4ab9b15b85ba9cbbef5999"},"version":"0.0.5"}, + "stm": {"dependencies":[],"location":{"type":"core"},"name":"stm","version":"2.5.0.0"}, + "stm-chans": {"dependencies":["Cabal","base","stm"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/stm-chans-3.0.0.4/stm-chans-3.0.0.4.tar.gz"},"name":"stm-chans","pinned":{"url":["https://hackage.haskell.org/package/stm-chans-3.0.0.4/stm-chans-3.0.0.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/stm-chans-3.0.0.4.tar.gz"],"sha256":"2344fc5bfa33d565bad7b009fc0e2c5a7a595060ba149c661f44419fc0d54738","cabal-sha256":"e2eef3cea5251628f7b2ad22c24a1e5d08b83c19be4bd886ab0d7fed58ef2a6d"},"version":"3.0.0.4"}, + "streaming": {"dependencies":["base","containers","ghc-prim","mmorph","mtl","transformers","transformers-base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/streaming-0.2.3.0/streaming-0.2.3.0.tar.gz"},"name":"streaming","pinned":{"url":["https://hackage.haskell.org/package/streaming-0.2.3.0/streaming-0.2.3.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/streaming-0.2.3.0.tar.gz"],"sha256":"b4008eee1fcee6a9f63d0d31eebefd6cf72731fab65d943831338c3961fafd62","cabal-sha256":"26638a19039b2f447fdbeb430de1f7084c68b6ccd21eff288f5e45cf83670e47"},"version":"0.2.3.0"}, + "strict": {"dependencies":["assoc","base","binary","bytestring","deepseq","ghc-prim","hashable","text","these","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/strict-0.4/strict-0.4.tar.gz"},"name":"strict","pinned":{"url":["https://hackage.haskell.org/package/strict-0.4/strict-0.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/strict-0.4.tar.gz"],"sha256":"279fee78690409ce0878beead4a620f0c0975dba215d6778f183699e3576453f","cabal-sha256":"1b50c7c9c636c3a1bbc7f8873b9be48f6ca0faca4df6eec6a014de6208fb1c0e"},"version":"0.4"}, + "syb": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/syb-0.7.1/syb-0.7.1.tar.gz"},"name":"syb","pinned":{"url":["https://hackage.haskell.org/package/syb-0.7.1/syb-0.7.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/syb-0.7.1.tar.gz"],"sha256":"e04a9c7ae48d9fe25e9b7a064f7122d39c710753544511e15df7a6e87fdfe700","cabal-sha256":"809b4587757c9358db125577fb7e4e11031b8a26075fabe346912bbe2cfffd65"},"version":"0.7.1"}, + "system-filepath": {"dependencies":["Cabal","base","bytestring","deepseq","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/system-filepath-0.4.14/system-filepath-0.4.14.tar.gz"},"name":"system-filepath","pinned":{"url":["https://hackage.haskell.org/package/system-filepath-0.4.14/system-filepath-0.4.14.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/system-filepath-0.4.14.tar.gz"],"sha256":"1656ce3c0d585650784ceb3f794748286e19fb635f557e7b29b0897f8956d993","cabal-sha256":"e8ce7d24d7008a825e5d03aa672950a0e8178ac54c3de7134f36c3a7e37694a2"},"version":"0.4.14"}, + "tagged": {"dependencies":["base","deepseq","template-haskell","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/tagged-0.8.6/tagged-0.8.6.tar.gz"},"name":"tagged","pinned":{"url":["https://hackage.haskell.org/package/tagged-0.8.6/tagged-0.8.6.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/tagged-0.8.6.tar.gz"],"sha256":"ad16def0884cf6f05ae1ae8e90192cf9d8d9673fa264b249499bd9e4fac791dd","cabal-sha256":"7cce0b9355d1daad797555dfa906f756ed0253a40bc826ca367adf21d7b369f3"},"version":"0.8.6"}, + "tasty": {"dependencies":["ansi-terminal","async","base","clock","containers","mtl","optparse-applicative","stm","tagged","unbounded-delays","unix","wcwidth"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/tasty-1.2.3/tasty-1.2.3.tar.gz"},"name":"tasty","pinned":{"url":["https://hackage.haskell.org/package/tasty-1.2.3/tasty-1.2.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/tasty-1.2.3.tar.gz"],"sha256":"8ca107abc12a476cfbc84f516f30a614c81be315903f910bc681137eb702f662","cabal-sha256":"bba67074e5326d57e8f53fc1dabcb6841daa4dc51b053506eb7f40a6f49a0497"},"version":"1.2.3"}, + "tasty-golden": {"dependencies":["async","base","bytestring","containers","deepseq","directory","filepath","mtl","optparse-applicative","process","tagged","tasty","temporary","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/tasty-golden-2.3.3.2/tasty-golden-2.3.3.2.tar.gz"},"name":"tasty-golden","pinned":{"url":["https://hackage.haskell.org/package/tasty-golden-2.3.3.2/tasty-golden-2.3.3.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/tasty-golden-2.3.3.2.tar.gz"],"sha256":"a936183e57da934c593d715ae0f122e36beaa935cea9fa19d21386730972b1a5","cabal-sha256":"2aa053398a20f9890702d910e6aade8971f9f1281817a72e74fc67eebe6cba4e"},"version":"2.3.3.2"}, + "tasty-hedgehog": {"dependencies":["base","hedgehog","tagged","tasty"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/tasty-hedgehog-1.0.0.2/tasty-hedgehog-1.0.0.2.tar.gz"},"name":"tasty-hedgehog","pinned":{"url":["https://hackage.haskell.org/package/tasty-hedgehog-1.0.0.2/tasty-hedgehog-1.0.0.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/tasty-hedgehog-1.0.0.2.tar.gz"],"sha256":"65538f7371f5ccf52c232a4723d931dd0278ea49bf478c2abe50c3bc4c1d5bef","cabal-sha256":"084d3cb5966cf01431cf0f8ab982a7925f8aaf5f98e8578581624812fe93478b"},"version":"1.0.0.2"}, + "tasty-hspec": {"dependencies":["QuickCheck","base","hspec","hspec-core","tasty","tasty-quickcheck","tasty-smallcheck"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/tasty-hspec-1.1.5.1/tasty-hspec-1.1.5.1.tar.gz"},"name":"tasty-hspec","pinned":{"url":["https://hackage.haskell.org/package/tasty-hspec-1.1.5.1/tasty-hspec-1.1.5.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/tasty-hspec-1.1.5.1.tar.gz"],"sha256":"fe889ec0f7b3991c46a07d9ff9cf09608a73a18f434a7480d2a09c79e56f3345","cabal-sha256":"7f2e21d2f2a235401d661b93f53e374ab0456a7d2fe542871235905c2e804775"},"version":"1.1.5.1"}, + "tasty-hunit": {"dependencies":["base","call-stack","tasty"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/tasty-hunit-0.10.0.2/tasty-hunit-0.10.0.2.tar.gz"},"name":"tasty-hunit","pinned":{"url":["https://hackage.haskell.org/package/tasty-hunit-0.10.0.2/tasty-hunit-0.10.0.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/tasty-hunit-0.10.0.2.tar.gz"],"sha256":"4823c85efe15f36e1d71867aaa6cdcdff3ef39f97492321e9bb8a30c742f6ef7","cabal-sha256":"8e8bd5807cec650f5aebc5ada07b57620c863e69145e65249651c1b48d97bd70"},"version":"0.10.0.2"}, + "tasty-quickcheck": {"dependencies":["QuickCheck","base","optparse-applicative","random","tagged","tasty"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/tasty-quickcheck-0.10.1.1/tasty-quickcheck-0.10.1.1.tar.gz"},"name":"tasty-quickcheck","pinned":{"url":["https://hackage.haskell.org/package/tasty-quickcheck-0.10.1.1/tasty-quickcheck-0.10.1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/tasty-quickcheck-0.10.1.1.tar.gz"],"sha256":"f8326014c975ad31cac9e3da55f4bc86d0b26139557987d58c1f9554a8f31f25","cabal-sha256":"b0a751bbe706447fd11cac21a7bbcf919631813aafaba3ce460a421348f6935c"},"version":"0.10.1.1"}, + "tasty-smallcheck": {"dependencies":["async","base","smallcheck","tagged","tasty"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/tasty-smallcheck-0.8.1/tasty-smallcheck-0.8.1.tar.gz"},"name":"tasty-smallcheck","pinned":{"url":["https://hackage.haskell.org/package/tasty-smallcheck-0.8.1/tasty-smallcheck-0.8.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/tasty-smallcheck-0.8.1.tar.gz"],"sha256":"314ba7acdb7793730e7677f553a72dd6a4a8f9a45ff3e931cd7d384affb3c6d8","cabal-sha256":"394b4d95ab25a9cea7a82e93a63245d1420a26ff03094f71ae5380a8d67eebb2"},"version":"0.8.1"}, + "template-haskell": {"dependencies":[],"location":{"type":"core"},"name":"template-haskell","version":"2.16.0.0"}, + "temporary": {"dependencies":["base","directory","exceptions","filepath","random","transformers","unix"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/temporary-1.3/temporary-1.3.tar.gz"},"name":"temporary","pinned":{"url":["https://hackage.haskell.org/package/temporary-1.3/temporary-1.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/temporary-1.3.tar.gz"],"sha256":"8c442993694b5ffca823ce864af95bd2841fb5264ee511c61cf48cc71d879890","cabal-sha256":"3a66c136f700dbf42f3c5000ca93e80b26dead51e54322c83272b236c1ec8ef1"},"version":"1.3"}, + "terminal-size": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/terminal-size-0.3.2.1/terminal-size-0.3.2.1.tar.gz"},"name":"terminal-size","pinned":{"url":["https://hackage.haskell.org/package/terminal-size-0.3.2.1/terminal-size-0.3.2.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/terminal-size-0.3.2.1.tar.gz"],"sha256":"b5c23e964756bc13914649a67d63233f59ad0a813abe7cadeb2fc9d586dc9658","cabal-sha256":"7b2d8e0475a46961d07ddfb91dee618de70eff55d9ba0402ebeac1f9dcf9b18b"},"version":"0.3.2.1"}, + "terminfo": {"dependencies":[],"location":{"type":"core"},"name":"terminfo","version":"0.4.1.4"}, + "text": {"dependencies":[],"location":{"type":"core"},"name":"text","version":"1.2.3.2"}, + "tf-random": {"dependencies":["base","primitive","random","time"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/tf-random-0.5/tf-random-0.5.tar.gz"},"name":"tf-random","pinned":{"url":["https://hackage.haskell.org/package/tf-random-0.5/tf-random-0.5.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/tf-random-0.5.tar.gz"],"sha256":"2e30cec027b313c9e1794d326635d8fc5f79b6bf6e7580ab4b00186dadc88510","cabal-sha256":"14012837d0f0e18fdbbe3d56e67da8622ee5e20b180abce952dd50bd9f36b326"},"version":"0.5"}, + "th-abstraction": {"dependencies":["base","containers","ghc-prim","template-haskell"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/th-abstraction-0.3.2.0/th-abstraction-0.3.2.0.tar.gz"},"name":"th-abstraction","pinned":{"url":["https://hackage.haskell.org/package/th-abstraction-0.3.2.0/th-abstraction-0.3.2.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/th-abstraction-0.3.2.0.tar.gz"],"sha256":"36fef33ad0f34b9b8fb5552fe6187579a00d5f90d938e9bc24d382a9919feb79","cabal-sha256":"9b5b4e6e2bbff9b075ad7751ee98e2107090bd17b51d5442695b8990e4db6521"},"version":"0.3.2.0"}, + "these": {"dependencies":["assoc","base","binary","deepseq","hashable"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/these-1.1.1.1/these-1.1.1.1.tar.gz"},"name":"these","pinned":{"url":["https://hackage.haskell.org/package/these-1.1.1.1/these-1.1.1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/these-1.1.1.1.tar.gz"],"sha256":"d798c9f56e17def441e8f51e54cc11afdb3e76c6a9d1e9ee154e9a78da0bf508","cabal-sha256":"bdc0a3015b2e5cdf016e402937d71856ae5fe4e9e9a0d4823cc94a214c55a39b"},"version":"1.1.1.1"}, + "time": {"dependencies":[],"location":{"type":"core"},"name":"time","version":"1.9.3"}, + "time-compat": {"dependencies":["base","base-orphans","deepseq","time"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/time-compat-1.9.3/time-compat-1.9.3.tar.gz"},"name":"time-compat","pinned":{"url":["https://hackage.haskell.org/package/time-compat-1.9.3/time-compat-1.9.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/time-compat-1.9.3.tar.gz"],"sha256":"bb6a44e667945ddca8ded93e041ee91986a4a19f59e149a5dd21fdb1bfa3db88","cabal-sha256":"a1a0a8b088be6a7be50c7c0bf156ce876151b1cbe14261736965e361c8073b2a"},"version":"1.9.3"}, + "transformers": {"dependencies":[],"location":{"type":"core"},"name":"transformers","version":"0.5.6.2"}, + "transformers-base": {"dependencies":["base","base-orphans","stm","transformers","transformers-compat"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/transformers-base-0.4.5.2/transformers-base-0.4.5.2.tar.gz"},"name":"transformers-base","pinned":{"url":["https://hackage.haskell.org/package/transformers-base-0.4.5.2/transformers-base-0.4.5.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/transformers-base-0.4.5.2.tar.gz"],"sha256":"d0c80c63fdce6a077dd8eda4f1ff289b85578703a3f1272e141d400fe23245e8","cabal-sha256":"402740dd5ef6574a05c7e4a3c874262e5a24b713c2b8b5125d59847ebd1041a2"},"version":"0.4.5.2"}, + "transformers-compat": {"dependencies":["base","ghc-prim","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/transformers-compat-0.6.5/transformers-compat-0.6.5.tar.gz"},"name":"transformers-compat","pinned":{"url":["https://hackage.haskell.org/package/transformers-compat-0.6.5/transformers-compat-0.6.5.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/transformers-compat-0.6.5.tar.gz"],"sha256":"da67cf11515da751b32a8ce6e96549f7268f7c435769ad19dc9766b69774620b","cabal-sha256":"50b00c57bf3fc379ec2477bfc261a2aebc983084488478adb29854f193af4696"},"version":"0.6.5"}, + "tree-sitter": {"dependencies":["base","bytestring","containers","directory","filepath","split","template-haskell","unordered-containers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/tree-sitter-0.9.0.2/tree-sitter-0.9.0.2.tar.gz"},"name":"tree-sitter","pinned":{"url":["https://hackage.haskell.org/package/tree-sitter-0.9.0.2/tree-sitter-0.9.0.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/tree-sitter-0.9.0.2.tar.gz"],"sha256":"ae9edfd5415e8f243b14010491d149add962cf47d0fab7a36844faf34f0587cb","cabal-sha256":"a8e9821575a1bf90455cc164619f5a59f6cc01d66a870944ece84a755b6450d9"},"version":"0.9.0.2"}, + "tree-sitter-go": {"dependencies":["base","tree-sitter"],"location":{"type":"vendored"},"name":"tree-sitter-go","version":"0.5.0.2"}, + "tree-sitter-java": {"dependencies":["base","tree-sitter"],"location":{"type":"vendored"},"name":"tree-sitter-java","version":"0.7.0.2"}, + "tree-sitter-json": {"dependencies":["base","tree-sitter"],"location":{"type":"vendored"},"name":"tree-sitter-json","version":"0.7.0.2"}, + "tree-sitter-php": {"dependencies":["base","tree-sitter"],"location":{"type":"vendored"},"name":"tree-sitter-php","version":"0.5.0.1"}, + "tree-sitter-python": {"dependencies":["base","tree-sitter"],"location":{"type":"vendored"},"name":"tree-sitter-python","version":"0.9.0.3"}, + "tree-sitter-ql": {"dependencies":["base","tree-sitter"],"location":{"type":"vendored"},"name":"tree-sitter-ql","version":"0.1.0.4"}, + "tree-sitter-ruby": {"dependencies":["base","tree-sitter"],"location":{"type":"vendored"},"name":"tree-sitter-ruby","version":"0.5.0.3"}, + "tree-sitter-rust": {"dependencies":["base","tree-sitter"],"location":{"type":"vendored"},"name":"tree-sitter-rust","version":"0.1.0.1"}, + "tree-sitter-tsx": {"dependencies":["base","tree-sitter"],"location":{"type":"vendored"},"name":"tree-sitter-tsx","version":"0.5.0.2"}, + "tree-sitter-typescript": {"dependencies":["base","tree-sitter"],"location":{"type":"vendored"},"name":"tree-sitter-typescript","version":"0.5.0.2"}, + "trifecta": {"dependencies":["Cabal","ansi-terminal","array","base","blaze-builder","blaze-html","blaze-markup","bytestring","cabal-doctest","charset","comonad","containers","deepseq","fingertree","ghc-prim","hashable","lens","mtl","parsers","prettyprinter","prettyprinter-ansi-terminal","profunctors","reducers","semigroups","transformers","unordered-containers","utf8-string"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/trifecta-2.1/trifecta-2.1.tar.gz"},"name":"trifecta","pinned":{"url":["https://hackage.haskell.org/package/trifecta-2.1/trifecta-2.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/trifecta-2.1.tar.gz"],"sha256":"7a25c6b07b6ca4c6465b9f888444183cd1eab54d2890272010150df7a911233b","cabal-sha256":"5a936da33052a9e7c1b3e6c974ba0357943fd5fa5b7e5d595fd7abda0f743f3b"},"version":"2.1"}, + "type-equality": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/type-equality-1/type-equality-1.tar.gz"},"name":"type-equality","pinned":{"url":["https://hackage.haskell.org/package/type-equality-1/type-equality-1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/type-equality-1.tar.gz"],"sha256":"4728b502a211454ef682a10d7a3e817c22d06ba509df114bb267ef9d43a08ce8","cabal-sha256":"f2a895a7b22384d9b43a9c6608725b2de7581e77e5b20ab9cfe3f959f6cd71a8"},"version":"1"}, + "unbounded-delays": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/unbounded-delays-0.1.1.0/unbounded-delays-0.1.1.0.tar.gz"},"name":"unbounded-delays","pinned":{"url":["https://hackage.haskell.org/package/unbounded-delays-0.1.1.0/unbounded-delays-0.1.1.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/unbounded-delays-0.1.1.0.tar.gz"],"sha256":"8aa7f7d10a8d0073518804db76c3ef4c313359994ef175122341b0bce07329c7","cabal-sha256":"890b9426e946b5d18e78446eebcc99cb7abce5fcf2d251323ea88b6999ad80a9"},"version":"0.1.1.0"}, + "unix": {"dependencies":[],"location":{"type":"core"},"name":"unix","version":"2.7.2.2"}, + "unliftio-core": {"dependencies":["base","transformers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/unliftio-core-0.2.0.1/unliftio-core-0.2.0.1.tar.gz"},"name":"unliftio-core","pinned":{"url":["https://hackage.haskell.org/package/unliftio-core-0.2.0.1/unliftio-core-0.2.0.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/unliftio-core-0.2.0.1.tar.gz"],"sha256":"919f0d1297ea2f5373118553c1df2a9405d8b9e31a8307e829da67d4953c299a","cabal-sha256":"f9abcdd3f3d28e4840563efb7b8760d2de9b5707bcd6f53a87f6a0d77bb5a9f7"},"version":"0.2.0.1"}, + "unordered-containers": {"dependencies":["base","deepseq","hashable"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/unordered-containers-0.2.12.0/unordered-containers-0.2.12.0.tar.gz"},"name":"unordered-containers","pinned":{"url":["https://hackage.haskell.org/package/unordered-containers-0.2.12.0/unordered-containers-0.2.12.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/unordered-containers-0.2.12.0.tar.gz"],"sha256":"481dab4ea59f10feaa7d65ecb8ae5d136d130bdbacf2356d414b3926d638bd20","cabal-sha256":"164a47850c4536c8b7cc12f74578588cf3b6c331f04e671306d2dcb806284bb1"},"version":"0.2.12.0"}, + "utf8-string": {"dependencies":["base","bytestring"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/utf8-string-1.0.1.1/utf8-string-1.0.1.1.tar.gz"},"name":"utf8-string","pinned":{"url":["https://hackage.haskell.org/package/utf8-string-1.0.1.1/utf8-string-1.0.1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/utf8-string-1.0.1.1.tar.gz"],"sha256":"fb0b9e3acbe0605bcd1c63e51f290a7bbbe6628dfa3294ff453e4235fbaef140","cabal-sha256":"68cc6cf665e7212334a51b63d6936daeaca023b2cfe8637d130acfe95f91700b"},"version":"1.0.1.1"}, + "utility-ht": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/utility-ht-0.0.15/utility-ht-0.0.15.tar.gz"},"name":"utility-ht","pinned":{"url":["https://hackage.haskell.org/package/utility-ht-0.0.15/utility-ht-0.0.15.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/utility-ht-0.0.15.tar.gz"],"sha256":"845c79cdf0925997ec190a761460b50a9577cd290567b9252e31d075cd6f0f91","cabal-sha256":"940b35a19ce392c4fd86d96fecd0efb3c3b8a598af31fe5aca7e9f3b172e284b"},"version":"0.0.15"}, + "uuid-types": {"dependencies":["base","binary","bytestring","deepseq","hashable","random","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/uuid-types-1.0.3/uuid-types-1.0.3.tar.gz"},"name":"uuid-types","pinned":{"url":["https://hackage.haskell.org/package/uuid-types-1.0.3/uuid-types-1.0.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/uuid-types-1.0.3.tar.gz"],"sha256":"9276517ab24a9b06f39d6e3c33c6c2b4ace1fc2126dbc1cd9806866a6551b3fd","cabal-sha256":"963505cf2eeadb4f1c14336cda8ee8a0e658386450caa6eef34100e44b73fc46"},"version":"1.0.3"}, + "vector": {"dependencies":["base","deepseq","ghc-prim","primitive"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/vector-0.12.1.2/vector-0.12.1.2.tar.gz"},"name":"vector","pinned":{"url":["https://hackage.haskell.org/package/vector-0.12.1.2/vector-0.12.1.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/vector-0.12.1.2.tar.gz"],"sha256":"3b6e27683f6f20b37b8a35d0fab9e34b57dad72ac64cb16f428726780d4011bd","cabal-sha256":"9291bc581f36e51d5bda9fce57cb980fbec3dd292996896f285fef39eb80a9a0"},"version":"0.12.1.2"}, + "vector-algorithms": {"dependencies":["base","bytestring","primitive","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/vector-algorithms-0.8.0.3/vector-algorithms-0.8.0.3.tar.gz"},"name":"vector-algorithms","pinned":{"url":["https://hackage.haskell.org/package/vector-algorithms-0.8.0.3/vector-algorithms-0.8.0.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/vector-algorithms-0.8.0.3.tar.gz"],"sha256":"1ac41f014663fd318b34a76b80e6d8f32f1629ef4996ae7304f31597a0d07387","cabal-sha256":"477ef5ac82fdd28a39536ed0a767faec3425802827abee485be31db5bc6f5e90"},"version":"0.8.0.3"}, + "vector-builder": {"dependencies":["base","base-prelude","semigroups","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/vector-builder-0.3.8/vector-builder-0.3.8.tar.gz"},"name":"vector-builder","pinned":{"url":["https://hackage.haskell.org/package/vector-builder-0.3.8/vector-builder-0.3.8.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/vector-builder-0.3.8.tar.gz"],"sha256":"a39afd7ac50c42de77660d235017be38ef50f792b6a98212accf687445a18073","cabal-sha256":"184ed15a76025943ccaf556887cf60bca21359e3ccf4d7735def394ab76b76f1"},"version":"0.3.8"}, + "void": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/void-0.7.3/void-0.7.3.tar.gz"},"name":"void","pinned":{"url":["https://hackage.haskell.org/package/void-0.7.3/void-0.7.3.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/void-0.7.3.tar.gz"],"sha256":"53af758ddc37dc63981671e503438d02c6f64a2d8744e9bec557a894431f7317","cabal-sha256":"13d30f62fcdf065e595d679d4ac8b4b0c1bb1a1b73db7b5b5a8f857cb5c8a546"},"version":"0.7.3"}, + "wcwidth": {"dependencies":["base","containers"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/wcwidth-0.0.2/wcwidth-0.0.2.tar.gz"},"name":"wcwidth","pinned":{"url":["https://hackage.haskell.org/package/wcwidth-0.0.2/wcwidth-0.0.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/wcwidth-0.0.2.tar.gz"],"sha256":"ffc68736a3bbde3e8157710f29f4a99c0ca593c41194579c54a92c62f6c12ed8","cabal-sha256":"77531eb6683c505c22ab3fa11bbc43d3ce1e7dac21401d4d5a19677d348bb5f3"},"version":"0.0.2"}, + "wl-pprint-annotated": {"dependencies":["base","containers","deepseq","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/wl-pprint-annotated-0.1.0.1/wl-pprint-annotated-0.1.0.1.tar.gz"},"name":"wl-pprint-annotated","pinned":{"url":["https://hackage.haskell.org/package/wl-pprint-annotated-0.1.0.1/wl-pprint-annotated-0.1.0.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/wl-pprint-annotated-0.1.0.1.tar.gz"],"sha256":"6b662b244b2e318a2923dc7057d707369a29ea4a0e721b4710eac7239cc727af","cabal-sha256":"0b8fd3649bfe72d155a4379e4c88b7ef00408f6f4973f63333787fd2e1b5ba1e"},"version":"0.1.0.1"}, + "yaml": {"dependencies":["aeson","attoparsec","base","bytestring","conduit","containers","directory","filepath","libyaml","mtl","resourcet","scientific","template-haskell","text","transformers","unordered-containers","vector"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/yaml-0.11.4.0/yaml-0.11.4.0.tar.gz"},"name":"yaml","pinned":{"url":["https://hackage.haskell.org/package/yaml-0.11.4.0/yaml-0.11.4.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/yaml-0.11.4.0.tar.gz"],"sha256":"da4ec8469bb5cc43d131ffee90e89a430a65baad4caa611e91cd9b684168c96c","cabal-sha256":"2583bfc6ea297290fa1bae47242627898896e2647aaaf7662d6d7df9a2dac0b2"},"version":"0.11.4.0"} + } +} \ No newline at end of file diff --git a/test/Analysis/Go/Spec.hs b/test/Analysis/Go/Spec.hs deleted file mode 100644 index 9bdb9f7a09..0000000000 --- a/test/Analysis/Go/Spec.hs +++ /dev/null @@ -1,36 +0,0 @@ -module Analysis.Go.Spec (spec) where - -import Data.Abstract.Evaluatable (EvalError(..)) -import qualified Data.Abstract.ModuleTable as ModuleTable -import qualified Data.Language as Language -import qualified Language.Go.Assignment as Go -import SpecHelpers - - -spec :: TaskSession -> Spec -spec session = parallel $ do - describe "Go" $ do - it "imports and wildcard imports" $ do - (scopeGraph, (heap, res)) <- evaluate ["main.go", "foo/foo.go", "bar/bar.go", "bar/rab.go"] - case ModuleTable.lookup "main.go" <$> res of - Right (Just (Module _ (scopeAndFrame, _))) -> do - () <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - SpecHelpers.lookupMembers "foo" Import scopeAndFrame heap scopeGraph `shouldBe` Just ["New"] - () <$ SpecHelpers.lookupDeclaration "main" scopeAndFrame heap scopeGraph `shouldBe` Just () - () <$ SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldBe` Just () - () <$ SpecHelpers.lookupDeclaration "Rab" scopeAndFrame heap scopeGraph `shouldBe` Just () - other -> expectationFailure (show other) - - it "imports with aliases (and side effects only)" $ do - (scopeGraph, (heap, res)) <- evaluate ["main1.go", "foo/foo.go", "bar/bar.go", "bar/rab.go"] - case ModuleTable.lookup "main1.go" <$> res of - Right (Just (Module _ (scopeAndFrame, _))) -> do - const () <$> SpecHelpers.lookupDeclaration "f" scopeAndFrame heap scopeGraph `shouldBe` Just () - const () <$> SpecHelpers.lookupDeclaration "main" scopeAndFrame heap scopeGraph `shouldBe` Just () - -- (lookupDeclaration "f" heap >>= deNamespace heap) `shouldBe` Just ("f", ["New"]) - other -> expectationFailure (show other) - - where - fixtures = "test/fixtures/go/analysis/" - evaluate = evalGoProject . map (fixtures <>) - evalGoProject = testEvaluating <=< evaluateProject' session (Proxy :: Proxy 'Language.Go) goParser diff --git a/test/Analysis/PHP/Spec.hs b/test/Analysis/PHP/Spec.hs deleted file mode 100644 index 2069e50ddb..0000000000 --- a/test/Analysis/PHP/Spec.hs +++ /dev/null @@ -1,49 +0,0 @@ -module Analysis.PHP.Spec (spec) where - -import Control.Abstract -import Data.Abstract.Evaluatable (EvalError (..)) -import qualified Data.Abstract.ModuleTable as ModuleTable -import qualified Data.Abstract.Value.Concrete as Value -import qualified Data.Language as Language -import qualified Language.PHP.Assignment as PHP -import SpecHelpers - - -spec :: TaskSession -> Spec -spec session = parallel $ do - describe "PHP" $ do - xit "evaluates include and require" $ do - (scopeGraph, (heap, res)) <- evaluate ["main.php", "foo.php", "bar.php"] - case ModuleTable.lookup "main.php" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - value `shouldBe` Value.Unit - const () <$> SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldBe` Just () - const () <$> SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - other -> expectationFailure (show other) - - xit "evaluates include_once and require_once" $ do - (scopeGraph, (heap, res)) <- evaluate ["main_once.php", "foo.php", "bar.php"] - case ModuleTable.lookup "main_once.php" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - value `shouldBe` Value.Unit - const () <$> SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldBe` Just () - const () <$> SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - other -> expectationFailure (show other) - - xit "evaluates namespaces" $ do - (scopeGraph, (heap, res)) <- evaluate ["namespaces.php"] - case ModuleTable.lookup "namespaces.php" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - const () <$> SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - const () <$> SpecHelpers.lookupDeclaration "NS1" scopeAndFrame heap scopeGraph `shouldBe` Just () - - undefined - -- (derefQName heap ("NS1" :| []) env >>= deNamespace heap) `shouldBe` Just ("NS1", ["Sub1", "b", "c"]) - -- (derefQName heap ("NS1" :| ["Sub1"]) env >>= deNamespace heap) `shouldBe` Just ("Sub1", ["Sub2"]) - -- (derefQName heap ("NS1" :| ["Sub1", "Sub2"]) env >>= deNamespace heap) `shouldBe` Just ("Sub2", ["f"]) - other -> expectationFailure (show other) - - where - fixtures = "test/fixtures/php/analysis/" - evaluate = evalPHPProject . map (fixtures <>) - evalPHPProject = testEvaluating <=< evaluateProject' session (Proxy :: Proxy 'Language.PHP) phpParser diff --git a/test/Analysis/Python/Spec.hs b/test/Analysis/Python/Spec.hs deleted file mode 100644 index a87e9e8bfc..0000000000 --- a/test/Analysis/Python/Spec.hs +++ /dev/null @@ -1,75 +0,0 @@ -module Analysis.Python.Spec (spec) where - -import Data.Abstract.Evaluatable (EvalError(..)) -import qualified Data.Abstract.ModuleTable as ModuleTable -import Data.Abstract.Value.Concrete -import qualified Language.Python.Assignment as Python -import qualified Data.Language as Language - -import SpecHelpers - - -spec :: TaskSession -> Spec -spec session = parallel $ do - describe "Python" $ do - it "imports" $ do - (scopeGraph, (heap, res)) <- evaluate ["main.py", "a.py", "b/__init__.py", "b/c.py"] - case ModuleTable.lookup "main.py" <$> res of - Right (Just (Module _ (scopeAndFrame, _))) -> do - const () <$> SpecHelpers.lookupDeclaration "a" scopeAndFrame heap scopeGraph `shouldBe` Just () - const () <$> SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldBe` Just () - - fromJust (SpecHelpers.lookupMembers "a" Import scopeAndFrame heap scopeGraph) `shouldContain` [ "foo" ] - fromJust (SpecHelpers.lookupMembers "b" Import scopeAndFrame heap scopeGraph) `shouldContain` ["c"] - -- (derefQName heap ("b" :| ["c"]) env >>= deNamespace heap) `shouldBe` Just ("c", ["baz"]) - other -> expectationFailure (show other) - - it "imports with aliases" $ do - (scopeGraph, (heap, res)) <- evaluate ["main1.py", "a.py", "b/__init__.py", "b/c.py"] - case ModuleTable.lookup "main1.py" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - const () <$> SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldBe` Just () - const () <$> SpecHelpers.lookupDeclaration "e" scopeAndFrame heap scopeGraph `shouldBe` Just () - other -> expectationFailure (show other) - - it "imports using from syntax" $ do - (scopeGraph, (heap, res)) <- evaluate ["main2.py", "a.py", "b/__init__.py", "b/c.py"] - case ModuleTable.lookup "main2.py" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - const () <$> SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldBe` Just () - const () <$> SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - - -- TODO: Enable when we constrain edge paths with path predicates - -- () <$ SpecHelpers.lookupDeclaration "baz" heap scopeGraph `shouldBe` Nothing - other -> expectationFailure (show other) - - it "imports with relative syntax" $ do - (scopeGraph, (heap, res)) <- evaluate ["main3.py", "c/__init__.py", "c/utils.py"] - case ModuleTable.lookup "main3.py" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - const () <$> SpecHelpers.lookupDeclaration "utils" scopeAndFrame heap scopeGraph `shouldBe` Just () - -- (lookupDeclaration "utils" heap >>= deNamespace heap) `shouldBe` Just ("utils", ["to_s"]) - other -> expectationFailure (show other) - - it "subclasses" $ do - (scopeGraph, (heap, res)) <- evaluate ["subclass.py"] - case ModuleTable.lookup "subclass.py" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - () <$ SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - () <$ SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldBe` Just () - SpecHelpers.lookupMembers "Bar" Superclass scopeAndFrame heap scopeGraph `shouldBe` Just [ "dang" ] - value `shouldBe` String "\"bar\"" - other -> expectationFailure (show other) - - it "handles multiple inheritance left-to-right" $ do - (scopeGraph, (heap, res)) <- evaluate ["multiple_inheritance.py"] - case ModuleTable.lookup "multiple_inheritance.py" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - SpecHelpers.lookupMembers "Baz" Superclass scopeAndFrame heap scopeGraph `shouldBe` Just [ "dang" ] - value `shouldBe` String "\"bar!\"" - other -> expectationFailure (show other) - - where - fixtures = "test/fixtures/python/analysis/" - evaluate = evalPythonProject . map (fixtures <>) - evalPythonProject = testEvaluating <=< evaluateProject' session (Proxy :: Proxy 'Language.Python) pythonParser diff --git a/test/Analysis/Ruby/Spec.hs b/test/Analysis/Ruby/Spec.hs deleted file mode 100644 index 6641ebfa54..0000000000 --- a/test/Analysis/Ruby/Spec.hs +++ /dev/null @@ -1,104 +0,0 @@ -{-# LANGUAGE TupleSections #-} -module Analysis.Ruby.Spec (spec) where - -import Control.Abstract (Declaration (..), ScopeError (..), runDeref) -import Control.Effect.Resumable (SomeError (..)) -import Data.Abstract.Evaluatable -import qualified Data.Abstract.ModuleTable as ModuleTable -import Data.Abstract.Number as Number -import Data.Abstract.Value.Concrete as Value -import qualified Data.Language as Language -import Data.List.NonEmpty (NonEmpty (..)) -import Data.Sum - -import SpecHelpers - - -spec :: TaskSession -> Spec -spec session = parallel $ do - describe "Ruby" $ do - it "evaluates require_relative" $ do - (scopeGraph, (heap, res)) <- evaluate ["main.rb", "foo.rb"] - case ModuleTable.lookup "main.rb" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - value `shouldBe` Value.Integer (Number.Integer 1) - () <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - other -> expectationFailure (show other) - - it "evaluates load" $ do - (scopeGraph, (heap, res)) <- evaluate ["load.rb", "foo.rb"] - case ModuleTable.lookup "load.rb" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - value `shouldBe` Value.Integer (Number.Integer 1) - () <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - other -> expectationFailure (show other) - - it "evaluates load with wrapper" $ do - (_, (_, res)) <- evaluate ["load-wrap.rb", "foo.rb"] - res `shouldBe` Left (SomeError (inject @(BaseError (ScopeError Precise)) (BaseError (ModuleInfo "load-wrap.rb" Language.Ruby mempty) (Span (Pos 3 1) (Pos 3 7)) (LookupPathError (Declaration "foo"))))) - - it "evaluates subclass" $ do - (scopeGraph, (heap, res)) <- evaluate ["subclass.rb"] - case ModuleTable.lookup "subclass.rb" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - value `shouldBe` String "\"\"" - () <$ SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldBe` Just () - () <$ SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - SpecHelpers.lookupMembers "Bar" Superclass scopeAndFrame heap scopeGraph `shouldBe` Just ["baz", "foo", "inspect"] - other -> expectationFailure (show other) - - it "evaluates modules" $ do - (scopeGraph, (heap, res)) <- evaluate ["modules.rb"] - case ModuleTable.lookup "modules.rb" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - const () <$> SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldBe` Just () - other -> expectationFailure (show other) - - it "handles break correctly" $ do - (_, (_, res)) <- evaluate ["break.rb"] - case ModuleTable.lookup "break.rb" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Value.Integer (Number.Integer 3) - other -> expectationFailure (show other) - - it "handles next correctly" $ do - (_, (_, res)) <- evaluate ["next.rb"] - case ModuleTable.lookup "next.rb" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Value.Integer (Number.Integer 8) - other -> expectationFailure (show other) - - it "calls functions with arguments" $ do - (_, (_, res)) <- evaluate ["call.rb"] - case ModuleTable.lookup "call.rb" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Value.Integer (Number.Integer 579) - other -> expectationFailure (show other) - - it "evaluates early return statements" $ do - (_, (_, res)) <- evaluate ["early-return.rb"] - case ModuleTable.lookup "early-return.rb" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Value.Integer (Number.Integer 123) - other -> expectationFailure (show other) - - it "has prelude" $ do - (_, (_, res)) <- evaluate ["preluded.rb"] - case ModuleTable.lookup "preluded.rb" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` String "\"\"" - other -> expectationFailure (show other) - - it "evaluates __LINE__" $ do - (_, (_, res)) <- evaluate ["line.rb"] - case ModuleTable.lookup "line.rb" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Value.Integer (Number.Integer 4) - other -> expectationFailure (show other) - - it "resolves builtins used in the prelude" $ do - (scopeGraph, (heap, res)) <- evaluate ["puts.rb"] - case ModuleTable.lookup "puts.rb" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - value `shouldBe` Unit - const () <$> SpecHelpers.lookupDeclaration "puts" scopeAndFrame heap scopeGraph `shouldBe` Just () - other -> expectationFailure (show other) - - where - fixtures = "test/fixtures/ruby/analysis/" - evaluate = evalRubyProject . map (fixtures <>) - evalRubyProject = testEvaluating <=< evaluateProject' session (Proxy :: Proxy 'Language.Ruby) rubyParser diff --git a/test/Analysis/TypeScript/Spec.hs b/test/Analysis/TypeScript/Spec.hs deleted file mode 100644 index 0e0e4b3e1a..0000000000 --- a/test/Analysis/TypeScript/Spec.hs +++ /dev/null @@ -1,190 +0,0 @@ -module Analysis.TypeScript.Spec (spec) where - -import Data.Syntax.Statement (StatementBlock(..)) -import qualified Data.Abstract.ScopeGraph as ScopeGraph (AccessControl(..)) -import Control.Abstract.ScopeGraph hiding (AccessControl(..)) -import Control.Abstract.Value as Value hiding (String, Unit) -import Control.Arrow ((&&&)) -import Data.Abstract.Evaluatable -import qualified Data.Abstract.Heap as Heap -import Data.Abstract.Module (ModuleInfo (..)) -import qualified Data.Abstract.ModuleTable as ModuleTable -import Data.Abstract.Number as Number -import Data.Abstract.Package (PackageInfo (..)) -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.Abstract.Value.Concrete as Concrete -import qualified Data.Language as Language -import qualified Data.List.NonEmpty as NonEmpty -import Data.Location -import qualified Data.Map.Internal as Map -import Data.Quieterm -import Data.Scientific (scientific) -import Data.Sum -import Data.Text (pack) -import qualified Language.TypeScript.Assignment as TypeScript -import SpecHelpers - -spec :: TaskSession -> Spec -spec session = parallel $ do - describe "TypeScript" $ do - it "qualified export from" $ do - (scopeGraph, (heap, res)) <- evaluate ["main6.ts", "baz.ts", "foo.ts"] - case ModuleTable.lookup "main6.ts" <$> res of - Right (Just (Module _ (scopeAndFrame, _))) -> do - () <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - other -> expectationFailure (show other) - - it "imports with aliased symbols" $ do - (scopeGraph, (heap, res)) <- evaluate ["main.ts", "foo.ts", "foo/b.ts"] - case ModuleTable.lookup "main.ts" <$> res of - Right (Just (Module _ (scopeAndFrame, _))) -> do - const () <$> SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldBe` Just () - const () <$> SpecHelpers.lookupDeclaration "quz" scopeAndFrame heap scopeGraph `shouldBe` Just () - - other -> expectationFailure (show other) - - it "imports with qualified names" $ do - (scopeGraph, (heap, res)) <- evaluate ["main1.ts", "foo.ts", "a.ts"] - case ModuleTable.lookup "main1.ts" <$> res of - Right (Just (Module _ (scopeAndFrame, _))) -> do - () <$ SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldBe` Just () - () <$ SpecHelpers.lookupDeclaration "z" scopeAndFrame heap scopeGraph `shouldBe` Just () - - lookupMembers "b" Import scopeAndFrame heap scopeGraph `shouldBe` Just [ "baz", "foo" ] - lookupMembers "z" Import scopeAndFrame heap scopeGraph `shouldBe` Just [ "baz", "foo" ] - - () <$ SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldBe` Nothing - () <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Nothing - other -> expectationFailure (show other) - - it "stores function declaration in scope graph" $ do - (scopeGraph, (heap, res)) <- evaluate ["a.ts"] - case ModuleTable.lookup "a.ts" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - const () <$> SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldBe` Just () - value `shouldBe` Unit - other -> expectationFailure (show other) - - it "imports functions" $ do - (scopeGraph, (heap, res)) <- evaluate ["main4.ts", "foo.ts"] - case ModuleTable.lookup "main4.ts" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - const () <$> SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - value `shouldBe` String (pack "\"this is the foo function\"") - other -> expectationFailure (show other) - - it "side effect only imports dont expose exports" $ do - (scopeGraph, (heap, res)) <- evaluate ["main3.ts", "a.ts"] - case ModuleTable.lookup "main3.ts" <$> res of - Right (Just (Module _ (scopeAndFrame@(currentScope, currentFrame), value))) -> do - () <$ SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldBe` Nothing - value `shouldBe` Unit - Heap.heapSize heap `shouldBe` 4 - other -> expectationFailure (show other) - - it "fails exporting symbols not defined in the module" $ do - (_, (_, res)) <- evaluate ["bad-export.ts", "pip.ts", "a.ts", "foo.ts"] - res `shouldBe` Left (SomeError (inject @(BaseError (ScopeError Precise)) (BaseError (ModuleInfo "bad-export.ts" Language.TypeScript mempty) (Span (Pos 2 1) (Pos 2 28)) ImportReferenceError))) - - it "evaluates early return statements" $ do - (scopeGraph, (heap, res)) <- evaluate ["early-return.ts"] - case ModuleTable.lookup "early-return.ts" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> - const () <$> SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () - other -> expectationFailure (show other) - - it "evaluates sequence expressions" $ do - (scopeGraph, (heap, res)) <- evaluate ["sequence-expression.ts"] - case ModuleTable.lookup "sequence-expression.ts" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> - SpecHelpers.lookupDeclaration "x" scopeAndFrame heap scopeGraph `shouldBe` Just [ Concrete.Float (Number.Decimal (scientific 3 0)) ] - other -> expectationFailure (show other) - - it "evaluates void expressions" $ do - (_, (_, res)) <- evaluate ["void.ts"] - case ModuleTable.lookup "void.ts" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Null - other -> expectationFailure (show other) - - it "evaluates delete" $ do - (scopeGraph, (heap, res)) <- evaluate ["delete.ts"] - case ModuleTable.lookup "delete.ts" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - value `shouldBe` Unit - SpecHelpers.lookupDeclaration "x" scopeAndFrame heap scopeGraph `shouldBe` Nothing - other -> expectationFailure (show other) - - it "evaluates await" $ do - (scopeGraph, (heap, res)) <- evaluate ["await.ts"] - case ModuleTable.lookup "await.ts" <$> res of - Right (Just (Module _ (scopeAndFrame, value))) -> do - -- Test that f2 is in the scopegraph and heap. - const () <$> SpecHelpers.lookupDeclaration "f2" scopeAndFrame heap scopeGraph `shouldBe` Just () - -- Test we can't reference y from outside the function - SpecHelpers.lookupDeclaration "y" scopeAndFrame heap scopeGraph `shouldBe` Nothing - other -> expectationFailure (show other) - - it "evaluates BOr statements" $ do - (_, (_, res)) <- evaluate ["bor.ts"] - case ModuleTable.lookup "bor.ts" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Concrete.Integer (Number.Integer 3) - other -> expectationFailure (show other) - - it "evaluates BAnd statements" $ do - (_, (_, res)) <- evaluate ["band.ts"] - case ModuleTable.lookup "band.ts" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Concrete.Integer (Number.Integer 0) - other -> expectationFailure (show other) - - it "evaluates BXOr statements" $ do - (_, (_, res)) <- evaluate ["bxor.ts"] - case ModuleTable.lookup "bxor.ts" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Concrete.Integer (Number.Integer 3) - other -> expectationFailure (show other) - - it "evaluates LShift statements" $ do - (_, (_, res)) <- evaluate ["lshift.ts"] - case ModuleTable.lookup "lshift.ts" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Concrete.Integer (Number.Integer 4) - other -> expectationFailure (show other) - - it "evaluates RShift statements" $ do - (_, (_, res)) <- evaluate ["rshift.ts"] - case ModuleTable.lookup "rshift.ts" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Concrete.Integer (Number.Integer 0) - other -> expectationFailure (show other) - - it "evaluates Complement statements" $ do - (_, (_, res)) <- evaluate ["complement.ts"] - case ModuleTable.lookup "complement.ts" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` Concrete.Integer (Number.Integer (-2)) - other -> expectationFailure (show other) - - it "uniquely tracks public fields for instances" $ do - (scopeGraph, (heap, res)) <- evaluate ["class1.ts", "class2.ts"] - case ModuleTable.lookup "class1.ts" <$> res of - Right (Just (Module _ (_, value))) -> value `shouldBe` (Concrete.Float (Number.Decimal 9.0)) - other -> expectationFailure (show other) - - it "member access of private field definition throws AccessControlError" $ do - (_, (_, res)) <- evaluate ["access_control/adder.ts", "access_control/private_field_definition.ts"] - let expected = Left (SomeError (inject @TypeScriptEvalError (BaseError (ModuleInfo "private_field_definition.ts" Language.TypeScript mempty) (Span (Pos 4 1) (Pos 4 6)) (AccessControlError ("foo", ScopeGraph.Public) ("y", ScopeGraph.Private) (Concrete.Float (Decimal 2.0)))))) - res `shouldBe` expected - - it "member access of private static field definition throws AccessControlError" $ do - (_, (_, res)) <- evaluate ["access_control/adder.ts", "access_control/private_static_field_definition.ts"] - let expected = Left (SomeError (inject @TypeScriptEvalError (BaseError (ModuleInfo "private_static_field_definition.ts" Language.TypeScript mempty) (Span (Pos 3 1) (Pos 3 8)) (AccessControlError ("Adder", ScopeGraph.Public) ("z", ScopeGraph.Private) Unit)))) - res `shouldBe` expected - - it "member access of private methods throws AccessControlError" $ do - (_, (_, res)) <- evaluate ["access_control/adder.ts", "access_control/private_method.ts"] - let expected = Left (SomeError (inject @TypeScriptEvalError (BaseError (ModuleInfo "private_method.ts" Language.TypeScript mempty) (Span (Pos 4 1) (Pos 4 16)) (AccessControlError ("foo", ScopeGraph.Public) ("private_add", ScopeGraph.Private) (Closure (PackageInfo "access_control" mempty) (ModuleInfo "adder.ts" Language.TypeScript mempty) (Just "private_add") Nothing [] (Right (Quieterm (In (Location (Range 146 148) (Span (Pos 7 27) (Pos 7 29))) (inject (StatementBlock []))))) (Precise 20) (Precise 18)))))) - res `shouldBe` expected - - where - fixtures = "test/fixtures/typescript/analysis/" - evaluate = evalTypeScriptProject . map (fixtures <>) - evalTypeScriptProject = testEvaluating <=< (evaluateProject' session (Proxy :: Proxy 'Language.TypeScript) typescriptParser) - -type TypeScriptTerm = Quieterm (Sum TypeScript.Syntax) Location -type TypeScriptEvalError = BaseError (EvalError TypeScriptTerm Precise (Concrete.Value TypeScriptTerm Precise)) diff --git a/test/Assigning/Assignment/Spec.hs b/test/Assigning/Assignment/Spec.hs deleted file mode 100644 index e188393abf..0000000000 --- a/test/Assigning/Assignment/Spec.hs +++ /dev/null @@ -1,278 +0,0 @@ -{-# LANGUAGE DataKinds, OverloadedLists #-} -module Assigning.Assignment.Spec (spec) where - -import Assigning.Assignment -import Data.AST -import Data.Bifunctor (first) -import Data.Ix -import Data.Range -import Data.Semigroup ((<>)) -import Data.Source -import Data.Span -import Data.Term -import Data.Text as T (Text, length, words) -import Data.Text.Encoding (encodeUtf8) -import GHC.Stack (getCallStack) -import Prelude hiding (words) -import Test.Hspec -import TreeSitter.Language (Symbol (..), SymbolType (..)) - -spec :: Spec -spec = do - describe "Applicative" $ - it "matches in sequence" $ - fst <$> runAssignment "helloworld" ((,) <$> red <*> red) (makeState [node Red 0 5 [], node Red 5 10 []]) - `shouldBe` - Right (Out "hello", Out "world") - - describe "Alternative" $ do - it "attempts multiple alternatives" $ - fst <$> runAssignment "hello" (green <|> red) (makeState [node Red 0 5 []]) - `shouldBe` - Right (Out "hello") - - it "matches repetitions" $ - let s = "colourless green ideas sleep furiously" - w = words s - (_, nodes) = foldl (\ (i, prev) word -> (i + T.length word + 1, prev <> [node Red i (i + T.length word) []])) (0, []) w in - fst <$> runAssignment (fromUTF8 (encodeUtf8 s)) (many red) (makeState nodes) - `shouldBe` - Right (Out <$> w) - - it "matches one-or-more repetitions against one or more input nodes" $ - fst <$> runAssignment "hello" (some red) (makeState [node Red 0 5 []]) - `shouldBe` - Right [Out "hello"] - - it "distributes through overlapping committed choices, matching the left alternative" $ - fst <$> runAssignment "(red (green))" (symbol Red *> children green <|> symbol Red *> children blue) (makeState [node Red 0 13 [node Green 5 12 []]]) - `shouldBe` - Right (Out "(green)") - - it "distributes through overlapping committed choices, matching the right alternative" $ - fst <$> runAssignment "(red (blue))" (symbol Red *> children green <|> symbol Red *> children blue) (makeState [node Red 0 12 [node Blue 5 11 []]]) - `shouldBe` - Right (Out "(blue)") - - it "distributes through overlapping committed choices, matching the left alternatives" $ - fst <$> runAssignment "magenta green green" (symbol Magenta *> many green <|> symbol Magenta *> many blue) (makeState [node Magenta 0 7 [], node Green 8 13 [], node Green 14 19 []]) - `shouldBe` - Right [Out "green", Out "green"] - - it "distributes through overlapping committed choices, matching the empty list" $ - fst <$> runAssignment "magenta" (symbol Magenta *> (Left <$> many green) <|> symbol Magenta *> (Right <$> many blue)) (makeState [node Magenta 0 7 []]) - `shouldBe` - Right (Left []) - - it "distributes through overlapping committed choices, dropping anonymous nodes & matching the left alternative" $ - fst <$> runAssignment "magenta green" (symbol Magenta *> green <|> symbol Magenta *> blue) (makeState [node Magenta 0 7 [], node Green 8 13 []]) - `shouldBe` - Right (Out "green") - - it "distributes through overlapping committed choices, dropping anonymous nodes & matching the right alternative" $ - fst <$> runAssignment "magenta blue" (symbol Magenta *> green <|> symbol Magenta *> blue) (makeState [node Magenta 0 7 [], node Blue 8 12 []]) - `shouldBe` - Right (Out "blue") - - it "alternates repetitions, matching the left alternative" $ - fst <$> runAssignment "green green" (many green <|> many blue) (makeState [node Green 0 5 [], node Green 6 11 []]) - `shouldBe` - Right [Out "green", Out "green"] - - it "alternates repetitions, matching at the end of input" $ - fst <$> runAssignment "" (many green <|> many blue) (makeState []) - `shouldBe` - Right [] - - it "distributes through children rules" $ - fst <$> runAssignment "(red (blue))" (children green <|> children blue) (makeState [node Red 0 12 [node Blue 5 11 []]]) - `shouldBe` - Right (Out "(blue)") - - it "matches rules to the left of pure" $ - fst <$> runAssignment "green" ((green <|> pure (Out "other") <|> blue) <* many source) (makeState [node Green 0 5 []]) - `shouldBe` - Right (Out "green") - - it "matches pure instead of rules to its right" $ - fst <$> runAssignment "blue" ((green <|> pure (Out "other") <|> blue) <* many source) (makeState [node Blue 0 4 []]) - `shouldBe` - Right (Out "other") - - it "matches other nodes with pure" $ - fst <$> runAssignment "red" ((green <|> pure (Out "other") <|> blue) <* many source) (makeState [node Red 0 3 []]) - `shouldBe` - Right (Out "other") - - it "matches at end with pure" $ - fst <$> runAssignment "red" ((green <|> pure (Out "other") <|> blue) <* many source) (makeState []) - `shouldBe` - Right (Out "other") - - describe "symbol" $ do - it "matches nodes with the same symbol" $ - fst <$> runAssignment "hello" red (makeState [node Red 0 5 []]) `shouldBe` Right (Out "hello") - - it "does not advance past the current node" $ - runAssignment "hi" (symbol Red) (makeState [ node Red 0 2 [] ]) `shouldBe` Left (Error (Span (Pos 1 1) (Pos 1 3)) [] (Just (Right Red)) []) - - describe "without catchError" $ do - it "assignment returns unexpected symbol error" $ - runAssignment "A" - red - (makeState [node Green 0 1 []]) - `shouldBe` - Left (Error (Span (Pos 1 1) (Pos 1 2)) [Right Red] (Just (Right Green)) []) - - it "assignment returns unexpected end of input" $ - runAssignment "A" - (symbol Green *> children (some red)) - (makeState [node Green 0 1 []]) - `shouldBe` - Left (Error (Span (Pos 1 1) (Pos 1 1)) [Right Red] Nothing []) - - describe "eof" $ do - it "matches at the end of branches" $ - fst <$> runAssignment "" eof (makeState [] :: State [] Grammar) `shouldBe` Right () - - it "matches before anonymous nodes at the end of branches" $ - fst <$> runAssignment "magenta" eof (makeState [ node Magenta 0 7 [] ] :: State [] Grammar) `shouldBe` Right () - - describe "catchError" $ do - it "catches failed committed choices" $ - fst <$> runAssignment "A" - ((symbol Green *> children red) `catchError` \ _ -> OutError <$ location <*> source) - (makeState [node Green 0 1 []]) - `shouldBe` - Right (OutError "A") - - it "doesn’t catch uncommitted choices" $ - fst <$> runAssignment "A" - (red `catchError` \ _ -> OutError <$ location <*> source) - (makeState [node Green 0 1 []]) - `shouldBe` - Left (Error (Span (Pos 1 1) (Pos 1 2)) [Right Red] (Just (Right Green)) []) - - it "doesn’t catch unexpected end of branch" $ - fst <$> runAssignment "" - (red `catchError` \ _ -> OutError <$ location <*> source) - (makeState []) - `shouldBe` - Left (Error (Span (Pos 1 1) (Pos 1 1)) [Right Red] Nothing []) - - it "doesn’t catch exhaustiveness errors" $ - fst <$> runAssignment "AA" - (red `catchError` \ _ -> OutError <$ location <*> source) - (makeState [node Red 0 1 [], node Red 1 2 []]) - `shouldBe` - Left (Error (Span (Pos 1 2) (Pos 1 3)) [] (Just (Right Red)) []) - - it "can error inside the handler" $ - runAssignment "A" - (symbol Green *> children red `catchError` const blue) - (makeState [node Green 0 1 []]) - `shouldBe` - Left (Error (Span (Pos 1 1) (Pos 1 1)) [Right Red] Nothing []) - - describe "many" $ do - it "takes ones and only one zero width repetition" $ - fst <$> runAssignment "PGG" - (symbol Palette *> children ( many (green <|> pure (Out "always")) )) - (makeState [node Palette 0 1 [node Green 1 2 [], node Green 2 3 []]]) - `shouldBe` - Right [Out "G", Out "G", Out "always"] - - describe "source" $ do - it "produces the node’s source" $ - assign "hi" source (node Red 0 2 []) `shouldBe` Right ("hi") - - it "advances past the current node" $ - snd <$> runAssignment "hi" source (makeState [ node Red 0 2 [] ]) - `shouldBe` - Right (State 2 (Pos 1 3) [] [] []) - - describe "children" $ do - it "advances past the current node" $ - snd <$> runAssignment "a" (children (pure (Out ""))) (makeState [node Red 0 1 []]) - `shouldBe` - Right (State 1 (Pos 1 2) [] [] []) - - it "matches if its subrule matches" $ - () <$ runAssignment "a" (children red) (makeState [node Blue 0 1 [node Red 0 1 []]]) - `shouldBe` - Right () - - it "does not match if its subrule does not match" $ - runAssignment "a" (children red) (makeState [node Blue 0 1 [node Green 0 1 []]]) - `shouldBe` - Left (Error (Span (Pos 1 1) (Pos 1 2)) [Right Red] (Just (Right Green)) []) - - it "matches nested children" $ - fst <$> runAssignment "1" - (symbol Red *> children (symbol Green *> children (symbol Blue *> source))) - (makeState [ node Red 0 1 [ node Green 0 1 [ node Blue 0 1 [] ] ] ]) - `shouldBe` - Right "1" - - it "continues after children" $ - fst <$> runAssignment "BC" - (many (symbol Red *> children (symbol Green *> source) - <|> symbol Blue *> source)) - (makeState [ node Red 0 1 [ node Green 0 1 [] ] - , node Blue 1 2 [] ]) - `shouldBe` - Right ["B", "C"] - - it "matches multiple nested children" $ - fst <$> runAssignment "12" - (symbol Red *> children (many (symbol Green *> children (symbol Blue *> source)))) - (makeState [ node Red 0 2 [ node Green 0 1 [ node Blue 0 1 [] ] - , node Green 1 2 [ node Blue 1 2 [] ] ] ]) - `shouldBe` - Right ["1", "2"] - - describe "runAssignment" $ do - it "drops anonymous nodes before matching symbols" $ - fst <$> runAssignment "magenta red" red (makeState [node Magenta 0 7 [], node Red 8 11 []]) - `shouldBe` - Right (Out "red") - - it "drops anonymous nodes after matching to ensure exhaustiveness" $ - stateNodes . snd <$> runAssignment "red magenta" red (makeState [node Red 0 3 [], node Magenta 4 11 []]) - `shouldBe` - Right [] - - it "does not drop anonymous nodes when requested" $ - fst <$> runAssignment "magenta red" ((,) <$> magenta <*> red) (makeState [node Magenta 0 7 [], node Red 8 11 []]) - `shouldBe` - Right (Out "magenta", Out "red") - - it "produces errors with callstacks pointing at the failing assignment" $ - first (fmap fst . getCallStack . errorCallStack) (runAssignment "blue" red (makeState [node Blue 0 4 []])) - `shouldBe` - Left [ "symbol" ] - -node :: symbol -> Int -> Int -> [AST [] symbol] -> AST [] symbol -node symbol start end children = Term (Node symbol (Location (Range start end) (Span (Pos 1 (succ start)) (Pos 1 (succ end)))) `In` children) - -data Grammar = Palette | Red | Green | Blue | Magenta - deriving (Bounded, Enum, Eq, Ix, Ord, Show) - -instance Symbol Grammar where - symbolType Magenta = Anonymous - symbolType _ = Regular - -data Out = Out T.Text | OutError T.Text - deriving (Eq, Show) - -red :: HasCallStack => Assignment [] Grammar Out -red = Out <$ symbol Red <*> source - -green :: HasCallStack => Assignment [] Grammar Out -green = Out <$ symbol Green <*> source - -blue :: HasCallStack => Assignment [] Grammar Out -blue = Out <$ symbol Blue <*> source - -magenta :: HasCallStack => Assignment [] Grammar Out -magenta = Out <$ symbol Magenta <*> source diff --git a/test/Control/Abstract/Evaluator/Spec.hs b/test/Control/Abstract/Evaluator/Spec.hs deleted file mode 100644 index 62735b0a9b..0000000000 --- a/test/Control/Abstract/Evaluator/Spec.hs +++ /dev/null @@ -1,123 +0,0 @@ -{-# LANGUAGE TypeOperators #-} -module Control.Abstract.Evaluator.Spec -( spec -) where - -import Control.Abstract as Abstract -import qualified Control.Abstract.Heap as Heap -import Data.Abstract.Address.Precise as Precise -import Data.Abstract.BaseError -import Data.Abstract.Evaluatable -import Data.Abstract.FreeVariables -import Data.Abstract.Module -import qualified Data.Abstract.Number as Number -import Data.Abstract.Package -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import Data.Abstract.Value.Concrete as Value -import Data.Algebra -import Data.Bifunctor (first) -import Data.Functor.Const -import qualified Data.Language as Language -import qualified Data.Map.Strict as Map -import Data.Sum -import Data.Text (pack) -import SpecHelpers hiding (reassociate) -import System.IO.Unsafe (unsafePerformIO) - -spec :: Spec -spec = parallel $ do - it "constructs integers" $ do - (_, (_, (_, expected))) <- evaluate (integer 123) - expected `shouldBe` Right (Value.Integer (Number.Integer 123)) - - it "calls functions" $ do - (_, (_, (_, expected))) <- evaluate . withLexicalScopeAndFrame $ do - currentScope' <- currentScope - let lexicalEdges = Map.singleton Lexical [ currentScope' ] - x = SpecHelpers.name "x" - associatedScope <- newScope lexicalEdges - declare (ScopeGraph.Declaration "identity") Default Public emptySpan ScopeGraph.Function (Just associatedScope) - withScope associatedScope $ do - declare (Declaration x) Default Public emptySpan ScopeGraph.RequiredParameter Nothing - identity <- function "identity" [ x ] - (SpecEff (Heap.lookupSlot (ScopeGraph.Declaration (SpecHelpers.name "x")) >>= deref)) associatedScope - val <- integer 123 - call identity [val] - expected `shouldBe` Right (Value.Integer (Number.Integer 123)) - -evaluate - = runM - . runTraceByIgnoring - . runState (lowerBound @(ScopeGraph Precise)) - . runState (lowerBound @(Heap Precise Precise Val)) - . runFresh - . runReader (PackageInfo (SpecHelpers.name "test") mempty) - . runReader (ModuleInfo "test/Control/Abstract/Evaluator/Spec.hs" Language.Haskell mempty) - . evalState (lowerBound @Span) - . runReader (lowerBound @Span) - . runEvaluator - . runAllocator - . evalModule - where - evalModule action = do - scopeAddress <- newScope mempty - frameAddress <- newFrame scopeAddress mempty - val <- raiseHandler (runReader (CurrentScope scopeAddress)) - . raiseHandler (runReader (CurrentFrame frameAddress)) - . fmap reassociate - . runScopeError - . runHeapError - . runValueError - . runAddressError - . runEvalError - . runDeref @SpecEff - . runAllocator - . runReturn - . runLoopControl - . runNumeric - . runBoolean - . runFunction runSpecEff - $ action - pure ((scopeAddress, frameAddress), val) - -reassociate :: Either (SomeError exc1) (Either (SomeError exc2) (Either (SomeError exc3) (Either (SomeError exc4) (Either (SomeError exc5) result)))) -> Either (SomeError (Sum '[exc5, exc4, exc3, exc2, exc1])) result -reassociate = mergeErrors . mergeErrors . mergeErrors . mergeErrors . mergeErrors . Right - -type Val = Value SpecEff Precise -newtype SpecEff = SpecEff - { runSpecEff :: Evaluator SpecEff Precise Val (FunctionC SpecEff Precise Val - (BooleanC Val - (NumericC Val - (ErrorC (LoopControl Val) - (ErrorC (Return Val) - (AllocatorC Precise - (DerefC Precise Val - (ResumableC (BaseError (EvalError SpecEff Precise Val)) - (ResumableC (BaseError (AddressError Precise Val)) - (ResumableC (BaseError (ValueError SpecEff Precise)) - (ResumableC (BaseError (HeapError Precise)) - (ResumableC (BaseError (ScopeError Precise)) - (ReaderC (CurrentFrame Precise) - (ReaderC (CurrentScope Precise) - (AllocatorC Precise - (ReaderC Span - (StateC Span - (ReaderC ModuleInfo - (ReaderC PackageInfo - (FreshC - (StateC (Heap Precise Precise Val) - (StateC (ScopeGraph Precise) - (TraceByIgnoringC - (LiftC IO)))))))))))))))))))))))) - Val - } - -instance Eq SpecEff where _ == _ = True -instance Show SpecEff where show _ = "_" -instance FreeVariables SpecEff where freeVariables _ = lowerBound - -instance Declarations SpecEff where - declaredName eff = - case unsafePerformIO (evaluate (runSpecEff eff)) of - (_, (_, (_, Right (Value.String text)))) -> Just (SpecHelpers.name text) - _ -> error "declaredName for SpecEff should return an RVal" diff --git a/test/Data/Abstract/Name/Spec.hs b/test/Data/Abstract/Name/Spec.hs deleted file mode 100644 index ab65902fff..0000000000 --- a/test/Data/Abstract/Name/Spec.hs +++ /dev/null @@ -1,11 +0,0 @@ -module Data.Abstract.Name.Spec where - -import SpecHelpers - -import Data.Abstract.Name - -spec :: Spec -spec = describe "Data.Abstract.Name" $ - it "should format anonymous names correctly" $ do - show (nameI 0) `shouldBe` "\"_a\"" - show (nameI 26) `shouldBe` "\"_aΚΉ\"" diff --git a/test/Data/Abstract/Path/Spec.hs b/test/Data/Abstract/Path/Spec.hs deleted file mode 100644 index fd1b88044f..0000000000 --- a/test/Data/Abstract/Path/Spec.hs +++ /dev/null @@ -1,20 +0,0 @@ -module Data.Abstract.Path.Spec(spec) where - -import Data.Abstract.Path -import SpecHelpers - -spec :: Spec -spec = parallel $ - describe "joinPaths" $ do - it "joins empty paths" $ - joinPaths "" "" `shouldBe` "." - it "joins relative paths" $ - joinPaths "a/b" "./c" `shouldBe` "a/b/c" - it "joins absolute paths" $ - joinPaths "/a/b" "c" `shouldBe` "/a/b/c" - it "walks up directories for ../" $ - joinPaths "a/b" "../c" `shouldBe` "a/c" - it "walks up directories for multiple ../" $ - joinPaths "a/b" "../../c" `shouldBe` "c" - it "stops walking at top directory" $ - joinPaths "a/b" "../../../c" `shouldBe` "c" diff --git a/test/Data/Diff/Spec.hs b/test/Data/Diff/Spec.hs deleted file mode 100644 index 4a4d1feb16..0000000000 --- a/test/Data/Diff/Spec.hs +++ /dev/null @@ -1,12 +0,0 @@ -{-# LANGUAGE DataKinds #-} -module Data.Diff.Spec (spec) where - -import Data.Diff -import Data.Functor.Listable (ListableSyntax) -import Test.Hspec -import Test.Hspec.LeanCheck - -spec :: Spec -spec = parallel $ do - prop "equality is reflexive" $ - \ diff -> diff `shouldBe` (diff :: Diff ListableSyntax () ()) diff --git a/test/Data/Functor/Classes/Generic/Spec.hs b/test/Data/Functor/Classes/Generic/Spec.hs deleted file mode 100644 index 01d4e41a53..0000000000 --- a/test/Data/Functor/Classes/Generic/Spec.hs +++ /dev/null @@ -1,87 +0,0 @@ -module Data.Functor.Classes.Generic.Spec (spec) where - -import Data.Functor.Classes.Generic -import Data.Functor.Listable -import GHC.Generics -import Test.Hspec -import Test.Hspec.LeanCheck - -spec :: Spec -spec = parallel $ do - describe "Eq1" $ do - describe "genericLiftEq" $ do - prop "equivalent to derived (==) for product types" $ - \ a b -> genericLiftEq (==) a b `shouldBe` a == (b :: Product Int) - - prop "equivalent to derived (==) for sum types" $ - \ a b -> genericLiftEq (==) a b `shouldBe` a == (b :: Sum Int) - - prop "equivalent to derived (==) for recursive types" $ - \ a b -> genericLiftEq (==) a b `shouldBe` a == (b :: Tree Int) - - describe "Ord1" $ do - describe "genericLiftCompare" $ do - prop "equivalent to derived compare for product types" $ - \ a b -> genericLiftCompare compare a b `shouldBe` compare a (b :: Product Int) - - prop "equivalent to derived compare for sum types" $ - \ a b -> genericLiftCompare compare a b `shouldBe` compare a (b :: Sum Int) - - prop "equivalent to derived compare for recursive types" $ - \ a b -> genericLiftCompare compare a b `shouldBe` compare a (b :: Tree Int) - - describe "Show1" $ do - describe "genericLiftShowsPrec" $ do - prop "equivalent to derived showsPrec for product types" $ - \ a -> genericLiftShowsPrec showsPrec showList 0 a "" `shouldBe` showsPrec 0 (a :: Product Int) "" - - prop "equivalent to derived showsPrec for sum types" $ - \ a -> genericLiftShowsPrec showsPrec showList 0 a "" `shouldBe` showsPrec 0 (a :: Sum Int) "" - - prop "equivalent to derived showsPrec for recursive types" $ - \ a -> genericLiftShowsPrec showsPrec showList 0 a "" `shouldBe` showsPrec 0 (a :: Tree Int) "" - - prop "equivalent to derived showsPrec for record selectors" $ - \ a -> genericLiftShowsPrecWithOptions defaultGShow1Options { optionsUseRecordSyntax = True } showsPrec showList 0 a "" `shouldBe` showsPrec 0 (a :: Record Int) "" - - prop "equivalent to derived showsPrec for infix constructors" $ - \ a -> genericLiftShowsPrec showsPrec showList 0 a "" `shouldBe` showsPrec 0 (a :: Infix Int) "" - - -data Product a = Product a a a - deriving (Eq, Generic1, Ord, Show) - -instance Listable a => Listable (Product a) where - tiers = cons3 Product - - -data Sum a = Sum1 a | Sum2 a | Sum3 a - deriving (Eq, Generic1, Ord, Show) - -instance Listable a => Listable (Sum a) where - tiers = cons1 Sum1 \/ cons1 Sum2 \/ cons1 Sum3 - - -data Tree a = Leaf a | Branch [Tree a] - deriving (Eq, Generic1, Ord, Show) - -instance Listable a => Listable (Tree a) where - tiers = cons1 Leaf \/ cons1 Branch - -instance Eq1 Tree where liftEq = genericLiftEq -instance Ord1 Tree where liftCompare = genericLiftCompare -instance Show1 Tree where liftShowsPrec = genericLiftShowsPrec - - -data Record a = Record { recordSelector1 :: a, recordSelector2 :: a, recordSelector3 :: a } - deriving (Eq, Generic1, Ord, Show) - -instance Listable a => Listable (Record a) where - tiers = cons3 Record - - -data Infix a = a :<>: a - deriving (Eq, Generic1, Ord, Show) - -instance Listable a => Listable (Infix a) where - tiers = cons2 (:<>:) diff --git a/test/Data/Functor/Listable.hs b/test/Data/Functor/Listable.hs deleted file mode 100644 index a5ff8e0f31..0000000000 --- a/test/Data/Functor/Listable.hs +++ /dev/null @@ -1,585 +0,0 @@ -{-# LANGUAGE DataKinds, ScopedTypeVariables, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -module Data.Functor.Listable -( Listable(..) -, mapT -, cons0 -, cons1 -, cons2 -, cons3 -, cons4 -, cons5 -, cons6 -, (\/) -, ListableF(..) -, addWeight -, ofWeight -, ListableSyntax -) where - -import Analysis.CyclomaticComplexity -import Analysis.TOCSummary -import Control.Monad.Free as Free -import Control.Monad.Trans.Free as FreeF -import Data.Abstract.ScopeGraph (AccessControl(..)) -import Data.Bifunctor.Join -import Data.ByteString (ByteString) -import Data.Char (chr) -import Data.Diff -import Data.Functor.Both -import qualified Data.Language as Language -import Data.List.NonEmpty -import Data.Patch -import Data.Range -import Data.Location -import Data.Semigroup (Semigroup(..)) -import Data.Semigroup.App -import Data.Source -import Data.Blob -import Data.Span -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Literal as Literal -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Directive as Directive -import qualified Data.Syntax.Statement as Statement -import qualified Data.Syntax.Expression as Expression -import qualified Language.Ruby.Syntax as Ruby.Syntax -import qualified Language.Python.Syntax as Python.Syntax -import qualified Data.Abstract.Name as Name -import Data.Term -import Data.Text as T (Text, pack) -import qualified Data.Text.Encoding as T -import Data.These -import Data.Sum -import Diffing.Algorithm.RWS -import Test.LeanCheck - -type Tier a = [a] - --- | Lifting of 'Listable' to @* -> *@. -class Listable1 l where - -- | The tiers for @l :: * -> *@, parameterized by the tiers for @a :: *@. - liftTiers :: [Tier a] -> [Tier (l a)] - --- | A suitable definition of 'tiers' for 'Listable1' type constructors parameterized by 'Listable' types. -tiers1 :: (Listable a, Listable1 l) => [Tier (l a)] -tiers1 = liftTiers tiers - - --- | Lifting of 'Listable' to @* -> * -> *@. -class Listable2 l where - -- | The tiers for @l :: * -> * -> *@, parameterized by the tiers for @a :: *@ & @b :: *@. - liftTiers2 :: [Tier a] -> [Tier b] -> [Tier (l a b)] - --- | A suitable definition of 'tiers' for 'Listable2' type constructors parameterized by 'Listable' types. -tiers2 :: (Listable a, Listable b, Listable2 l) => [Tier (l a b)] -tiers2 = liftTiers2 tiers tiers - - -class Listable3 l where - liftTiers3 :: [Tier a] -> [Tier b] -> [Tier c] -> [Tier (l a b c)] - -tiers3 :: (Listable3 l, Listable a, Listable b, Listable c) => [Tier (l a b c)] -tiers3 = liftTiers3 tiers tiers tiers - - --- | Lifts a unary constructor to a list of tiers, given a list of tiers for its argument. --- --- Commonly used in the definition of 'Listable1' and 'Listable2' instances. -liftCons1 :: [Tier a] -> (a -> b) -> [Tier b] -liftCons1 tiers f = mapT f tiers `addWeight` 1 - --- | Lifts a binary constructor to a list of tiers, given lists of tiers for its arguments. --- --- Commonly used in the definition of 'Listable1' and 'Listable2' instances. -liftCons2 :: [Tier a] -> [Tier b] -> (a -> b -> c) -> [Tier c] -liftCons2 tiers1 tiers2 f = mapT (uncurry f) (liftTiers2 tiers1 tiers2) `addWeight` 1 - --- | Lifts a ternary constructor to a list of tiers, given lists of tiers for its arguments. --- --- Commonly used in the definition of 'Listable1' and 'Listable2' instances. -liftCons3 :: [Tier a] -> [Tier b] -> [Tier c] -> (a -> b -> c -> d) -> [Tier d] -liftCons3 tiers1 tiers2 tiers3 f = mapT (uncurry3 f) (tiers1 >< tiers2 >< tiers3) `addWeight` 1 - where uncurry3 f (a, (b, c)) = f a b c - --- | Lifts a quaternary constructor to a list of tiers, given lists of tiers for its arguments. --- --- Commonly used in the definition of 'Listable1' and 'Listable2' instances. -liftCons4 :: [Tier a] -> [Tier b] -> [Tier c] -> [Tier d] -> (a -> b -> c -> d -> e) -> [Tier e] -liftCons4 tiers1 tiers2 tiers3 tiers4 f = mapT (uncurry4 f) (tiers1 >< tiers2 >< tiers3 >< tiers4) `addWeight` 1 - where uncurry4 f (a, (b, (c, d))) = f a b c d - --- | Lifts a quinary constructor to a list of tiers, given lists of tiers for its arguments. --- --- Commonly used in the definition of 'Listable1' and 'Listable2' instances. -liftCons5 :: [Tier a] -> [Tier b] -> [Tier c] -> [Tier d] -> [Tier e] -> (a -> b -> c -> d -> e -> f) -> [Tier f] -liftCons5 tiers1 tiers2 tiers3 tiers4 tiers5 f = mapT (uncurry5 f) (tiers1 >< tiers2 >< tiers3 >< tiers4 >< tiers5) `addWeight` 1 - where uncurry5 f (a, (b, (c, (d, e)))) = f a b c d e - --- | Lifts a senary constructor to a list of tiers, given lists of tiers for its arguments. --- --- Commonly used in the definition of 'Listable1' and 'Listable2' instances. -liftCons6 :: [Tier a] -> [Tier b] -> [Tier c] -> [Tier d] -> [Tier e] -> [Tier f] -> (a -> b -> c -> d -> e -> f -> g) -> [Tier g] -liftCons6 tiers1 tiers2 tiers3 tiers4 tiers5 tiers6 f = mapT (uncurry6 f) (tiers1 >< tiers2 >< tiers3 >< tiers4 >< tiers5 >< tiers6) `addWeight` 1 - where uncurry6 g (a, (b, (c, (d, (e, f))))) = g a b c d e f - --- | Convenient wrapper for 'Listable1' type constructors and 'Listable' types, where a 'Listable' instance would necessarily be orphaned. -newtype ListableF f a = ListableF { unListableF :: f a } - deriving Show - --- | Convenient wrapper for 'Listable2' type constructors and 'Listable' types, where a 'Listable' instance would necessarily be orphaned. -newtype ListableF2 f a b = ListableF2 { unListableF2 :: f a b } - deriving Show - -instance (Listable2 f, Listable a, Listable b) => Listable (ListableF2 f a b) where - tiers = ListableF2 `mapT` tiers2 - - --- Instances - -instance Listable1 Maybe where - liftTiers tiers = cons0 Nothing \/ liftCons1 tiers Just - -instance Listable2 (,) where - liftTiers2 = (><) - -instance Listable2 Either where - liftTiers2 leftTiers rightTiers = liftCons1 leftTiers Left \/ liftCons1 rightTiers Right - -instance Listable a => Listable1 ((,) a) where - liftTiers = liftTiers2 tiers - -instance Listable1 [] where - liftTiers tiers = go - where go = cons0 [] \/ liftCons2 tiers go (:) - -instance Listable1 NonEmpty where - liftTiers tiers = liftCons2 tiers (liftTiers tiers) (:|) - -instance Listable2 p => Listable1 (Join p) where - liftTiers tiers = liftCons1 (liftTiers2 tiers tiers) Join - -instance Listable1 Both where - liftTiers tiers = liftCons2 tiers tiers Both - -instance Listable2 These where - liftTiers2 this that = liftCons1 this This \/ liftCons1 that That \/ liftCons2 this that These - -instance Listable1 f => Listable2 (FreeF f) where - liftTiers2 pureTiers recurTiers = liftCons1 pureTiers FreeF.Pure \/ liftCons1 (liftTiers recurTiers) FreeF.Free - -instance (Listable1 f, Listable a) => Listable1 (FreeF f a) where - liftTiers = liftTiers2 tiers - -instance Listable1 f => Listable1 (Free.Free f) where - liftTiers pureTiers = go - where go = liftCons1 (liftTiers2 pureTiers go) free - free (FreeF.Free f) = Free.Free f - free (FreeF.Pure a) = Free.Pure a - -instance (Listable1 f, Listable a) => Listable (ListableF f a) where - tiers = ListableF `mapT` tiers1 - - -instance Listable1 f => Listable2 (TermF f) where - liftTiers2 annotationTiers recurTiers = liftCons2 annotationTiers (liftTiers recurTiers) In - -instance (Listable1 f, Listable a) => Listable1 (TermF f a) where - liftTiers = liftTiers2 tiers - -instance (Listable1 f, Listable a, Listable b) => Listable (TermF f a b) where - tiers = tiers1 - -instance Listable1 f => Listable1 (Term f) where - liftTiers annotationTiers = go - where go = liftCons1 (liftTiers2 annotationTiers go) Term - -instance (Listable1 f, Listable a) => Listable (Term f a) where - tiers = tiers1 - - -instance (Listable1 syntax) => Listable3 (DiffF syntax) where - liftTiers3 ann1Tiers ann2Tiers recurTiers - = liftCons1 (liftTiers2 (liftTiers2 ann1Tiers recurTiers) (liftTiers2 ann2Tiers recurTiers)) Patch - \/ liftCons1 (liftTiers2 (liftTiers2 ann1Tiers ann2Tiers) recurTiers) Merge - -instance (Listable1 syntax, Listable ann1, Listable ann2, Listable recur) => Listable (DiffF syntax ann1 ann2 recur) where - tiers = tiers3 - -instance Listable AccessControl where - tiers = cons0 Public \/ cons0 Protected \/ cons0 Private - -instance Listable1 f => Listable2 (Diff f) where - liftTiers2 annTiers1 annTiers2 = go where go = liftCons1 (liftTiers3 annTiers1 annTiers2 go) Diff - -instance (Listable1 syntax, Listable ann1, Listable ann2) => Listable (Diff syntax ann1 ann2) where - tiers = tiers2 - - -instance Listable2 Patch where - liftTiers2 t1 t2 = liftCons1 t2 Insert \/ liftCons1 t1 Delete \/ liftCons2 t1 t2 Replace - -instance (Listable a, Listable b) => Listable (Patch a b) where - tiers = tiers2 - - -instance (Listable1 f, Listable1 (Sum (g ': fs))) => Listable1 (Sum (f ': g ': fs)) where - liftTiers tiers = (inject `mapT` ((liftTiers :: [Tier a] -> [Tier (f a)]) tiers)) \/ (weaken `mapT` ((liftTiers :: [Tier a] -> [Tier (Sum (g ': fs) a)]) tiers)) - -instance Listable1 f => Listable1 (Sum '[f]) where - liftTiers tiers = inject `mapT` ((liftTiers :: [Tier a] -> [Tier (f a)]) tiers) - -instance (Listable1 (Sum fs), Listable a) => Listable (Sum fs a) where - tiers = tiers1 - - -instance Listable1 Comment.Comment where - liftTiers _ = cons1 Comment.Comment - -instance Listable1 Declaration.Function where - liftTiers tiers = liftCons4 (liftTiers tiers) tiers (liftTiers tiers) tiers Declaration.Function - -instance Listable1 Declaration.Method where - liftTiers tiers' = liftCons6 (liftTiers tiers') tiers' tiers' (liftTiers tiers') tiers' tiers Declaration.Method - -instance Listable1 Statement.If where - liftTiers tiers = liftCons3 tiers tiers tiers Statement.If - -instance Listable1 Statement.Return where - liftTiers tiers = liftCons1 tiers Statement.Return - -instance Listable1 Syntax.Context where - liftTiers tiers = liftCons2 (liftTiers tiers) tiers Syntax.Context - -instance Listable1 Syntax.Empty where - liftTiers _ = cons0 Syntax.Empty - -instance Listable1 Syntax.Identifier where - liftTiers _ = cons1 Syntax.Identifier - -instance Listable1 Literal.KeyValue where - liftTiers tiers = liftCons2 tiers tiers Literal.KeyValue - -instance Listable1 Literal.Array where - liftTiers tiers = liftCons1 (liftTiers tiers) Literal.Array - -instance Listable1 Literal.Boolean where - liftTiers tiers = cons1 Literal.Boolean - -instance Listable1 Literal.Hash where - liftTiers tiers = liftCons1 (liftTiers tiers) Literal.Hash - -instance Listable1 Literal.Float where - liftTiers tiers = cons1 Literal.Float - -instance Listable1 Literal.Null where - liftTiers tiers = cons0 Literal.Null - -instance Listable1 Literal.TextElement where - liftTiers tiers = cons1 Literal.TextElement - -instance Listable1 Literal.EscapeSequence where - liftTiers tiers = cons1 Literal.EscapeSequence - -instance Listable1 Literal.InterpolationElement where - liftTiers tiers = liftCons1 tiers Literal.InterpolationElement - -instance Listable1 Literal.Character where - liftTiers tiers = cons1 Literal.Character - -instance Listable1 Statement.Statements where - liftTiers tiers = liftCons1 (liftTiers tiers) Statement.Statements - -instance Listable1 Syntax.Error where - liftTiers tiers = liftCons4 mempty mempty mempty (liftTiers tiers) Syntax.Error - -instance Listable1 Directive.File where - liftTiers tiers = cons0 Directive.File - -instance Listable1 Directive.Line where - liftTiers tiers = cons0 Directive.Line - -instance Listable1 Expression.Plus where - liftTiers tiers = liftCons2 tiers tiers Expression.Plus - -instance Listable1 Expression.Minus where - liftTiers tiers = liftCons2 tiers tiers Expression.Minus - -instance Listable1 Expression.Times where - liftTiers tiers = liftCons2 tiers tiers Expression.Times - -instance Listable1 Expression.DividedBy where - liftTiers tiers = liftCons2 tiers tiers Expression.DividedBy - -instance Listable1 Expression.FloorDivision where - liftTiers tiers = liftCons2 tiers tiers Expression.FloorDivision - -instance Listable1 Expression.Modulo where - liftTiers tiers = liftCons2 tiers tiers Expression.Modulo - -instance Listable1 Expression.Power where - liftTiers tiers = liftCons2 tiers tiers Expression.Power - -instance Listable1 Expression.Negate where - liftTiers tiers = liftCons1 tiers Expression.Negate - -instance Listable1 Expression.BOr where - liftTiers tiers = liftCons2 tiers tiers Expression.BOr - -instance Listable1 Expression.BAnd where - liftTiers tiers = liftCons2 tiers tiers Expression.BAnd - -instance Listable1 Expression.BXOr where - liftTiers tiers = liftCons2 tiers tiers Expression.BXOr - -instance Listable1 Expression.LShift where - liftTiers tiers = liftCons2 tiers tiers Expression.LShift - -instance Listable1 Expression.RShift where - liftTiers tiers = liftCons2 tiers tiers Expression.RShift - -instance Listable1 Expression.UnsignedRShift where - liftTiers tiers = liftCons2 tiers tiers Expression.UnsignedRShift - -instance Listable1 Expression.Complement where - liftTiers tiers = liftCons1 tiers Expression.Complement - -instance Listable1 Expression.Or where - liftTiers tiers = liftCons2 tiers tiers Expression.Or - -instance Listable1 Expression.And where - liftTiers tiers = liftCons2 tiers tiers Expression.And - -instance Listable1 Expression.Not where - liftTiers tiers = liftCons1 tiers Expression.Not - -instance Listable1 Expression.XOr where - liftTiers tiers = liftCons2 tiers tiers Expression.XOr - -instance Listable1 Expression.Call where - liftTiers tiers = liftCons4 (liftTiers tiers) tiers (liftTiers tiers) tiers Expression.Call - -instance Listable1 Expression.LessThan where - liftTiers tiers = liftCons2 tiers tiers Expression.LessThan - -instance Listable1 Expression.LessThanEqual where - liftTiers tiers = liftCons2 tiers tiers Expression.LessThanEqual - -instance Listable1 Expression.GreaterThan where - liftTiers tiers = liftCons2 tiers tiers Expression.GreaterThan - -instance Listable1 Expression.GreaterThanEqual where - liftTiers tiers = liftCons2 tiers tiers Expression.GreaterThanEqual - -instance Listable1 Expression.Equal where - liftTiers tiers = liftCons2 tiers tiers Expression.Equal - -instance Listable1 Expression.StrictEqual where - liftTiers tiers = liftCons2 tiers tiers Expression.StrictEqual - -instance Listable1 Expression.Comparison where - liftTiers tiers = liftCons2 tiers tiers Expression.Comparison - -instance Listable1 Expression.Enumeration where - liftTiers tiers = liftCons3 tiers tiers tiers Expression.Enumeration - -instance Listable1 Expression.Matches where - liftTiers tiers = liftCons2 tiers tiers Expression.Matches - -instance Listable1 Expression.NotMatches where - liftTiers tiers = liftCons2 tiers tiers Expression.NotMatches - -instance Listable1 Expression.MemberAccess where - liftTiers tiers = liftCons2 tiers mempty Expression.MemberAccess - -instance Listable1 Expression.ScopeResolution where - liftTiers tiers = liftCons1 (liftTiers tiers) Expression.ScopeResolution - -instance Listable1 Expression.Subscript where - liftTiers tiers = liftCons2 tiers (liftTiers tiers) Expression.Subscript - -instance Listable1 Expression.Member where - liftTiers tiers = liftCons2 tiers tiers Expression.Member - -instance Listable1 Expression.This where - liftTiers tiers = cons0 Expression.This - -instance Listable1 Literal.Complex where - liftTiers tiers = cons1 Literal.Complex - -instance Listable1 Literal.Integer where - liftTiers tiers = cons1 Literal.Integer - -instance Listable1 Literal.Rational where - liftTiers tiers = cons1 Literal.Rational - -instance Listable1 Literal.Regex where - liftTiers tiers = cons1 Literal.Regex - -instance Listable1 Literal.String where - liftTiers tiers = liftCons1 (liftTiers tiers) Literal.String - -instance Listable1 Literal.Symbol where - liftTiers tiers = liftCons1 (liftTiers tiers) Literal.Symbol - -instance Listable1 Literal.SymbolElement where - liftTiers tiers = cons1 Literal.SymbolElement - -instance Listable1 Statement.Assignment where - liftTiers tiers = liftCons3 (liftTiers tiers) tiers tiers Statement.Assignment - -instance Listable1 Statement.Break where - liftTiers tiers = liftCons1 tiers Statement.Break - -instance Listable1 Statement.Catch where - liftTiers tiers = liftCons2 tiers tiers Statement.Catch - -instance Listable1 Statement.Continue where - liftTiers tiers = liftCons1 tiers Statement.Continue - -instance Listable1 Statement.Else where - liftTiers tiers = liftCons2 tiers tiers Statement.Else - -instance Listable1 Statement.Finally where - liftTiers tiers = liftCons1 tiers Statement.Finally - -instance Listable1 Statement.ForEach where - liftTiers tiers = liftCons3 tiers tiers tiers Statement.ForEach - -instance Listable1 Statement.Match where - liftTiers tiers = liftCons2 tiers tiers Statement.Match - -instance Listable1 Statement.Pattern where - liftTiers tiers = liftCons2 tiers tiers Statement.Pattern - -instance Listable1 Statement.Retry where - liftTiers tiers = liftCons1 tiers Statement.Retry - -instance Listable1 Statement.ScopeEntry where - liftTiers tiers = liftCons1 (liftTiers tiers) Statement.ScopeEntry - -instance Listable1 Statement.ScopeExit where - liftTiers tiers = liftCons1 (liftTiers tiers) Statement.ScopeExit - -instance Listable1 Statement.Try where - liftTiers tiers = liftCons2 tiers (liftTiers tiers) Statement.Try - -instance Listable1 Statement.While where - liftTiers tiers = liftCons2 tiers tiers Statement.While - -instance Listable1 Statement.Yield where - liftTiers tiers = liftCons1 tiers Statement.Yield - -instance Listable1 Ruby.Syntax.Assignment where - liftTiers tiers = liftCons3 (liftTiers tiers) tiers tiers Ruby.Syntax.Assignment - -instance Listable1 Ruby.Syntax.Class where - liftTiers tiers = liftCons3 tiers (liftTiers tiers) tiers Ruby.Syntax.Class - -instance Listable1 Ruby.Syntax.Load where - liftTiers tiers = liftCons2 tiers (liftTiers tiers) Ruby.Syntax.Load - -instance Listable1 Ruby.Syntax.LowPrecedenceOr where - liftTiers tiers = liftCons2 tiers tiers Ruby.Syntax.LowPrecedenceOr - -instance Listable1 Ruby.Syntax.LowPrecedenceAnd where - liftTiers tiers = liftCons2 tiers tiers Ruby.Syntax.LowPrecedenceAnd - -instance Listable1 Ruby.Syntax.Module where - liftTiers tiers = liftCons2 tiers (liftTiers tiers) Ruby.Syntax.Module - -instance Listable1 Ruby.Syntax.Require where - liftTiers tiers' = liftCons2 tiers tiers' Ruby.Syntax.Require - -instance Listable1 Ruby.Syntax.ZSuper where - liftTiers tiers = cons0 Ruby.Syntax.ZSuper - -instance Listable1 Ruby.Syntax.Send where - liftTiers tiers = liftCons4 (liftTiers tiers) (liftTiers tiers) (liftTiers tiers) (liftTiers tiers) Ruby.Syntax.Send - -instance Listable Python.Syntax.QualifiedName where - tiers = liftCons1 tiers1 Python.Syntax.QualifiedName \/ liftCons2 tiers tiers1 Python.Syntax.RelativeQualifiedName - -instance Listable1 Python.Syntax.Import where - liftTiers tiers' = liftCons2 tiers (liftTiers tiers') Python.Syntax.Import - -instance Listable1 Python.Syntax.Alias where - liftTiers tiers = liftCons2 tiers tiers Python.Syntax.Alias - - -type ListableSyntax = Sum - '[ Comment.Comment - , Declaration.Function - , Declaration.Method - , Statement.If - , Syntax.Context - , Syntax.Empty - , Syntax.Identifier - , [] - ] - -instance Listable Name.Name where - tiers = cons1 Name.name - -instance Listable1 Gram where - liftTiers tiers = liftCons2 (liftTiers (liftTiers tiers)) (liftTiers (liftTiers tiers)) Gram - -instance Listable a => Listable (Gram a) where - tiers = tiers1 - - -instance Listable Text where - tiers = pack `mapT` tiers - -instance Listable Declaration where - tiers - = cons5 MethodDeclaration - \/ cons4 FunctionDeclaration - \/ cons3 (\ a b c -> ErrorDeclaration a b c Language.Unknown) - -instance Listable CyclomaticComplexity where - tiers = cons1 CyclomaticComplexity - -instance Listable Language.Language where - tiers - = cons0 Language.Go - \/ cons0 Language.JavaScript - \/ cons0 Language.Python - \/ cons0 Language.Ruby - \/ cons0 Language.TypeScript - -instance Listable (f a) => Listable (App f a) where - tiers = cons1 App - -instance Listable (f a) => Listable (AppMerge f a) where - tiers = cons1 AppMerge - -instance Listable Location where - tiers = cons2 Location - -instance Listable Range where - tiers = cons2 Range - -instance Listable Pos where - tiers = cons2 Pos - -instance Listable Span where - tiers = cons2 Span - -instance Listable Blob where - tiers = cons4 makeBlob - -instance Listable BlobPair where - tiers = liftTiers tiers - -instance Listable Source where - tiers = fromUTF8 `mapT` tiers - -instance Listable ByteString where - tiers = (T.encodeUtf8 . T.pack) `mapT` strings - where strings = foldr ((\\//) . listsOf . toTiers) [] - [ ['a'..'z'] <> ['A'..'Z'] <> ['0'..'9'] - , [' '..'/'] <> [':'..'@'] <> ['['..'`'] <> ['{'..'~'] - , [chr 0x00..chr 0x1f] <> [chr 127] -- Control characters. - , [chr 0xa0..chr 0x24f] ] -- Non-ASCII. diff --git a/test/Data/Graph/Spec.hs b/test/Data/Graph/Spec.hs deleted file mode 100644 index 47a7496161..0000000000 --- a/test/Data/Graph/Spec.hs +++ /dev/null @@ -1,20 +0,0 @@ -{-# LANGUAGE PackageImports #-} - -module Data.Graph.Spec where - -import SpecHelpers - -import "semantic" Data.Graph -import qualified Algebra.Graph.Class as Class - -spec :: Spec -spec = describe "Data.Graph" $ - it "has a valid topological sort" $ do - let topo = topologicalSort - topo (Class.path "ab") `shouldBe` "ba" - topo (Class.path "abc") `shouldBe` "cba" - topo ((vertex 'a' `connect` vertex 'b') `connect` vertex 'c') `shouldBe` "cba" - topo (vertex 'a' `connect` (vertex 'b' `connect` vertex 'c')) `shouldBe` "cba" - topo ((vertex 'a' `connect` vertex 'b') <> (vertex 'a' `connect` vertex 'c')) `shouldBe` "cba" - topo (Class.path "abd" <> Class.path "acd") `shouldBe` "dcba" - topo (Class.path "aba") `shouldBe` "ab" diff --git a/test/Data/Mergeable.hs b/test/Data/Mergeable.hs deleted file mode 100644 index 64d58bc885..0000000000 --- a/test/Data/Mergeable.hs +++ /dev/null @@ -1,86 +0,0 @@ -{-# LANGUAGE DefaultSignatures, TypeOperators, UndecidableInstances #-} -module Data.Mergeable ( Mergeable (..) ) where - -import Control.Applicative -import Data.Functor.Identity -import Data.List.NonEmpty -import Data.Sum -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Comment as Comment -import qualified Data.Syntax.Declaration as Declaration -import qualified Data.Syntax.Statement as Statement -import GHC.Generics - --- Classes - --- | A 'Mergeable' functor is one which supports pushing itself through an 'Alternative' functor. Note the similarities with 'Traversable' & 'Crosswalk'. --- --- This is a kind of distributive law which produces (at least) the union of the two functors’ shapes; i.e. unlike 'Traversable', an 'empty' value in the inner functor does not produce an 'empty' result, and unlike 'Crosswalk', an 'empty' value in the outer functor does not produce an 'empty' result. --- --- For example, 'Data.Diff' uses 'sequenceAlt' to select one side or the other of a diff node, while correctly handling the fact that some patches don’t have any content for that side. -class Functor t => Mergeable t where - -- | Sequence a 'Mergeable' functor by merging the 'Alternative' values. - sequenceAlt :: Alternative f => t (f a) -> f (t a) - default sequenceAlt :: (Generic1 t, GMergeable (Rep1 t), Alternative f) => t (f a) -> f (t a) - sequenceAlt = genericSequenceAlt - - --- Instances - -instance Mergeable [] where - sequenceAlt = foldr (\ x -> (((:) <$> x <|> pure id) <*>)) (pure []) - -instance Mergeable NonEmpty where - sequenceAlt (x :|[]) = (:|) <$> x <*> pure [] - sequenceAlt (x1:|x2:xs) = (:|) <$> x1 <*> sequenceAlt (x2 : xs) <|> sequenceAlt (x2:|xs) - -instance Mergeable Maybe where - sequenceAlt = maybe (pure empty) (fmap Just) - -instance Mergeable Identity where - sequenceAlt = fmap Identity . runIdentity - -instance (Apply Functor fs, Apply Mergeable fs) => Mergeable (Sum fs) where - sequenceAlt = apply' @Mergeable (\ reinj t -> reinj <$> sequenceAlt t) - -instance Mergeable Comment.Comment -instance Mergeable Declaration.Function -instance Mergeable Declaration.Method -instance Mergeable Statement.If -instance Mergeable Syntax.Context -instance Mergeable Syntax.Empty -instance Mergeable Syntax.Identifier - - --- Generics - -class GMergeable t where - gsequenceAlt :: Alternative f => t (f a) -> f (t a) - -genericSequenceAlt :: (Generic1 t, GMergeable (Rep1 t), Alternative f) => t (f a) -> f (t a) -genericSequenceAlt = fmap to1 . gsequenceAlt . from1 - - --- Instances - -instance GMergeable U1 where - gsequenceAlt _ = pure U1 - -instance GMergeable Par1 where - gsequenceAlt (Par1 a) = Par1 <$> a - -instance GMergeable (K1 i c) where - gsequenceAlt (K1 a) = pure (K1 a) - -instance Mergeable f => GMergeable (Rec1 f) where - gsequenceAlt (Rec1 a) = Rec1 <$> sequenceAlt a - -instance GMergeable f => GMergeable (M1 i c f) where - gsequenceAlt (M1 a) = M1 <$> gsequenceAlt a - -instance (GMergeable f, GMergeable g) => GMergeable (f :+: g) where - gsequenceAlt (L1 a) = L1 <$> gsequenceAlt a - gsequenceAlt (R1 a) = R1 <$> gsequenceAlt a - -instance (GMergeable f, GMergeable g) => GMergeable (f :*: g) where - gsequenceAlt (a :*: b) = (:*:) <$> gsequenceAlt a <*> gsequenceAlt b diff --git a/test/Data/Range/Spec.hs b/test/Data/Range/Spec.hs deleted file mode 100644 index b6c4e2af2d..0000000000 --- a/test/Data/Range/Spec.hs +++ /dev/null @@ -1,11 +0,0 @@ -{-# LANGUAGE ScopedTypeVariables #-} - -module Data.Range.Spec where - -import Data.Range -import SpecHelpers - -spec :: Spec -spec = describe "Data.Range" $ - prop "should have an associative Semigroup instance" $ - \(a, b, c) -> a <> (b <> c) `shouldBe` (a <> b) <> (c :: Range) diff --git a/test/Data/Scientific/Spec.hs b/test/Data/Scientific/Spec.hs deleted file mode 100644 index cdfd3d9810..0000000000 --- a/test/Data/Scientific/Spec.hs +++ /dev/null @@ -1,49 +0,0 @@ -module Data.Scientific.Spec where - -import Data.Scientific.Exts -import Data.Either -import SpecHelpers - -spec :: Spec -spec = describe "Scientific parsing" $ do - - let go cases = forM_ cases $ \(s, v) -> parseScientific s `shouldBe` Right v - - -- TODO: hexadecimal floats, someday (0x1.999999999999ap-4) - - it "should handle Python floats" $ - go [ ("-.6_6", -0.66) - , ("+.1_1", 0.11) - , ("123.4123", 123.4123) - , ("123.123J", 123.123) -- TODO: handle complex values separately in the parser - , ("1_1.3_1", 11.31) - , ("1_1.", 11.0) - , ("99E+01", 99e1) - , ("1e+3_4j", 1e34) - , ("3.e14", 3e14) - , (".3e1_4", 0.3e14) - , ("1_0.l", 10) -- this and the subsequent ones don't actually seem to be valid syntax, we should fix this in tree-sitter - , (".3", 0.3) - , (".1l", 0.1) -- omitting a leading 0 is deprecated in python 3, also note that the -l suffix is not valid in Python 3 - ] - - it "should handle Ruby floats" $ - go [ ("1.234_5e1_0", 1.2345e10) - , ("1E30", 1e30) - , ("1.2i", 1.2) - , ("1.0e+6", 1.0e6) - , ("1.0e-6", 1.0e-6) - ] - - it "should handle JS numbers, including multiple bases" $ - go [ ("101", 101) - , ("3.14", 3.14) - , ("3.14e+1", 3.14e1) - , ("0x1ABCDEFabcdef", 470375954370031) - , ("0o7632157312", 1047060170) - , ("0b1010101001", 681) - ] - - it "should not accept truly bad input" $ do - parseScientific "." `shouldSatisfy` isLeft - parseScientific "" `shouldSatisfy` isLeft diff --git a/test/Data/Semigroup/App/Spec.hs b/test/Data/Semigroup/App/Spec.hs deleted file mode 100644 index e3acf4bc1c..0000000000 --- a/test/Data/Semigroup/App/Spec.hs +++ /dev/null @@ -1,20 +0,0 @@ -module Data.Semigroup.App.Spec where - -import SpecHelpers -import Data.Semigroup.App - -spec :: Spec -spec = do - describe "App" $ - prop "should be associative" $ - \a b c -> a <> (b <> c) == (a <> b) <> (c :: App Maybe Integer) - - describe "AppMerge" $ do - prop "should be associative" $ - \ a b c -> a <> (b <> c) == (a <> b) <> (c :: AppMerge Maybe String) - - prop "identity/left" $ - \ a -> mempty <> a == (a :: AppMerge Maybe String) - - prop "identity/right" $ - \ a -> a <> mempty == (a :: AppMerge Maybe String) diff --git a/test/Data/Source/Spec.hs b/test/Data/Source/Spec.hs deleted file mode 100644 index dcca0db8c1..0000000000 --- a/test/Data/Source/Spec.hs +++ /dev/null @@ -1,77 +0,0 @@ -module Data.Source.Spec (spec) where - -import Data.Char (chr) -import Data.Functor.Listable -import Data.Range -import Data.Source -import Data.Span -import qualified Data.Text as Text -import Test.Hspec -import Test.Hspec.LeanCheck -import Test.LeanCheck - -spec :: Spec -spec = parallel $ do - describe "sourceLineRanges" $ do - prop "produces 1 more range than there are newlines" $ - \ source -> length (sourceLineRanges source) `shouldBe` succ (Text.count "\n" (toText source)) - - prop "produces exhaustive ranges" $ - \ source -> foldMap (`slice` source) (sourceLineRanges source) `shouldBe` source - - describe "spanToRange" $ do - prop "computes single-line ranges" $ - \ s -> let source = fromUTF8 s - spans = zipWith (\ i Range {..} -> Span (Pos i 1) (Pos i (succ (end - start)))) [1..] ranges - ranges = sourceLineRanges source in - spanToRange source <$> spans `shouldBe` ranges - - prop "computes multi-line ranges" $ - \ source -> - spanToRange source (totalSpan source) `shouldBe` totalRange source - - prop "computes sub-line ranges" $ - \ s -> let source = "*" <> s <> "*" in - spanToRange source (insetSpan (totalSpan source)) `shouldBe` insetRange (totalRange source) - - prop "inverse of rangeToSpan" $ - \ a b -> let s = a <> "\n" <> b in spanToRange s (totalSpan s) `shouldBe` totalRange s - - describe "rangeToSpan" $ do - prop "inverse of spanToRange" $ - \ a b -> let s = a <> "\n" <> b in rangeToSpan s (totalRange s) `shouldBe` totalSpan s - - describe "totalSpan" $ do - prop "covers single lines" $ - \ n -> totalSpan (fromText (Text.replicate n "*")) `shouldBe` Span (Pos 1 1) (Pos 1 (max 1 (succ n))) - - prop "covers multiple lines" $ - \ n -> totalSpan (fromText (Text.intersperse '\n' (Text.replicate n "*"))) `shouldBe` Span (Pos 1 1) (Pos (max 1 n) (if n > 0 then 2 else 1)) - - describe "newlineIndices" $ do - it "finds \\n" $ - let source = "a\nb" in - newlineIndices source `shouldBe` [1] - it "finds \\r" $ - let source = "a\rb" in - newlineIndices source `shouldBe` [1] - it "finds \\r\\n" $ - let source = "a\r\nb" in - newlineIndices source `shouldBe` [2] - it "finds intermixed line endings" $ - let source = "hi\r}\r}\n xxx \r a" in - newlineIndices source `shouldBe` [2, 4, 6, 12] - - prop "preserves characters" . forAll (toTiers (list +| [chr 0xa0..chr 0x24f])) $ - \ c -> Text.unpack (toText (fromText (Text.singleton c))) `shouldBe` [c] - - prop "preserves strings" $ - \ s -> fromText (toText s) `shouldBe` s - - -insetSpan :: Span -> Span -insetSpan sourceSpan = sourceSpan { spanStart = (spanStart sourceSpan) { posColumn = succ (posColumn (spanStart sourceSpan)) } - , spanEnd = (spanEnd sourceSpan) { posColumn = pred (posColumn (spanEnd sourceSpan)) } } - -insetRange :: Range -> Range -insetRange Range {..} = Range (succ start) (pred end) diff --git a/test/Data/Term/Spec.hs b/test/Data/Term/Spec.hs deleted file mode 100644 index ec4cc3ddde..0000000000 --- a/test/Data/Term/Spec.hs +++ /dev/null @@ -1,14 +0,0 @@ -{-# LANGUAGE DataKinds #-} -module Data.Term.Spec (spec) where - -import Data.Functor.Listable -import Data.Term -import Test.Hspec (Spec, describe, parallel) -import Test.Hspec.Expectations.Pretty -import Test.Hspec.LeanCheck - -spec :: Spec -spec = parallel $ do - describe "Term" $ do - prop "equality is reflexive" $ - \ a -> a `shouldBe` (a :: Term ListableSyntax ()) diff --git a/test/Diffing/Algorithm/RWS/Spec.hs b/test/Diffing/Algorithm/RWS/Spec.hs deleted file mode 100644 index d62a3aec09..0000000000 --- a/test/Diffing/Algorithm/RWS/Spec.hs +++ /dev/null @@ -1,48 +0,0 @@ -{-# LANGUAGE DataKinds, TypeOperators #-} -module Diffing.Algorithm.RWS.Spec (spec) where - -import Data.Bifunctor -import Data.Diff -import Data.Functor.Listable (ListableSyntax) -import Data.Sum -import qualified Data.Syntax as Syntax -import Data.Term -import Data.These -import Diffing.Algorithm -import Diffing.Interpreter (stripDiff) -import Diffing.Algorithm.RWS -import Diffing.Interpreter.Spec (afterTerm, beforeTerm) -import Test.Hspec.LeanCheck -import SpecHelpers - -spec :: Spec -spec = parallel $ do - let positively = succ . abs - describe "pqGramDecorator" $ do - prop "produces grams with stems of the specified length" $ - \ (term, p, q) -> pqGramDecorator (positively p) (positively q) (term :: Term ListableSyntax ()) `shouldSatisfy` all ((== positively p) . length . stem . fst) - - prop "produces grams with bases of the specified width" $ - \ (term, p, q) -> pqGramDecorator (positively p) (positively q) (term :: Term ListableSyntax ()) `shouldSatisfy` all ((== positively q) . length . base . fst) - - describe "rws" $ do - prop "produces correct diffs" $ - \ (as, bs) -> let tas = decorate <$> (as :: [Term ListableSyntax ()]) - tbs = decorate <$> (bs :: [Term ListableSyntax ()]) - wrap = termIn emptyAnnotation . inject - diff = merge (emptyAnnotation, emptyAnnotation) (inject (stripDiff . diffThese <$> rws comparableTerms (equalTerms comparableTerms) tas tbs)) in - (beforeTerm diff, afterTerm diff) `shouldBe` (Just (wrap (stripTerm <$> tas)), Just (wrap (stripTerm <$> tbs))) - - it "produces unbiased insertions within branches" $ - let (a, b) = (decorate (termIn emptyAnnotation (inject [ termIn emptyAnnotation (inject (Syntax.Identifier "a")) ])), decorate (termIn emptyAnnotation (inject [ termIn emptyAnnotation (inject (Syntax.Identifier "b")) ]))) in - fmap (bimap stripTerm stripTerm) (rws comparableTerms (equalTerms comparableTerms) [ b ] [ a, b ]) `shouldBe` fmap (bimap stripTerm stripTerm) [ That a, These b b ] - - where decorate = defaultFeatureVectorDecorator - - diffThese = these deleting inserting replacing - -stripTerm :: Functor f => Term f (FeatureVector, ()) -> Term f () -stripTerm = fmap snd - -emptyAnnotation :: () -emptyAnnotation = () diff --git a/test/Diffing/Algorithm/SES/Spec.hs b/test/Diffing/Algorithm/SES/Spec.hs deleted file mode 100644 index 97ddf96b7d..0000000000 --- a/test/Diffing/Algorithm/SES/Spec.hs +++ /dev/null @@ -1,24 +0,0 @@ -module Diffing.Algorithm.SES.Spec (spec) where - -import Data.These -import Diffing.Algorithm.SES -import Test.Hspec -import Test.Hspec.LeanCheck - -spec :: Spec -spec = do - describe "ses" $ do - prop "returns equal lists in These" $ - \ as -> (ses (==) as as :: EditScript Char Char) `shouldBe` zipWith These as as - - prop "returns deletions in This" $ - \ as -> (ses (==) as [] :: EditScript Char Char) `shouldBe` fmap This as - - prop "returns insertions in That" $ - \ bs -> (ses (==) [] bs :: EditScript Char Char) `shouldBe` fmap That bs - - prop "returns all elements individually for disjoint inputs" $ - \ as bs -> length (ses (==) ((,) 0 <$> as :: [(Int, Char)]) ((,) 1 <$> bs :: [(Int, Char)])) `shouldBe` length as + length bs - - prop "is lossless w.r.t. both input elements & ordering" $ - \ as bs -> foldr (\ each (as, bs) -> these (flip (,) bs. (:as)) ((,) as . (:bs)) (\ a b -> (a:as, b:bs)) each) ([], []) (ses (==) as bs :: EditScript Char Char) `shouldBe` (as, bs) diff --git a/test/Diffing/Interpreter/Spec.hs b/test/Diffing/Interpreter/Spec.hs deleted file mode 100644 index 04933af76b..0000000000 --- a/test/Diffing/Interpreter/Spec.hs +++ /dev/null @@ -1,85 +0,0 @@ -{-# LANGUAGE DataKinds #-} -module Diffing.Interpreter.Spec (spec, afterTerm, beforeTerm) where - -import Control.Applicative ((<|>)) -import Data.Diff -import Data.Foldable (asum) -import Data.Functor.Foldable (cata) -import Data.Functor.Listable -import Data.Maybe -import Data.Mergeable -import Data.Patch (after, before) -import Data.Sum -import Data.Term -import Data.These -import Diffing.Interpreter -import qualified Data.Syntax as Syntax -import Test.Hspec (Spec, describe, it, parallel) -import Test.Hspec.Expectations.Pretty -import Test.Hspec.LeanCheck -import Test.LeanCheck.Core -import SpecHelpers () - -spec :: Spec -spec = parallel $ do - describe "diffTerms" $ do - it "returns a replacement when comparing two unicode equivalent terms" $ - let termA = termIn emptyAnnotation (inject (Syntax.Identifier "t\776")) - termB = termIn emptyAnnotation (inject (Syntax.Identifier "\7831")) in - diffTerms termA termB `shouldBe` replacing termA (termB :: Term ListableSyntax ()) - - prop "produces correct diffs" $ - \ a b -> let diff = diffTerms a b :: Diff ListableSyntax () () in - (beforeTerm diff, afterTerm diff) `shouldBe` (Just a, Just b) - - prop "produces identity diffs for equal terms " $ - \ a -> let diff = diffTerms a a :: Diff ListableSyntax () () in - length (diffPatches diff) `shouldBe` 0 - - it "produces unbiased insertions within branches" $ - let term s = termIn emptyAnnotation (inject [ termIn emptyAnnotation (inject (Syntax.Identifier s)) ]) :: Term ListableSyntax () - wrap = termIn emptyAnnotation . inject in - diffTerms (wrap [ term "b" ]) (wrap [ term "a", term "b" ]) `shouldBe` merge (emptyAnnotation, emptyAnnotation) (inject [ inserting (term "a"), merging (term "b") ]) - - let noContext :: Term ListableSyntax a -> Bool - noContext = isNothing . project @Syntax.Context . termOut - - prop "compares nodes against context" . forAll (filterT (noContext . fst) tiers) $ - \ (a, b) -> diffTerms a (termIn emptyAnnotation (inject (Syntax.Context (pure b) a))) `shouldBe` insertF (In emptyAnnotation (inject (Syntax.Context (pure (inserting b)) (merging (a :: Term ListableSyntax ()))))) - - prop "diffs forward permutations as changes" $ - \ a -> let wrap = termIn emptyAnnotation . inject - b = wrap [a] - c = wrap [a, b] in - diffTerms (wrap [a, b, c]) (wrap [c, a, b :: Term ListableSyntax ()]) `shouldBe` merge (emptyAnnotation, emptyAnnotation) (inject [ inserting c, merging a, merging b, deleting c ]) - - prop "diffs backward permutations as changes" $ - \ a -> let wrap = termIn emptyAnnotation . inject - b = wrap [a] - c = wrap [a, b] in - diffTerms (wrap [a, b, c]) (wrap [b, c, a :: Term ListableSyntax ()]) `shouldBe` merge (emptyAnnotation, emptyAnnotation) (inject [ deleting a, merging b, merging c, inserting a ]) - - describe "diffTermPair" $ do - prop "produces an Insert when the first term is missing" $ do - \ after -> let diff = diffTermPair (That after) :: Diff ListableSyntax () () in - diff `shouldBe` inserting after - - prop "produces a Delete when the second term is missing" $ do - \ before -> let diff = diffTermPair (This before) :: Diff ListableSyntax () () in - diff `shouldBe` deleting before - - --- | Recover the before state of a diff. -beforeTerm :: (Foldable syntax, Mergeable syntax) => Diff syntax ann1 ann2 -> Maybe (Term syntax ann1) -beforeTerm = cata $ \ diff -> case diff of - Patch patch -> (before patch >>= \ (In a l) -> termIn a <$> sequenceAlt l) <|> (after patch >>= asum) - Merge (In (a, _) l) -> termIn a <$> sequenceAlt l - --- | Recover the after state of a diff. -afterTerm :: (Foldable syntax, Mergeable syntax) => Diff syntax ann1 ann2 -> Maybe (Term syntax ann2) -afterTerm = cata $ \ diff -> case diff of - Patch patch -> (after patch >>= \ (In b r) -> termIn b <$> sequenceAlt r) <|> (before patch >>= asum) - Merge (In (_, b) r) -> termIn b <$> sequenceAlt r - -emptyAnnotation :: () -emptyAnnotation = () diff --git a/test/Examples.hs b/test/Examples.hs deleted file mode 100644 index b7c5b3ab27..0000000000 --- a/test/Examples.hs +++ /dev/null @@ -1,108 +0,0 @@ -{-# LANGUAGE TypeApplications #-} -module Main (main) where - -import Control.Effect -import Control.Exception (displayException) -import Control.Monad -import Control.Monad.IO.Class -import qualified Data.ByteString as B -import Data.ByteString.Builder -import qualified Data.ByteString.Char8 as BC -import Data.Either -import Data.Blob (fileForPath) -import Data.Flag -import Data.Foldable -import Data.List -import Data.Maybe -import Data.Quieterm -import Data.Typeable (cast) -import Data.Void -import Parsing.Parser -import Semantic.Api (TermOutputFormat (..), parseTermBuilder) -import Semantic.Config (Config (..), Options (..), FailOnWarning (..), defaultOptions) -import qualified Semantic.IO as IO -import Semantic.Task -import Semantic.Task.Files -import System.Directory -import System.Exit (die) -import System.FilePath.Glob -import System.FilePath.Posix -import System.Process -import Test.Hspec - - -main :: IO () -main = withOptions opts $ \ config logger statter -> hspec . parallel $ do - let args = TaskSession config "-" False logger statter - - runIO setupExampleRepos - - for_ languages $ \ lang@LanguageExample{..} -> do - let tsDir = languagesDir languageName ("vendor/tree-sitter-" <> languageName) - parallel . describe languageName $ parseExamples args lang tsDir - - where - parseExamples session LanguageExample{..} tsDir = do - knownFailures <- runIO $ knownFailuresForPath tsDir languageKnownFailuresTxt - files <- runIO $ globDir1 (compile ("**/*" <> languageExtension)) (tsDir languageExampleDir) - for_ files $ \file -> it file $ do - res <- runTask session (parseFilePath file) - case res of - Left (SomeException e) -> case cast e of - -- We have a number of known assignment timeouts, consider these pending specs instead of failing the build. - Just AssignmentTimedOut -> pendingWith $ show (displayException e) - Just ParserTimedOut -> pendingWith $ show (displayException e) - -- Other exceptions are true failures - _ -> expectationFailure (show (displayException e)) - _ -> if file `elem` knownFailures - then pendingWith $ "Known parse failures " <> show (const "Assignment: OK" <$> res) - else res `shouldSatisfy` isRight - - setupExampleRepos = readProcess "script/clone-example-repos" mempty mempty >>= print - opts = defaultOptions { optionsFailOnWarning = flag FailOnWarning True, optionsLogLevel = Nothing } - - knownFailuresForPath :: FilePath -> Maybe FilePath -> IO [FilePath] - knownFailuresForPath _ Nothing = pure [] - knownFailuresForPath tsDir (Just path) = do - known <- BC.lines <$> B.readFile (tsDir path) - pure $ (tsDir ) . BC.unpack <$> stripComments known - where stripComments = filter (\line -> not (BC.null line) && BC.head line == '#') - -data LanguageExample - = LanguageExample - { languageName :: FilePath - , languageExtension :: FilePath - , languageExampleDir :: FilePath - , languageKnownFailuresTxt :: Maybe FilePath - } deriving (Eq, Show) - -le :: FilePath -> FilePath -> FilePath -> Maybe FilePath -> LanguageExample -le = LanguageExample - -languages :: [LanguageExample] -languages = - [ le "python" ".py" "examples" (Just "script/known_failures.txt") - , le "ruby" ".rb" "examples" (Just "script/known_failures.txt") - , le "typescript" ".ts" "examples" (Just "typescript/script/known_failures.txt") - , le "typescript" ".tsx" "examples" (Just "typescript/script/known_failures.txt") - , le "typescript" ".js" "examples" Nothing -- parse JavaScript with TypeScript parser. - , le "go" ".go" "examples" (Just "script/known-failures.txt") - - -- TODO: Java assignment errors need to be investigated - -- , le "java" ".java" "examples/guava" (Just "script/known_failures_guava.txt") - -- , le "java" ".java" "examples/elasticsearch" (Just "script/known_failures_elasticsearch.txt") - -- , le "java" ".java" "examples/RxJava" (Just "script/known_failures_RxJava.txt") - - -- TODO: Haskell assignment errors need to be investigated - -- , le "haskell" ".hs" "examples/effects" (Just "script/known-failures-effects.txt") - -- , le "haskell" ".hs" "examples/postgrest" (Just "script/known-failures-postgrest.txt") - -- , le "haskell" ".hs" "examples/ivory" (Just "script/known-failures-ivory.txt") - - -- , ("php", ".php") -- TODO: No parse-examples in tree-sitter yet - ] - -parseFilePath :: (Member (Error SomeException) sig, Member Distribute sig, Member Task sig, Member Files sig, Carrier sig m, MonadIO m) => FilePath -> m Bool -parseFilePath path = readBlob (fileForPath path) >>= parseTermBuilder @[] TermShow . pure >>= const (pure True) - -languagesDir :: FilePath -languagesDir = "vendor/haskell-tree-sitter/languages" diff --git a/test/Graphing/Calls/Spec.hs b/test/Graphing/Calls/Spec.hs deleted file mode 100644 index 4fee9ed626..0000000000 --- a/test/Graphing/Calls/Spec.hs +++ /dev/null @@ -1,49 +0,0 @@ -{-# LANGUAGE PackageImports #-} - -module Graphing.Calls.Spec ( spec ) where - -import Prelude hiding (readFile) -import Prologue -import SpecHelpers hiding (readFile) - -import Algebra.Graph -import Data.List (uncons) - -import Data.Abstract.Module -import "semantic" Data.Graph (Graph (..), topologicalSort) -import Data.Graph.ControlFlowVertex -import Data.Span -import qualified Data.Language as Language -import Semantic.Config (defaultOptions) -import Semantic.Graph -import Semantic.IO - -callGraphPythonProject paths = runTaskOrDie $ do - let proxy = Proxy @'Language.Python - let lang = Language.Python - blobs <- catMaybes <$> traverse readBlobFromFile (flip File lang <$> paths) - package <- fmap snd <$> parsePackage pythonParser (Project (takeDirectory (maybe "/" fst (uncons paths))) blobs lang []) - modules <- topologicalSort <$> runImportGraphToModules proxy package - runCallGraph proxy False modules package - -spec :: Spec -spec = describe "call graphing" $ do - - let needs r v = unGraph r `shouldSatisfy` hasVertex v - - it "should work for a simple example" $ do - res <- callGraphPythonProject ["test/fixtures/python/graphing/simple/simple.py"] - res `needs` Variable "magnus" "simple.py" (Span (Pos 4 1) (Pos 4 7)) - - it "should evaluate both sides of an if-statement" $ do - res <- callGraphPythonProject ["test/fixtures/python/graphing/conditional/conditional.py"] - res `needs` Variable "merle" "conditional.py" (Span (Pos 5 5) (Pos 5 10)) - res `needs` Variable "taako" "conditional.py" (Span (Pos 8 5) (Pos 8 10)) - - it "should continue even when a type error is encountered" $ do - res <- callGraphPythonProject ["test/fixtures/python/graphing/typeerror/typeerror.py"] - res `needs` Variable "lup" "typeerror.py" (Span (Pos 5 1) (Pos 5 4)) - - it "should continue when an unbound variable is encountered" $ do - res <- callGraphPythonProject ["test/fixtures/python/graphing/unbound/unbound.py"] - res `needs` Variable "lucretia" "unbound.py" (Span (Pos 5 1) (Pos 5 9)) diff --git a/test/Integration/Spec.hs b/test/Integration/Spec.hs deleted file mode 100644 index bc10362891..0000000000 --- a/test/Integration/Spec.hs +++ /dev/null @@ -1,98 +0,0 @@ -module Integration.Spec (spec) where - -import Control.Exception (throw) -import Data.Foldable (find, traverse_, for_) -import Data.List (union, concat, transpose) -import qualified Data.ByteString as B -import System.FilePath.Glob -import System.FilePath.Posix - -import SpecHelpers - -languages :: [FilePath] -languages = ["go", "javascript", "json", "python", "ruby", "typescript", "tsx"] - -spec :: TaskSession -> Spec -spec config = parallel $ do - for_ languages $ \language -> do - let dir = "test/fixtures" language "corpus" - it (language <> " corpus exists") $ examples dir `shouldNotReturn` [] - describe (language <> " corpus") $ runTestsIn dir [] - - where - runTestsIn :: FilePath -> [(FilePath, String)] -> SpecWith () - runTestsIn directory pending = do - examples <- runIO $ examples directory - traverse_ (runTest pending) examples - runTest pending ParseExample{..} = it ("parses " <> file) $ maybe (testParse config file parseOutput) pendingWith (lookup parseOutput pending) - runTest pending DiffExample{..} = it ("diffs " <> diffOutput) $ maybe (testDiff config (Both fileA fileB) diffOutput) pendingWith (lookup diffOutput pending) - -data Example = DiffExample { fileA :: FilePath, fileB :: FilePath, diffOutput :: FilePath } - | ParseExample { file :: FilePath, parseOutput :: FilePath } - deriving (Eq, Show) - --- | Return all the examples from the given directory. Examples are expected to --- | have the form: --- | --- | example-name.A.rb - The left hand side of the diff. --- | example-name.B.rb - The right hand side of the diff. --- | --- | example-name.diffA-B.txt - The expected sexpression diff output for A -> B. --- | example-name.diffB-A.txt - The expected sexpression diff output for B -> A. --- | --- | example-name.parseA.txt - The expected sexpression parse tree for example-name.A.rb --- | example-name.parseB.txt - The expected sexpression parse tree for example-name.B.rb -examples :: FilePath -> IO [Example] -examples directory = do - as <- globFor "*.A.*" - bs <- globFor "*.B.*" - sExpAs <- globFor "*.parseA.txt" - sExpBs <- globFor "*.parseB.txt" - sExpDiffsAB <- globFor "*.diffA-B.txt" - sExpDiffsBA <- globFor "*.diffB-A.txt" - - let exampleDiff lefts rights out name = DiffExample (lookupNormalized name lefts) (lookupNormalized name rights) out - let exampleParse files out name = ParseExample (lookupNormalized name files) out - - let keys = (normalizeName <$> as) `union` (normalizeName <$> bs) - pure $ merge [ getExamples (exampleParse as) sExpAs keys - , getExamples (exampleParse bs) sExpBs keys - , getExamples (exampleDiff as bs) sExpDiffsAB keys - , getExamples (exampleDiff bs as) sExpDiffsBA keys ] - where - merge = concat . transpose - -- Only returns examples if they exist - getExamples f list = foldr (go f list) [] - where go f list name acc = case lookupNormalized' name list of - Just out -> f out name : acc - Nothing -> acc - - lookupNormalized :: FilePath -> [FilePath] -> FilePath - lookupNormalized name xs = fromMaybe - (error ("cannot find " <> name <> " make sure .A, .B and exist.")) - (lookupNormalized' name xs) - - lookupNormalized' :: FilePath -> [FilePath] -> Maybe FilePath - lookupNormalized' name = find ((== name) . normalizeName) - - globFor :: FilePath -> IO [FilePath] - globFor p = globDir1 (compile p) directory - --- | Given a test name like "foo.A.js", return "foo". -normalizeName :: FilePath -> FilePath -normalizeName path = dropExtension $ dropExtension path - -testParse :: TaskSession -> FilePath -> FilePath -> Expectation -testParse session path expectedOutput = do - actual <- fmap verbatim <$> parseFilePath session path - case actual of - Left err -> throw err - Right actual -> do - expected <- verbatim <$> B.readFile expectedOutput - actual `shouldBe` expected - -testDiff :: TaskSession -> Both FilePath -> FilePath -> Expectation -testDiff config paths expectedOutput = do - actual <- verbatim <$> diffFilePaths config paths - expected <- verbatim <$> B.readFile expectedOutput - actual `shouldBe` expected diff --git a/test/Numeric/Spec.hs b/test/Numeric/Spec.hs deleted file mode 100644 index 383b59fe3e..0000000000 --- a/test/Numeric/Spec.hs +++ /dev/null @@ -1,38 +0,0 @@ -module Numeric.Spec - ( spec - ) where - -import SpecHelpers -import Data.Either -import Numeric.Exts - -spec :: Spec -spec = describe "Integer parsing" $ do - - let go cases = forM_ cases $ \(s, v) -> parseInteger s `shouldBe` Right v - - it "should handle Python integers" $ - go [ ("-1", (negate 1)) - , ("0xDEAD", 0xDEAD) - , ("0XDEAD", 0xDEAD) - , ("1j", 1) - , ("0o123", 83) - , ("0O123", 83) - , ("0b001", 1) - , ("0B001", 1) - , ("1_1", 11) -- underscore syntax is Python 3 only - , ("0B1_1", 3) - , ("0O1_1", 9) - , ("0L", 0) - ] - - it "should handle Ruby integers" $ - go [ ("0xa_bcd_ef0_123_456_789", 0xabcdef0123456789) - , ("01234567", 342391) - ] - - it "should not accept floating-points" $ do - parseInteger "1.5" `shouldSatisfy` isLeft - - it "should not accept the empty string" $ do - parseInteger "" `shouldSatisfy` isLeft diff --git a/test/Parsing/Spec.hs b/test/Parsing/Spec.hs deleted file mode 100644 index 591e1328ad..0000000000 --- a/test/Parsing/Spec.hs +++ /dev/null @@ -1,36 +0,0 @@ -module Parsing.Spec (spec) where - -import Control.Effect -import Data.AST -import Data.Blob -import Data.ByteString.Char8 (pack) -import Data.Duration -import Data.Language -import Data.Maybe -import Data.Source -import Parsing.TreeSitter -import Semantic.Config -import SpecHelpers -import System.Timeout -import TreeSitter.JSON (tree_sitter_json, Grammar) - -spec :: Spec -spec = parallel $ do - describe "parseToAST" $ do - let source = toJSONSource $ take 10000 [1..] - let largeBlob = sourceBlob "large.json" JSON source - - it "returns a result when the timeout does not expire" $ do - let timeout = fromMicroseconds 0 -- Zero microseconds indicates no timeout - let parseTask = parseToAST timeout tree_sitter_json largeBlob :: TaskEff (Maybe (AST [] Grammar)) - result <- runTaskOrDie parseTask - (isJust result) `shouldBe` True - - it "returns nothing when the timeout expires" $ do - let timeout = fromMicroseconds 1000 - let parseTask = parseToAST timeout tree_sitter_json largeBlob :: TaskEff (Maybe (AST [] Grammar)) - result <- runTaskOrDie parseTask - (isNothing result) `shouldBe` True - -toJSONSource :: Show a => a -> Source -toJSONSource = fromUTF8 . pack . show diff --git a/test/Rendering/TOC/Spec.hs b/test/Rendering/TOC/Spec.hs deleted file mode 100644 index a811b6a0dc..0000000000 --- a/test/Rendering/TOC/Spec.hs +++ /dev/null @@ -1,244 +0,0 @@ -{-# LANGUAGE DataKinds, MonoLocalBinds, TypeOperators #-} -module Rendering.TOC.Spec (spec) where - -import Analysis.TOCSummary -import Control.Effect -import Data.Aeson hiding (defaultOptions) -import Data.Bifunctor -import Data.Bifunctor.Join -import Data.Diff -import Data.Functor.Classes -import Data.Hashable.Lifted -import Data.Patch -import Data.Range -import Data.Location -import Data.Span -import Data.Sum -import Data.Term -import Data.Text (Text) -import Data.Text.Encoding (encodeUtf8) -import Diffing.Algorithm hiding (Diff) -import Diffing.Interpreter -import Prelude -import qualified Data.Syntax as Syntax -import qualified Data.Syntax.Declaration as Declaration -import Rendering.TOC -import Semantic.Config -import Semantic.Api (diffSummaryBuilder) -import Serializing.Format as Format - -import SpecHelpers - - -spec :: Spec -spec = parallel $ do - describe "tableOfContentsBy" $ do - prop "drops all nodes with the constant Nothing function" $ - \ diff -> tableOfContentsBy (const Nothing :: a -> Maybe ()) (diff :: Diff ListableSyntax () ()) `shouldBe` [] - - prop "produces no entries for identity diffs" $ - \ term -> tableOfContentsBy (Just . termFAnnotation) (diffTerms term (term :: Term ListableSyntax ())) `shouldBe` [] - - prop "produces inserted/deleted/replaced entries for relevant nodes within patches" $ - \ p -> tableOfContentsBy (Just . termFAnnotation) (patch deleting inserting replacing p) - `shouldBe` - patch (fmap Deleted) (fmap Inserted) (\ as bs -> Replaced (head bs) : fmap Deleted (tail as) <> fmap Inserted (tail bs)) (bimap (foldMap pure) (foldMap pure) (p :: Patch (Term ListableSyntax Int) (Term ListableSyntax Int))) - - prop "produces changed entries for relevant nodes containing irrelevant patches" $ - \ diff -> do - let diff' = merge (True, True) (inject [bimap (const False) (const False) (diff :: Diff ListableSyntax Bool Bool)]) - let toc = tableOfContentsBy (\ (n `In` _) -> if n then Just n else Nothing) diff' - toc `shouldBe` if null (diffPatches diff') then [] - else [Changed True] - - describe "diffTOC" $ do - it "blank if there are no methods" $ - diffTOC blankDiff `shouldBe` [ ] - - it "summarizes changed methods" $ do - sourceBlobs <- blobsForPaths (Both "ruby/toc/methods.A.rb" "ruby/toc/methods.B.rb") - diff <- runTaskOrDie $ diffWithParser rubyParser sourceBlobs - diffTOC diff `shouldBe` - [ TOCSummary "Method" "self.foo" (Span (Pos 1 1) (Pos 2 4)) "added" - , TOCSummary "Method" "bar" (Span (Pos 4 1) (Pos 6 4)) "modified" - , TOCSummary "Method" "baz" (Span (Pos 4 1) (Pos 5 4)) "removed" - ] - - xit "summarizes changed classes" $ do - sourceBlobs <- blobsForPaths (Both "ruby/toc/classes.A.rb" "ruby/toc/classes.B.rb") - diff <- runTaskOrDie $ diffWithParser rubyParser sourceBlobs - diffTOC diff `shouldBe` - [ TOCSummary "Class" "Baz" (Span (Pos 1 1) (Pos 2 4)) "removed" - , TOCSummary "Class" "Foo" (Span (Pos 1 1) (Pos 3 4)) "modified" - , TOCSummary "Class" "Bar" (Span (Pos 5 1) (Pos 6 4)) "added" - ] - - it "dedupes changes in same parent method" $ do - sourceBlobs <- blobsForPaths (Both "javascript/toc/duplicate-parent.A.js" "javascript/toc/duplicate-parent.B.js") - diff <- runTaskOrDie $ diffWithParser typescriptParser sourceBlobs - diffTOC diff `shouldBe` - [ TOCSummary "Function" "myFunction" (Span (Pos 1 1) (Pos 6 2)) "modified" ] - - it "dedupes similar methods" $ do - sourceBlobs <- blobsForPaths (Both "javascript/toc/erroneous-duplicate-method.A.js" "javascript/toc/erroneous-duplicate-method.B.js") - diff <- runTaskOrDie $ diffWithParser typescriptParser sourceBlobs - diffTOC diff `shouldBe` - [ TOCSummary "Function" "performHealthCheck" (Span (Pos 8 1) (Pos 29 2)) "modified" ] - - it "summarizes Go methods with receivers with special formatting" $ do - sourceBlobs <- blobsForPaths (Both "go/toc/method-with-receiver.A.go" "go/toc/method-with-receiver.B.go") - diff <- runTaskOrDie $ diffWithParser goParser sourceBlobs - diffTOC diff `shouldBe` - [ TOCSummary "Method" "(*apiClient) CheckAuth" (Span (Pos 3 1) (Pos 3 101)) "added" ] - - it "summarizes Ruby methods that start with two identifiers" $ do - sourceBlobs <- blobsForPaths (Both "ruby/toc/method-starts-with-two-identifiers.A.rb" "ruby/toc/method-starts-with-two-identifiers.B.rb") - diff <- runTaskOrDie $ diffWithParser rubyParser sourceBlobs - diffTOC diff `shouldBe` - [ TOCSummary "Method" "foo" (Span (Pos 1 1) (Pos 4 4)) "modified" ] - - it "handles unicode characters in file" $ do - sourceBlobs <- blobsForPaths (Both "ruby/toc/unicode.A.rb" "ruby/toc/unicode.B.rb") - diff <- runTaskOrDie $ diffWithParser rubyParser sourceBlobs - diffTOC diff `shouldBe` - [ TOCSummary "Method" "foo" (Span (Pos 6 1) (Pos 7 4)) "added" ] - - it "properly slices source blob that starts with a newline and has multi-byte chars" $ do - sourceBlobs <- blobsForPaths (Both "javascript/toc/starts-with-newline.js" "javascript/toc/starts-with-newline.js") - diff <- runTaskOrDie $ diffWithParser typescriptParser sourceBlobs - diffTOC diff `shouldBe` [] - - prop "inserts of methods and functions are summarized" . forAll ((not . isMethodOrFunction . Prelude.snd) `filterT` tiers) $ - \(name, body) -> - let diff = programWithInsert name body - in numTocSummaries diff `shouldBe` 1 - - prop "deletes of methods and functions are summarized" . forAll ((not . isMethodOrFunction . Prelude.snd) `filterT` tiers) $ - \(name, body) -> - let diff = programWithDelete name body - in numTocSummaries diff `shouldBe` 1 - - prop "replacements of methods and functions are summarized" . forAll ((not . isMethodOrFunction . Prelude.snd) `filterT` tiers) $ - \(name, body) -> - let diff = programWithReplace name body - in numTocSummaries diff `shouldBe` 1 - - prop "changes inside methods and functions are summarizied" . forAll (((&&) <$> not . isMethodOrFunction <*> isMeaningfulTerm) `filterT` tiers) $ - \body -> - let diff = programWithChange body - in numTocSummaries diff `shouldBe` 1 - - prop "other changes don't summarize" . forAll ((not . isMethodOrFunction) `filterT` tiers) $ - \body -> - let diff = programWithChangeOutsideFunction body - in numTocSummaries diff `shouldBe` 0 - - prop "unchanged diffs aren’t summarized" $ - \term -> diffTOC (diffTerms term (term :: Term')) `shouldBe` [] - - describe "TOCSummary" $ do - it "encodes modified summaries to JSON" $ do - let summary = TOCSummary "Method" "foo" (Span (Pos 1 1) (Pos 4 4)) "modified" - encode summary `shouldBe` "{\"span\":{\"start\":[1,1],\"end\":[4,4]},\"category\":\"Method\",\"term\":\"foo\",\"changeType\":\"modified\"}" - - it "encodes added summaries to JSON" $ do - let summary = TOCSummary "Method" "self.foo" (Span (Pos 1 1) (Pos 2 4)) "added" - encode summary `shouldBe` "{\"span\":{\"start\":[1,1],\"end\":[2,4]},\"category\":\"Method\",\"term\":\"self.foo\",\"changeType\":\"added\"}" - - describe "diff with ToCDiffRenderer'" $ do - it "produces JSON output" $ do - blobs <- blobsForPaths (Both "ruby/toc/methods.A.rb" "ruby/toc/methods.B.rb") - output <- runTaskOrDie (diffSummaryBuilder Format.JSON [blobs]) - runBuilder output `shouldBe` ("{\"files\":[{\"path\":\"test/fixtures/ruby/toc/methods.A.rb -> test/fixtures/ruby/toc/methods.B.rb\",\"language\":\"Ruby\",\"changes\":[{\"category\":\"Method\",\"term\":\"self.foo\",\"span\":{\"start\":{\"line\":1,\"column\":1},\"end\":{\"line\":2,\"column\":4}},\"changeType\":\"ADDED\"},{\"category\":\"Method\",\"term\":\"bar\",\"span\":{\"start\":{\"line\":4,\"column\":1},\"end\":{\"line\":6,\"column\":4}},\"changeType\":\"MODIFIED\"},{\"category\":\"Method\",\"term\":\"baz\",\"span\":{\"start\":{\"line\":4,\"column\":1},\"end\":{\"line\":5,\"column\":4}},\"changeType\":\"REMOVED\"}]}]}\n" :: ByteString) - - it "produces JSON output if there are parse errors" $ do - blobs <- blobsForPaths (Both "ruby/toc/methods.A.rb" "ruby/toc/methods.X.rb") - output <- runTaskOrDie (diffSummaryBuilder Format.JSON [blobs]) - runBuilder output `shouldBe` ("{\"files\":[{\"path\":\"test/fixtures/ruby/toc/methods.A.rb -> test/fixtures/ruby/toc/methods.X.rb\",\"language\":\"Ruby\",\"changes\":[{\"category\":\"Method\",\"term\":\"bar\",\"span\":{\"start\":{\"line\":1,\"column\":1},\"end\":{\"line\":2,\"column\":4}},\"changeType\":\"REMOVED\"},{\"category\":\"Method\",\"term\":\"baz\",\"span\":{\"start\":{\"line\":4,\"column\":1},\"end\":{\"line\":5,\"column\":4}},\"changeType\":\"REMOVED\"}],\"errors\":[{\"error\":\"expected end of input nodes, but got ParseError\",\"span\":{\"start\":{\"line\":1,\"column\":1},\"end\":{\"line\":2,\"column\":3}}}]}]}\n" :: ByteString) - - it "ignores anonymous functions" $ do - blobs <- blobsForPaths (Both "ruby/toc/lambda.A.rb" "ruby/toc/lambda.B.rb") - output <- runTaskOrDie (diffSummaryBuilder Format.JSON [blobs]) - runBuilder output `shouldBe` ("{\"files\":[{\"path\":\"test/fixtures/ruby/toc/lambda.A.rb -> test/fixtures/ruby/toc/lambda.B.rb\",\"language\":\"Ruby\"}]}\n" :: ByteString) - - it "summarizes Markdown headings" $ do - blobs <- blobsForPaths (Both "markdown/toc/headings.A.md" "markdown/toc/headings.B.md") - output <- runTaskOrDie (diffSummaryBuilder Format.JSON [blobs]) - runBuilder output `shouldBe` ("{\"files\":[{\"path\":\"test/fixtures/markdown/toc/headings.A.md -> test/fixtures/markdown/toc/headings.B.md\",\"language\":\"Markdown\",\"changes\":[{\"category\":\"Heading 1\",\"term\":\"Introduction\",\"span\":{\"start\":{\"line\":1,\"column\":1},\"end\":{\"line\":3,\"column\":16}},\"changeType\":\"REMOVED\"},{\"category\":\"Heading 2\",\"term\":\"Two\",\"span\":{\"start\":{\"line\":5,\"column\":1},\"end\":{\"line\":7,\"column\":4}},\"changeType\":\"MODIFIED\"},{\"category\":\"Heading 3\",\"term\":\"This heading is new\",\"span\":{\"start\":{\"line\":9,\"column\":1},\"end\":{\"line\":11,\"column\":10}},\"changeType\":\"ADDED\"},{\"category\":\"Heading 1\",\"term\":\"Final\",\"span\":{\"start\":{\"line\":13,\"column\":1},\"end\":{\"line\":14,\"column\":4}},\"changeType\":\"ADDED\"}]}]}\n" :: ByteString) - - -type Diff' = Diff ListableSyntax (Maybe Declaration) (Maybe Declaration) -type Term' = Term ListableSyntax (Maybe Declaration) - -numTocSummaries :: Diff' -> Int -numTocSummaries diff = length $ filter isValidSummary (diffTOC diff) - --- Return a diff where body is inserted in the expressions of a function. The function is present in Both sides of the diff. -programWithChange :: Term' -> Diff' -programWithChange body = merge (Nothing, Nothing) (inject [ function' ]) - where - function' = merge (Just (FunctionDeclaration "foo" mempty lowerBound Ruby), Just (FunctionDeclaration "foo" mempty lowerBound Ruby)) (inject (Declaration.Function [] name' [] (merge (Nothing, Nothing) (inject [ inserting body ])))) - name' = merge (Nothing, Nothing) (inject (Syntax.Identifier (name "foo"))) - --- Return a diff where term is inserted in the program, below a function found on Both sides of the diff. -programWithChangeOutsideFunction :: Term' -> Diff' -programWithChangeOutsideFunction term = merge (Nothing, Nothing) (inject [ function', term' ]) - where - function' = merge (Nothing, Nothing) (inject (Declaration.Function [] name' [] (merge (Nothing, Nothing) (inject [])))) - name' = merge (Nothing, Nothing) (inject (Syntax.Identifier (name "foo"))) - term' = inserting term - -programWithInsert :: Text -> Term' -> Diff' -programWithInsert name body = programOf $ inserting (functionOf name body) - -programWithDelete :: Text -> Term' -> Diff' -programWithDelete name body = programOf $ deleting (functionOf name body) - -programWithReplace :: Text -> Term' -> Diff' -programWithReplace name body = programOf $ replacing (functionOf name body) (functionOf (name <> "2") body) - -programOf :: Diff' -> Diff' -programOf diff = merge (Nothing, Nothing) (inject [ diff ]) - -functionOf :: Text -> Term' -> Term' -functionOf n body = termIn (Just (FunctionDeclaration n mempty lowerBound Unknown)) (inject (Declaration.Function [] name' [] (termIn Nothing (inject [body])))) - where - name' = termIn Nothing (inject (Syntax.Identifier (name n))) - --- Filter tiers for terms that we consider "meaniningful" in TOC summaries. -isMeaningfulTerm :: Term ListableSyntax a -> Bool -isMeaningfulTerm a - | Just (_:_) <- project (termOut a) = False - | Just [] <- project (termOut a) = False - | otherwise = True - --- Filter tiers for terms if the Syntax is a Method or a Function. -isMethodOrFunction :: Term' -> Bool -isMethodOrFunction a - | Just Declaration.Method{} <- project (termOut a) = True - | Just Declaration.Function{} <- project (termOut a) = True - | any isJust (foldMap (:[]) a) = True - | otherwise = False - -blobsForPaths :: Both FilePath -> IO BlobPair -blobsForPaths = readFilePathPair . fmap ("test/fixtures" ) - -blankDiff :: Diff' -blankDiff = merge (Nothing, Nothing) (inject [ inserting (termIn Nothing (inject (Syntax.Identifier (name "\"a\"")))) ]) - --- Diff helpers -diffWithParser :: ( Eq1 syntax - , Show1 syntax - , Traversable syntax - , Diffable syntax - , HasDeclaration syntax - , Hashable1 syntax - , Member Distribute sig - , Member Task sig - , Carrier sig m - , Monad m - ) - => Parser (Term syntax Location) - -> BlobPair - -> m (Diff syntax (Maybe Declaration) (Maybe Declaration)) -diffWithParser parser blobs = distributeFor blobs (\ blob -> parse parser blob >>= decorate (declarationAlgebra blob)) >>= SpecHelpers.diff . runJoin diff --git a/test/Reprinting/Spec.hs b/test/Reprinting/Spec.hs deleted file mode 100644 index b138e6c4cf..0000000000 --- a/test/Reprinting/Spec.hs +++ /dev/null @@ -1,71 +0,0 @@ -{-# LANGUAGE GADTs, OverloadedLists, TypeOperators #-} - -module Reprinting.Spec where - -import SpecHelpers hiding (inject, project) - -import Data.Foldable -import Data.Functor.Foldable (cata, embed) -import qualified Data.Machine as Machine - -import Control.Rewriting hiding (context) -import Data.Algebra -import Data.Blob -import qualified Data.Language as Language -import Data.Reprinting.Scope -import Data.Reprinting.Token -import Data.Sum -import qualified Data.Syntax.Literal as Literal -import Language.JSON.PrettyPrint -import Language.Python.PrettyPrint -import Language.Ruby.PrettyPrint -import Reprinting.Pipeline -import Reprinting.Tokenize -import Semantic.IO - -increaseNumbers :: (Literal.Float :< fs, Apply Functor fs) => Rule (Term (Sum fs) History) -increaseNumbers = do - (Literal.Float c) <- target >>= guardTerm - create (Literal.Float (c <> "0")) - -spec :: Spec -spec = describe "reprinting" $ do - context "JSON" $ do - let path = "test/fixtures/javascript/reprinting/map.json" - (src, tree) <- runIO $ do - src <- blobSource <$> readBlobFromFile' (File path Language.JSON) - tree <- parseFile jsonParser path - pure (src, tree) - - describe "tokenization" $ do - - it "should pass over a pristine tree" $ do - let tagged = mark Unmodified tree - let toks = Machine.run $ tokenizing src tagged - toks `shouldSatisfy` not . null - head toks `shouldSatisfy` isControl - last toks `shouldSatisfy` isChunk - - it "should emit control tokens but only 1 chunk for a wholly-modified tree" $ do - let toks = Machine.run $ tokenizing src (mark Refactored tree) - for_ @[] [List, Hash] $ \t -> do - toks `shouldSatisfy` elem (Control (Enter t)) - toks `shouldSatisfy` elem (Control (Exit t)) - - describe "pipeline" $ do - - it "should roundtrip exactly over a pristine tree" $ do - let tagged = mark Unmodified tree - let printed = runReprinter src defaultJSONPipeline tagged - printed `shouldBe` Right src - - it "should roundtrip exactly over a wholly-modified tree" $ do - let tagged = mark Refactored tree - let printed = runReprinter src defaultJSONPipeline tagged - printed `shouldBe` Right src - - it "should be able to parse the output of a refactor" $ do - let (Just tagged) = rewrite (mark Unmodified tree) (topDownAny increaseNumbers) - let (Right printed) = runReprinter src defaultJSONPipeline tagged - tree' <- runTaskOrDie (parse jsonParser (makeBlob printed path Language.JSON mempty)) - length tree' `shouldSatisfy` (/= 0) diff --git a/test/Rewriting/Go/Spec.hs b/test/Rewriting/Go/Spec.hs deleted file mode 100644 index 54a9bcb45b..0000000000 --- a/test/Rewriting/Go/Spec.hs +++ /dev/null @@ -1,42 +0,0 @@ -{-# LANGUAGE TypeOperators #-} - -module Rewriting.Go.Spec (spec) where - -import Control.Rewriting -import Data.Abstract.Module -import Data.List -import Data.Sum -import qualified Data.Syntax.Declaration as Decl -import qualified Data.Syntax.Literal as Lit -import qualified Data.Syntax.Statement as Stmt -import Data.Text (Text) -import SpecHelpers - --- This gets the Text contents of all integers -integerMatcher :: (Lit.Integer :< fs) => Rewrite (Term (Sum fs) ann) Text -integerMatcher = enter Lit.integerContent - --- This matches all for-loops with its index variable new variable bound to 0, --- e.g. `for i := 0; i < 10; i++` -loopMatcher :: ( Stmt.For :< fs - , Stmt.Assignment :< fs - , Lit.Integer :< fs) - => Rule (Term (Sum fs) ann) -loopMatcher = target <* go where - go = enter Stmt.forBefore - >>> enter Stmt.assignmentValue - >>> enter Lit.integerContent - >>> ensure (== "0") - - -spec :: Spec -spec = describe "recursively" $ do - it "extracts integers" $ do - parsed <- parseFile goParser "test/fixtures/go/matching/integers.go" - let matched = recursively integerMatcher parsed - sort matched `shouldBe` ["1", "2", "3"] - - it "counts for loops" $ do - parsed <- parseFile goParser "test/fixtures/go/matching/for.go" - let matched = recursively @[] @(Term _ _) loopMatcher parsed - length matched `shouldBe` 2 diff --git a/test/Rewriting/JSON/Spec.hs b/test/Rewriting/JSON/Spec.hs deleted file mode 100644 index 284f03523f..0000000000 --- a/test/Rewriting/JSON/Spec.hs +++ /dev/null @@ -1,60 +0,0 @@ -{-# LANGUAGE TypeOperators, TypeFamilies #-} - -module Rewriting.JSON.Spec (spec) where - -import Prelude hiding (id, (.)) - -import SpecHelpers - -import qualified Data.ByteString as B -import Data.Either -import Data.Text (Text) - -import Control.Category -import Control.Rewriting as Rewriting -import Data.History as History -import qualified Data.Source as Source -import Data.Sum -import qualified Data.Syntax.Literal as Literal -import Language.JSON.PrettyPrint -import Reprinting.Pipeline - --- Adds a "hi": "bye" key-value pair to any empty Hash. -onTrees :: ( Literal.TextElement :< syn - , Literal.Hash :< syn - , Literal.KeyValue :< syn - , Apply Functor syn - , term ~ Term (Sum syn) History - ) => Rule term -onTrees = do - Literal.Hash els <- Rewriting.target >>= guardTerm - guard (null els) - k <- create $ Literal.TextElement "\"hi\"" - v <- create $ Literal.TextElement "\"bye\"" - pair <- create $ (Literal.KeyValue k v) - create (Literal.Hash (pair : els)) - --- Matches only "hi" string literals. -isHi :: ( Literal.TextElement :< fs - ) => Rewrite (Term (Sum fs) History) Text -isHi = enter Literal.textElementContent - >>> ensure (== "\"hi\"") - -spec :: Spec -spec = describe "rewriting" $ do - let path = "test/fixtures/json/rewriting/add_keys.json" - - bytes <- runIO $ Source.fromUTF8 <$> B.readFile path - - refactored <- runIO $ do - json <- parseFile jsonParser path - let result = rewrite @Maybe (History.mark Unmodified json) (topDownAny onTrees) - maybe (fail "rewrite failed") pure result - - it "should add keys to JSON values" $ do - length (recursively @[] isHi refactored) `shouldBe` 1 - - it "should round-trip correctly" $ do - let res = runReprinter bytes defaultJSONPipeline refactored - expected <- Source.fromUTF8 <$> B.readFile "test/fixtures/json/rewriting/add_keys_expected.json" - res `shouldBe` Right expected diff --git a/test/Rewriting/Python/Spec.hs b/test/Rewriting/Python/Spec.hs deleted file mode 100644 index 6a9a9ea94c..0000000000 --- a/test/Rewriting/Python/Spec.hs +++ /dev/null @@ -1,39 +0,0 @@ -{-# LANGUAGE TypeFamilies, TypeOperators #-} - -module Rewriting.Python.Spec (spec) where - -import Control.Arrow -import Control.Rewriting -import Data.Abstract.Module -import Data.List -import Data.Sum -import qualified Data.Syntax.Declaration as Decl -import qualified Data.Syntax.Literal as Lit -import qualified Data.Syntax.Statement as Stmt -import Data.Text (Text) -import SpecHelpers - --- This gets the Text contents of all integers -docstringMatcher :: ( Decl.Function :< fs - , [] :< fs - , Lit.TextElement :< fs - , term ~ Term (Sum fs) ann - ) => Rewrite term (TermF Decl.Function ann term) -docstringMatcher = - narrowF <* (enter Decl.functionBody - >>> narrow @[] - >>> mhead - >>> narrow @Lit.TextElement - >>> ensure Lit.isTripleQuoted) - -spec :: Spec -spec = describe "matching/python" $ do - it "matches top-level docstrings" $ do - parsed <- parseFile pythonParser "test/fixtures/python/matching/docstrings.py" - let matched = recursively @[] docstringMatcher parsed - length matched `shouldBe` 2 - - it "matches docstrings recursively" $ do - parsed <- parseFile pythonParser "test/fixtures/python/matching/docstrings_nested.py" - let matched = recursively @[] docstringMatcher parsed - length matched `shouldBe` 3 diff --git a/test/Semantic/CLI/Spec.hs b/test/Semantic/CLI/Spec.hs deleted file mode 100644 index cfc46ea721..0000000000 --- a/test/Semantic/CLI/Spec.hs +++ /dev/null @@ -1,55 +0,0 @@ -module Semantic.CLI.Spec (spec) where - -import Control.Monad (when) -import qualified Data.ByteString as B -import Data.ByteString.Builder -import Data.Foldable (for_) -import Semantic.Api hiding (File, Blob, BlobPair) -import Semantic.CLI -import Semantic.IO -import Semantic.Task -import Serializing.Format - -import SpecHelpers - - -spec :: Spec -spec = parallel $ do - describe "parseDiffBuilder" $ - for_ diffFixtures $ \ (diffRenderer, runDiff, files, expected) -> - it ("renders to " <> diffRenderer <> " with files " <> show files) $ do - output <- runTaskOrDie $ readBlobPairs (Right files) >>= runDiff - runBuilder output `shouldBe'` expected - - describe "parseTermBuilder" $ - for_ parseFixtures $ \ (format, runParse, files, expected) -> - it ("renders to " <> format <> " with files " <> show files) $ do - output <- runTaskOrDie $ readBlobs (FilesFromPaths files) >>= runParse - runBuilder output `shouldBe'` expected - where - shouldBe' actual' expectedFile = do - let actual = verbatim actual' - expected <- verbatim <$> B.readFile expectedFile - actual `shouldBe` expected - -parseFixtures :: [(String, [Blob] -> TaskEff Builder, [File], FilePath)] -parseFixtures = - [ ("s-expression", parseTermBuilder TermSExpression, path, "test/fixtures/ruby/corpus/and-or.parseA.txt") - , ("json", parseTermBuilder TermJSONTree, path, prefix "parse-tree.json") - , ("json", parseTermBuilder TermJSONTree, path', prefix "parse-trees.json") - , ("json", parseTermBuilder TermJSONTree, [], prefix "parse-tree-empty.json") - , ("symbols", parseSymbolsBuilder Serializing.Format.JSON, path'', prefix "parse-tree.symbols.json") - ] - where path = [File "test/fixtures/ruby/corpus/and-or.A.rb" Ruby] - path' = [File "test/fixtures/ruby/corpus/and-or.A.rb" Ruby, File "test/fixtures/ruby/corpus/and-or.B.rb" Ruby] - path'' = [File "test/fixtures/ruby/corpus/method-declaration.A.rb" Ruby] - prefix = "test/fixtures/cli" - -diffFixtures :: [(String, [BlobPair] -> TaskEff Builder, [Both File], FilePath)] -diffFixtures = - [ ("json diff", parseDiffBuilder DiffJSONTree, pathMode, prefix "diff-tree.json") - , ("s-expression diff", parseDiffBuilder DiffSExpression, pathMode, "test/fixtures/ruby/corpus/method-declaration.diffA-B.txt") - , ("toc summaries diff", diffSummaryBuilder Serializing.Format.JSON, pathMode, prefix "diff-tree.toc.json") - ] - where pathMode = [Both (File "test/fixtures/ruby/corpus/method-declaration.A.rb" Ruby) (File "test/fixtures/ruby/corpus/method-declaration.B.rb" Ruby)] - prefix = "test/fixtures/cli" diff --git a/test/Semantic/IO/Spec.hs b/test/Semantic/IO/Spec.hs deleted file mode 100644 index baef0f3a8b..0000000000 --- a/test/Semantic/IO/Spec.hs +++ /dev/null @@ -1,113 +0,0 @@ -module Semantic.IO.Spec (spec) where - -import Prelude hiding (readFile) - -import Control.Monad.IO.Class -import Data.List -import System.Directory -import System.Exit (ExitCode (..)) -import System.IO.Temp -import System.Process - -import Data.Blob -import Data.Handle -import SpecHelpers hiding (readFile) -import qualified Semantic.Git as Git - - -spec :: Spec -spec = parallel $ do - describe "readBlobsFromGitRepo" $ do - hasGit <- runIO $ isJust <$> findExecutable "git" - when hasGit . it "should read from a git directory" $ do - -- This temporary directory will be cleaned after use. - blobs <- liftIO . withSystemTempDirectory "semantic-temp-git-repo" $ \dir -> do - let commands = [ "cd " <> dir - , "git init" - , "touch foo.py bar.rb" - , "git add foo.py bar.rb" - , "git config user.name 'Test'" - , "git config user.email 'test@test.test'" - , "git commit -am 'test commit'" - ] - exit <- system (intercalate " && " commands) - when (exit /= ExitSuccess) (fail ("Couldn't run git properly in dir " <> dir)) - readBlobsFromGitRepo (dir ".git") (Git.OID "HEAD") [] - let files = sortOn fileLanguage (blobFile <$> blobs) - files `shouldBe` [ File "foo.py" Python - , File "bar.rb" Ruby - ] - - describe "readFile" $ do - it "returns a blob for extant files" $ do - Just blob <- readBlobFromFile (File "semantic.cabal" Unknown) - blobPath blob `shouldBe` "semantic.cabal" - - it "throws for absent files" $ do - readBlobFromFile (File "this file should not exist" Unknown) `shouldThrow` anyIOException - - describe "readBlobPairsFromHandle" $ do - let a = sourceBlob "method.rb" Ruby "def foo; end" - let b = sourceBlob "method.rb" Ruby "def bar(x); end" - it "returns blobs for valid JSON encoded diff input" $ do - putStrLn "step 1" - blobs <- blobsFromFilePath "test/fixtures/cli/diff.json" - putStrLn "done" - blobs `shouldBe` [Diffing a b] - - it "returns blobs when there's no before" $ do - blobs <- blobsFromFilePath "test/fixtures/cli/diff-no-before.json" - blobs `shouldBe` [Inserting b] - - it "returns blobs when there's null before" $ do - blobs <- blobsFromFilePath "test/fixtures/cli/diff-null-before.json" - blobs `shouldBe` [Inserting b] - - it "returns blobs when there's no after" $ do - blobs <- blobsFromFilePath "test/fixtures/cli/diff-no-after.json" - blobs `shouldBe` [Deleting a] - - it "returns blobs when there's null after" $ do - blobs <- blobsFromFilePath "test/fixtures/cli/diff-null-after.json" - blobs `shouldBe` [Deleting a] - - - it "returns blobs for unsupported language" $ do - h <- openFileForReading "test/fixtures/cli/diff-unsupported-language.json" - blobs <- readBlobPairsFromHandle h - let b' = sourceBlob "test.kt" Unknown "fun main(args: Array) {\nprintln(\"hi\")\n}\n" - blobs `shouldBe` [Inserting b'] - - it "detects language based on filepath for empty language" $ do - blobs <- blobsFromFilePath "test/fixtures/cli/diff-empty-language.json" - blobs `shouldBe` [Diffing a b] - - it "throws on blank input" $ do - h <- openFileForReading "test/fixtures/cli/blank.json" - readBlobPairsFromHandle h `shouldThrow` (== ExitFailure 1) - - it "throws if language field not given" $ do - h <- openFileForReading "test/fixtures/cli/diff-no-language.json" - readBlobsFromHandle h `shouldThrow` (== ExitFailure 1) - - it "throws if null on before and after" $ do - h <- openFileForReading "test/fixtures/cli/diff-null-both-sides.json" - readBlobPairsFromHandle h `shouldThrow` (== ExitFailure 1) - - describe "readBlobsFromHandle" $ do - it "returns blobs for valid JSON encoded parse input" $ do - h <- openFileForReading "test/fixtures/cli/parse.json" - blobs <- readBlobsFromHandle h - let a = sourceBlob "method.rb" Ruby "def foo; end" - blobs `shouldBe` [a] - - it "throws on blank input" $ do - h <- openFileForReading "test/fixtures/cli/blank.json" - readBlobsFromHandle h `shouldThrow` (== ExitFailure 1) - - where blobsFromFilePath path = do - h <- openFileForReading path - putStrLn "got handle" - blobs <- readBlobPairsFromHandle h - putStrLn "got blobs" - pure blobs diff --git a/test/Semantic/Spec.hs b/test/Semantic/Spec.hs deleted file mode 100644 index 76b53738ab..0000000000 --- a/test/Semantic/Spec.hs +++ /dev/null @@ -1,46 +0,0 @@ -module Semantic.Spec (spec) where - -import Data.Diff -import Data.Patch -import Semantic.Api hiding (Blob) -import Semantic.Git -import System.Exit - -import SpecHelpers - - -- we need some lenses here, oof -setBlobLanguage :: Language -> Blob -> Blob -setBlobLanguage lang b = b { blobFile = (blobFile b) { fileLanguage = lang }} - -spec :: Spec -spec = parallel $ do - describe "parseBlob" $ do - it "returns error if given an unknown language (json)" $ do - output <- fmap runBuilder . runTaskOrDie $ parseTermBuilder TermJSONTree [ setBlobLanguage Unknown methodsBlob ] - output `shouldBe` "{\"trees\":[{\"path\":\"methods.rb\",\"error\":\"NoLanguageForBlob \\\"methods.rb\\\"\",\"language\":\"Unknown\"}]}\n" - - it "throws if given an unknown language for sexpression output" $ do - runTaskOrDie (parseTermBuilder TermSExpression [setBlobLanguage Unknown methodsBlob]) `shouldThrow` (== ExitFailure 1) - - it "renders with the specified renderer" $ do - output <- fmap runBuilder . runTaskOrDie $ parseTermBuilder TermSExpression [methodsBlob] - output `shouldBe` "(Statements\n (Method\n (Empty)\n (Identifier)\n (Statements)))\n" - - describe "git ls-tree parsing" $ do - it "parses a git output string" $ do - let input = "100644 tree abcdef\t/this/is/the/path" - let expected = Right $ TreeEntry NormalMode TreeObject (OID "abcdef") "/this/is/the/path" - parseEntry input `shouldBe` expected - - it "allows whitespace in the path" $ do - let input = "100644 tree 12345\t/this\n/is\t/the /path\r" - let expected = Right $ TreeEntry NormalMode TreeObject (OID "12345") "/this\n/is\t/the /path\r" - parseEntry input `shouldBe` expected - - it "parses many outputs separated by \\NUL" $ do - let input = "100644 tree abcdef\t/this/is/the/path\NUL120000 blob 17776\t/dev/urandom\NUL\n" - let expected = [ TreeEntry NormalMode TreeObject (OID "abcdef") "/this/is/the/path", TreeEntry SymlinkMode BlobObject (OID "17776") "/dev/urandom"] - parseEntries input `shouldBe` expected - - where - methodsBlob = makeBlob "def foo\nend\n" "methods.rb" Ruby mempty diff --git a/test/Semantic/Stat/Spec.hs b/test/Semantic/Stat/Spec.hs deleted file mode 100644 index 47d9bfd0d1..0000000000 --- a/test/Semantic/Stat/Spec.hs +++ /dev/null @@ -1,87 +0,0 @@ -module Semantic.Stat.Spec (spec) where - -import Control.Exception -import Network.Socket hiding (recv) -import Network.Socket.ByteString -import Semantic.Telemetry.Stat -import Semantic.Config -import System.Environment - -import SpecHelpers - -withSocketPair :: ((Socket, Socket) -> IO c) -> IO c -withSocketPair = bracket create release - where create = socketPair AF_UNIX Datagram defaultProtocol - release (client, server) = close client >> close server - -withEnvironment :: String -> String -> (() -> IO ()) -> IO () -withEnvironment key value = bracket (setEnv key value) (const (unsetEnv key)) - --- NOTE: These cannot easily run in parallel because we test things like --- setting/unsetting the environment. -spec :: Spec -spec = do - describe "defaultStatsClient" $ do - it "sets appropriate defaults" $ do - StatsClient{..} <- defaultStatsClient - statsClientNamespace `shouldBe` "semantic" - statsClientUDPHost `shouldBe` "127.0.0.1" - statsClientUDPPort `shouldBe` "28125" - - around (withEnvironment "STATS_ADDR" "localhost:8125") $ - it "takes STATS_ADDR from environment" $ do - StatsClient{..} <- defaultStatsClient - statsClientUDPHost `shouldBe` "localhost" - statsClientUDPPort `shouldBe` "8125" - - around (withEnvironment "STATS_ADDR" "localhost") $ - it "handles STATS_ADDR with just hostname" $ do - StatsClient{..} <- defaultStatsClient - statsClientUDPHost `shouldBe` "localhost" - statsClientUDPPort `shouldBe` "28125" - - around (withEnvironment "DOGSTATSD_HOST" "0.0.0.0") $ - it "takes DOGSTATSD_HOST from environment" $ do - StatsClient{..} <- defaultStatsClient - statsClientUDPHost `shouldBe` "0.0.0.0" - statsClientUDPPort `shouldBe` "28125" - - describe "renderDatagram" $ do - let key = "app.metric" - - describe "counters" $ do - it "renders increment" $ - renderDatagram "" (increment key []) `shouldBe` "app.metric:1|c" - it "renders decrement" $ - renderDatagram "" (decrement key []) `shouldBe` "app.metric:-1|c" - it "renders count" $ - renderDatagram "" (count key 8 []) `shouldBe` "app.metric:8|c" - - it "renders statsClientNamespace" $ - renderDatagram "pre" (increment key []) `shouldBe` "pre.app.metric:1|c" - - describe "tags" $ do - it "renders a tag" $ do - let inc = increment key [("key", "value")] - renderDatagram "" inc `shouldBe` "app.metric:1|c|#key:value" - it "renders a tag without value" $ do - let inc = increment key [("a", "")] - renderDatagram "" inc `shouldBe` "app.metric:1|c|#a" - it "renders tags" $ do - let inc = increment key [("key", "value"), ("a", "true")] - renderDatagram "" inc `shouldBe` "app.metric:1|c|#key:value,a:true" - it "renders tags without value" $ do - let inc = increment key [("key", "value"), ("a", "")] - renderDatagram "" inc `shouldBe` "app.metric:1|c|#key:value,a" - - describe "sendStat" $ - it "delivers datagram" $ do - client@StatsClient{..} <- defaultStatsClient - withSocketPair $ \(clientSoc, serverSoc) -> do - sendStat client { statsClientUDPSocket = clientSoc } (increment "app.metric" []) - info <- recv serverSoc 1024 - info `shouldBe` "semantic.app.metric:1|c" - --- Defaults are all driven by defaultConfig. -defaultStatsClient :: IO StatsClient -defaultStatsClient = defaultConfig defaultOptions >>= \Config{..} -> statsClient configStatsHost configStatsPort configAppName diff --git a/test/Spec.hs b/test/Spec.hs deleted file mode 100644 index 3497d6bd0b..0000000000 --- a/test/Spec.hs +++ /dev/null @@ -1,79 +0,0 @@ -module Main where - -import qualified Analysis.Go.Spec -import qualified Analysis.PHP.Spec -import qualified Analysis.Python.Spec -import qualified Analysis.Ruby.Spec -import qualified Analysis.TypeScript.Spec -import qualified Assigning.Assignment.Spec -import qualified Control.Abstract.Evaluator.Spec -import qualified Data.Diff.Spec -import qualified Data.Abstract.Name.Spec -import qualified Data.Abstract.Path.Spec -import qualified Data.Functor.Classes.Generic.Spec -import qualified Data.Graph.Spec -import qualified Data.Range.Spec -import qualified Data.Scientific.Spec -import qualified Data.Semigroup.App.Spec -import qualified Data.Source.Spec -import qualified Data.Term.Spec -import qualified Diffing.Algorithm.RWS.Spec -import qualified Diffing.Algorithm.SES.Spec -import qualified Diffing.Interpreter.Spec -import qualified Graphing.Calls.Spec -import qualified Integration.Spec -import qualified Numeric.Spec -import qualified Parsing.Spec -import qualified Rendering.TOC.Spec -import qualified Reprinting.Spec -import qualified Rewriting.Go.Spec -import qualified Rewriting.JSON.Spec -import qualified Rewriting.Python.Spec -import qualified Tags.Spec -import qualified Semantic.Spec -import qualified Semantic.CLI.Spec -import qualified Semantic.IO.Spec -import qualified Semantic.Stat.Spec -import Semantic.Config (defaultOptions, optionsLogLevel) -import Semantic.Task (withOptions, TaskSession(..)) -import Test.Hspec - -main :: IO () -main = do - withOptions defaultOptions { optionsLogLevel = Nothing } $ \ config logger statter -> hspec $ do - let args = TaskSession config "-" False logger statter - describe "Semantic.Stat" Semantic.Stat.Spec.spec - parallel $ do - describe "Analysis.Go" (Analysis.Go.Spec.spec args) - describe "Analysis.PHP" (Analysis.PHP.Spec.spec args) - describe "Analysis.Python" (Analysis.Python.Spec.spec args) - describe "Analysis.Ruby" (Analysis.Ruby.Spec.spec args) - describe "Analysis.TypeScript" (Analysis.TypeScript.Spec.spec args) - describe "Assigning.Assignment" Assigning.Assignment.Spec.spec - describe "Control.Abstract.Evaluator" Control.Abstract.Evaluator.Spec.spec - describe "Data.Diff" Data.Diff.Spec.spec - describe "Data.Graph" Data.Graph.Spec.spec - describe "Data.Abstract.Path" Data.Abstract.Path.Spec.spec - describe "Data.Abstract.Name" Data.Abstract.Name.Spec.spec - describe "Data.Functor.Classes.Generic" Data.Functor.Classes.Generic.Spec.spec - describe "Data.Range" Data.Range.Spec.spec - describe "Data.Scientific" Data.Scientific.Spec.spec - describe "Data.Semigroup.App" Data.Semigroup.App.Spec.spec - describe "Data.Source" Data.Source.Spec.spec - describe "Data.Term" Data.Term.Spec.spec - describe "Diffing.Algorithm.RWS" Diffing.Algorithm.RWS.Spec.spec - describe "Diffing.Algorithm.SES" Diffing.Algorithm.SES.Spec.spec - describe "Diffing.Interpreter" Diffing.Interpreter.Spec.spec - describe "Graphing.Calls" Graphing.Calls.Spec.spec - describe "Numeric" Numeric.Spec.spec - describe "Rendering.TOC" Rendering.TOC.Spec.spec - describe "Reprinting.Spec" Reprinting.Spec.spec - describe "Rewriting.Go" Rewriting.Go.Spec.spec - describe "Rewriting.JSON" Rewriting.JSON.Spec.spec - describe "Rewriting.Python" Rewriting.Python.Spec.spec - describe "Tags.Spec" Tags.Spec.spec - describe "Semantic" Semantic.Spec.spec - describe "Semantic.CLI" Semantic.CLI.Spec.spec - describe "Semantic.IO" Semantic.IO.Spec.spec - describe "Integration" (Integration.Spec.spec args) - describe "Parsing" Parsing.Spec.spec diff --git a/test/SpecHelpers.hs b/test/SpecHelpers.hs deleted file mode 100644 index 992f3524ed..0000000000 --- a/test/SpecHelpers.hs +++ /dev/null @@ -1,211 +0,0 @@ -{-# OPTIONS_GHC -fno-warn-orphans #-} - -module SpecHelpers -( module X -, runBuilder -, diffFilePaths -, parseFilePath -, parseTestFile -, readFilePathPair -, runTaskOrDie -, TaskSession(..) -, testEvaluating -, verbatim -, Verbatim(..) -, toList -, Config -, LogQueue -, StatQueue -, lookupDeclaration -, lookupMembers -, EdgeLabel(..) -) where - -import Control.Abstract hiding (lookupDeclaration) -import Data.Abstract.ScopeGraph (EdgeLabel(..)) -import qualified Data.Abstract.ScopeGraph as ScopeGraph -import qualified Data.Abstract.Heap as Heap -import Control.Arrow ((&&&)) -import Control.Effect.Trace as X (runTraceByIgnoring, runTraceByReturning) -import Control.Monad ((>=>)) -import Data.Traversable as X (for) -import Data.Abstract.Address.Precise as X -import Data.Abstract.Evaluatable hiding (lookupDeclaration) -import Data.Abstract.FreeVariables as X -import Data.Abstract.Module as X -import Data.Abstract.ModuleTable as X hiding (lookup) -import Data.Abstract.Name as X -import Data.Abstract.Value.Concrete (Value(..), ValueError, runValueError) -import Data.Bifunctor (first) -import Data.Blob as X -import Data.Blob.IO as X -import Data.ByteString.Builder (toLazyByteString) -import Data.ByteString.Lazy (toStrict) -import Data.Project as X -import Data.Proxy as X -import Data.Foldable (toList) -import Data.Functor.Listable as X -import Data.Language as X -import Data.List.NonEmpty as X (NonEmpty(..)) -import Data.Range as X -import Data.Semilattice.Lower as X -import Data.Source as X -import Data.Span as X hiding (HasSpan(..)) -import Data.String -import Data.Sum -import Data.Term as X -import qualified Data.Text as T -import qualified Data.Text.Encoding as T -import Parsing.Parser as X -import Semantic.Task as X hiding (parsePackage) -import Semantic.Util as X -import Semantic.Graph (runHeap, runScopeGraph) -import System.FilePath as X -import Debug.Trace as X (traceShowM, traceM) - -import Data.ByteString as X (ByteString) -import Data.Functor.Both as X (Both (Both), runBothWith) -import Data.Maybe as X -import Data.Monoid as X (Monoid(..), First(..), Last(..)) -import Data.Semigroup as X (Semigroup(..)) -import Control.Monad as X - -import Test.Hspec as X (Spec, SpecWith, context, describe, it, xit, parallel, pendingWith, around, runIO) -import Test.Hspec.Expectations.Pretty as X -import Test.Hspec.LeanCheck as X -import Test.LeanCheck as X - -import qualified Data.ByteString as B -import qualified Data.Set as Set -import Data.Set (Set) -import qualified Semantic.IO as IO -import Semantic.Config (Config(..), optionsLogLevel) -import Semantic.Telemetry (LogQueue, StatQueue) -import Semantic.Api hiding (File, Blob, BlobPair) -import System.Exit (die) -import Control.Exception (displayException) - -runBuilder = toStrict . toLazyByteString - --- | This orphan instance is so we don't have to insert @name@ calls --- in dozens and dozens of environment specs. -instance IsString Name where - fromString = X.name . fromString - --- | Returns an s-expression formatted diff for the specified FilePath pair. -diffFilePaths :: TaskSession -> Both FilePath -> IO ByteString -diffFilePaths session paths = readFilePathPair paths >>= runTask session . parseDiffBuilder @[] DiffSExpression . pure >>= either (die . displayException) (pure . runBuilder) - --- | Returns an s-expression parse tree for the specified FilePath. -parseFilePath :: TaskSession -> FilePath -> IO (Either SomeException ByteString) -parseFilePath session path = do - blob <- readBlobFromFile (fileForPath path) - res <- runTask session $ parseTermBuilder TermSExpression (toList blob) - pure (runBuilder <$> res) - --- | Read two files to a BlobPair. -readFilePathPair :: Both FilePath -> IO BlobPair -readFilePathPair paths = let paths' = fmap fileForPath paths in - runBothWith readFilePair paths' - -parseTestFile :: Parser term -> FilePath -> IO (Blob, term) -parseTestFile parser path = runTaskOrDie $ do - blob <- readBlob (fileForPath path) - term <- parse parser blob - pure (blob, term) - --- Run a Task and call `die` if it returns an Exception. -runTaskOrDie :: TaskEff a -> IO a -runTaskOrDie task = runTaskWithOptions defaultOptions { optionsLogLevel = Nothing } task >>= either (die . displayException) pure - -type TestEvaluatingC term - = ResumableC (BaseError (AddressError Precise (Val term))) - ( ResumableC (BaseError (ValueError term Precise)) - ( ResumableC (BaseError ResolutionError) - ( ResumableC (BaseError (EvalError term Precise (Val term))) - ( ResumableC (BaseError (HeapError Precise)) - ( ResumableC (BaseError (ScopeError Precise)) - ( ResumableC (BaseError (UnspecializedError Precise (Val term))) - ( ResumableC (BaseError (LoadError Precise (Val term))) - ( StateC (Heap Precise Precise (Val term)) - ( StateC (ScopeGraph Precise) - ( FreshC - ( TraceByIgnoringC - ( LiftC IO)))))))))))) -type TestEvaluatingErrors term - = '[ BaseError (AddressError Precise (Val term)) - , BaseError (ValueError term Precise) - , BaseError ResolutionError - , BaseError (EvalError term Precise (Val term)) - , BaseError (HeapError Precise) - , BaseError (ScopeError Precise) - , BaseError (UnspecializedError Precise (Val term)) - , BaseError (LoadError Precise (Val term)) - ] -testEvaluating :: Evaluator term Precise (Val term) (TestEvaluatingC term) a - -> IO - (ScopeGraph Precise, - (Heap Precise Precise (Value term Precise), - Either (SomeError (Data.Sum.Sum (TestEvaluatingErrors term))) a)) -testEvaluating - = runM - . runTraceByIgnoring - . runFresh - . runEvaluator - . runScopeGraph - . runHeap - . fmap reassociate - . runLoadError - . runUnspecialized - . runScopeError - . runHeapError - . runEvalError - . runResolutionError - . runValueError - . runAddressError - -type Val term = Value term Precise - - -members :: EdgeLabel - -> Heap Precise Precise (Value term Precise) - -> ScopeGraph Precise - -> Value term Precise - -> Maybe [Name] -members edgeLabel heap scopeGraph (Data.Abstract.Value.Concrete.Object frame) = frameNames [ edgeLabel ] heap scopeGraph frame -members edgeLabel heap scopeGraph (Class _ _ frame) = frameNames [ edgeLabel ] heap scopeGraph frame -members _ _ _ _ = Nothing - -frameNames :: [ EdgeLabel ] - -> Heap Precise Precise (Value term Precise) - -> ScopeGraph Precise - -> Precise - -> Maybe [ Name ] -frameNames edge heap scopeGraph frame = do - scopeAddress <- Heap.scopeLookup frame heap - scope <- ScopeGraph.lookupScope scopeAddress scopeGraph - pure (unDeclaration <$> toList (ScopeGraph.declarationNames edge scope scopeGraph)) - -lookupMembers :: Name -> EdgeLabel -> (Precise, Precise) -> Heap Precise Precise (Value term Precise) -> ScopeGraph Precise -> Maybe [ Name ] -lookupMembers name edgeLabel scopeAndFrame heap scopeGraph = - (lookupDeclaration name scopeAndFrame heap scopeGraph >>= members edgeLabel heap scopeGraph . Prelude.head) - -lookupDeclaration :: Name -> (Precise, Precise) -> Heap Precise Precise (Value term Precise) -> ScopeGraph Precise -> Maybe [ Value term Precise ] -lookupDeclaration name (currentScope, currentFrame) heap scopeGraph = do - path <- ScopeGraph.lookupScopePath name currentScope scopeGraph - frameAddress <- Heap.lookupFrameAddress path currentFrame heap - toList <$> Heap.getSlotValue (Slot frameAddress (Heap.pathPosition path)) heap - -newtype Verbatim = Verbatim ByteString - deriving (Eq) - -instance Show Verbatim where - showsPrec _ (Verbatim byteString) = (T.unpack (T.decodeUtf8 byteString) ++) - -verbatim :: ByteString -> Verbatim -verbatim = Verbatim . stripWhitespace - where - stripWhitespace :: ByteString -> ByteString - stripWhitespace = B.foldl' go B.empty - where go acc x | x `B.elem` " \t\n" = acc - | otherwise = B.snoc acc x diff --git a/test/Tags/Spec.hs b/test/Tags/Spec.hs deleted file mode 100644 index f094648a0d..0000000000 --- a/test/Tags/Spec.hs +++ /dev/null @@ -1,100 +0,0 @@ -module Tags.Spec (spec) where - -import Data.Text (Text) -import SpecHelpers -import Tags.Tagging - - -spec :: Spec -spec = parallel $ do - describe "go" $ do - it "produces tags for functions with docs" $ do - (blob, tree) <- parseTestFile goParser "test/fixtures/go/tags/simple_functions.go" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "TestFromBits" "Function" (Span (Pos 6 1) (Pos 8 2)) ["Statements"] (Just "func TestFromBits(t *testing.T) {") (Just "// TestFromBits ...") - , Tag "Hi" "Function" (Span (Pos 10 1) (Pos 11 2)) ["Statements"] (Just "func Hi()") Nothing ] - - it "produces tags for methods" $ do - (blob, tree) <- parseTestFile goParser "test/fixtures/go/tags/method.go" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "CheckAuth" "Method" (Span (Pos 3 1) (Pos 3 100)) ["Statements"] (Just "func (c *apiClient) CheckAuth(req *http.Request, user, repo string) (*authenticatedActor, error)") Nothing] - - it "produces tags for calls" $ do - (blob, tree) <- parseTestFile goParser "test/fixtures/go/tags/simple_functions.go" - runTagging blob ["Call"] tree `shouldBe` - [ Tag "Hi" "Call" (Span (Pos 7 2) (Pos 7 6)) ["Function", "Context", "Statements"] (Just "Hi()") Nothing] - - describe "javascript and typescript" $ do - it "produces tags for functions with docs" $ do - (blob, tree) <- parseTestFile typescriptParser "test/fixtures/javascript/tags/simple_function_with_docs.js" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "myFunction" "Function" (Span (Pos 2 1) (Pos 4 2)) ["Statements"] (Just "function myFunction()") (Just "// This is myFunction") ] - - it "produces tags for classes" $ do - (blob, tree) <- parseTestFile typescriptParser "test/fixtures/typescript/tags/class.ts" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "FooBar" "Class" (Span (Pos 1 1) (Pos 1 16)) ["Statements"] (Just "class FooBar") Nothing ] - - it "produces tags for modules" $ do - (blob, tree) <- parseTestFile typescriptParser "test/fixtures/typescript/tags/module.ts" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "APromise" "Module" (Span (Pos 1 1) (Pos 1 20)) ["Statements"] (Just "module APromise { }") Nothing ] - - describe "python" $ do - it "produces tags for functions" $ do - (blob, tree) <- parseTestFile pythonParser "test/fixtures/python/tags/simple_functions.py" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "Foo" "Function" (Span (Pos 1 1) (Pos 5 17)) ["Statements"] (Just "def Foo(x):") Nothing - , Tag "Bar" "Function" (Span (Pos 7 1) (Pos 11 13)) ["Statements"] (Just "def Bar():") Nothing - , Tag "local" "Function" (Span (Pos 8 5) (Pos 9 17)) ["Statements", "Function", "Statements"] (Just "def local():") Nothing - ] - - it "produces tags for functions with docs" $ do - (blob, tree) <- parseTestFile pythonParser "test/fixtures/python/tags/simple_function_with_docs.py" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "Foo" "Function" (Span (Pos 1 1) (Pos 3 13)) ["Statements"] (Just "def Foo(x):") (Just "\"\"\"This is the foo function\"\"\"") ] - - it "produces tags for classes" $ do - (blob, tree) <- parseTestFile pythonParser "test/fixtures/python/tags/class.py" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "Foo" "Class" (Span (Pos 1 1) (Pos 5 17)) ["Statements"] (Just "class Foo:") (Just "\"\"\"The Foo class\"\"\"") - , Tag "f" "Function" (Span (Pos 3 5) (Pos 5 17)) ["Statements", "Class", "Statements"] (Just "def f(self):") (Just "\"\"\"The f method\"\"\"") - ] - - it "produces tags for multi-line functions" $ do - (blob, tree) <- parseTestFile pythonParser "test/fixtures/python/tags/multiline.py" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "Foo" "Function" (Span (Pos 1 1) (Pos 3 13)) ["Statements"] (Just "def Foo(x,") Nothing ] - - describe "ruby" $ do - it "produces tags for methods" $ do - (blob, tree) <- parseTestFile rubyParser "test/fixtures/ruby/tags/simple_method.rb" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "foo" "Method" (Span (Pos 1 1) (Pos 4 4)) ["Statements"] (Just "def foo") Nothing ] - - it "produces tags for sends" $ do - (blob, tree) <- parseTestFile rubyParser "test/fixtures/ruby/tags/simple_method.rb" - runTagging blob ["Send"] tree `shouldBe` - [ Tag "puts" "Send" (Span (Pos 2 3) (Pos 2 12)) ["Statements", "Method", "Statements"] (Just "puts \"hi\"") Nothing - , Tag "bar" "Send" (Span (Pos 3 3) (Pos 3 8)) ["Statements", "Method", "Statements"] (Just "a.bar") Nothing - , Tag "a" "Send" (Span (Pos 3 3) (Pos 3 4)) ["Send", "Statements", "Method", "Statements"] (Just "a") Nothing - ] - - it "produces tags for methods with docs" $ do - (blob, tree) <- parseTestFile rubyParser "test/fixtures/ruby/tags/simple_method_with_docs.rb" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "foo" "Method" (Span (Pos 2 1) (Pos 3 4)) ["Statements"] (Just "def foo") (Just "# Public: foo") ] - - it "produces tags for methods and classes with docs" $ do - (blob, tree) <- parseTestFile rubyParser "test/fixtures/ruby/tags/class_module.rb" - runTagging blob symbolsToSummarize tree `shouldBe` - [ Tag "Foo" "Module" (Span (Pos 2 1 ) (Pos 12 4)) ["Statements"] (Just "module Foo") (Just "# Public: Foo") - , Tag "Bar" "Class" (Span (Pos 5 3 ) (Pos 11 6)) ["Module", "Context", "Statements"] (Just "class Bar") (Just "# Public: Bar") - , Tag "baz" "Method" (Span (Pos 8 5 ) (Pos 10 8)) ["Class", "Context", "Module", "Context", "Statements"] (Just "def baz(a)") (Just "# Public: baz") - , Tag "C" "Class" (Span (Pos 14 1) (Pos 20 4)) ["Statements"] (Just "class A::B::C") Nothing - , Tag "foo" "Method" (Span (Pos 15 3) (Pos 17 6)) ["Statements", "Class", "Statements"] (Just "def foo") Nothing - , Tag "foo" "Method" (Span (Pos 18 3) (Pos 19 6)) ["Statements", "Class", "Statements"] (Just "def self.foo") Nothing - ] - -symbolsToSummarize :: [Text] -symbolsToSummarize = ["Function", "Method", "Class", "Module"] diff --git a/test/Test/Hspec/LeanCheck.hs b/test/Test/Hspec/LeanCheck.hs deleted file mode 100644 index 0540bc0173..0000000000 --- a/test/Test/Hspec/LeanCheck.hs +++ /dev/null @@ -1,95 +0,0 @@ -{-# LANGUAGE GADTs, TypeFamilies #-} -module Test.Hspec.LeanCheck -( prop -, forAll -) where - -import Control.Exception -import Data.Bifunctor (first) -import Data.List (intercalate) -import Data.Maybe (listToMaybe) -import Data.Typeable -import GHC.Show as Show (showsPrec) -import Test.Hspec -import Test.Hspec.Core.Spec as Hspec -import qualified Test.HUnit.Lang as HUnit -import Test.LeanCheck.Core - -data Property where - Property :: IOTestable prop => prop -> Property - --- | Perform an enumerative test of a property using LeanCheck. --- --- 'prop' will typically be a function of one or more 'Listable' arguments, returning either 'Bool' or 'IO ()' (in the latter case, typically via 'shouldBe' and friends). For example: --- --- > describe "+" $ do --- > prop "associativity" $ --- > \ a b c -> a + (b + c) `shouldBe` (a + b :: Int) + c -prop :: (HasCallStack, IOTestable prop) => String -> prop -> Spec -prop s = it s . Property - -data ForAll a where - ForAll :: IOTestable prop => [[a]] -> (a -> prop) -> ForAll a - --- | Test a property given by an explicit list of tiers rather than a 'Listable' instance. This can be used to e.g. filter input values for which the property does not hold. --- --- > describe "mean" $ do --- > prop "β‰₯ the minimum" . forAll (not . null `filterT` tiers) $ --- > \ list -> (mean list :: Int) `shouldSatisfy` (>= min list) -forAll :: IOTestable prop => [[a]] -> (a -> prop) -> ForAll a -forAll = ForAll - -instance Example Property where - type Arg Property = () - evaluateExample (Property prop) (Params _ bound) _ _ = do - result <- try (iocounterExample bound prop) - case result of - Left e - | Just (LeanCheckException messages e') <- fromException e -> throw (addMessages messages e') - | otherwise -> throw e - Right (Just messages) -> pure $ Result "" (Failure Nothing (Reason (concat messages))) - Right Nothing -> pure $ Result "" Success - where addMessages messages (HUnit.HUnitFailure loc r) = HUnit.HUnitFailure loc $ case r of - HUnit.Reason s -> HUnit.Reason (intercalate "\n" messages ++ "\n" ++ s) - HUnit.ExpectedButGot Nothing expected actual -> HUnit.ExpectedButGot (Just (concat messages)) expected actual - HUnit.ExpectedButGot (Just preface) expected actual -> HUnit.ExpectedButGot (Just (intercalate "\n" messages ++ preface)) expected actual - - -class IOTestable t where - -- 'resultiers', lifted into 'IO'. - ioResultTiers :: t -> [[IO ([String], Bool)]] - -instance IOTestable (IO ()) where - ioResultTiers action = [[ (action >> pure ([], True)) `catch` (throw . LeanCheckException []) ]] - -instance (IOTestable b, Show a, Listable a) => IOTestable (a -> b) where - ioResultTiers p = concatMapT (resultiersFor p) tiers - -instance IOTestable Bool where - ioResultTiers p = [[ pure ([], p) ]] - -instance Show a => IOTestable (ForAll a) where - ioResultTiers (ForAll tiers property) = concatMapT (resultiersFor property) tiers - -resultiersFor :: (IOTestable b, Show a) => (a -> b) -> a -> [[IO ([String], Bool)]] -resultiersFor p x = fmap (eval x) <$> ioResultTiers (p x) - -eval :: Show a => a -> IO ([String], Bool) -> IO ([String], Bool) -eval x action = first (prepend x) <$> action - `catch` \ (LeanCheckException messages failure) -> throw (LeanCheckException (prepend x messages) failure) - where prepend x = (showsPrec 11 x "":) - - --- | 'counterExamples', lifted into 'IO'. -iocounterExamples :: IOTestable a => Int -> a -> IO [[String]] -iocounterExamples n = fmap (fmap fst . filter (not . snd)) . sequenceA . take n . concat . ioResultTiers - --- | 'counterExample', lifted into 'IO'. -iocounterExample :: IOTestable a => Int -> a -> IO (Maybe [String]) -iocounterExample n = fmap listToMaybe . iocounterExamples n - - -data LeanCheckException = LeanCheckException [String] HUnit.HUnitFailure - deriving (Show, Typeable) - -instance Exception LeanCheckException diff --git a/test/fixtures/cli/diff-tree.json b/test/fixtures/cli/diff-tree.json deleted file mode 100644 index 42e9aa6427..0000000000 --- a/test/fixtures/cli/diff-tree.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "diffs": [{ - "diff": { - "merge": { - "term": "Statements", - "statements": [{ - "merge": { - "term": "Method", - "methodAccessControl":"Public", - "methodBody": { - "merge": { - "children": [{ - "patch": { - "insert": { - "term": "Send", - "sourceRange": [13, 16], - "sendReceiver": null, - "sendBlock": null, - "sendArgs": [], - "sourceSpan": { - "start": [2, 3], - "end": [2, 6] - }, - "sendSelector": { - "patch": { - "insert": { - "term": "Identifier", - "name": "baz", - "sourceRange": [13, 16], - "sourceSpan": { - "start": [2, 3], - "end": [2, 6] - } - } - } - } - } - } - }], - "before": { - "sourceRange": [8, 11], - "sourceSpan": { - "start": [2, 1], - "end": [2, 4] - } - }, - "after": { - "sourceRange": [13, 16], - "sourceSpan": { - "start": [2, 3], - "end": [2, 6] - } - } - } - }, - "methodContext": [], - "methodName": { - "patch": { - "replace": [{ - "term": "Identifier", - "name": "foo", - "sourceRange": [4, 7], - "sourceSpan": { - "start": [1, 5], - "end": [1, 8] - } - }, { - "term": "Identifier", - "name": "bar", - "sourceRange": [4, 7], - "sourceSpan": { - "start": [1, 5], - "end": [1, 8] - } - }] - } - }, - "methodParameters": [{ - "patch": { - "insert": { - "term": "Identifier", - "name": "a", - "sourceRange": [8, 9], - "sourceSpan": { - "start": [1, 9], - "end": [1, 10] - } - } - } - }], - "methodReceiver": { - "merge": { - "term": "Empty", - "before": { - "sourceRange": [0, 0], - "sourceSpan": { - "start": [1, 1], - "end": [1, 1] - } - }, - "after": { - "sourceRange": [0, 0], - "sourceSpan": { - "start": [1, 1], - "end": [1, 1] - } - } - } - }, - "before": { - "sourceRange": [0, 11], - "sourceSpan": { - "start": [1, 1], - "end": [2, 4] - } - }, - "after": { - "sourceRange": [0, 20], - "sourceSpan": { - "start": [1, 1], - "end": [3, 4] - } - } - } - }], - "before": { - "sourceRange": [0, 12], - "sourceSpan": { - "start": [1, 1], - "end": [3, 1] - } - }, - "after": { - "sourceRange": [0, 21], - "sourceSpan": { - "start": [1, 1], - "end": [4, 1] - } - } - } - }, - "stat": { - "path": "test/fixtures/ruby/corpus/method-declaration.A.rb->test/fixtures/ruby/corpus/method-declaration.B.rb", - "replace": [{ - "path": "test/fixtures/ruby/corpus/method-declaration.A.rb", - "language": "Ruby" - }, { - "path": "test/fixtures/ruby/corpus/method-declaration.B.rb", - "language": "Ruby" - }] - } - }] -} diff --git a/test/fixtures/cli/diff-tree.toc.json b/test/fixtures/cli/diff-tree.toc.json deleted file mode 100644 index d235422390..0000000000 --- a/test/fixtures/cli/diff-tree.toc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "files": [ - { - "path": "test/fixtures/ruby/corpus/method-declaration.A.rb -> test/fixtures/ruby/corpus/method-declaration.B.rb", - "language": "Ruby", - "changes": [ - { - "category": "Method", - "term": "bar", - "span": - { - "start": - { - "line": 1, - "column": 1 - }, - "end": - { - "line": 3, - "column": 4 - } - }, - "changeType": "MODIFIED" - }] - }] -} diff --git a/test/fixtures/cli/parse-tree-empty.json b/test/fixtures/cli/parse-tree-empty.json deleted file mode 100644 index ec8e3347d6..0000000000 --- a/test/fixtures/cli/parse-tree-empty.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "trees": [] -} diff --git a/test/fixtures/cli/parse-tree.json b/test/fixtures/cli/parse-tree.json deleted file mode 100644 index 745c11a91b..0000000000 --- a/test/fixtures/cli/parse-tree.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "trees": [{ - "tree": { - "term": "Statements", - "statements": [{ - "term": "LowPrecedenceAnd", - "lhs": { - "term": "Send", - "sendArgs": [], - "sendBlock": null, - "sendReceiver": null, - "sendSelector": { - "term": "Identifier", - "name": "foo", - "sourceRange": [0, 3], - "sourceSpan": { - "start": [1, 1], - "end": [1, 4] - } - }, - "sourceRange": [0, 3], - "sourceSpan": { - "start": [1, 1], - "end": [1, 4] - } - }, - "rhs": { - "term": "Send", - "sendArgs": [], - "sendBlock": null, - "sendReceiver": null, - "sendSelector": { - "term": "Identifier", - "name": "bar", - "sourceRange": [8, 11], - "sourceSpan": { - "start": [1, 9], - "end": [1, 12] - } - }, - "sourceRange": [8, 11], - "sourceSpan": { - "start": [1, 9], - "end": [1, 12] - } - }, - "sourceRange": [0, 11], - "sourceSpan": { - "start": [1, 1], - "end": [1, 12] - } - }], - "sourceRange": [0, 12], - "sourceSpan": { - "start": [1, 1], - "end": [2, 1] - } - }, - "path": "test/fixtures/ruby/corpus/and-or.A.rb", - "language": "Ruby" - }] -} \ No newline at end of file diff --git a/test/fixtures/cli/parse-tree.symbols.json b/test/fixtures/cli/parse-tree.symbols.json deleted file mode 100644 index eb92820091..0000000000 --- a/test/fixtures/cli/parse-tree.symbols.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "files": [ - { - "path": "test/fixtures/ruby/corpus/method-declaration.A.rb", - "language": "Ruby", - "symbols": [ - { - "symbol": "foo", - "kind": "Method", - "line": "def foo", - "span": - { - "start": - { - "line": 1, - "column": 1 - }, - "end": - { - "line": 2, - "column": 4 - } - } - }] - }] -} diff --git a/test/fixtures/cli/parse-trees.json b/test/fixtures/cli/parse-trees.json deleted file mode 100644 index 3f91bf823c..0000000000 --- a/test/fixtures/cli/parse-trees.json +++ /dev/null @@ -1,196 +0,0 @@ -{ - "trees": [{ - "tree": { - "term": "Statements", - "statements": [{ - "term": "LowPrecedenceAnd", - "lhs": { - "term": "Send", - "sendArgs": [], - "sendBlock": null, - "sendReceiver": null, - "sendSelector": { - "term": "Identifier", - "name": "foo", - "sourceRange": [0, 3], - "sourceSpan": { - "start": [1, 1], - "end": [1, 4] - } - }, - "sourceRange": [0, 3], - "sourceSpan": { - "start": [1, 1], - "end": [1, 4] - } - }, - "rhs": { - "term": "Send", - "sendArgs": [], - "sendBlock": null, - "sendReceiver": null, - "sendSelector": { - "term": "Identifier", - "name": "bar", - "sourceRange": [8, 11], - "sourceSpan": { - "start": [1, 9], - "end": [1, 12] - } - }, - "sourceRange": [8, 11], - "sourceSpan": { - "start": [1, 9], - "end": [1, 12] - } - }, - "sourceRange": [0, 11], - "sourceSpan": { - "start": [1, 1], - "end": [1, 12] - } - }], - "sourceRange": [0, 12], - "sourceSpan": { - "start": [1, 1], - "end": [2, 1] - } - }, - "path": "test/fixtures/ruby/corpus/and-or.A.rb", - "language": "Ruby" - }, { - "tree": { - "term": "Statements", - "statements": [{ - "term": "LowPrecedenceOr", - "lhs": { - "term": "Send", - "sendArgs": [], - "sendBlock": null, - "sendReceiver": null, - "sendSelector": { - "term": "Identifier", - "name": "foo", - "sourceRange": [0, 3], - "sourceSpan": { - "start": [1, 1], - "end": [1, 4] - } - }, - "sourceRange": [0, 3], - "sourceSpan": { - "start": [1, 1], - "end": [1, 4] - } - }, - "rhs": { - "term": "Send", - "sendArgs": [], - "sendBlock": null, - "sendReceiver": null, - "sendSelector": { - "term": "Identifier", - "name": "bar", - "sourceRange": [7, 10], - "sourceSpan": { - "start": [1, 8], - "end": [1, 11] - } - }, - "sourceRange": [7, 10], - "sourceSpan": { - "start": [1, 8], - "end": [1, 11] - } - }, - "sourceRange": [0, 10], - "sourceSpan": { - "start": [1, 1], - "end": [1, 11] - } - }, { - "term": "LowPrecedenceAnd", - "lhs": { - "term": "LowPrecedenceOr", - "lhs": { - "term": "Send", - "sendArgs": [], - "sendBlock": null, - "sendReceiver": null, - "sendSelector": { - "term": "Identifier", - "name": "a", - "sourceRange": [11, 12], - "sourceSpan": { - "start": [2, 1], - "end": [2, 2] - } - }, - "sourceRange": [11, 12], - "sourceSpan": { - "start": [2, 1], - "end": [2, 2] - } - }, - "rhs": { - "term": "Send", - "sendArgs": [], - "sendBlock": null, - "sendReceiver": null, - "sendSelector": { - "term": "Identifier", - "name": "b", - "sourceRange": [16, 17], - "sourceSpan": { - "start": [2, 6], - "end": [2, 7] - } - }, - "sourceRange": [16, 17], - "sourceSpan": { - "start": [2, 6], - "end": [2, 7] - } - }, - "sourceRange": [11, 17], - "sourceSpan": { - "start": [2, 1], - "end": [2, 7] - } - }, - "rhs": { - "term": "Send", - "sendArgs": [], - "sendBlock": null, - "sendReceiver": null, - "sendSelector": { - "term": "Identifier", - "name": "c", - "sourceRange": [22, 23], - "sourceSpan": { - "start": [2, 12], - "end": [2, 13] - } - }, - "sourceRange": [22, 23], - "sourceSpan": { - "start": [2, 12], - "end": [2, 13] - } - }, - "sourceRange": [11, 23], - "sourceSpan": { - "start": [2, 1], - "end": [2, 13] - } - }], - "sourceRange": [0, 24], - "sourceSpan": { - "start": [1, 1], - "end": [3, 1] - } - }, - "path": "test/fixtures/ruby/corpus/and-or.B.rb", - "language": "Ruby" - }] -} \ No newline at end of file diff --git a/test/fixtures/go/corpus/array-types.parseA.txt b/test/fixtures/go/corpus/array-types.parseA.txt deleted file mode 100644 index 4cb197809a..0000000000 --- a/test/fixtures/go/corpus/array-types.parseA.txt +++ /dev/null @@ -1,32 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Statements - (Type - (Identifier) - (Array - (Plus - (Integer) - (Integer)) - (Identifier)))) - (Statements - (Type - (Identifier) - (Array - (Integer) - (Array - (Integer) - (Identifier))))) - (Statements - (Type - (Identifier) - (Array - (Integer) - (Array - (Integer) - (Array - (Integer) - (Identifier))))))))) diff --git a/test/fixtures/go/corpus/array-types.parseB.txt b/test/fixtures/go/corpus/array-types.parseB.txt deleted file mode 100644 index 4cb197809a..0000000000 --- a/test/fixtures/go/corpus/array-types.parseB.txt +++ /dev/null @@ -1,32 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Statements - (Type - (Identifier) - (Array - (Plus - (Integer) - (Integer)) - (Identifier)))) - (Statements - (Type - (Identifier) - (Array - (Integer) - (Array - (Integer) - (Identifier))))) - (Statements - (Type - (Identifier) - (Array - (Integer) - (Array - (Integer) - (Array - (Integer) - (Identifier))))))))) diff --git a/test/fixtures/go/corpus/array-with-implicit-length.parseA.txt b/test/fixtures/go/corpus/array-with-implicit-length.parseA.txt deleted file mode 100644 index f8c34190ca..0000000000 --- a/test/fixtures/go/corpus/array-with-implicit-length.parseA.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Identifier) - (Composite - (Array - (Identifier)) - (Statements - (Integer) - (Integer) - (Integer)))))) diff --git a/test/fixtures/go/corpus/array-with-implicit-length.parseB.txt b/test/fixtures/go/corpus/array-with-implicit-length.parseB.txt deleted file mode 100644 index f8c34190ca..0000000000 --- a/test/fixtures/go/corpus/array-with-implicit-length.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Identifier) - (Composite - (Array - (Identifier)) - (Statements - (Integer) - (Integer) - (Integer)))))) diff --git a/test/fixtures/go/corpus/assignment-statements.diffA-B.txt b/test/fixtures/go/corpus/assignment-statements.diffA-B.txt deleted file mode 100644 index b74799cf74..0000000000 --- a/test/fixtures/go/corpus/assignment-statements.diffA-B.txt +++ /dev/null @@ -1,131 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - { (Identifier) - ->(Identifier) } - (Integer)) - (Assignment - (Statements - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (Plus - (Statements - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (Statements - (Integer) - (Integer)))) - {+(Assignment - {+(Identifier)+} - {+(Times - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(Plus - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(LShift - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(RShift - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(DividedBy - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(BXOr - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(Modulo - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(Not - {+(BAnd - {+(Identifier)+} - {+(Integer)+})+})+})+} - {+(Assignment - {+(Identifier)+} - {+(Statements - {+(Pointer - {+(Identifier)+})+} - {+(Reference - {+(Composite - {+(Identifier)+} - {+(Statements - {+(KeyValue - {+(Identifier)+} - {+(Integer)+})+})+})+})+})+})+} - {-(Assignment - {-(Identifier)-} - {-(Times - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(Plus - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(LShift - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(RShift - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(DividedBy - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(BXOr - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(Modulo - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(Not - {-(BAnd - {-(Identifier)-} - {-(Integer)-})-})-})-} - {-(Assignment - {-(Identifier)-} - {-(Statements - {-(Pointer - {-(Identifier)-})-} - {-(Reference - {-(Composite - {-(Identifier)-} - {-(Statements - {-(KeyValue - {-(Identifier)-} - {-(Integer)-})-})-})-})-})-})-}))) diff --git a/test/fixtures/go/corpus/assignment-statements.diffB-A.txt b/test/fixtures/go/corpus/assignment-statements.diffB-A.txt deleted file mode 100644 index b74799cf74..0000000000 --- a/test/fixtures/go/corpus/assignment-statements.diffB-A.txt +++ /dev/null @@ -1,131 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - { (Identifier) - ->(Identifier) } - (Integer)) - (Assignment - (Statements - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (Plus - (Statements - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (Statements - (Integer) - (Integer)))) - {+(Assignment - {+(Identifier)+} - {+(Times - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(Plus - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(LShift - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(RShift - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(DividedBy - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(BXOr - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(Modulo - {+(Identifier)+} - {+(Integer)+})+})+} - {+(Assignment - {+(Identifier)+} - {+(Not - {+(BAnd - {+(Identifier)+} - {+(Integer)+})+})+})+} - {+(Assignment - {+(Identifier)+} - {+(Statements - {+(Pointer - {+(Identifier)+})+} - {+(Reference - {+(Composite - {+(Identifier)+} - {+(Statements - {+(KeyValue - {+(Identifier)+} - {+(Integer)+})+})+})+})+})+})+} - {-(Assignment - {-(Identifier)-} - {-(Times - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(Plus - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(LShift - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(RShift - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(DividedBy - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(BXOr - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(Modulo - {-(Identifier)-} - {-(Integer)-})-})-} - {-(Assignment - {-(Identifier)-} - {-(Not - {-(BAnd - {-(Identifier)-} - {-(Integer)-})-})-})-} - {-(Assignment - {-(Identifier)-} - {-(Statements - {-(Pointer - {-(Identifier)-})-} - {-(Reference - {-(Composite - {-(Identifier)-} - {-(Statements - {-(KeyValue - {-(Identifier)-} - {-(Integer)-})-})-})-})-})-})-}))) diff --git a/test/fixtures/go/corpus/assignment-statements.parseA.txt b/test/fixtures/go/corpus/assignment-statements.parseA.txt deleted file mode 100644 index 4e8f718e5f..0000000000 --- a/test/fixtures/go/corpus/assignment-statements.parseA.txt +++ /dev/null @@ -1,73 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Integer)) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Plus - (Statements - (Identifier) - (Identifier)) - (Statements - (Integer) - (Integer)))) - (Assignment - (Identifier) - (Times - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Plus - (Identifier) - (Integer))) - (Assignment - (Identifier) - (LShift - (Identifier) - (Integer))) - (Assignment - (Identifier) - (RShift - (Identifier) - (Integer))) - (Assignment - (Identifier) - (DividedBy - (Identifier) - (Integer))) - (Assignment - (Identifier) - (BXOr - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Modulo - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Not - (BAnd - (Identifier) - (Integer)))) - (Assignment - (Identifier) - (Statements - (Pointer - (Identifier)) - (Reference - (Composite - (Identifier) - (Statements - (KeyValue - (Identifier) - (Integer)))))))))) diff --git a/test/fixtures/go/corpus/assignment-statements.parseB.txt b/test/fixtures/go/corpus/assignment-statements.parseB.txt deleted file mode 100644 index 4e8f718e5f..0000000000 --- a/test/fixtures/go/corpus/assignment-statements.parseB.txt +++ /dev/null @@ -1,73 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Integer)) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Plus - (Statements - (Identifier) - (Identifier)) - (Statements - (Integer) - (Integer)))) - (Assignment - (Identifier) - (Times - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Plus - (Identifier) - (Integer))) - (Assignment - (Identifier) - (LShift - (Identifier) - (Integer))) - (Assignment - (Identifier) - (RShift - (Identifier) - (Integer))) - (Assignment - (Identifier) - (DividedBy - (Identifier) - (Integer))) - (Assignment - (Identifier) - (BXOr - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Modulo - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Not - (BAnd - (Identifier) - (Integer)))) - (Assignment - (Identifier) - (Statements - (Pointer - (Identifier)) - (Reference - (Composite - (Identifier) - (Statements - (KeyValue - (Identifier) - (Integer)))))))))) diff --git a/test/fixtures/go/corpus/binary-expressions.parseA.txt b/test/fixtures/go/corpus/binary-expressions.parseA.txt deleted file mode 100644 index 102017e04b..0000000000 --- a/test/fixtures/go/corpus/binary-expressions.parseA.txt +++ /dev/null @@ -1,70 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Context - (Comment) - (Or - (Identifier) - (Context - (Comment) - (Identifier)))) - (Context - (Comment) - (And - (Identifier) - (Identifier))) - (Equal - (Identifier) - (Identifier)) - (Not - (Equal - (Identifier) - (Identifier))) - (LessThan - (Identifier) - (Identifier)) - (LessThanEqual - (Identifier) - (Identifier)) - (GreaterThan - (Identifier) - (Identifier)) - (GreaterThanEqual - (Identifier) - (Identifier)) - (Plus - (Identifier) - (Identifier)) - (Minus - (Identifier) - (Identifier)) - (BOr - (Identifier) - (Identifier)) - (BXOr - (Identifier) - (Identifier)) - (Times - (Identifier) - (Identifier)) - (DividedBy - (Identifier) - (Identifier)) - (Modulo - (Identifier) - (Identifier)) - (LShift - (Identifier) - (Identifier)) - (RShift - (Identifier) - (Identifier)) - (BAnd - (Identifier) - (Identifier)) - (BAnd - (Identifier) - (Identifier))))) diff --git a/test/fixtures/go/corpus/binary-expressions.parseB.txt b/test/fixtures/go/corpus/binary-expressions.parseB.txt deleted file mode 100644 index 102017e04b..0000000000 --- a/test/fixtures/go/corpus/binary-expressions.parseB.txt +++ /dev/null @@ -1,70 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Context - (Comment) - (Or - (Identifier) - (Context - (Comment) - (Identifier)))) - (Context - (Comment) - (And - (Identifier) - (Identifier))) - (Equal - (Identifier) - (Identifier)) - (Not - (Equal - (Identifier) - (Identifier))) - (LessThan - (Identifier) - (Identifier)) - (LessThanEqual - (Identifier) - (Identifier)) - (GreaterThan - (Identifier) - (Identifier)) - (GreaterThanEqual - (Identifier) - (Identifier)) - (Plus - (Identifier) - (Identifier)) - (Minus - (Identifier) - (Identifier)) - (BOr - (Identifier) - (Identifier)) - (BXOr - (Identifier) - (Identifier)) - (Times - (Identifier) - (Identifier)) - (DividedBy - (Identifier) - (Identifier)) - (Modulo - (Identifier) - (Identifier)) - (LShift - (Identifier) - (Identifier)) - (RShift - (Identifier) - (Identifier)) - (BAnd - (Identifier) - (Identifier)) - (BAnd - (Identifier) - (Identifier))))) diff --git a/test/fixtures/go/corpus/call-expressions.parseA.txt b/test/fixtures/go/corpus/call-expressions.parseA.txt deleted file mode 100644 index c2be4b4f0b..0000000000 --- a/test/fixtures/go/corpus/call-expressions.parseA.txt +++ /dev/null @@ -1,30 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Call - (Identifier) - (Statements - (Identifier) - (Variadic - (Identifier))) - (Empty)) - (Call - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Empty)) - (Call - (Identifier) - (Statements - (Identifier) - (Variadic - (Identifier))) - (Empty)) - (Call - (Identifier) - (Statements) - (Empty))))) diff --git a/test/fixtures/go/corpus/call-expressions.parseB.txt b/test/fixtures/go/corpus/call-expressions.parseB.txt deleted file mode 100644 index a7e3c8fc51..0000000000 --- a/test/fixtures/go/corpus/call-expressions.parseB.txt +++ /dev/null @@ -1,26 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Call - (Identifier) - (Statements - (Identifier) - (Variadic - (Identifier))) - (Empty)) - (Call - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Empty)) - (Call - (Identifier) - (Statements - (Identifier) - (Variadic - (Identifier))) - (Empty))))) diff --git a/test/fixtures/go/corpus/case-statements.diffA-B.txt b/test/fixtures/go/corpus/case-statements.diffA-B.txt deleted file mode 100644 index 15007ff49c..0000000000 --- a/test/fixtures/go/corpus/case-statements.diffA-B.txt +++ /dev/null @@ -1,45 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - { (Match - {-(Empty)-} - {-(Statements)-}) - ->(Statements - {+(Match - {+(Statements)+} - {+(Pattern - {+(Identifier)+} - {+(Call - {+(Identifier)+} - {+(Statements)+} - {+(Empty)+})+})+})+} - {+(Match - {+(Statements - {+(Identifier)+})+} - {+(Statements - {+(Pattern - {+(Statements - {+(Integer)+} - {+(Integer)+})+} - {+(Statements - {+(Call - {+(Identifier)+} - {+(Statements)+} - {+(Empty)+})+} - {+(Call - {+(Identifier)+} - {+(Statements)+} - {+(Empty)+})+} - {+(Pattern - {+(Identifier)+} - {+(Empty)+})+})+})+} - {+(DefaultPattern - {+(Statements - {+(Call - {+(Identifier)+} - {+(Statements)+} - {+(Empty)+})+} - {+(Break - {+(Empty)+})+})+})+})+})+}) })) diff --git a/test/fixtures/go/corpus/case-statements.diffB-A.txt b/test/fixtures/go/corpus/case-statements.diffB-A.txt deleted file mode 100644 index 8d66c65f8f..0000000000 --- a/test/fixtures/go/corpus/case-statements.diffB-A.txt +++ /dev/null @@ -1,45 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - { (Statements - {-(Match - {-(Statements)-} - {-(Pattern - {-(Identifier)-} - {-(Call - {-(Identifier)-} - {-(Statements)-} - {-(Empty)-})-})-})-} - {-(Match - {-(Statements - {-(Identifier)-})-} - {-(Statements - {-(Pattern - {-(Statements - {-(Integer)-} - {-(Integer)-})-} - {-(Statements - {-(Call - {-(Identifier)-} - {-(Statements)-} - {-(Empty)-})-} - {-(Call - {-(Identifier)-} - {-(Statements)-} - {-(Empty)-})-} - {-(Pattern - {-(Identifier)-} - {-(Empty)-})-})-})-} - {-(DefaultPattern - {-(Statements - {-(Call - {-(Identifier)-} - {-(Statements)-} - {-(Empty)-})-} - {-(Break - {-(Empty)-})-})-})-})-})-}) - ->(Match - {+(Empty)+} - {+(Statements)+}) })) diff --git a/test/fixtures/go/corpus/case-statements.parseA.txt b/test/fixtures/go/corpus/case-statements.parseA.txt deleted file mode 100644 index c3c5076a62..0000000000 --- a/test/fixtures/go/corpus/case-statements.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Match - (Empty) - (Statements)))) diff --git a/test/fixtures/go/corpus/case-statements.parseB.txt b/test/fixtures/go/corpus/case-statements.parseB.txt deleted file mode 100644 index 1d6dca61d6..0000000000 --- a/test/fixtures/go/corpus/case-statements.parseB.txt +++ /dev/null @@ -1,42 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Match - (Statements) - (Pattern - (Identifier) - (Call - (Identifier) - (Statements) - (Empty)))) - (Match - (Statements - (Identifier)) - (Statements - (Pattern - (Statements - (Integer) - (Integer)) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Call - (Identifier) - (Statements) - (Empty)) - (Pattern - (Identifier) - (Empty)))) - (DefaultPattern - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Break - (Empty))))))))) diff --git a/test/fixtures/go/corpus/channel-types.parseA.txt b/test/fixtures/go/corpus/channel-types.parseA.txt deleted file mode 100644 index c30dcd3606..0000000000 --- a/test/fixtures/go/corpus/channel-types.parseA.txt +++ /dev/null @@ -1,34 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (BidirectionalChannel - (ReceiveChannel - (Identifier)))) - (Type - (Identifier) - (SendChannel - (SendChannel - (Constructor - (Empty) - (Statements))))) - (Type - (Identifier) - (SendChannel - (ReceiveChannel - (Identifier)))) - (Type - (Identifier) - (ReceiveChannel - (ReceiveChannel - (Identifier)))) - (Type - (Identifier) - (BidirectionalChannel - (Parenthesized - (ReceiveChannel - (Identifier)))))))) diff --git a/test/fixtures/go/corpus/channel-types.parseB.txt b/test/fixtures/go/corpus/channel-types.parseB.txt deleted file mode 100644 index c30dcd3606..0000000000 --- a/test/fixtures/go/corpus/channel-types.parseB.txt +++ /dev/null @@ -1,34 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (BidirectionalChannel - (ReceiveChannel - (Identifier)))) - (Type - (Identifier) - (SendChannel - (SendChannel - (Constructor - (Empty) - (Statements))))) - (Type - (Identifier) - (SendChannel - (ReceiveChannel - (Identifier)))) - (Type - (Identifier) - (ReceiveChannel - (ReceiveChannel - (Identifier)))) - (Type - (Identifier) - (BidirectionalChannel - (Parenthesized - (ReceiveChannel - (Identifier)))))))) diff --git a/test/fixtures/go/corpus/comment.parseA.txt b/test/fixtures/go/corpus/comment.parseA.txt deleted file mode 100644 index 979bd3f77f..0000000000 --- a/test/fixtures/go/corpus/comment.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Context - (Comment) - (Empty)))) diff --git a/test/fixtures/go/corpus/comment.parseB.txt b/test/fixtures/go/corpus/comment.parseB.txt deleted file mode 100644 index 979bd3f77f..0000000000 --- a/test/fixtures/go/corpus/comment.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Context - (Comment) - (Empty)))) diff --git a/test/fixtures/go/corpus/const-declarations-with-types.parseA.txt b/test/fixtures/go/corpus/const-declarations-with-types.parseA.txt deleted file mode 100644 index a99782556e..0000000000 --- a/test/fixtures/go/corpus/const-declarations-with-types.parseA.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Annotation - (Statements - (Identifier)) - (Identifier)) - (Integer)))) diff --git a/test/fixtures/go/corpus/const-declarations-with-types.parseB.txt b/test/fixtures/go/corpus/const-declarations-with-types.parseB.txt deleted file mode 100644 index 0d56bee447..0000000000 --- a/test/fixtures/go/corpus/const-declarations-with-types.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Annotation - (Statements - (Identifier) - (Identifier)) - (Identifier)) - (Statements - (Integer) - (Integer))))) diff --git a/test/fixtures/go/corpus/const-declarations-without-types.parseA.txt b/test/fixtures/go/corpus/const-declarations-without-types.parseA.txt deleted file mode 100644 index e5e2a55640..0000000000 --- a/test/fixtures/go/corpus/const-declarations-without-types.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Identifier) - (Integer)))) diff --git a/test/fixtures/go/corpus/const-declarations-without-types.parseB.txt b/test/fixtures/go/corpus/const-declarations-without-types.parseB.txt deleted file mode 100644 index a144c2045c..0000000000 --- a/test/fixtures/go/corpus/const-declarations-without-types.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Statements - (Integer) - (Integer))))) diff --git a/test/fixtures/go/corpus/const-with-implicit-values.parseA.txt b/test/fixtures/go/corpus/const-with-implicit-values.parseA.txt deleted file mode 100644 index d5f15bece5..0000000000 --- a/test/fixtures/go/corpus/const-with-implicit-values.parseA.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Identifier)) - (Assignment - (Identifier) - (Statements)) - (Assignment - (Identifier) - (Statements))))) diff --git a/test/fixtures/go/corpus/const-with-implicit-values.parseB.txt b/test/fixtures/go/corpus/const-with-implicit-values.parseB.txt deleted file mode 100644 index d5f15bece5..0000000000 --- a/test/fixtures/go/corpus/const-with-implicit-values.parseB.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Identifier)) - (Assignment - (Identifier) - (Statements)) - (Assignment - (Identifier) - (Statements))))) diff --git a/test/fixtures/go/corpus/constructors.parseA.txt b/test/fixtures/go/corpus/constructors.parseA.txt deleted file mode 100644 index 914e81fd49..0000000000 --- a/test/fixtures/go/corpus/constructors.parseA.txt +++ /dev/null @@ -1,34 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Call - (Identifier) - (SendChannel - (Identifier)) - (Empty)) - (Call - (Identifier) - (Statements - (SendChannel - (Identifier)) - (Minus - (Identifier) - (Identifier))) - (Empty)) - (Call - (Identifier) - (Statements - (SendChannel - (Identifier)) - (Integer) - (Integer)) - (Empty)) - (Call - (Identifier) - (Map - (Identifier) - (Identifier)) - (Empty))))) diff --git a/test/fixtures/go/corpus/constructors.parseB.txt b/test/fixtures/go/corpus/constructors.parseB.txt deleted file mode 100644 index 914e81fd49..0000000000 --- a/test/fixtures/go/corpus/constructors.parseB.txt +++ /dev/null @@ -1,34 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Call - (Identifier) - (SendChannel - (Identifier)) - (Empty)) - (Call - (Identifier) - (Statements - (SendChannel - (Identifier)) - (Minus - (Identifier) - (Identifier))) - (Empty)) - (Call - (Identifier) - (Statements - (SendChannel - (Identifier)) - (Integer) - (Integer)) - (Empty)) - (Call - (Identifier) - (Map - (Identifier) - (Identifier)) - (Empty))))) diff --git a/test/fixtures/go/corpus/float-literals.parseA.txt b/test/fixtures/go/corpus/float-literals.parseA.txt deleted file mode 100644 index 5829e0d6b0..0000000000 --- a/test/fixtures/go/corpus/float-literals.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Float)) - (Assignment - (Identifier) - (Float)) - (Assignment - (Identifier) - (Float)) - (Assignment - (Identifier) - (Float)) - (Assignment - (Identifier) - (Float))))) diff --git a/test/fixtures/go/corpus/float-literals.parseB.txt b/test/fixtures/go/corpus/float-literals.parseB.txt deleted file mode 100644 index 5829e0d6b0..0000000000 --- a/test/fixtures/go/corpus/float-literals.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Float)) - (Assignment - (Identifier) - (Float)) - (Assignment - (Identifier) - (Float)) - (Assignment - (Identifier) - (Float)) - (Assignment - (Identifier) - (Float))))) diff --git a/test/fixtures/go/corpus/for-statements.parseA.txt b/test/fixtures/go/corpus/for-statements.parseA.txt deleted file mode 100644 index e87630f2e1..0000000000 --- a/test/fixtures/go/corpus/for-statements.parseA.txt +++ /dev/null @@ -1,104 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (For - (Empty) - (Empty) - (Empty) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Goto - (Identifier)))) - (For - (Assignment - (Identifier) - (Integer)) - (LessThan - (Identifier) - (Integer)) - (PostIncrement - (Identifier)) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Break - (Identifier)))) - (For - (LessThan - (Identifier) - (Integer)) - (PostIncrement - (Identifier)) - (Empty) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Continue - (Identifier)))) - (For - (Empty) - (Empty) - (Empty) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Continue - (Empty)))) - (ForEach - (Identifier) - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (Break - (Empty)))) - (ForEach - (Statements - (Identifier) - (Identifier)) - (Identifier) - (Call - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Empty))) - (ForEach - (Statements - (Identifier) - (Identifier)) - (Identifier) - (Call - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Empty))) - (For - (Empty) - (LessThan - (Integer) - (Integer)) - (Empty) - (Call - (Identifier) - (Statements) - (Empty))) - (ForEach - (Empty) - (Identifier) - (Statements))))) diff --git a/test/fixtures/go/corpus/for-statements.parseB.txt b/test/fixtures/go/corpus/for-statements.parseB.txt deleted file mode 100644 index 2471c6650c..0000000000 --- a/test/fixtures/go/corpus/for-statements.parseB.txt +++ /dev/null @@ -1,99 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (For - (Empty) - (Empty) - (Empty) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Goto - (Identifier)))) - (ForEach - (Identifier) - (Identifier) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Break - (Identifier)))) - (For - (Empty) - (Empty) - (Empty) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Continue - (Identifier)))) - (For - (LessThan - (Identifier) - (Integer)) - (PostIncrement - (Identifier)) - (Empty) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Continue - (Empty)))) - (For - (Empty) - (Empty) - (Empty) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (Break - (Empty)))) - (ForEach - (Statements - (Identifier) - (Identifier)) - (Identifier) - (Call - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Empty))) - (ForEach - (Statements - (Identifier) - (Identifier)) - (Identifier) - (Call - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Empty))) - (For - (Empty) - (LessThan - (Integer) - (Integer)) - (Empty) - (Call - (Identifier) - (Statements) - (Empty))) - (ForEach - (Empty) - (Identifier) - (Statements))))) diff --git a/test/fixtures/go/corpus/function-declarations.parseA.txt b/test/fixtures/go/corpus/function-declarations.parseA.txt deleted file mode 100644 index 120d23763b..0000000000 --- a/test/fixtures/go/corpus/function-declarations.parseA.txt +++ /dev/null @@ -1,53 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements)) - (Function - (Identifier) - (Statements)) - (Function - (Identifier) - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Statements - (Identifier) - (Identifier) - (Identifier) - (Identifier)) - (Statements)) - (Function - (Statements - (Statements - (Identifier)) - (Statements - (Identifier))) - (Identifier) - (Statements)) - (Function - (Statements - (Statements - (Identifier) - (Identifier)) - (Statements - (Identifier) - (Identifier))) - (Identifier) - (Statements)) - (Function - (Identifier) - (Identifier) - (Empty)) - (Function - (Context - (Comment) - (Empty)) - (Identifier) - (Statements - (Identifier) - (Pointer - (Identifier))) - (Statements))) diff --git a/test/fixtures/go/corpus/function-declarations.parseB.txt b/test/fixtures/go/corpus/function-declarations.parseB.txt deleted file mode 100644 index a78e627d10..0000000000 --- a/test/fixtures/go/corpus/function-declarations.parseB.txt +++ /dev/null @@ -1,58 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements)) - (Function - (Identifier) - (Statements)) - (Function - (Identifier) - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Statements - (Identifier) - (Identifier) - (Identifier) - (Identifier)) - (Statements)) - (Function - (Statements - (Statements - (Identifier)) - (Statements - (Identifier))) - (Identifier) - (Statements)) - (Function - (Statements - (Statements - (Identifier) - (Identifier)) - (Statements - (Identifier) - (Identifier))) - (Identifier) - (Statements)) - (Function - (Statements) - (Identifier) - (NoOp - (Empty))) - (Function - (Identifier) - (Identifier) - (Empty)) - (Function - (Context - (Comment) - (Empty)) - (Identifier) - (Statements - (Identifier) - (Pointer - (Identifier))) - (Statements))) diff --git a/test/fixtures/go/corpus/function-literals.parseA.txt b/test/fixtures/go/corpus/function-literals.parseA.txt deleted file mode 100644 index a27f6ef7c9..0000000000 --- a/test/fixtures/go/corpus/function-literals.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Identifier) - (Function - (Statements - (Statements - (Identifier)) - (Statements - (Identifier))) - (Empty) - (Statements - (Identifier) - (Identifier)) - (Return - (Statements - (Integer) - (Integer))))))) diff --git a/test/fixtures/go/corpus/function-literals.parseB.txt b/test/fixtures/go/corpus/function-literals.parseB.txt deleted file mode 100644 index a27f6ef7c9..0000000000 --- a/test/fixtures/go/corpus/function-literals.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Identifier) - (Function - (Statements - (Statements - (Identifier)) - (Statements - (Identifier))) - (Empty) - (Statements - (Identifier) - (Identifier)) - (Return - (Statements - (Integer) - (Integer))))))) diff --git a/test/fixtures/go/corpus/function-types.parseA.txt b/test/fixtures/go/corpus/function-types.parseA.txt deleted file mode 100644 index d4cca4536f..0000000000 --- a/test/fixtures/go/corpus/function-types.parseA.txt +++ /dev/null @@ -1,24 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (Function - (Statements - (Identifier)) - (Identifier))) - (Type - (Identifier) - (Function - (Statements - (Identifier)) - (Statements - (Identifier)) - (Statements - (Statements - (Identifier)) - (Statements - (Identifier)))))))) diff --git a/test/fixtures/go/corpus/function-types.parseB.txt b/test/fixtures/go/corpus/function-types.parseB.txt deleted file mode 100644 index 936d40265c..0000000000 --- a/test/fixtures/go/corpus/function-types.parseB.txt +++ /dev/null @@ -1,25 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (Function - (Statements - (Identifier)) - (Identifier))) - (Type - (Identifier) - (Function - (Statements - (Identifier)) - (Statements - (Identifier)) - (Statements - (Statements - (BidirectionalChannel - (Identifier))) - (Statements - (Identifier)))))))) diff --git a/test/fixtures/go/corpus/go-and-defer-statements.parseA.txt b/test/fixtures/go/corpus/go-and-defer-statements.parseA.txt deleted file mode 100644 index fccff24566..0000000000 --- a/test/fixtures/go/corpus/go-and-defer-statements.parseA.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Defer - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements) - (Empty))) - (Go - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements) - (Empty)))))) diff --git a/test/fixtures/go/corpus/go-and-defer-statements.parseB.txt b/test/fixtures/go/corpus/go-and-defer-statements.parseB.txt deleted file mode 100644 index fccff24566..0000000000 --- a/test/fixtures/go/corpus/go-and-defer-statements.parseB.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Defer - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements) - (Empty))) - (Go - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements) - (Empty)))))) diff --git a/test/fixtures/go/corpus/grouped-import-declarations.parseA.txt b/test/fixtures/go/corpus/grouped-import-declarations.parseA.txt deleted file mode 100644 index f926339568..0000000000 --- a/test/fixtures/go/corpus/grouped-import-declarations.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Package - (Identifier)) - (Statements - (QualifiedImport - (Identifier)) - (Import - (TextElement)) - (QualifiedImport - (Identifier))) - (Function - (Identifier) - (Statements))) diff --git a/test/fixtures/go/corpus/grouped-import-declarations.parseB.txt b/test/fixtures/go/corpus/grouped-import-declarations.parseB.txt deleted file mode 100644 index f926339568..0000000000 --- a/test/fixtures/go/corpus/grouped-import-declarations.parseB.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Package - (Identifier)) - (Statements - (QualifiedImport - (Identifier)) - (Import - (TextElement)) - (QualifiedImport - (Identifier))) - (Function - (Identifier) - (Statements))) diff --git a/test/fixtures/go/corpus/grouped-var-declarations.parseA.txt b/test/fixtures/go/corpus/grouped-var-declarations.parseA.txt deleted file mode 100644 index 42a338adf5..0000000000 --- a/test/fixtures/go/corpus/grouped-var-declarations.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Integer)) - (Assignment - (Identifier) - (Integer))))) diff --git a/test/fixtures/go/corpus/grouped-var-declarations.parseB.txt b/test/fixtures/go/corpus/grouped-var-declarations.parseB.txt deleted file mode 100644 index 42a338adf5..0000000000 --- a/test/fixtures/go/corpus/grouped-var-declarations.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Integer)) - (Assignment - (Identifier) - (Integer))))) diff --git a/test/fixtures/go/corpus/if-statements.parseA.txt b/test/fixtures/go/corpus/if-statements.parseA.txt deleted file mode 100644 index 0e44a6dd3b..0000000000 --- a/test/fixtures/go/corpus/if-statements.parseA.txt +++ /dev/null @@ -1,79 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (If - (Statements - (Call - (Identifier) - (Statements) - (Empty))) - (Call - (Identifier) - (Statements) - (Empty)) - (Empty)) - (If - (Statements - (Assignment - (Identifier) - (Call - (Identifier) - (Statements) - (Empty))) - (Identifier)) - (Call - (Identifier) - (Statements) - (Empty)) - (Empty)) - (If - (Statements - (Call - (Identifier) - (Statements) - (Empty))) - (Call - (Identifier) - (Statements) - (Empty)) - (Call - (Identifier) - (Statements) - (Empty))) - (If - (Statements - (Assignment - (Identifier) - (Integer)) - (LessThan - (Identifier) - (Integer))) - (Call - (Identifier) - (Statements) - (Empty)) - (If - (Statements - (LessThan - (Identifier) - (Integer))) - (Call - (Identifier) - (Statements) - (Empty)) - (Context - (Comment) - (If - (Statements - (Call - (Identifier) - (Statements) - (Empty))) - (Call - (Identifier) - (Statements) - (Empty)) - (Empty)))))))) diff --git a/test/fixtures/go/corpus/if-statements.parseB.txt b/test/fixtures/go/corpus/if-statements.parseB.txt deleted file mode 100644 index 95655d79f4..0000000000 --- a/test/fixtures/go/corpus/if-statements.parseB.txt +++ /dev/null @@ -1,72 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (If - (Statements - (Call - (Identifier) - (Statements) - (Empty))) - (Call - (Identifier) - (Statements) - (Empty)) - (Empty)) - (If - (Statements - (Assignment - (Identifier) - (Call - (Identifier) - (Statements) - (Empty))) - (Identifier)) - (Call - (Identifier) - (Statements) - (Empty)) - (Empty)) - (If - (Statements - (Call - (Identifier) - (Statements) - (Empty))) - (Call - (Identifier) - (Statements) - (Empty)) - (Call - (Identifier) - (Statements) - (Empty))) - (If - (Statements - (Assignment - (Identifier) - (Integer)) - (LessThan - (Identifier) - (Integer))) - (Call - (Identifier) - (Statements) - (Empty)) - (Context - (Comment) - (If - (Statements - (LessThan - (Identifier) - (Integer))) - (Call - (Identifier) - (Statements) - (Empty)) - (Call - (Identifier) - (Statements) - (Empty)))))))) diff --git a/test/fixtures/go/corpus/imaginary-literals.parseA.txt b/test/fixtures/go/corpus/imaginary-literals.parseA.txt deleted file mode 100644 index 154d5eabc6..0000000000 --- a/test/fixtures/go/corpus/imaginary-literals.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Complex)) - (Assignment - (Identifier) - (Complex))))) diff --git a/test/fixtures/go/corpus/imaginary-literals.parseB.txt b/test/fixtures/go/corpus/imaginary-literals.parseB.txt deleted file mode 100644 index 154d5eabc6..0000000000 --- a/test/fixtures/go/corpus/imaginary-literals.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Complex)) - (Assignment - (Identifier) - (Complex))))) diff --git a/test/fixtures/go/corpus/import-statements.parseA.txt b/test/fixtures/go/corpus/import-statements.parseA.txt deleted file mode 100644 index 4aeffce206..0000000000 --- a/test/fixtures/go/corpus/import-statements.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Statements - (Comment) - (Comment) - (QualifiedImport - (Identifier)) - (Comment)) - (Function - (Identifier) - (Statements))) diff --git a/test/fixtures/go/corpus/import-statements.parseB.txt b/test/fixtures/go/corpus/import-statements.parseB.txt deleted file mode 100644 index 4aeffce206..0000000000 --- a/test/fixtures/go/corpus/import-statements.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Statements - (Comment) - (Comment) - (QualifiedImport - (Identifier)) - (Comment)) - (Function - (Identifier) - (Statements))) diff --git a/test/fixtures/go/corpus/increment-decrement-statements.parseA.txt b/test/fixtures/go/corpus/increment-decrement-statements.parseA.txt deleted file mode 100644 index 9abd7c4090..0000000000 --- a/test/fixtures/go/corpus/increment-decrement-statements.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (PostIncrement - (Identifier)) - (PostDecrement - (Identifier))))) diff --git a/test/fixtures/go/corpus/increment-decrement-statements.parseB.txt b/test/fixtures/go/corpus/increment-decrement-statements.parseB.txt deleted file mode 100644 index 05df292e24..0000000000 --- a/test/fixtures/go/corpus/increment-decrement-statements.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (PostIncrement - (Identifier)) - (PostIncrement - (Identifier))))) diff --git a/test/fixtures/go/corpus/int-literals.parseA.txt b/test/fixtures/go/corpus/int-literals.parseA.txt deleted file mode 100644 index e86cf1892c..0000000000 --- a/test/fixtures/go/corpus/int-literals.parseA.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Integer)) - (Assignment - (Identifier) - (Integer)) - (Assignment - (Identifier) - (Integer))))) diff --git a/test/fixtures/go/corpus/int-literals.parseB.txt b/test/fixtures/go/corpus/int-literals.parseB.txt deleted file mode 100644 index e86cf1892c..0000000000 --- a/test/fixtures/go/corpus/int-literals.parseB.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Integer)) - (Assignment - (Identifier) - (Integer)) - (Assignment - (Identifier) - (Integer))))) diff --git a/test/fixtures/go/corpus/interface-types.parseA.txt b/test/fixtures/go/corpus/interface-types.parseA.txt deleted file mode 100644 index 8d033dfa35..0000000000 --- a/test/fixtures/go/corpus/interface-types.parseA.txt +++ /dev/null @@ -1,42 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Statements - (Type - (Identifier) - (Interface - (Statements)))) - (Statements - (Type - (Identifier) - (Interface - (MemberAccess - (Identifier) - (Identifier))))) - (Statements - (Type - (Identifier) - (Interface - (Statements - (Identifier) - (MemberAccess - (Identifier) - (Identifier)) - (MethodSignature - (Identifier) - (Identifier) - (Statements - (Identifier) - (Identifier))))))) - (Context - (Comment) - (Statements - (Type - (Identifier) - (Interface - (MethodSignature - (Empty) - (Identifier))))))))) diff --git a/test/fixtures/go/corpus/interface-types.parseB.txt b/test/fixtures/go/corpus/interface-types.parseB.txt deleted file mode 100644 index 8d033dfa35..0000000000 --- a/test/fixtures/go/corpus/interface-types.parseB.txt +++ /dev/null @@ -1,42 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Statements - (Type - (Identifier) - (Interface - (Statements)))) - (Statements - (Type - (Identifier) - (Interface - (MemberAccess - (Identifier) - (Identifier))))) - (Statements - (Type - (Identifier) - (Interface - (Statements - (Identifier) - (MemberAccess - (Identifier) - (Identifier)) - (MethodSignature - (Identifier) - (Identifier) - (Statements - (Identifier) - (Identifier))))))) - (Context - (Comment) - (Statements - (Type - (Identifier) - (Interface - (MethodSignature - (Empty) - (Identifier))))))))) diff --git a/test/fixtures/go/corpus/label-statements.parseA.txt b/test/fixtures/go/corpus/label-statements.parseA.txt deleted file mode 100644 index 39b607f865..0000000000 --- a/test/fixtures/go/corpus/label-statements.parseA.txt +++ /dev/null @@ -1,38 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Label - (Identifier) - (NoOp - (Empty))) - (Context - (Comment) - (Label - (Identifier) - (Context - (Comment) - (For - (Assignment - (Identifier) - (Integer)) - (LessThan - (Identifier) - (Integer)) - (PostIncrement - (Identifier)) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (Break - (Identifier)) - (Context - (Comment) - (Empty))))))) - (Label - (Identifier) - (Empty))))) diff --git a/test/fixtures/go/corpus/label-statements.parseB.txt b/test/fixtures/go/corpus/label-statements.parseB.txt deleted file mode 100644 index 39b607f865..0000000000 --- a/test/fixtures/go/corpus/label-statements.parseB.txt +++ /dev/null @@ -1,38 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Label - (Identifier) - (NoOp - (Empty))) - (Context - (Comment) - (Label - (Identifier) - (Context - (Comment) - (For - (Assignment - (Identifier) - (Integer)) - (LessThan - (Identifier) - (Integer)) - (PostIncrement - (Identifier)) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (Break - (Identifier)) - (Context - (Comment) - (Empty))))))) - (Label - (Identifier) - (Empty))))) diff --git a/test/fixtures/go/corpus/map-literals.parseA.txt b/test/fixtures/go/corpus/map-literals.parseA.txt deleted file mode 100644 index 2c9618ed97..0000000000 --- a/test/fixtures/go/corpus/map-literals.parseA.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Identifier) - (Composite - (Map - (Identifier) - (Identifier)) - (Statements - (KeyValue - (TextElement) - (TextElement)) - (KeyValue - (TextElement) - (TextElement))))))) diff --git a/test/fixtures/go/corpus/map-literals.parseB.txt b/test/fixtures/go/corpus/map-literals.parseB.txt deleted file mode 100644 index 2c9618ed97..0000000000 --- a/test/fixtures/go/corpus/map-literals.parseB.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Identifier) - (Composite - (Map - (Identifier) - (Identifier)) - (Statements - (KeyValue - (TextElement) - (TextElement)) - (KeyValue - (TextElement) - (TextElement))))))) diff --git a/test/fixtures/go/corpus/map-types.parseA.txt b/test/fixtures/go/corpus/map-types.parseA.txt deleted file mode 100644 index 1f81e82d27..0000000000 --- a/test/fixtures/go/corpus/map-types.parseA.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (Map - (Identifier) - (Identifier)))))) diff --git a/test/fixtures/go/corpus/map-types.parseB.txt b/test/fixtures/go/corpus/map-types.parseB.txt deleted file mode 100644 index 1f81e82d27..0000000000 --- a/test/fixtures/go/corpus/map-types.parseB.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (Map - (Identifier) - (Identifier)))))) diff --git a/test/fixtures/go/corpus/method-declarations.parseA.txt b/test/fixtures/go/corpus/method-declarations.parseA.txt deleted file mode 100644 index 0ed4de9cf5..0000000000 --- a/test/fixtures/go/corpus/method-declarations.parseA.txt +++ /dev/null @@ -1,90 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements)) - (Method - (Statements - (Identifier)) - (Identifier) - (Empty)) - (Method - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Statements)) - (Method - (Identifier) - (Statements - (Identifier) - (Pointer - (Identifier))) - (Identifier) - (Return - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Plus - (Times - (MemberAccess - (Identifier) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier))) - (Times - (MemberAccess - (Identifier) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)))) - (Empty)))) - (Method - (Statements - (Assignment - (MemberAccess - (Identifier) - (Identifier)) - (Times - (MemberAccess - (Identifier) - (Identifier)) - (Identifier))) - (Assignment - (MemberAccess - (Identifier) - (Identifier)) - (Times - (MemberAccess - (Identifier) - (Identifier)) - (Identifier)))) - (Statements - (Identifier) - (Pointer - (Identifier))) - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Empty)) - (Method - (Identifier) - (Statements - (Identifier) - (Pointer - (Identifier))) - (Identifier) - (Statements - (Identifier) - (Identifier) - (Identifier)) - (Statements))) diff --git a/test/fixtures/go/corpus/method-declarations.parseB.txt b/test/fixtures/go/corpus/method-declarations.parseB.txt deleted file mode 100644 index a5920ebbba..0000000000 --- a/test/fixtures/go/corpus/method-declarations.parseB.txt +++ /dev/null @@ -1,104 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements)) - (Method - (Statements - (Identifier)) - (Identifier) - (Empty)) - (Method - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Statements)) - (Method - (Identifier) - (Statements - (Identifier) - (Pointer - (Identifier))) - (Identifier) - (Return - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Plus - (Plus - (Plus - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (MemberAccess - (Identifier) - (Identifier)) - (Integer)) - (Empty)) - (MemberAccess - (Identifier) - (Identifier))) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (MemberAccess - (Identifier) - (Identifier)) - (Integer)) - (Empty))) - (MemberAccess - (Identifier) - (Identifier))) - (Empty)))) - (Method - (Statements - (Assignment - (MemberAccess - (Identifier) - (Identifier)) - (Times - (MemberAccess - (Identifier) - (Identifier)) - (Identifier))) - (Assignment - (MemberAccess - (Identifier) - (Identifier)) - (Times - (MemberAccess - (Identifier) - (Identifier)) - (Identifier)))) - (Statements - (Identifier) - (Pointer - (Identifier))) - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Empty)) - (Method - (Identifier) - (Statements - (Identifier) - (Pointer - (Identifier))) - (Identifier) - (Statements - (Identifier) - (Identifier) - (Identifier)) - (Statements))) diff --git a/test/fixtures/go/corpus/modifying-struct-fields.parseA.txt b/test/fixtures/go/corpus/modifying-struct-fields.parseA.txt deleted file mode 100644 index ebd05f8733..0000000000 --- a/test/fixtures/go/corpus/modifying-struct-fields.parseA.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Identifier) - (Reference - (Composite - (Identifier) - (Statements - (KeyValue - (Identifier) - (Identifier)))))))) diff --git a/test/fixtures/go/corpus/modifying-struct-fields.parseB.txt b/test/fixtures/go/corpus/modifying-struct-fields.parseB.txt deleted file mode 100644 index f8c1bf289f..0000000000 --- a/test/fixtures/go/corpus/modifying-struct-fields.parseB.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Identifier) - (Reference - (Composite - (Identifier) - (Statements - (KeyValue - (Identifier) - (Call - (Identifier) - (MemberAccess - (Identifier) - (Identifier)) - (Empty))))))))) diff --git a/test/fixtures/go/corpus/parameter-declarations-with-types.parseA.txt b/test/fixtures/go/corpus/parameter-declarations-with-types.parseA.txt deleted file mode 100644 index 61b1b36d96..0000000000 --- a/test/fixtures/go/corpus/parameter-declarations-with-types.parseA.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements)) - (Function - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Statements - (Identifier) - (Identifier)) - (Statements))) diff --git a/test/fixtures/go/corpus/parameter-declarations-with-types.parseB.txt b/test/fixtures/go/corpus/parameter-declarations-with-types.parseB.txt deleted file mode 100644 index 61b1b36d96..0000000000 --- a/test/fixtures/go/corpus/parameter-declarations-with-types.parseB.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements)) - (Function - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Statements - (Identifier) - (Identifier)) - (Statements))) diff --git a/test/fixtures/go/corpus/pointer-types.parseA.txt b/test/fixtures/go/corpus/pointer-types.parseA.txt deleted file mode 100644 index 72e163d81a..0000000000 --- a/test/fixtures/go/corpus/pointer-types.parseA.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (Pointer - (Identifier))) - (Type - (Identifier) - (Pointer - (Pointer - (Identifier))))))) diff --git a/test/fixtures/go/corpus/pointer-types.parseB.txt b/test/fixtures/go/corpus/pointer-types.parseB.txt deleted file mode 100644 index 72e163d81a..0000000000 --- a/test/fixtures/go/corpus/pointer-types.parseB.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (Pointer - (Identifier))) - (Type - (Identifier) - (Pointer - (Pointer - (Identifier))))))) diff --git a/test/fixtures/go/corpus/qualified-types.parseA.txt b/test/fixtures/go/corpus/qualified-types.parseA.txt deleted file mode 100644 index e6e8e9b2e1..0000000000 --- a/test/fixtures/go/corpus/qualified-types.parseA.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (MemberAccess - (Identifier) - (Identifier)))))) diff --git a/test/fixtures/go/corpus/qualified-types.parseB.txt b/test/fixtures/go/corpus/qualified-types.parseB.txt deleted file mode 100644 index e6e8e9b2e1..0000000000 --- a/test/fixtures/go/corpus/qualified-types.parseB.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (MemberAccess - (Identifier) - (Identifier)))))) diff --git a/test/fixtures/go/corpus/rune-literals.parseA.txt b/test/fixtures/go/corpus/rune-literals.parseA.txt deleted file mode 100644 index 3e0b36dc30..0000000000 --- a/test/fixtures/go/corpus/rune-literals.parseA.txt +++ /dev/null @@ -1,22 +0,0 @@ -(Statements - (Package - (Identifier)) - (Statements - (Assignment - (Identifier) - (Rune)) - (Assignment - (Identifier) - (Rune)) - (Assignment - (Identifier) - (Rune)) - (Assignment - (Identifier) - (Rune)) - (Assignment - (Identifier) - (Rune)) - (Assignment - (Identifier) - (Rune)))) diff --git a/test/fixtures/go/corpus/rune-literals.parseB.txt b/test/fixtures/go/corpus/rune-literals.parseB.txt deleted file mode 100644 index 3e0b36dc30..0000000000 --- a/test/fixtures/go/corpus/rune-literals.parseB.txt +++ /dev/null @@ -1,22 +0,0 @@ -(Statements - (Package - (Identifier)) - (Statements - (Assignment - (Identifier) - (Rune)) - (Assignment - (Identifier) - (Rune)) - (Assignment - (Identifier) - (Rune)) - (Assignment - (Identifier) - (Rune)) - (Assignment - (Identifier) - (Rune)) - (Assignment - (Identifier) - (Rune)))) diff --git a/test/fixtures/go/corpus/select-statements.parseA.txt b/test/fixtures/go/corpus/select-statements.parseA.txt deleted file mode 100644 index b94f855fdd..0000000000 --- a/test/fixtures/go/corpus/select-statements.parseA.txt +++ /dev/null @@ -1,79 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Select - (Statements - (Pattern - (Receive - (Identifier) - (ReceiveOperator - (Identifier))) - (Call - (Identifier) - (Identifier) - (Empty))) - (Pattern - (Send - (Identifier) - (Identifier)) - (Call - (Identifier) - (Integer) - (Empty))) - (Pattern - (Receive - (Empty) - (ReceiveOperator - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Integer) - (Empty)))) - (Statements - (Call - (Identifier) - (Integer) - (Empty)) - (PostDecrement - (Identifier)) - (If - (Statements - (Identifier)) - (Statements - (Send - (Identifier) - (Composite - (Identifier) - (Statements - (Identifier) - (Identifier)))) - (Return - (Empty))) - (Empty)))) - (Pattern - (DefaultPattern - (Statements)) - (Return - (Empty))))) - (Select - (Statements - (Pattern - (Receive - (Empty) - (ReceiveOperator - (Identifier))) - (Statements)) - (Pattern - (Receive - (Empty) - (ReceiveOperator - (Identifier))) - (Statements)) - (Pattern - (DefaultPattern - (Statements)) - (Statements))))))) diff --git a/test/fixtures/go/corpus/select-statements.parseB.txt b/test/fixtures/go/corpus/select-statements.parseB.txt deleted file mode 100644 index 8aca1e677a..0000000000 --- a/test/fixtures/go/corpus/select-statements.parseB.txt +++ /dev/null @@ -1,75 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Select - (Statements - (Pattern - (Receive - (Identifier) - (ReceiveOperator - (Identifier))) - (Call - (Identifier) - (Identifier) - (Empty))) - (Pattern - (Send - (Identifier) - (Identifier)) - (Call - (Identifier) - (Integer) - (Empty))) - (Pattern - (Receive - (Empty) - (ReceiveOperator - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Integer) - (Empty)))) - (Statements - (Call - (Identifier) - (Integer) - (Empty)) - (PostIncrement - (Identifier)) - (If - (Statements - (Identifier)) - (Statements - (Send - (Identifier) - (Composite - (Identifier) - (Statements - (Identifier) - (Identifier)))) - (Return - (Empty))) - (Empty)))) - (Pattern - (DefaultPattern - (Statements)) - (Return - (Empty))))) - (Select - (Statements - (Pattern - (Receive - (Empty) - (ReceiveOperator - (Identifier))) - (Statements)) - (Pattern - (Receive - (Empty) - (ReceiveOperator - (Identifier))) - (Statements))))))) diff --git a/test/fixtures/go/corpus/selector-expressions.parseA.txt b/test/fixtures/go/corpus/selector-expressions.parseA.txt deleted file mode 100644 index 1ec0fc10a5..0000000000 --- a/test/fixtures/go/corpus/selector-expressions.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Call - (MemberAccess - (MemberAccess - (Identifier) - (Identifier)) - (Identifier)) - (Statements) - (Empty)))) diff --git a/test/fixtures/go/corpus/selector-expressions.parseB.txt b/test/fixtures/go/corpus/selector-expressions.parseB.txt deleted file mode 100644 index 1ec0fc10a5..0000000000 --- a/test/fixtures/go/corpus/selector-expressions.parseB.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Call - (MemberAccess - (MemberAccess - (Identifier) - (Identifier)) - (Identifier)) - (Statements) - (Empty)))) diff --git a/test/fixtures/go/corpus/send-statements.parseA.txt b/test/fixtures/go/corpus/send-statements.parseA.txt deleted file mode 100644 index 61edb44b2d..0000000000 --- a/test/fixtures/go/corpus/send-statements.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Send - (Identifier) - (Integer)))) diff --git a/test/fixtures/go/corpus/send-statements.parseB.txt b/test/fixtures/go/corpus/send-statements.parseB.txt deleted file mode 100644 index 61edb44b2d..0000000000 --- a/test/fixtures/go/corpus/send-statements.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Send - (Identifier) - (Integer)))) diff --git a/test/fixtures/go/corpus/short-var-declarations.parseA.txt b/test/fixtures/go/corpus/short-var-declarations.parseA.txt deleted file mode 100644 index a144c2045c..0000000000 --- a/test/fixtures/go/corpus/short-var-declarations.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Statements - (Integer) - (Integer))))) diff --git a/test/fixtures/go/corpus/short-var-declarations.parseB.txt b/test/fixtures/go/corpus/short-var-declarations.parseB.txt deleted file mode 100644 index a144c2045c..0000000000 --- a/test/fixtures/go/corpus/short-var-declarations.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Statements - (Integer) - (Integer))))) diff --git a/test/fixtures/go/corpus/single-import-declarations.parseA.txt b/test/fixtures/go/corpus/single-import-declarations.parseA.txt deleted file mode 100644 index 2eeb86d5f3..0000000000 --- a/test/fixtures/go/corpus/single-import-declarations.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (QualifiedImport - (Identifier)) - (Import - (TextElement)) - (QualifiedImport - (Identifier)) - (Function - (Identifier) - (Statements))) diff --git a/test/fixtures/go/corpus/single-import-declarations.parseB.txt b/test/fixtures/go/corpus/single-import-declarations.parseB.txt deleted file mode 100644 index 2eeb86d5f3..0000000000 --- a/test/fixtures/go/corpus/single-import-declarations.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (QualifiedImport - (Identifier)) - (Import - (TextElement)) - (QualifiedImport - (Identifier)) - (Function - (Identifier) - (Statements))) diff --git a/test/fixtures/go/corpus/single-line-function-declarations.parseA.txt b/test/fixtures/go/corpus/single-line-function-declarations.parseA.txt deleted file mode 100644 index fd6373e9f2..0000000000 --- a/test/fixtures/go/corpus/single-line-function-declarations.parseA.txt +++ /dev/null @@ -1,34 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements)) - (Function - (Identifier) - (Call - (Identifier) - (Statements) - (Empty))) - (Function - (Identifier) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Call - (Identifier) - (Statements) - (Empty)))) - (Function - (Identifier) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Call - (Identifier) - (Statements) - (Empty))))) diff --git a/test/fixtures/go/corpus/single-line-function-declarations.parseB.txt b/test/fixtures/go/corpus/single-line-function-declarations.parseB.txt deleted file mode 100644 index fd6373e9f2..0000000000 --- a/test/fixtures/go/corpus/single-line-function-declarations.parseB.txt +++ /dev/null @@ -1,34 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements)) - (Function - (Identifier) - (Call - (Identifier) - (Statements) - (Empty))) - (Function - (Identifier) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Call - (Identifier) - (Statements) - (Empty)))) - (Function - (Identifier) - (Statements - (Call - (Identifier) - (Statements) - (Empty)) - (Call - (Identifier) - (Statements) - (Empty))))) diff --git a/test/fixtures/go/corpus/slice-expressions.parseA.txt b/test/fixtures/go/corpus/slice-expressions.parseA.txt deleted file mode 100644 index cba5ced8e7..0000000000 --- a/test/fixtures/go/corpus/slice-expressions.parseA.txt +++ /dev/null @@ -1,31 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Slice - (Identifier) - (Integer) - (Empty) - (Empty)) - (Slice - (Identifier) - (Empty) - (Integer) - (Empty)) - (Slice - (Identifier) - (Empty) - (Empty) - (Empty)) - (Slice - (Identifier) - (Integer) - (Integer) - (Integer)) - (Slice - (Identifier) - (Integer) - (Integer) - (Empty))))) diff --git a/test/fixtures/go/corpus/slice-expressions.parseB.txt b/test/fixtures/go/corpus/slice-expressions.parseB.txt deleted file mode 100644 index d9c166324b..0000000000 --- a/test/fixtures/go/corpus/slice-expressions.parseB.txt +++ /dev/null @@ -1,31 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Slice - (Identifier) - (Integer) - (Empty) - (Empty)) - (Slice - (Identifier) - (Empty) - (Integer) - (Empty)) - (Slice - (Identifier) - (Integer) - (Integer) - (Empty)) - (Slice - (Identifier) - (Integer) - (Integer) - (Integer)) - (Slice - (Identifier) - (Integer) - (Integer) - (Empty))))) diff --git a/test/fixtures/go/corpus/slice-literals.parseA.txt b/test/fixtures/go/corpus/slice-literals.parseA.txt deleted file mode 100644 index 8cab0dad32..0000000000 --- a/test/fixtures/go/corpus/slice-literals.parseA.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Composite - (Slice - (Identifier)) - (Statements))) - (Assignment - (Identifier) - (Composite - (Slice - (Identifier)) - (Statements - (TextElement)))) - (Assignment - (Identifier) - (Composite - (Slice - (Identifier)) - (Statements - (TextElement) - (TextElement))))))) diff --git a/test/fixtures/go/corpus/slice-literals.parseB.txt b/test/fixtures/go/corpus/slice-literals.parseB.txt deleted file mode 100644 index 4274986d78..0000000000 --- a/test/fixtures/go/corpus/slice-literals.parseB.txt +++ /dev/null @@ -1,28 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Composite - (Slice - (Identifier)) - (Statements - (TextElement)))) - (Assignment - (Identifier) - (Composite - (Slice - (Identifier)) - (Statements - (TextElement)))) - (Assignment - (Identifier) - (Composite - (Slice - (Identifier)) - (Statements - (TextElement) - (TextElement))))))) diff --git a/test/fixtures/go/corpus/slice-types.parseA.txt b/test/fixtures/go/corpus/slice-types.parseA.txt deleted file mode 100644 index a3387f59c3..0000000000 --- a/test/fixtures/go/corpus/slice-types.parseA.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Statements - (Type - (Identifier) - (Slice - (Identifier)))) - (Statements - (Type - (Identifier) - (Slice - (Slice - (Identifier)))))))) diff --git a/test/fixtures/go/corpus/slice-types.parseB.txt b/test/fixtures/go/corpus/slice-types.parseB.txt deleted file mode 100644 index 9edb211a98..0000000000 --- a/test/fixtures/go/corpus/slice-types.parseB.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Statements - (Type - (Identifier) - (Slice - (Slice - (Identifier))))) - (Statements - (Type - (Identifier) - (Slice - (Identifier))))))) diff --git a/test/fixtures/go/corpus/string-literals.parseA.txt b/test/fixtures/go/corpus/string-literals.parseA.txt deleted file mode 100644 index bc3dff6286..0000000000 --- a/test/fixtures/go/corpus/string-literals.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (TextElement)) - (Assignment - (Identifier) - (TextElement))))) diff --git a/test/fixtures/go/corpus/string-literals.parseB.txt b/test/fixtures/go/corpus/string-literals.parseB.txt deleted file mode 100644 index bc3dff6286..0000000000 --- a/test/fixtures/go/corpus/string-literals.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (TextElement)) - (Assignment - (Identifier) - (TextElement))))) diff --git a/test/fixtures/go/corpus/struct-field-declarations.parseA.txt b/test/fixtures/go/corpus/struct-field-declarations.parseA.txt deleted file mode 100644 index 1c64c98cca..0000000000 --- a/test/fixtures/go/corpus/struct-field-declarations.parseA.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (Constructor - (Empty) - (Field - (Identifier) - (Statements - (Identifier)))))))) diff --git a/test/fixtures/go/corpus/struct-field-declarations.parseB.txt b/test/fixtures/go/corpus/struct-field-declarations.parseB.txt deleted file mode 100644 index c40437883f..0000000000 --- a/test/fixtures/go/corpus/struct-field-declarations.parseB.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Type - (Identifier) - (Constructor - (Empty) - (Field - (Identifier) - (Statements - (Identifier) - (Identifier)))))))) diff --git a/test/fixtures/go/corpus/struct-literals.parseA.txt b/test/fixtures/go/corpus/struct-literals.parseA.txt deleted file mode 100644 index fc8fc1c67f..0000000000 --- a/test/fixtures/go/corpus/struct-literals.parseA.txt +++ /dev/null @@ -1,37 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Composite - (Identifier) - (Statements - (KeyValue - (Identifier) - (TextElement)) - (KeyValue - (Identifier) - (TextElement))))) - (Assignment - (Identifier) - (Composite - (Constructor - (Empty) - (Field - (Identifier) - (Statements - (Identifier)))) - (Statements - (KeyValue - (Identifier) - (Integer))))) - (Assignment - (Identifier) - (Composite - (MemberAccess - (Identifier) - (Identifier)) - (Statements)))))) diff --git a/test/fixtures/go/corpus/struct-literals.parseB.txt b/test/fixtures/go/corpus/struct-literals.parseB.txt deleted file mode 100644 index fc8fc1c67f..0000000000 --- a/test/fixtures/go/corpus/struct-literals.parseB.txt +++ /dev/null @@ -1,37 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Identifier) - (Composite - (Identifier) - (Statements - (KeyValue - (Identifier) - (TextElement)) - (KeyValue - (Identifier) - (TextElement))))) - (Assignment - (Identifier) - (Composite - (Constructor - (Empty) - (Field - (Identifier) - (Statements - (Identifier)))) - (Statements - (KeyValue - (Identifier) - (Integer))))) - (Assignment - (Identifier) - (Composite - (MemberAccess - (Identifier) - (Identifier)) - (Statements)))))) diff --git a/test/fixtures/go/corpus/struct-types.parseA.txt b/test/fixtures/go/corpus/struct-types.parseA.txt deleted file mode 100644 index 80a61bc56e..0000000000 --- a/test/fixtures/go/corpus/struct-types.parseA.txt +++ /dev/null @@ -1,46 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Statements - (Type - (Identifier) - (Constructor - (Empty) - (Statements)))) - (Statements - (Type - (Identifier) - (Constructor - (Empty) - (Field - (Identifier) - (Statements))))) - (Statements - (Type - (Identifier) - (Constructor - (Empty) - (Field - (Identifier) - (Statements - (Identifier) - (Identifier)))))) - (Statements - (Type - (Identifier) - (Constructor - (Empty) - (Statements - (Field - (Statements - (MemberAccess - (Identifier) - (Identifier)))) - (Field - (Identifier) - (TextElement) - (Statements - (Identifier)))))))))) diff --git a/test/fixtures/go/corpus/struct-types.parseB.txt b/test/fixtures/go/corpus/struct-types.parseB.txt deleted file mode 100644 index 80a61bc56e..0000000000 --- a/test/fixtures/go/corpus/struct-types.parseB.txt +++ /dev/null @@ -1,46 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Statements - (Type - (Identifier) - (Constructor - (Empty) - (Statements)))) - (Statements - (Type - (Identifier) - (Constructor - (Empty) - (Field - (Identifier) - (Statements))))) - (Statements - (Type - (Identifier) - (Constructor - (Empty) - (Field - (Identifier) - (Statements - (Identifier) - (Identifier)))))) - (Statements - (Type - (Identifier) - (Constructor - (Empty) - (Statements - (Field - (Statements - (MemberAccess - (Identifier) - (Identifier)))) - (Field - (Identifier) - (TextElement) - (Statements - (Identifier)))))))))) diff --git a/test/fixtures/go/corpus/switch-statements.diffA-B.txt b/test/fixtures/go/corpus/switch-statements.diffA-B.txt deleted file mode 100644 index 59f0638b79..0000000000 --- a/test/fixtures/go/corpus/switch-statements.diffA-B.txt +++ /dev/null @@ -1,42 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Match - (Statements) - (Statements - (Pattern - (LessThan - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (Call - (Identifier) - (Statements) - (Empty))) - (Pattern - (LessThan - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - {-(Context - {-(Comment)-} - (Call - (Identifier) - (Statements) - (Empty)))-}) - {-(Context - {-(Comment)-} - (Pattern - (Equal - { (Identifier) - ->(Identifier) } - (Integer)) - (Call - { (Identifier) - ->(Identifier) } - (Statements) - (Empty))))-})))) diff --git a/test/fixtures/go/corpus/switch-statements.diffB-A.txt b/test/fixtures/go/corpus/switch-statements.diffB-A.txt deleted file mode 100644 index a9fa0887b2..0000000000 --- a/test/fixtures/go/corpus/switch-statements.diffB-A.txt +++ /dev/null @@ -1,42 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Match - (Statements) - (Statements - (Pattern - (LessThan - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (Call - (Identifier) - (Statements) - (Empty))) - (Pattern - (LessThan - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - {+(Context - {+(Comment)+} - (Call - (Identifier) - (Statements) - (Empty)))+}) - {+(Context - {+(Comment)+} - (Pattern - (Equal - { (Identifier) - ->(Identifier) } - (Integer)) - (Call - { (Identifier) - ->(Identifier) } - (Statements) - (Empty))))+})))) diff --git a/test/fixtures/go/corpus/switch-statements.parseA.txt b/test/fixtures/go/corpus/switch-statements.parseA.txt deleted file mode 100644 index 569989d3e4..0000000000 --- a/test/fixtures/go/corpus/switch-statements.parseA.txt +++ /dev/null @@ -1,36 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Match - (Statements) - (Statements - (Pattern - (LessThan - (Identifier) - (Identifier)) - (Call - (Identifier) - (Statements) - (Empty))) - (Pattern - (LessThan - (Identifier) - (Identifier)) - (Context - (Comment) - (Call - (Identifier) - (Statements) - (Empty)))) - (Context - (Comment) - (Pattern - (Equal - (Identifier) - (Integer)) - (Call - (Identifier) - (Statements) - (Empty)))))))) diff --git a/test/fixtures/go/corpus/switch-statements.parseB.txt b/test/fixtures/go/corpus/switch-statements.parseB.txt deleted file mode 100644 index be48814de6..0000000000 --- a/test/fixtures/go/corpus/switch-statements.parseB.txt +++ /dev/null @@ -1,32 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Match - (Statements) - (Statements - (Pattern - (LessThan - (Identifier) - (Identifier)) - (Call - (Identifier) - (Statements) - (Empty))) - (Pattern - (LessThan - (Identifier) - (Identifier)) - (Call - (Identifier) - (Statements) - (Empty))) - (Pattern - (Equal - (Identifier) - (Integer)) - (Call - (Identifier) - (Statements) - (Empty))))))) diff --git a/test/fixtures/go/corpus/type-aliases.parseA.txt b/test/fixtures/go/corpus/type-aliases.parseA.txt deleted file mode 100644 index b45062fb30..0000000000 --- a/test/fixtures/go/corpus/type-aliases.parseA.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (TypeAlias - (Identifier) - (Slice - (Pointer - (Identifier)))) - (TypeAlias - (Identifier) - (Identifier))))) diff --git a/test/fixtures/go/corpus/type-aliases.parseB.txt b/test/fixtures/go/corpus/type-aliases.parseB.txt deleted file mode 100644 index b45062fb30..0000000000 --- a/test/fixtures/go/corpus/type-aliases.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (TypeAlias - (Identifier) - (Slice - (Pointer - (Identifier)))) - (TypeAlias - (Identifier) - (Identifier))))) diff --git a/test/fixtures/go/corpus/type-assertion-expressions.parseA.txt b/test/fixtures/go/corpus/type-assertion-expressions.parseA.txt deleted file mode 100644 index c7b4026cc4..0000000000 --- a/test/fixtures/go/corpus/type-assertion-expressions.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (TypeAssertion - (Identifier) - (MemberAccess - (Identifier) - (Identifier))))) diff --git a/test/fixtures/go/corpus/type-assertion-expressions.parseB.txt b/test/fixtures/go/corpus/type-assertion-expressions.parseB.txt deleted file mode 100644 index c7b4026cc4..0000000000 --- a/test/fixtures/go/corpus/type-assertion-expressions.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (TypeAssertion - (Identifier) - (MemberAccess - (Identifier) - (Identifier))))) diff --git a/test/fixtures/go/corpus/type-conversion-expressions.parseA.txt b/test/fixtures/go/corpus/type-conversion-expressions.parseA.txt deleted file mode 100644 index 5fb5fa8a40..0000000000 --- a/test/fixtures/go/corpus/type-conversion-expressions.parseA.txt +++ /dev/null @@ -1,72 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Pointer - (Call - (Identifier) - (Identifier) - (Empty))) - (Call - (Pointer - (Identifier)) - (Identifier) - (Empty)) - (TypeConversion - (ReceiveChannel - (Identifier)) - (Identifier)) - (TypeConversion - (Parenthesized - (ReceiveChannel - (Identifier))) - (Identifier)) - (TypeConversion - (Function - (Empty)) - (Identifier)) - (TypeConversion - (Parenthesized - (Function - (Empty))) - (Identifier)) - (TypeConversion - (Parenthesized - (Function - (Identifier))) - (Identifier)) - (TypeConversion - (Function - (Identifier)) - (Identifier)) - (TypeConversion - (Slice - (MemberAccess - (Identifier) - (Identifier))) - (MemberAccess - (Identifier) - (Identifier))) - (TypeConversion - (Parenthesized - (Slice - (MemberAccess - (Identifier) - (Identifier)))) - (MemberAccess - (Identifier) - (Identifier))) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty)) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty))))) diff --git a/test/fixtures/go/corpus/type-conversion-expressions.parseB.txt b/test/fixtures/go/corpus/type-conversion-expressions.parseB.txt deleted file mode 100644 index 5fb5fa8a40..0000000000 --- a/test/fixtures/go/corpus/type-conversion-expressions.parseB.txt +++ /dev/null @@ -1,72 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Pointer - (Call - (Identifier) - (Identifier) - (Empty))) - (Call - (Pointer - (Identifier)) - (Identifier) - (Empty)) - (TypeConversion - (ReceiveChannel - (Identifier)) - (Identifier)) - (TypeConversion - (Parenthesized - (ReceiveChannel - (Identifier))) - (Identifier)) - (TypeConversion - (Function - (Empty)) - (Identifier)) - (TypeConversion - (Parenthesized - (Function - (Empty))) - (Identifier)) - (TypeConversion - (Parenthesized - (Function - (Identifier))) - (Identifier)) - (TypeConversion - (Function - (Identifier)) - (Identifier)) - (TypeConversion - (Slice - (MemberAccess - (Identifier) - (Identifier))) - (MemberAccess - (Identifier) - (Identifier))) - (TypeConversion - (Parenthesized - (Slice - (MemberAccess - (Identifier) - (Identifier)))) - (MemberAccess - (Identifier) - (Identifier))) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty)) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty))))) diff --git a/test/fixtures/go/corpus/type-declarations.parseA.txt b/test/fixtures/go/corpus/type-declarations.parseA.txt deleted file mode 100644 index bdc352d1f8..0000000000 --- a/test/fixtures/go/corpus/type-declarations.parseA.txt +++ /dev/null @@ -1,44 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Statements - (Type - (Identifier) - (Identifier))) - (Statements - (Type - (Identifier) - (Identifier)) - (Type - (Identifier) - (Identifier))) - (Statements - (Context - (Comment) - (Type - (Identifier) - (Constructor - (Empty) - (Statements - (Field - (Identifier) - (Statements - (Identifier))) - (Field - (Identifier) - (Statements - (Identifier))) - (Field - (Identifier) - (Statements - (Identifier))))))) - (Type - (Identifier) - (Interface - (Statements))) - (Context - (Comment) - (Empty)))))) diff --git a/test/fixtures/go/corpus/type-declarations.parseB.txt b/test/fixtures/go/corpus/type-declarations.parseB.txt deleted file mode 100644 index bdc352d1f8..0000000000 --- a/test/fixtures/go/corpus/type-declarations.parseB.txt +++ /dev/null @@ -1,44 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Statements - (Type - (Identifier) - (Identifier))) - (Statements - (Type - (Identifier) - (Identifier)) - (Type - (Identifier) - (Identifier))) - (Statements - (Context - (Comment) - (Type - (Identifier) - (Constructor - (Empty) - (Statements - (Field - (Identifier) - (Statements - (Identifier))) - (Field - (Identifier) - (Statements - (Identifier))) - (Field - (Identifier) - (Statements - (Identifier))))))) - (Type - (Identifier) - (Interface - (Statements))) - (Context - (Comment) - (Empty)))))) diff --git a/test/fixtures/go/corpus/type-switch-statements.diffA-B.txt b/test/fixtures/go/corpus/type-switch-statements.diffA-B.txt deleted file mode 100644 index 4d1a44ceaf..0000000000 --- a/test/fixtures/go/corpus/type-switch-statements.diffA-B.txt +++ /dev/null @@ -1,136 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (TypeSwitch - (Statements - (Assignment - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (TypeSwitchGuard - { (Identifier) - ->(Identifier) })) - (Statements - (Pattern - (Statements - (Identifier) - (Pointer - (MemberAccess - (Identifier) - (Identifier)))) - (Statements)) - (Context - (Comment) - (Pattern - (Slice - (Identifier)) - (Call - (Identifier) - (Statements) - (Empty)))) - (Pattern - (Pointer - (Identifier)) - (Break - (Empty))) - {+(Pattern - {+(DefaultPattern - {+(Statements)+})+} - {+(Break - {+(Empty)+})+})+})) - (TypeSwitch - (Statements - (TypeSwitchGuard - (Statements - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }))) - (Statements - (Pattern - { (Identifier) - ->(Identifier) } - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - {+(DividedBy - {+(Integer)+} - {+(Identifier)+})+} - {-(Times - {-(Identifier)-} - {-(Integer)-})-}) - (Empty))) - (Pattern - { (Identifier) - ->(Identifier) } - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - {+(Times - {+(Identifier)+} - {+(Integer)+})+} - {-(DividedBy - {-(Integer)-} - {-(Identifier)-})-}) - (Empty))) - (Pattern - (Identifier) - (Statements - (Assignment - { (Identifier) - ->(Identifier) } - (DividedBy - (Call - (Identifier) - { (Identifier) - ->(Identifier) } - (Empty)) - (Integer))) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - (Plus - (Slice - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Empty) - (Empty)) - (Slice - { (Identifier) - ->(Identifier) } - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)))) - (Empty)))) - (Pattern - (DefaultPattern - (Statements)) - (Statements)))) - (TypeSwitch - (Empty) - (Statements - (TypeSwitchGuard - (Statements - (Identifier) - { (Identifier) - ->(Identifier) })) - (Context - { (Comment) - ->(Comment) } - (Empty))))))) diff --git a/test/fixtures/go/corpus/type-switch-statements.diffB-A.txt b/test/fixtures/go/corpus/type-switch-statements.diffB-A.txt deleted file mode 100644 index 8ac7411bb8..0000000000 --- a/test/fixtures/go/corpus/type-switch-statements.diffB-A.txt +++ /dev/null @@ -1,136 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (TypeSwitch - (Statements - (Assignment - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (TypeSwitchGuard - { (Identifier) - ->(Identifier) })) - (Statements - (Pattern - (Statements - (Identifier) - (Pointer - (MemberAccess - (Identifier) - (Identifier)))) - (Statements)) - (Context - (Comment) - (Pattern - (Slice - (Identifier)) - (Call - (Identifier) - (Statements) - (Empty)))) - (Pattern - (Pointer - (Identifier)) - (Break - (Empty))) - {-(Pattern - {-(DefaultPattern - {-(Statements)-})-} - {-(Break - {-(Empty)-})-})-})) - (TypeSwitch - (Statements - (TypeSwitchGuard - (Statements - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }))) - (Statements - (Pattern - { (Identifier) - ->(Identifier) } - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - {+(Times - {+(Identifier)+} - {+(Integer)+})+} - {-(DividedBy - {-(Integer)-} - {-(Identifier)-})-}) - (Empty))) - (Pattern - { (Identifier) - ->(Identifier) } - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - {+(DividedBy - {+(Integer)+} - {+(Identifier)+})+} - {-(Times - {-(Identifier)-} - {-(Integer)-})-}) - (Empty))) - (Pattern - (Identifier) - (Statements - (Assignment - { (Identifier) - ->(Identifier) } - (DividedBy - (Call - (Identifier) - { (Identifier) - ->(Identifier) } - (Empty)) - (Integer))) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - (Plus - (Slice - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Empty) - (Empty)) - (Slice - { (Identifier) - ->(Identifier) } - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)))) - (Empty)))) - (Pattern - (DefaultPattern - (Statements)) - (Statements)))) - (TypeSwitch - (Empty) - (Statements - (TypeSwitchGuard - (Statements - (Identifier) - { (Identifier) - ->(Identifier) })) - (Context - { (Comment) - ->(Comment) } - (Empty))))))) diff --git a/test/fixtures/go/corpus/type-switch-statements.parseA.txt b/test/fixtures/go/corpus/type-switch-statements.parseA.txt deleted file mode 100644 index 148054aa6b..0000000000 --- a/test/fixtures/go/corpus/type-switch-statements.parseA.txt +++ /dev/null @@ -1,110 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (TypeSwitch - (Statements - (Assignment - (Identifier) - (Identifier)) - (TypeSwitchGuard - (Identifier))) - (Statements - (Pattern - (Statements - (Identifier) - (Pointer - (MemberAccess - (Identifier) - (Identifier)))) - (Statements)) - (Context - (Comment) - (Pattern - (Slice - (Identifier)) - (Call - (Identifier) - (Statements) - (Empty)))) - (Pattern - (Pointer - (Identifier)) - (Break - (Empty))))) - (TypeSwitch - (Statements - (TypeSwitchGuard - (Statements - (Identifier) - (Identifier)))) - (Statements - (Pattern - (Identifier) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - (Times - (Identifier) - (Integer))) - (Empty))) - (Pattern - (Identifier) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - (DividedBy - (Integer) - (Identifier))) - (Empty))) - (Pattern - (Identifier) - (Statements - (Assignment - (Identifier) - (DividedBy - (Call - (Identifier) - (Identifier) - (Empty)) - (Integer))) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - (Plus - (Slice - (Identifier) - (Identifier) - (Empty) - (Empty)) - (Slice - (Identifier) - (Empty) - (Identifier) - (Empty)))) - (Empty)))) - (Pattern - (DefaultPattern - (Statements)) - (Statements)))) - (TypeSwitch - (Empty) - (Statements - (TypeSwitchGuard - (Statements - (Identifier) - (Identifier))) - (Context - (Comment) - (Empty))))))) diff --git a/test/fixtures/go/corpus/type-switch-statements.parseB.txt b/test/fixtures/go/corpus/type-switch-statements.parseB.txt deleted file mode 100644 index 43273b57ad..0000000000 --- a/test/fixtures/go/corpus/type-switch-statements.parseB.txt +++ /dev/null @@ -1,115 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (TypeSwitch - (Statements - (Assignment - (Identifier) - (Identifier)) - (TypeSwitchGuard - (Identifier))) - (Statements - (Pattern - (Statements - (Identifier) - (Pointer - (MemberAccess - (Identifier) - (Identifier)))) - (Statements)) - (Context - (Comment) - (Pattern - (Slice - (Identifier)) - (Call - (Identifier) - (Statements) - (Empty)))) - (Pattern - (Pointer - (Identifier)) - (Break - (Empty))) - (Pattern - (DefaultPattern - (Statements)) - (Break - (Empty))))) - (TypeSwitch - (Statements - (TypeSwitchGuard - (Statements - (Identifier) - (Identifier)))) - (Statements - (Pattern - (Identifier) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - (DividedBy - (Integer) - (Identifier))) - (Empty))) - (Pattern - (Identifier) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - (Times - (Identifier) - (Integer))) - (Empty))) - (Pattern - (Identifier) - (Statements - (Assignment - (Identifier) - (DividedBy - (Call - (Identifier) - (Identifier) - (Empty)) - (Integer))) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (TextElement) - (Plus - (Slice - (Identifier) - (Identifier) - (Empty) - (Empty)) - (Slice - (Identifier) - (Empty) - (Identifier) - (Empty)))) - (Empty)))) - (Pattern - (DefaultPattern - (Statements)) - (Statements)))) - (TypeSwitch - (Empty) - (Statements - (TypeSwitchGuard - (Statements - (Identifier) - (Identifier))) - (Context - (Comment) - (Empty))))))) diff --git a/test/fixtures/go/corpus/unary-expressions.parseA.txt b/test/fixtures/go/corpus/unary-expressions.parseA.txt deleted file mode 100644 index fb3269e2bf..0000000000 --- a/test/fixtures/go/corpus/unary-expressions.parseA.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Identifier) - (Negate - (Identifier)) - (Not - (ReceiveOperator - (Identifier))) - (Pointer - (Call - (Identifier) - (Statements) - (Empty))) - (Complement - (Identifier)) - (Reference - (Identifier)) - (ReceiveOperator - (Identifier))))) diff --git a/test/fixtures/go/corpus/unary-expressions.parseB.txt b/test/fixtures/go/corpus/unary-expressions.parseB.txt deleted file mode 100644 index fb3269e2bf..0000000000 --- a/test/fixtures/go/corpus/unary-expressions.parseB.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Identifier) - (Negate - (Identifier)) - (Not - (ReceiveOperator - (Identifier))) - (Pointer - (Call - (Identifier) - (Statements) - (Empty))) - (Complement - (Identifier)) - (Reference - (Identifier)) - (ReceiveOperator - (Identifier))))) diff --git a/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseA.txt b/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseA.txt deleted file mode 100644 index e1c5b31340..0000000000 --- a/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseA.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Annotation - (Statements - (Identifier)) - (Identifier)) - (Statements)) - (Assignment - (Annotation - (Statements - (Identifier) - (Identifier)) - (Identifier)) - (Statements))))) diff --git a/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseB.txt b/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseB.txt deleted file mode 100644 index e1c5b31340..0000000000 --- a/test/fixtures/go/corpus/var-declarations-with-no-expressions.parseB.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Annotation - (Statements - (Identifier)) - (Identifier)) - (Statements)) - (Assignment - (Annotation - (Statements - (Identifier) - (Identifier)) - (Identifier)) - (Statements))))) diff --git a/test/fixtures/go/corpus/var-declarations-with-types.parseA.txt b/test/fixtures/go/corpus/var-declarations-with-types.parseA.txt deleted file mode 100644 index 951e220675..0000000000 --- a/test/fixtures/go/corpus/var-declarations-with-types.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Annotation - (Statements - (Identifier)) - (Identifier)) - (Integer)) - (Assignment - (Annotation - (Statements - (Identifier) - (Identifier)) - (Identifier)) - (Statements - (Integer) - (Integer)))))) diff --git a/test/fixtures/go/corpus/var-declarations-with-types.parseB.txt b/test/fixtures/go/corpus/var-declarations-with-types.parseB.txt deleted file mode 100644 index 951e220675..0000000000 --- a/test/fixtures/go/corpus/var-declarations-with-types.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements - (Assignment - (Annotation - (Statements - (Identifier)) - (Identifier)) - (Integer)) - (Assignment - (Annotation - (Statements - (Identifier) - (Identifier)) - (Identifier)) - (Statements - (Integer) - (Integer)))))) diff --git a/test/fixtures/go/corpus/var-declarations-without-types.parseA.txt b/test/fixtures/go/corpus/var-declarations-without-types.parseA.txt deleted file mode 100644 index e5e2a55640..0000000000 --- a/test/fixtures/go/corpus/var-declarations-without-types.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Identifier) - (Integer)))) diff --git a/test/fixtures/go/corpus/var-declarations-without-types.parseB.txt b/test/fixtures/go/corpus/var-declarations-without-types.parseB.txt deleted file mode 100644 index a144c2045c..0000000000 --- a/test/fixtures/go/corpus/var-declarations-without-types.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Statements - (Integer) - (Integer))))) diff --git a/test/fixtures/go/corpus/variadic-function-declarations.parseA.txt b/test/fixtures/go/corpus/variadic-function-declarations.parseA.txt deleted file mode 100644 index 09b16360eb..0000000000 --- a/test/fixtures/go/corpus/variadic-function-declarations.parseA.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements)) - (Function - (Identifier) - (Variadic - (Pointer - (Identifier)) - (Identifier)) - (Statements)) - (Function - (Identifier) - (Variadic - (Identifier) - (Empty)) - (Statements)) - (Function - (Identifier) - (Statements - (Identifier)) - (Variadic - (Identifier) - (Empty)) - (Statements))) diff --git a/test/fixtures/go/corpus/variadic-function-declarations.parseB.txt b/test/fixtures/go/corpus/variadic-function-declarations.parseB.txt deleted file mode 100644 index 09b16360eb..0000000000 --- a/test/fixtures/go/corpus/variadic-function-declarations.parseB.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Package - (Identifier)) - (Function - (Identifier) - (Statements)) - (Function - (Identifier) - (Variadic - (Pointer - (Identifier)) - (Identifier)) - (Statements)) - (Function - (Identifier) - (Variadic - (Identifier) - (Empty)) - (Statements)) - (Function - (Identifier) - (Statements - (Identifier)) - (Variadic - (Identifier) - (Empty)) - (Statements))) diff --git a/test/fixtures/javascript/corpus/anonymous-function.parseA.txt b/test/fixtures/javascript/corpus/anonymous-function.parseA.txt deleted file mode 100644 index a0268da01b..0000000000 --- a/test/fixtures/javascript/corpus/anonymous-function.parseA.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Plus - (Identifier) - (Identifier)))))) diff --git a/test/fixtures/javascript/corpus/anonymous-function.parseB.txt b/test/fixtures/javascript/corpus/anonymous-function.parseB.txt deleted file mode 100644 index 34c5cb21e2..0000000000 --- a/test/fixtures/javascript/corpus/anonymous-function.parseB.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Times - (Identifier) - (Identifier)))))) diff --git a/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseA.txt b/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseA.txt deleted file mode 100644 index 7b029338cd..0000000000 --- a/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock - (Return - (TextElement))))) diff --git a/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseB.txt b/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseB.txt deleted file mode 100644 index 7b029338cd..0000000000 --- a/test/fixtures/javascript/corpus/anonymous-parameterless-function.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock - (Return - (TextElement))))) diff --git a/test/fixtures/javascript/corpus/array.parseA.txt b/test/fixtures/javascript/corpus/array.parseA.txt deleted file mode 100644 index d5891f355d..0000000000 --- a/test/fixtures/javascript/corpus/array.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Array - (TextElement))) diff --git a/test/fixtures/javascript/corpus/array.parseB.txt b/test/fixtures/javascript/corpus/array.parseB.txt deleted file mode 100644 index 4de5832a5c..0000000000 --- a/test/fixtures/javascript/corpus/array.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Array - (TextElement) - (TextElement))) diff --git a/test/fixtures/javascript/corpus/arrow-function.parseA.txt b/test/fixtures/javascript/corpus/arrow-function.parseA.txt deleted file mode 100644 index b232ac3bd9..0000000000 --- a/test/fixtures/javascript/corpus/arrow-function.parseA.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier))))) diff --git a/test/fixtures/javascript/corpus/arrow-function.parseB.txt b/test/fixtures/javascript/corpus/arrow-function.parseB.txt deleted file mode 100644 index b232ac3bd9..0000000000 --- a/test/fixtures/javascript/corpus/arrow-function.parseB.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier))))) diff --git a/test/fixtures/javascript/corpus/assignment-pattern.parseA.txt b/test/fixtures/javascript/corpus/assignment-pattern.parseA.txt deleted file mode 100644 index 2db3947eee..0000000000 --- a/test/fixtures/javascript/corpus/assignment-pattern.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Empty) - (Hash - (Assignment - (ShorthandPropertyIdentifier) - (Float))) - (Identifier)))) diff --git a/test/fixtures/javascript/corpus/assignment-pattern.parseB.txt b/test/fixtures/javascript/corpus/assignment-pattern.parseB.txt deleted file mode 100644 index 2db3947eee..0000000000 --- a/test/fixtures/javascript/corpus/assignment-pattern.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Empty) - (Hash - (Assignment - (ShorthandPropertyIdentifier) - (Float))) - (Identifier)))) diff --git a/test/fixtures/javascript/corpus/assignment.parseA.txt b/test/fixtures/javascript/corpus/assignment.parseA.txt deleted file mode 100644 index e68803f140..0000000000 --- a/test/fixtures/javascript/corpus/assignment.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Float))) diff --git a/test/fixtures/javascript/corpus/assignment.parseB.txt b/test/fixtures/javascript/corpus/assignment.parseB.txt deleted file mode 100644 index e68803f140..0000000000 --- a/test/fixtures/javascript/corpus/assignment.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Float))) diff --git a/test/fixtures/javascript/corpus/bitwise-operator.parseA.txt b/test/fixtures/javascript/corpus/bitwise-operator.parseA.txt deleted file mode 100644 index 3be6465cf4..0000000000 --- a/test/fixtures/javascript/corpus/bitwise-operator.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (RShift - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/bitwise-operator.parseB.txt b/test/fixtures/javascript/corpus/bitwise-operator.parseB.txt deleted file mode 100644 index 3be6465cf4..0000000000 --- a/test/fixtures/javascript/corpus/bitwise-operator.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (RShift - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/boolean-operator.parseA.txt b/test/fixtures/javascript/corpus/boolean-operator.parseA.txt deleted file mode 100644 index 90cabac734..0000000000 --- a/test/fixtures/javascript/corpus/boolean-operator.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Or - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/boolean-operator.parseB.txt b/test/fixtures/javascript/corpus/boolean-operator.parseB.txt deleted file mode 100644 index 8fa994bf72..0000000000 --- a/test/fixtures/javascript/corpus/boolean-operator.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (And - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/break.parseA.txt b/test/fixtures/javascript/corpus/break.parseA.txt deleted file mode 100644 index 7e374ef006..0000000000 --- a/test/fixtures/javascript/corpus/break.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (For - (Assignment - (Identifier) - (Float)) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (If - (StrictEqual - (Identifier) - (Float)) - (Statements - (Break - (Empty))) - (Empty)) - (Empty) - (Identifier)))) diff --git a/test/fixtures/javascript/corpus/break.parseB.txt b/test/fixtures/javascript/corpus/break.parseB.txt deleted file mode 100644 index 33b8ce8987..0000000000 --- a/test/fixtures/javascript/corpus/break.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (For - (Assignment - (Identifier) - (Float)) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (If - (StrictEqual - (Identifier) - (Float)) - (Statements - (Continue - (Empty))) - (Empty)) - (Empty) - (Identifier)))) diff --git a/test/fixtures/javascript/corpus/chained-callbacks.parseA.txt b/test/fixtures/javascript/corpus/chained-callbacks.parseA.txt deleted file mode 100644 index 0b0623d664..0000000000 --- a/test/fixtures/javascript/corpus/chained-callbacks.parseA.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Call - (MemberAccess - (This) - (Identifier)) - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (MemberAccess - (Identifier) - (Identifier))))) - (Empty))) diff --git a/test/fixtures/javascript/corpus/chained-callbacks.parseB.txt b/test/fixtures/javascript/corpus/chained-callbacks.parseB.txt deleted file mode 100644 index 0b0623d664..0000000000 --- a/test/fixtures/javascript/corpus/chained-callbacks.parseB.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Call - (MemberAccess - (This) - (Identifier)) - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (MemberAccess - (Identifier) - (Identifier))))) - (Empty))) diff --git a/test/fixtures/javascript/corpus/chained-property-access.parseA.txt b/test/fixtures/javascript/corpus/chained-property-access.parseA.txt deleted file mode 100644 index 52d3691117..0000000000 --- a/test/fixtures/javascript/corpus/chained-property-access.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Return - (Call - (MemberAccess - (Call - (MemberAccess - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Empty)) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)) - (Empty)) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)) - (Empty)))) diff --git a/test/fixtures/javascript/corpus/chained-property-access.parseB.txt b/test/fixtures/javascript/corpus/chained-property-access.parseB.txt deleted file mode 100644 index 52d3691117..0000000000 --- a/test/fixtures/javascript/corpus/chained-property-access.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Return - (Call - (MemberAccess - (Call - (MemberAccess - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Empty)) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)) - (Empty)) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)) - (Empty)))) diff --git a/test/fixtures/javascript/corpus/class.parseA.txt b/test/fixtures/javascript/corpus/class.parseA.txt deleted file mode 100644 index cb71079ce9..0000000000 --- a/test/fixtures/javascript/corpus/class.parseA.txt +++ /dev/null @@ -1,51 +0,0 @@ -(Statements - (Class - (TypeIdentifier) - (Statements - (PublicFieldDefinition - (Empty) - (Empty) - (Identifier) - (Float)) - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier)))) - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier)))) - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier))))))) diff --git a/test/fixtures/javascript/corpus/class.parseB.txt b/test/fixtures/javascript/corpus/class.parseB.txt deleted file mode 100644 index a47080a26a..0000000000 --- a/test/fixtures/javascript/corpus/class.parseB.txt +++ /dev/null @@ -1,46 +0,0 @@ -(Statements - (Class - (TypeIdentifier) - (Statements - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier)))) - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier)))) - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier))))))) diff --git a/test/fixtures/javascript/corpus/comma-operator.parseA.txt b/test/fixtures/javascript/corpus/comma-operator.parseA.txt deleted file mode 100644 index 06fbde18ff..0000000000 --- a/test/fixtures/javascript/corpus/comma-operator.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (SequenceExpression - (Assignment - (Identifier) - (Float)) - (Assignment - (Identifier) - (Float)))) diff --git a/test/fixtures/javascript/corpus/comma-operator.parseB.txt b/test/fixtures/javascript/corpus/comma-operator.parseB.txt deleted file mode 100644 index acf60ac42a..0000000000 --- a/test/fixtures/javascript/corpus/comma-operator.parseB.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Hash - (KeyValue - (Identifier) - (SequenceExpression - (Float) - (SequenceExpression - (Plus - (Float) - (Float)) - (Float))))))) diff --git a/test/fixtures/javascript/corpus/comment.parseA.txt b/test/fixtures/javascript/corpus/comment.parseA.txt deleted file mode 100644 index 4568b6b783..0000000000 --- a/test/fixtures/javascript/corpus/comment.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Context - (Comment) - (Empty))) diff --git a/test/fixtures/javascript/corpus/comment.parseB.txt b/test/fixtures/javascript/corpus/comment.parseB.txt deleted file mode 100644 index 4568b6b783..0000000000 --- a/test/fixtures/javascript/corpus/comment.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Context - (Comment) - (Empty))) diff --git a/test/fixtures/javascript/corpus/constructor-call.parseA.txt b/test/fixtures/javascript/corpus/constructor-call.parseA.txt deleted file mode 100644 index 64b4f69b77..0000000000 --- a/test/fixtures/javascript/corpus/constructor-call.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (New - (MemberAccess - (Identifier) - (Identifier)) - (Empty) - (Float) - (TextElement))) diff --git a/test/fixtures/javascript/corpus/constructor-call.parseB.txt b/test/fixtures/javascript/corpus/constructor-call.parseB.txt deleted file mode 100644 index 64b4f69b77..0000000000 --- a/test/fixtures/javascript/corpus/constructor-call.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (New - (MemberAccess - (Identifier) - (Identifier)) - (Empty) - (Float) - (TextElement))) diff --git a/test/fixtures/javascript/corpus/continue.parseA.txt b/test/fixtures/javascript/corpus/continue.parseA.txt deleted file mode 100644 index 33b8ce8987..0000000000 --- a/test/fixtures/javascript/corpus/continue.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (For - (Assignment - (Identifier) - (Float)) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (If - (StrictEqual - (Identifier) - (Float)) - (Statements - (Continue - (Empty))) - (Empty)) - (Empty) - (Identifier)))) diff --git a/test/fixtures/javascript/corpus/continue.parseB.txt b/test/fixtures/javascript/corpus/continue.parseB.txt deleted file mode 100644 index 7e374ef006..0000000000 --- a/test/fixtures/javascript/corpus/continue.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (For - (Assignment - (Identifier) - (Float)) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (If - (StrictEqual - (Identifier) - (Float)) - (Statements - (Break - (Empty))) - (Empty)) - (Empty) - (Identifier)))) diff --git a/test/fixtures/javascript/corpus/delete-operator.parseA.txt b/test/fixtures/javascript/corpus/delete-operator.parseA.txt deleted file mode 100644 index 1f1a1d58f3..0000000000 --- a/test/fixtures/javascript/corpus/delete-operator.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Delete - (Subscript - (Identifier) - (TextElement)))) diff --git a/test/fixtures/javascript/corpus/delete-operator.parseB.txt b/test/fixtures/javascript/corpus/delete-operator.parseB.txt deleted file mode 100644 index 310b7babec..0000000000 --- a/test/fixtures/javascript/corpus/delete-operator.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Delete - (MemberAccess - (Identifier) - (Identifier)))) diff --git a/test/fixtures/javascript/corpus/do-while-statement.parseA.txt b/test/fixtures/javascript/corpus/do-while-statement.parseA.txt deleted file mode 100644 index d518e0b65e..0000000000 --- a/test/fixtures/javascript/corpus/do-while-statement.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (DoWhile - (Boolean) - (Statements - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty))))) diff --git a/test/fixtures/javascript/corpus/do-while-statement.parseB.txt b/test/fixtures/javascript/corpus/do-while-statement.parseB.txt deleted file mode 100644 index d518e0b65e..0000000000 --- a/test/fixtures/javascript/corpus/do-while-statement.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (DoWhile - (Boolean) - (Statements - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty))))) diff --git a/test/fixtures/javascript/corpus/export.diffA-B.txt b/test/fixtures/javascript/corpus/export.diffA-B.txt deleted file mode 100644 index 76d438714d..0000000000 --- a/test/fixtures/javascript/corpus/export.diffA-B.txt +++ /dev/null @@ -1,77 +0,0 @@ -(Statements -{ (QualifiedExport) -->(QualifiedExport) } -{ (QualifiedExport) -->(QualifiedExport) } - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)) - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)) - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)))) - (DefaultExport - (VariableDeclaration - {-(Assignment - {-(Empty)-} - {-(Identifier)-} - {-(Identifier)-})-} - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - { (Empty) - ->(Identifier) }) - {+(Assignment - {+(Empty)+} - {+(Identifier)+} - {+(Empty)+})+} - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)))) - (DefaultExport - { (Identifier) - ->(Identifier) }) -{+(DefaultExport - {+(Function - {+(Empty)+} - {+(Empty)+} - {+(Identifier)+} - {+(StatementBlock)+})+})+} - (DefaultExport - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock))) -{+(QualifiedExport)+} -{+(DefaultExport - {+(TextElement)+})+} -{+(QualifiedExportFrom)+} -{+(QualifiedExportFrom)+} -{-(DefaultExport - {-(Function - {-(Empty)-} - {-(Empty)-} - {-(Identifier)-} - {-(StatementBlock)-})-})-} -{-(QualifiedExport)-} -{-(DefaultExport - {-(TextElement)-})-} -{-(QualifiedExportFrom)-} -{-(QualifiedExportFrom)-}) diff --git a/test/fixtures/javascript/corpus/export.diffB-A.txt b/test/fixtures/javascript/corpus/export.diffB-A.txt deleted file mode 100644 index d042a32b3c..0000000000 --- a/test/fixtures/javascript/corpus/export.diffB-A.txt +++ /dev/null @@ -1,79 +0,0 @@ -(Statements -{ (QualifiedExport) -->(QualifiedExport) } -{ (QualifiedExport) -->(QualifiedExport) } - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)) - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)) - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)))) - (DefaultExport - (VariableDeclaration - {+(Assignment - {+(Empty)+} - {+(Identifier)+} - {+(Identifier)+})+} - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - { (Identifier) - ->(Empty) }) - {+(Assignment - {+(Empty)+} - {+(Identifier)+} - {+(Empty)+})+} - {-(Assignment - {-(Empty)-} - {-(Identifier)-} - {-(Empty)-})-} - {-(Assignment - {-(Empty)-} - {-(Identifier)-} - {-(Empty)-})-})) - (DefaultExport - { (Identifier) - ->(Identifier) }) -{-(DefaultExport - {-(Function - {-(Empty)-} - {-(Empty)-} - {-(Identifier)-} - {-(StatementBlock)-})-})-} - (DefaultExport - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock))) -{+(DefaultExport - {+(Function - {+(Empty)+} - {+(Empty)+} - {+(Identifier)+} - {+(StatementBlock)+})+})+} -{ (QualifiedExport) -->(QualifiedExport) } - (DefaultExport - { (TextElement) - ->(TextElement) }) -{ (QualifiedExportFrom) -->(QualifiedExportFrom) } -{ (QualifiedExportFrom) -->(QualifiedExportFrom) }) diff --git a/test/fixtures/javascript/corpus/export.parseA.txt b/test/fixtures/javascript/corpus/export.parseA.txt deleted file mode 100644 index 2a01fba805..0000000000 --- a/test/fixtures/javascript/corpus/export.parseA.txt +++ /dev/null @@ -1,54 +0,0 @@ -(Statements - (QualifiedExport) - (QualifiedExport) - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)))) - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)))) - (DefaultExport - (Identifier)) - (DefaultExport - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock))) - (DefaultExport - (Function - (Empty) - (Empty) - (Identifier) - (StatementBlock))) - (QualifiedExport) - (DefaultExport - (TextElement)) - (QualifiedExportFrom) - (QualifiedExportFrom)) diff --git a/test/fixtures/javascript/corpus/export.parseB.txt b/test/fixtures/javascript/corpus/export.parseB.txt deleted file mode 100644 index a341a4f860..0000000000 --- a/test/fixtures/javascript/corpus/export.parseB.txt +++ /dev/null @@ -1,54 +0,0 @@ -(Statements - (QualifiedExport) - (QualifiedExport) - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)))) - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)))) - (DefaultExport - (Identifier)) - (DefaultExport - (Function - (Empty) - (Empty) - (Identifier) - (StatementBlock))) - (DefaultExport - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock))) - (QualifiedExport) - (DefaultExport - (TextElement)) - (QualifiedExportFrom) - (QualifiedExportFrom)) diff --git a/test/fixtures/javascript/corpus/false.parseA.txt b/test/fixtures/javascript/corpus/false.parseA.txt deleted file mode 100644 index 25d98872e4..0000000000 --- a/test/fixtures/javascript/corpus/false.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Boolean)) diff --git a/test/fixtures/javascript/corpus/false.parseB.txt b/test/fixtures/javascript/corpus/false.parseB.txt deleted file mode 100644 index 02e3c2a135..0000000000 --- a/test/fixtures/javascript/corpus/false.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Boolean))) diff --git a/test/fixtures/javascript/corpus/for-in-statement.parseA.txt b/test/fixtures/javascript/corpus/for-in-statement.parseA.txt deleted file mode 100644 index 6becb7a8dd..0000000000 --- a/test/fixtures/javascript/corpus/for-in-statement.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (ForEach - (Identifier) - (Identifier) - (Statements - (Call - (Identifier) - (Empty))))) diff --git a/test/fixtures/javascript/corpus/for-in-statement.parseB.txt b/test/fixtures/javascript/corpus/for-in-statement.parseB.txt deleted file mode 100644 index 6becb7a8dd..0000000000 --- a/test/fixtures/javascript/corpus/for-in-statement.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (ForEach - (Identifier) - (Identifier) - (Statements - (Call - (Identifier) - (Empty))))) diff --git a/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseA.txt b/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseA.txt deleted file mode 100644 index a83600b055..0000000000 --- a/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseA.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (For - (And - (Member - (Identifier) - (Identifier)) - (Assignment - (Identifier) - (Float))) - (LessThan - (Identifier) - (Identifier)) - (Update - (Identifier)) - (Statements - (Call - (Identifier) - (Empty))))) diff --git a/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseB.txt b/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseB.txt deleted file mode 100644 index a83600b055..0000000000 --- a/test/fixtures/javascript/corpus/for-loop-with-in-statement.parseB.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (For - (And - (Member - (Identifier) - (Identifier)) - (Assignment - (Identifier) - (Float))) - (LessThan - (Identifier) - (Identifier)) - (Update - (Identifier)) - (Statements - (Call - (Identifier) - (Empty))))) diff --git a/test/fixtures/javascript/corpus/for-of-statement.diffA-B.txt b/test/fixtures/javascript/corpus/for-of-statement.diffA-B.txt deleted file mode 100644 index a17ddbf189..0000000000 --- a/test/fixtures/javascript/corpus/for-of-statement.diffA-B.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (ForOf - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Statements - (Call - (Identifier) - { (Identifier) - ->(Identifier) } - (Empty)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/for-of-statement.diffB-A.txt b/test/fixtures/javascript/corpus/for-of-statement.diffB-A.txt deleted file mode 100644 index a17ddbf189..0000000000 --- a/test/fixtures/javascript/corpus/for-of-statement.diffB-A.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (ForOf - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Statements - (Call - (Identifier) - { (Identifier) - ->(Identifier) } - (Empty)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/for-of-statement.parseA.txt b/test/fixtures/javascript/corpus/for-of-statement.parseA.txt deleted file mode 100644 index f7defa7f3c..0000000000 --- a/test/fixtures/javascript/corpus/for-of-statement.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (ForOf - (Identifier) - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/for-of-statement.parseB.txt b/test/fixtures/javascript/corpus/for-of-statement.parseB.txt deleted file mode 100644 index f7defa7f3c..0000000000 --- a/test/fixtures/javascript/corpus/for-of-statement.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (ForOf - (Identifier) - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/for-statement.parseA.txt b/test/fixtures/javascript/corpus/for-statement.parseA.txt deleted file mode 100644 index 883d1fd1a6..0000000000 --- a/test/fixtures/javascript/corpus/for-statement.parseA.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (For - (SequenceExpression - (Assignment - (Identifier) - (Float)) - (Call - (Identifier) - (Empty))) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (Call - (Identifier) - (Identifier) - (Empty))))) diff --git a/test/fixtures/javascript/corpus/for-statement.parseB.txt b/test/fixtures/javascript/corpus/for-statement.parseB.txt deleted file mode 100644 index 883d1fd1a6..0000000000 --- a/test/fixtures/javascript/corpus/for-statement.parseB.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (For - (SequenceExpression - (Assignment - (Identifier) - (Float)) - (Call - (Identifier) - (Empty))) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (Call - (Identifier) - (Identifier) - (Empty))))) diff --git a/test/fixtures/javascript/corpus/function-call-args.parseA.txt b/test/fixtures/javascript/corpus/function-call-args.parseA.txt deleted file mode 100644 index ed0a647fd0..0000000000 --- a/test/fixtures/javascript/corpus/function-call-args.parseA.txt +++ /dev/null @@ -1,30 +0,0 @@ -(Statements - (Call - (Identifier) - (Float) - (TextElement) - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty)) - (Return - (Identifier)))) - (Boolean) - (Empty))) diff --git a/test/fixtures/javascript/corpus/function-call-args.parseB.txt b/test/fixtures/javascript/corpus/function-call-args.parseB.txt deleted file mode 100644 index ed0a647fd0..0000000000 --- a/test/fixtures/javascript/corpus/function-call-args.parseB.txt +++ /dev/null @@ -1,30 +0,0 @@ -(Statements - (Call - (Identifier) - (Float) - (TextElement) - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty)) - (Return - (Identifier)))) - (Boolean) - (Empty))) diff --git a/test/fixtures/javascript/corpus/function-call.parseA.txt b/test/fixtures/javascript/corpus/function-call.parseA.txt deleted file mode 100644 index 0a2778613c..0000000000 --- a/test/fixtures/javascript/corpus/function-call.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (TextElement) - (Empty))) diff --git a/test/fixtures/javascript/corpus/function-call.parseB.txt b/test/fixtures/javascript/corpus/function-call.parseB.txt deleted file mode 100644 index 0a2778613c..0000000000 --- a/test/fixtures/javascript/corpus/function-call.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (TextElement) - (Empty))) diff --git a/test/fixtures/javascript/corpus/function.diffA-B.txt b/test/fixtures/javascript/corpus/function.diffA-B.txt deleted file mode 100644 index 479b32b622..0000000000 --- a/test/fixtures/javascript/corpus/function.diffA-B.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - { (Identifier) - ->(Identifier) })) - (Empty)) diff --git a/test/fixtures/javascript/corpus/function.diffB-A.txt b/test/fixtures/javascript/corpus/function.diffB-A.txt deleted file mode 100644 index 479b32b622..0000000000 --- a/test/fixtures/javascript/corpus/function.diffB-A.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - { (Identifier) - ->(Identifier) })) - (Empty)) diff --git a/test/fixtures/javascript/corpus/function.parseA.txt b/test/fixtures/javascript/corpus/function.parseA.txt deleted file mode 100644 index 264c089be9..0000000000 --- a/test/fixtures/javascript/corpus/function.parseA.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Identifier))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/function.parseB.txt b/test/fixtures/javascript/corpus/function.parseB.txt deleted file mode 100644 index 264c089be9..0000000000 --- a/test/fixtures/javascript/corpus/function.parseB.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Identifier))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/generator-function.parseA.txt b/test/fixtures/javascript/corpus/generator-function.parseA.txt deleted file mode 100644 index 797e02cc53..0000000000 --- a/test/fixtures/javascript/corpus/generator-function.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Yield - (Empty)) - (Yield - (Identifier)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/generator-function.parseB.txt b/test/fixtures/javascript/corpus/generator-function.parseB.txt deleted file mode 100644 index 797e02cc53..0000000000 --- a/test/fixtures/javascript/corpus/generator-function.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Yield - (Empty)) - (Yield - (Identifier)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/identifier.parseA.txt b/test/fixtures/javascript/corpus/identifier.parseA.txt deleted file mode 100644 index 5f0ab64c18..0000000000 --- a/test/fixtures/javascript/corpus/identifier.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Identifier)) diff --git a/test/fixtures/javascript/corpus/identifier.parseB.txt b/test/fixtures/javascript/corpus/identifier.parseB.txt deleted file mode 100644 index 5f0ab64c18..0000000000 --- a/test/fixtures/javascript/corpus/identifier.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Identifier)) diff --git a/test/fixtures/javascript/corpus/if-else.parseA.txt b/test/fixtures/javascript/corpus/if-else.parseA.txt deleted file mode 100644 index 09d6781342..0000000000 --- a/test/fixtures/javascript/corpus/if-else.parseA.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (If - (Identifier) - (Identifier) - (If - (Identifier) - (Identifier) - (If - (Identifier) - (Identifier) - (If - (Identifier) - (Identifier) - (Identifier)))))) diff --git a/test/fixtures/javascript/corpus/if-else.parseB.txt b/test/fixtures/javascript/corpus/if-else.parseB.txt deleted file mode 100644 index 49c8b8af13..0000000000 --- a/test/fixtures/javascript/corpus/if-else.parseB.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (If - (Identifier) - (Identifier) - (If - (Identifier) - (Statements - (Identifier)) - (If - (Identifier) - (Identifier) - (If - (Identifier) - (Statements - (Identifier)) - (Identifier)))))) diff --git a/test/fixtures/javascript/corpus/if.parseA.txt b/test/fixtures/javascript/corpus/if.parseA.txt deleted file mode 100644 index 63f3ac3212..0000000000 --- a/test/fixtures/javascript/corpus/if.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (If - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty))) - (Empty))) diff --git a/test/fixtures/javascript/corpus/if.parseB.txt b/test/fixtures/javascript/corpus/if.parseB.txt deleted file mode 100644 index 0b58858fd8..0000000000 --- a/test/fixtures/javascript/corpus/if.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (If - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (Identifier)) - (Empty))) diff --git a/test/fixtures/javascript/corpus/import.diffA-B.txt b/test/fixtures/javascript/corpus/import.diffA-B.txt deleted file mode 100644 index ae06e60a33..0000000000 --- a/test/fixtures/javascript/corpus/import.diffA-B.txt +++ /dev/null @@ -1,29 +0,0 @@ -(Statements -{+(Import)+} -{+(QualifiedAliasedImport - {+(Identifier)+})+} -{+(Import)+} -{+(Import)+} -{+(Import)+} -{+(Statements - {+(Import)+} - {+(Import)+})+} -{+(Statements - {+(Import)+} - {+(QualifiedAliasedImport - {+(Identifier)+})+})+} -{+(SideEffectImport)+} -{-(Import)-} -{-(QualifiedAliasedImport - {-(Identifier)-})-} -{-(Import)-} -{-(Import)-} -{-(Import)-} -{-(Statements - {-(Import)-} - {-(Import)-})-} -{-(Statements - {-(Import)-} - {-(QualifiedAliasedImport - {-(Identifier)-})-})-} -{-(SideEffectImport)-}) diff --git a/test/fixtures/javascript/corpus/import.diffB-A.txt b/test/fixtures/javascript/corpus/import.diffB-A.txt deleted file mode 100644 index ae06e60a33..0000000000 --- a/test/fixtures/javascript/corpus/import.diffB-A.txt +++ /dev/null @@ -1,29 +0,0 @@ -(Statements -{+(Import)+} -{+(QualifiedAliasedImport - {+(Identifier)+})+} -{+(Import)+} -{+(Import)+} -{+(Import)+} -{+(Statements - {+(Import)+} - {+(Import)+})+} -{+(Statements - {+(Import)+} - {+(QualifiedAliasedImport - {+(Identifier)+})+})+} -{+(SideEffectImport)+} -{-(Import)-} -{-(QualifiedAliasedImport - {-(Identifier)-})-} -{-(Import)-} -{-(Import)-} -{-(Import)-} -{-(Statements - {-(Import)-} - {-(Import)-})-} -{-(Statements - {-(Import)-} - {-(QualifiedAliasedImport - {-(Identifier)-})-})-} -{-(SideEffectImport)-}) diff --git a/test/fixtures/javascript/corpus/import.parseA.txt b/test/fixtures/javascript/corpus/import.parseA.txt deleted file mode 100644 index 828eb6ea72..0000000000 --- a/test/fixtures/javascript/corpus/import.parseA.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Import) - (QualifiedAliasedImport - (Identifier)) - (Import) - (Import) - (Import) - (Statements - (Import) - (Import)) - (Statements - (Import) - (QualifiedAliasedImport - (Identifier))) - (SideEffectImport)) diff --git a/test/fixtures/javascript/corpus/import.parseB.txt b/test/fixtures/javascript/corpus/import.parseB.txt deleted file mode 100644 index 828eb6ea72..0000000000 --- a/test/fixtures/javascript/corpus/import.parseB.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Import) - (QualifiedAliasedImport - (Identifier)) - (Import) - (Import) - (Import) - (Statements - (Import) - (Import)) - (Statements - (Import) - (QualifiedAliasedImport - (Identifier))) - (SideEffectImport)) diff --git a/test/fixtures/javascript/corpus/math-assignment-operator.diffA-B.txt b/test/fixtures/javascript/corpus/math-assignment-operator.diffA-B.txt deleted file mode 100644 index b1aa79ef31..0000000000 --- a/test/fixtures/javascript/corpus/math-assignment-operator.diffA-B.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - { (Float) - ->(Float) }))) diff --git a/test/fixtures/javascript/corpus/math-assignment-operator.diffB-A.txt b/test/fixtures/javascript/corpus/math-assignment-operator.diffB-A.txt deleted file mode 100644 index b1aa79ef31..0000000000 --- a/test/fixtures/javascript/corpus/math-assignment-operator.diffB-A.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - { (Float) - ->(Float) }))) diff --git a/test/fixtures/javascript/corpus/math-assignment-operator.parseA.txt b/test/fixtures/javascript/corpus/math-assignment-operator.parseA.txt deleted file mode 100644 index 5403b2a5e3..0000000000 --- a/test/fixtures/javascript/corpus/math-assignment-operator.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - (Float)))) diff --git a/test/fixtures/javascript/corpus/math-assignment-operator.parseB.txt b/test/fixtures/javascript/corpus/math-assignment-operator.parseB.txt deleted file mode 100644 index 5403b2a5e3..0000000000 --- a/test/fixtures/javascript/corpus/math-assignment-operator.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - (Float)))) diff --git a/test/fixtures/javascript/corpus/math-operator.parseA.txt b/test/fixtures/javascript/corpus/math-operator.parseA.txt deleted file mode 100644 index 023fa5c6af..0000000000 --- a/test/fixtures/javascript/corpus/math-operator.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Minus - (Plus - (Identifier) - (Times - (Identifier) - (Float))) - (Modulo - (Identifier) - (Float)))) diff --git a/test/fixtures/javascript/corpus/math-operator.parseB.txt b/test/fixtures/javascript/corpus/math-operator.parseB.txt deleted file mode 100644 index 023fa5c6af..0000000000 --- a/test/fixtures/javascript/corpus/math-operator.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Minus - (Plus - (Identifier) - (Times - (Identifier) - (Float))) - (Modulo - (Identifier) - (Float)))) diff --git a/test/fixtures/javascript/corpus/member-access-assignment.parseA.txt b/test/fixtures/javascript/corpus/member-access-assignment.parseA.txt deleted file mode 100644 index a4d2743694..0000000000 --- a/test/fixtures/javascript/corpus/member-access-assignment.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (MemberAccess - (Identifier) - (Identifier)) - (Float))) diff --git a/test/fixtures/javascript/corpus/member-access-assignment.parseB.txt b/test/fixtures/javascript/corpus/member-access-assignment.parseB.txt deleted file mode 100644 index a4d2743694..0000000000 --- a/test/fixtures/javascript/corpus/member-access-assignment.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (MemberAccess - (Identifier) - (Identifier)) - (Float))) diff --git a/test/fixtures/javascript/corpus/member-access.parseA.txt b/test/fixtures/javascript/corpus/member-access.parseA.txt deleted file mode 100644 index 70674960a3..0000000000 --- a/test/fixtures/javascript/corpus/member-access.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (MemberAccess - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/member-access.parseB.txt b/test/fixtures/javascript/corpus/member-access.parseB.txt deleted file mode 100644 index 70674960a3..0000000000 --- a/test/fixtures/javascript/corpus/member-access.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (MemberAccess - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/method-call.parseA.txt b/test/fixtures/javascript/corpus/method-call.parseA.txt deleted file mode 100644 index 447b0ae78c..0000000000 --- a/test/fixtures/javascript/corpus/method-call.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (TextElement) - (Empty))) diff --git a/test/fixtures/javascript/corpus/method-call.parseB.txt b/test/fixtures/javascript/corpus/method-call.parseB.txt deleted file mode 100644 index 447b0ae78c..0000000000 --- a/test/fixtures/javascript/corpus/method-call.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (TextElement) - (Empty))) diff --git a/test/fixtures/javascript/corpus/named-function.parseA.txt b/test/fixtures/javascript/corpus/named-function.parseA.txt deleted file mode 100644 index c1953a1de1..0000000000 --- a/test/fixtures/javascript/corpus/named-function.parseA.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Identifier))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/named-function.parseB.txt b/test/fixtures/javascript/corpus/named-function.parseB.txt deleted file mode 100644 index 635f5b4bbf..0000000000 --- a/test/fixtures/javascript/corpus/named-function.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (StatementBlock - (Return - (Boolean)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/nested-do-while-in-function.parseA.txt b/test/fixtures/javascript/corpus/nested-do-while-in-function.parseA.txt deleted file mode 100644 index 1686da7c10..0000000000 --- a/test/fixtures/javascript/corpus/nested-do-while-in-function.parseA.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (DoWhile - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty))))))) diff --git a/test/fixtures/javascript/corpus/nested-do-while-in-function.parseB.txt b/test/fixtures/javascript/corpus/nested-do-while-in-function.parseB.txt deleted file mode 100644 index 1686da7c10..0000000000 --- a/test/fixtures/javascript/corpus/nested-do-while-in-function.parseB.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (DoWhile - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty))))))) diff --git a/test/fixtures/javascript/corpus/nested-functions.parseA.txt b/test/fixtures/javascript/corpus/nested-functions.parseA.txt deleted file mode 100644 index e2ed7efc63..0000000000 --- a/test/fixtures/javascript/corpus/nested-functions.parseA.txt +++ /dev/null @@ -1,43 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty)) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty))))))) diff --git a/test/fixtures/javascript/corpus/nested-functions.parseB.txt b/test/fixtures/javascript/corpus/nested-functions.parseB.txt deleted file mode 100644 index e2ed7efc63..0000000000 --- a/test/fixtures/javascript/corpus/nested-functions.parseB.txt +++ /dev/null @@ -1,43 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty)) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty))))))) diff --git a/test/fixtures/javascript/corpus/null.parseA.txt b/test/fixtures/javascript/corpus/null.parseA.txt deleted file mode 100644 index 5c722556e5..0000000000 --- a/test/fixtures/javascript/corpus/null.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Null)) diff --git a/test/fixtures/javascript/corpus/null.parseB.txt b/test/fixtures/javascript/corpus/null.parseB.txt deleted file mode 100644 index 24f16825d6..0000000000 --- a/test/fixtures/javascript/corpus/null.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Null))) diff --git a/test/fixtures/javascript/corpus/number.parseA.txt b/test/fixtures/javascript/corpus/number.parseA.txt deleted file mode 100644 index ca689125a1..0000000000 --- a/test/fixtures/javascript/corpus/number.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Float)) diff --git a/test/fixtures/javascript/corpus/number.parseB.txt b/test/fixtures/javascript/corpus/number.parseB.txt deleted file mode 100644 index ca689125a1..0000000000 --- a/test/fixtures/javascript/corpus/number.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Float)) diff --git a/test/fixtures/javascript/corpus/object.parseA.txt b/test/fixtures/javascript/corpus/object.parseA.txt deleted file mode 100644 index 7a96e8f9f7..0000000000 --- a/test/fixtures/javascript/corpus/object.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Hash - (KeyValue - (TextElement) - (TextElement)))) diff --git a/test/fixtures/javascript/corpus/object.parseB.txt b/test/fixtures/javascript/corpus/object.parseB.txt deleted file mode 100644 index a992629117..0000000000 --- a/test/fixtures/javascript/corpus/object.parseB.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Hash - (KeyValue - (TextElement) - (TextElement)) - (KeyValue - (TextElement) - (TextElement)) - (KeyValue - (TextElement) - (TextElement)))) diff --git a/test/fixtures/javascript/corpus/objects-with-methods.parseA.txt b/test/fixtures/javascript/corpus/objects-with-methods.parseA.txt deleted file mode 100644 index 510dcd7652..0000000000 --- a/test/fixtures/javascript/corpus/objects-with-methods.parseA.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Hash - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Plus - (Identifier) - (Identifier))))))) diff --git a/test/fixtures/javascript/corpus/objects-with-methods.parseB.txt b/test/fixtures/javascript/corpus/objects-with-methods.parseB.txt deleted file mode 100644 index 112b1b8d75..0000000000 --- a/test/fixtures/javascript/corpus/objects-with-methods.parseB.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Hash - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Minus - (Identifier) - (Identifier))))))) diff --git a/test/fixtures/javascript/corpus/regex.parseA.txt b/test/fixtures/javascript/corpus/regex.parseA.txt deleted file mode 100644 index b154d3ebe6..0000000000 --- a/test/fixtures/javascript/corpus/regex.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Regex)) diff --git a/test/fixtures/javascript/corpus/regex.parseB.txt b/test/fixtures/javascript/corpus/regex.parseB.txt deleted file mode 100644 index b154d3ebe6..0000000000 --- a/test/fixtures/javascript/corpus/regex.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Regex)) diff --git a/test/fixtures/javascript/corpus/relational-operator.parseA.txt b/test/fixtures/javascript/corpus/relational-operator.parseA.txt deleted file mode 100644 index 4bacd5c818..0000000000 --- a/test/fixtures/javascript/corpus/relational-operator.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (LessThan - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/relational-operator.parseB.txt b/test/fixtures/javascript/corpus/relational-operator.parseB.txt deleted file mode 100644 index eb9125c713..0000000000 --- a/test/fixtures/javascript/corpus/relational-operator.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (LessThanEqual - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/return-statement.parseA.txt b/test/fixtures/javascript/corpus/return-statement.parseA.txt deleted file mode 100644 index fd629221ea..0000000000 --- a/test/fixtures/javascript/corpus/return-statement.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Float))) diff --git a/test/fixtures/javascript/corpus/return-statement.parseB.txt b/test/fixtures/javascript/corpus/return-statement.parseB.txt deleted file mode 100644 index 878ee5e753..0000000000 --- a/test/fixtures/javascript/corpus/return-statement.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Empty))) diff --git a/test/fixtures/javascript/corpus/string.parseA.txt b/test/fixtures/javascript/corpus/string.parseA.txt deleted file mode 100644 index 244724dcdd..0000000000 --- a/test/fixtures/javascript/corpus/string.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (TextElement)) diff --git a/test/fixtures/javascript/corpus/string.parseB.txt b/test/fixtures/javascript/corpus/string.parseB.txt deleted file mode 100644 index 244724dcdd..0000000000 --- a/test/fixtures/javascript/corpus/string.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (TextElement)) diff --git a/test/fixtures/javascript/corpus/subscript-access-assignment.parseA.txt b/test/fixtures/javascript/corpus/subscript-access-assignment.parseA.txt deleted file mode 100644 index 065c52c81e..0000000000 --- a/test/fixtures/javascript/corpus/subscript-access-assignment.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (Subscript - (Identifier) - (TextElement)) - (Float))) diff --git a/test/fixtures/javascript/corpus/subscript-access-assignment.parseB.txt b/test/fixtures/javascript/corpus/subscript-access-assignment.parseB.txt deleted file mode 100644 index 065c52c81e..0000000000 --- a/test/fixtures/javascript/corpus/subscript-access-assignment.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (Subscript - (Identifier) - (TextElement)) - (Float))) diff --git a/test/fixtures/javascript/corpus/subscript-access-string.parseA.txt b/test/fixtures/javascript/corpus/subscript-access-string.parseA.txt deleted file mode 100644 index 5d5853ad77..0000000000 --- a/test/fixtures/javascript/corpus/subscript-access-string.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Subscript - (Identifier) - (TextElement))) diff --git a/test/fixtures/javascript/corpus/subscript-access-string.parseB.txt b/test/fixtures/javascript/corpus/subscript-access-string.parseB.txt deleted file mode 100644 index 5d5853ad77..0000000000 --- a/test/fixtures/javascript/corpus/subscript-access-string.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Subscript - (Identifier) - (TextElement))) diff --git a/test/fixtures/javascript/corpus/subscript-access-variable.parseA.txt b/test/fixtures/javascript/corpus/subscript-access-variable.parseA.txt deleted file mode 100644 index e2c7fbd55a..0000000000 --- a/test/fixtures/javascript/corpus/subscript-access-variable.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Subscript - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/subscript-access-variable.parseB.txt b/test/fixtures/javascript/corpus/subscript-access-variable.parseB.txt deleted file mode 100644 index e2c7fbd55a..0000000000 --- a/test/fixtures/javascript/corpus/subscript-access-variable.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Subscript - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/switch-statement.parseA.txt b/test/fixtures/javascript/corpus/switch-statement.parseA.txt deleted file mode 100644 index 50a633ec51..0000000000 --- a/test/fixtures/javascript/corpus/switch-statement.parseA.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Match - (Float) - (Statements - (Pattern - (Float) - (Statements - (Float))) - (Pattern - (Float) - (Statements - (Float))) - (Pattern - (Float) - (Statements - (Float))))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/switch-statement.parseB.txt b/test/fixtures/javascript/corpus/switch-statement.parseB.txt deleted file mode 100644 index 50a633ec51..0000000000 --- a/test/fixtures/javascript/corpus/switch-statement.parseB.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Match - (Float) - (Statements - (Pattern - (Float) - (Statements - (Float))) - (Pattern - (Float) - (Statements - (Float))) - (Pattern - (Float) - (Statements - (Float))))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/template-string.parseA.txt b/test/fixtures/javascript/corpus/template-string.parseA.txt deleted file mode 100644 index d6d776fad5..0000000000 --- a/test/fixtures/javascript/corpus/template-string.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (String)) diff --git a/test/fixtures/javascript/corpus/template-string.parseB.txt b/test/fixtures/javascript/corpus/template-string.parseB.txt deleted file mode 100644 index d6d776fad5..0000000000 --- a/test/fixtures/javascript/corpus/template-string.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (String)) diff --git a/test/fixtures/javascript/corpus/ternary.parseA.txt b/test/fixtures/javascript/corpus/ternary.parseA.txt deleted file mode 100644 index ff5f03d892..0000000000 --- a/test/fixtures/javascript/corpus/ternary.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (If - (Identifier) - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/ternary.parseB.txt b/test/fixtures/javascript/corpus/ternary.parseB.txt deleted file mode 100644 index 93db1d9d28..0000000000 --- a/test/fixtures/javascript/corpus/ternary.parseB.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Assignment - (MemberAccess - (Identifier) - (Identifier)) - (If - (MemberAccess - (Identifier) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)) - (MemberAccess - (MemberAccess - (Identifier) - (Identifier)) - (Identifier))))) diff --git a/test/fixtures/javascript/corpus/this-expression.parseA.txt b/test/fixtures/javascript/corpus/this-expression.parseA.txt deleted file mode 100644 index 2fce35ed58..0000000000 --- a/test/fixtures/javascript/corpus/this-expression.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (This)) diff --git a/test/fixtures/javascript/corpus/this-expression.parseB.txt b/test/fixtures/javascript/corpus/this-expression.parseB.txt deleted file mode 100644 index 2ebca766a5..0000000000 --- a/test/fixtures/javascript/corpus/this-expression.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (This))) diff --git a/test/fixtures/javascript/corpus/throw-statement.parseA.txt b/test/fixtures/javascript/corpus/throw-statement.parseA.txt deleted file mode 100644 index dbba82efaf..0000000000 --- a/test/fixtures/javascript/corpus/throw-statement.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Throw - (New - (Identifier) - (Empty) - (TextElement)))) diff --git a/test/fixtures/javascript/corpus/throw-statement.parseB.txt b/test/fixtures/javascript/corpus/throw-statement.parseB.txt deleted file mode 100644 index dbba82efaf..0000000000 --- a/test/fixtures/javascript/corpus/throw-statement.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Throw - (New - (Identifier) - (Empty) - (TextElement)))) diff --git a/test/fixtures/javascript/corpus/true.parseA.txt b/test/fixtures/javascript/corpus/true.parseA.txt deleted file mode 100644 index 25d98872e4..0000000000 --- a/test/fixtures/javascript/corpus/true.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Boolean)) diff --git a/test/fixtures/javascript/corpus/true.parseB.txt b/test/fixtures/javascript/corpus/true.parseB.txt deleted file mode 100644 index 02e3c2a135..0000000000 --- a/test/fixtures/javascript/corpus/true.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Boolean))) diff --git a/test/fixtures/javascript/corpus/try-statement.parseA.txt b/test/fixtures/javascript/corpus/try-statement.parseA.txt deleted file mode 100644 index 00902f2752..0000000000 --- a/test/fixtures/javascript/corpus/try-statement.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Try - (Statements - (Identifier)) - (Catch - (Empty) - (Statements - (Identifier))) - (Finally - (Statements - (Identifier)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/try-statement.parseB.txt b/test/fixtures/javascript/corpus/try-statement.parseB.txt deleted file mode 100644 index 00902f2752..0000000000 --- a/test/fixtures/javascript/corpus/try-statement.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Try - (Statements - (Identifier)) - (Catch - (Empty) - (Statements - (Identifier))) - (Finally - (Statements - (Identifier)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/type-operator.parseA.txt b/test/fixtures/javascript/corpus/type-operator.parseA.txt deleted file mode 100644 index f20b037531..0000000000 --- a/test/fixtures/javascript/corpus/type-operator.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Typeof - (Identifier))) diff --git a/test/fixtures/javascript/corpus/type-operator.parseB.txt b/test/fixtures/javascript/corpus/type-operator.parseB.txt deleted file mode 100644 index 6087bffacc..0000000000 --- a/test/fixtures/javascript/corpus/type-operator.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (InstanceOf - (Identifier) - (Identifier))) diff --git a/test/fixtures/javascript/corpus/undefined.parseA.txt b/test/fixtures/javascript/corpus/undefined.parseA.txt deleted file mode 100644 index ea5e6fca6d..0000000000 --- a/test/fixtures/javascript/corpus/undefined.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Undefined)) diff --git a/test/fixtures/javascript/corpus/undefined.parseB.txt b/test/fixtures/javascript/corpus/undefined.parseB.txt deleted file mode 100644 index 58c1a9eaf1..0000000000 --- a/test/fixtures/javascript/corpus/undefined.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Undefined))) diff --git a/test/fixtures/javascript/corpus/var-declaration.parseA.txt b/test/fixtures/javascript/corpus/var-declaration.parseA.txt deleted file mode 100644 index 1634cc36e7..0000000000 --- a/test/fixtures/javascript/corpus/var-declaration.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Float)))) diff --git a/test/fixtures/javascript/corpus/var-declaration.parseB.txt b/test/fixtures/javascript/corpus/var-declaration.parseB.txt deleted file mode 100644 index 2ffadbf28e..0000000000 --- a/test/fixtures/javascript/corpus/var-declaration.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Hash)) - (Assignment - (Empty) - (Identifier) - (Empty)))) diff --git a/test/fixtures/javascript/corpus/variable.parseA.txt b/test/fixtures/javascript/corpus/variable.parseA.txt deleted file mode 100644 index 5f0ab64c18..0000000000 --- a/test/fixtures/javascript/corpus/variable.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Identifier)) diff --git a/test/fixtures/javascript/corpus/variable.parseB.txt b/test/fixtures/javascript/corpus/variable.parseB.txt deleted file mode 100644 index 5f0ab64c18..0000000000 --- a/test/fixtures/javascript/corpus/variable.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Identifier)) diff --git a/test/fixtures/javascript/corpus/void-operator.parseA.txt b/test/fixtures/javascript/corpus/void-operator.parseA.txt deleted file mode 100644 index 71bb378919..0000000000 --- a/test/fixtures/javascript/corpus/void-operator.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Void - (Call - (Identifier) - (Empty)))) diff --git a/test/fixtures/javascript/corpus/void-operator.parseB.txt b/test/fixtures/javascript/corpus/void-operator.parseB.txt deleted file mode 100644 index 71bb378919..0000000000 --- a/test/fixtures/javascript/corpus/void-operator.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Void - (Call - (Identifier) - (Empty)))) diff --git a/test/fixtures/javascript/corpus/while-statement.parseA.txt b/test/fixtures/javascript/corpus/while-statement.parseA.txt deleted file mode 100644 index 9d2e8f0d85..0000000000 --- a/test/fixtures/javascript/corpus/while-statement.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (While - (Identifier) - (Statements - (Call - (Identifier) - (Empty)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/while-statement.parseB.txt b/test/fixtures/javascript/corpus/while-statement.parseB.txt deleted file mode 100644 index 9d2e8f0d85..0000000000 --- a/test/fixtures/javascript/corpus/while-statement.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (While - (Identifier) - (Statements - (Call - (Identifier) - (Empty)))) - (Empty)) diff --git a/test/fixtures/javascript/corpus/yield.parseA.txt b/test/fixtures/javascript/corpus/yield.parseA.txt deleted file mode 100644 index c1ee0ed8ee..0000000000 --- a/test/fixtures/javascript/corpus/yield.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (StatementBlock - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Float))) - (Yield - (Identifier))))) diff --git a/test/fixtures/javascript/corpus/yield.parseB.txt b/test/fixtures/javascript/corpus/yield.parseB.txt deleted file mode 100644 index 149b2ad448..0000000000 --- a/test/fixtures/javascript/corpus/yield.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (StatementBlock - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Float))) - (Yield - (Update - (Identifier)))))) diff --git a/test/fixtures/json/corpus/array.diffA-B.txt b/test/fixtures/json/corpus/array.diffA-B.txt deleted file mode 100644 index 5bcc256b87..0000000000 --- a/test/fixtures/json/corpus/array.diffA-B.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Array -{ (Float) -->(Float) } - (Float) -{ (Float) -->(Float) } - (Float) -{ (Float) -->(Float) }) diff --git a/test/fixtures/json/corpus/array.diffB-A.txt b/test/fixtures/json/corpus/array.diffB-A.txt deleted file mode 100644 index 5bcc256b87..0000000000 --- a/test/fixtures/json/corpus/array.diffB-A.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Array -{ (Float) -->(Float) } - (Float) -{ (Float) -->(Float) } - (Float) -{ (Float) -->(Float) }) diff --git a/test/fixtures/json/corpus/array.parseA.txt b/test/fixtures/json/corpus/array.parseA.txt deleted file mode 100644 index a00977d83d..0000000000 --- a/test/fixtures/json/corpus/array.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Array - (Float) - (Float) - (Float) - (Float) - (Float)) diff --git a/test/fixtures/json/corpus/array.parseB.txt b/test/fixtures/json/corpus/array.parseB.txt deleted file mode 100644 index a00977d83d..0000000000 --- a/test/fixtures/json/corpus/array.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Array - (Float) - (Float) - (Float) - (Float) - (Float)) diff --git a/test/fixtures/json/corpus/boolean.diffA-B.txt b/test/fixtures/json/corpus/boolean.diffA-B.txt deleted file mode 100644 index f60c190f69..0000000000 --- a/test/fixtures/json/corpus/boolean.diffA-B.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Array -{ (Boolean) -->(Boolean) }) diff --git a/test/fixtures/json/corpus/boolean.diffB-A.txt b/test/fixtures/json/corpus/boolean.diffB-A.txt deleted file mode 100644 index f60c190f69..0000000000 --- a/test/fixtures/json/corpus/boolean.diffB-A.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Array -{ (Boolean) -->(Boolean) }) diff --git a/test/fixtures/json/corpus/boolean.parseA.txt b/test/fixtures/json/corpus/boolean.parseA.txt deleted file mode 100644 index 97f605028d..0000000000 --- a/test/fixtures/json/corpus/boolean.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Array - (Boolean)) diff --git a/test/fixtures/json/corpus/boolean.parseB.txt b/test/fixtures/json/corpus/boolean.parseB.txt deleted file mode 100644 index 97f605028d..0000000000 --- a/test/fixtures/json/corpus/boolean.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Array - (Boolean)) diff --git a/test/fixtures/json/corpus/hash.diffA-B.txt b/test/fixtures/json/corpus/hash.diffA-B.txt deleted file mode 100644 index f9fa320ed2..0000000000 --- a/test/fixtures/json/corpus/hash.diffA-B.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Hash - {-(KeyValue - {-(TextElement)-} - {-(Float)-})-} - (KeyValue - (TextElement) - (Float)) - (KeyValue - { (TextElement) - ->(TextElement) } - (Float)) - (KeyValue - (TextElement) - { (Float) - ->(Float)}) - {+(KeyValue - {+(TextElement)+} - {+(Float)+})+}) diff --git a/test/fixtures/json/corpus/hash.diffB-A.txt b/test/fixtures/json/corpus/hash.diffB-A.txt deleted file mode 100644 index 952d54b0d2..0000000000 --- a/test/fixtures/json/corpus/hash.diffB-A.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Hash -{+(KeyValue - {+(TextElement)+} - {+(Float)+})+} - (KeyValue - (TextElement) - (Float)) - (KeyValue - { (TextElement) - ->(TextElement)} - (Float)) - (KeyValue - (TextElement) - { (Float) - ->(Float)}) -{-(KeyValue - {-(TextElement)-} - {-(Float)-})-}) \ No newline at end of file diff --git a/test/fixtures/json/corpus/hash.parseA.txt b/test/fixtures/json/corpus/hash.parseA.txt deleted file mode 100644 index 8d92b2f0aa..0000000000 --- a/test/fixtures/json/corpus/hash.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Hash - (KeyValue - (TextElement) - (Float)) - (KeyValue - (TextElement) - (Float)) - (KeyValue - (TextElement) - (Float)) - (KeyValue - (TextElement) - (Float))) diff --git a/test/fixtures/json/corpus/hash.parseB.txt b/test/fixtures/json/corpus/hash.parseB.txt deleted file mode 100644 index 8d92b2f0aa..0000000000 --- a/test/fixtures/json/corpus/hash.parseB.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Hash - (KeyValue - (TextElement) - (Float)) - (KeyValue - (TextElement) - (Float)) - (KeyValue - (TextElement) - (Float)) - (KeyValue - (TextElement) - (Float))) diff --git a/test/fixtures/json/corpus/null.diffA-B.txt b/test/fixtures/json/corpus/null.diffA-B.txt deleted file mode 100644 index 38f3ae1a65..0000000000 --- a/test/fixtures/json/corpus/null.diffA-B.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Array - (Null)) diff --git a/test/fixtures/json/corpus/null.diffB-A.txt b/test/fixtures/json/corpus/null.diffB-A.txt deleted file mode 100644 index 38f3ae1a65..0000000000 --- a/test/fixtures/json/corpus/null.diffB-A.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Array - (Null)) diff --git a/test/fixtures/json/corpus/null.parseA.txt b/test/fixtures/json/corpus/null.parseA.txt deleted file mode 100644 index 38f3ae1a65..0000000000 --- a/test/fixtures/json/corpus/null.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Array - (Null)) diff --git a/test/fixtures/json/corpus/null.parseB.txt b/test/fixtures/json/corpus/null.parseB.txt deleted file mode 100644 index 38f3ae1a65..0000000000 --- a/test/fixtures/json/corpus/null.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Array - (Null)) diff --git a/test/fixtures/json/corpus/number.diffA-B.txt b/test/fixtures/json/corpus/number.diffA-B.txt deleted file mode 100644 index 741efced64..0000000000 --- a/test/fixtures/json/corpus/number.diffA-B.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Array -{ (Float) -->(Float) }) diff --git a/test/fixtures/json/corpus/number.diffB-A.txt b/test/fixtures/json/corpus/number.diffB-A.txt deleted file mode 100644 index 741efced64..0000000000 --- a/test/fixtures/json/corpus/number.diffB-A.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Array -{ (Float) -->(Float) }) diff --git a/test/fixtures/json/corpus/number.parseA.txt b/test/fixtures/json/corpus/number.parseA.txt deleted file mode 100644 index c512a04128..0000000000 --- a/test/fixtures/json/corpus/number.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Array - (Float)) diff --git a/test/fixtures/json/corpus/number.parseB.txt b/test/fixtures/json/corpus/number.parseB.txt deleted file mode 100644 index c512a04128..0000000000 --- a/test/fixtures/json/corpus/number.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Array - (Float)) diff --git a/test/fixtures/json/corpus/string.diffA-B.txt b/test/fixtures/json/corpus/string.diffA-B.txt deleted file mode 100644 index 8a94c6e35d..0000000000 --- a/test/fixtures/json/corpus/string.diffA-B.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Array -{ (TextElement) -->(TextElement) }) diff --git a/test/fixtures/json/corpus/string.diffB-A.txt b/test/fixtures/json/corpus/string.diffB-A.txt deleted file mode 100644 index 8a94c6e35d..0000000000 --- a/test/fixtures/json/corpus/string.diffB-A.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Array -{ (TextElement) -->(TextElement) }) diff --git a/test/fixtures/json/corpus/string.parseA.txt b/test/fixtures/json/corpus/string.parseA.txt deleted file mode 100644 index 5aedb7f506..0000000000 --- a/test/fixtures/json/corpus/string.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Array - (TextElement)) diff --git a/test/fixtures/json/corpus/string.parseB.txt b/test/fixtures/json/corpus/string.parseB.txt deleted file mode 100644 index 5aedb7f506..0000000000 --- a/test/fixtures/json/corpus/string.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Array - (TextElement)) diff --git a/test/fixtures/python/corpus/assert-statement.parseA.txt b/test/fixtures/python/corpus/assert-statement.parseA.txt deleted file mode 100644 index ad22b5d535..0000000000 --- a/test/fixtures/python/corpus/assert-statement.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (Context - (Comment) - (Call - (Identifier) - (Identifier) - (Identifier) - (Empty)))) diff --git a/test/fixtures/python/corpus/assert-statement.parseB.txt b/test/fixtures/python/corpus/assert-statement.parseB.txt deleted file mode 100644 index eaeb4c216f..0000000000 --- a/test/fixtures/python/corpus/assert-statement.parseB.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Empty)) - (Context - (Comment) - (Empty))) diff --git a/test/fixtures/python/corpus/assignment.diffA-B.txt b/test/fixtures/python/corpus/assignment.diffA-B.txt deleted file mode 100644 index 936a92db5d..0000000000 --- a/test/fixtures/python/corpus/assignment.diffA-B.txt +++ /dev/null @@ -1,29 +0,0 @@ -(Statements -{+(Assignment - {+(Statements - {+(Identifier)+} - {+(Identifier)+})+} - {+(Statements - {+(Integer)+} - {+(Integer)+})+})+} - (Assignment - { (Identifier) - ->(Identifier) } - (Integer)) -{+(Assignment - {+(Identifier)+} - {+(Statements - {+(Integer)+} - {+(Integer)+})+})+} -{-(Assignment - {-(Statements - {-(Identifier)-} - {-(Identifier)-})-} - {-(Statements - {-(Integer)-} - {-(Integer)-})-})-} -{-(Assignment - {-(Identifier)-} - {-(Statements - {-(Integer)-} - {-(Integer)-})-})-}) diff --git a/test/fixtures/python/corpus/assignment.parseA.txt b/test/fixtures/python/corpus/assignment.parseA.txt deleted file mode 100644 index f012ce5ddb..0000000000 --- a/test/fixtures/python/corpus/assignment.parseA.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Integer)) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Statements - (Integer) - (Integer))) - (Assignment - (Identifier) - (Statements - (Integer) - (Integer)))) diff --git a/test/fixtures/python/corpus/assignment.parseB.txt b/test/fixtures/python/corpus/assignment.parseB.txt deleted file mode 100644 index c22a7c1098..0000000000 --- a/test/fixtures/python/corpus/assignment.parseB.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Assignment - (Statements - (Identifier) - (Identifier)) - (Statements - (Integer) - (Integer))) - (Assignment - (Identifier) - (Integer)) - (Assignment - (Identifier) - (Statements - (Integer) - (Integer)))) diff --git a/test/fixtures/python/corpus/async-function-definition.parseA.txt b/test/fixtures/python/corpus/async-function-definition.parseA.txt deleted file mode 100644 index 54fde157cf..0000000000 --- a/test/fixtures/python/corpus/async-function-definition.parseA.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (Function - (Identifier) - (Statements - (Identifier))) - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (RequiredParameter - (Identifier)) - (Statements - (Identifier))) - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (Statements - (Identifier)))) diff --git a/test/fixtures/python/corpus/async-function-definition.parseB.txt b/test/fixtures/python/corpus/async-function-definition.parseB.txt deleted file mode 100644 index 7eb7d5ff57..0000000000 --- a/test/fixtures/python/corpus/async-function-definition.parseB.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (RequiredParameter - (Identifier)) - (Statements - (Identifier))) - (Function - (Identifier) - (Statements - (Identifier))) - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (Statements - (Identifier)))) diff --git a/test/fixtures/python/corpus/attribute.parseA.txt b/test/fixtures/python/corpus/attribute.parseA.txt deleted file mode 100644 index 70674960a3..0000000000 --- a/test/fixtures/python/corpus/attribute.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (MemberAccess - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/attribute.parseB.txt b/test/fixtures/python/corpus/attribute.parseB.txt deleted file mode 100644 index 9d14d98a79..0000000000 --- a/test/fixtures/python/corpus/attribute.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (MemberAccess - (MemberAccess - (Identifier) - (Identifier)) - (Identifier))) diff --git a/test/fixtures/python/corpus/augmented-assignment.diffA-B.txt b/test/fixtures/python/corpus/augmented-assignment.diffA-B.txt deleted file mode 100644 index 733405a4d8..0000000000 --- a/test/fixtures/python/corpus/augmented-assignment.diffA-B.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Assignment - (Identifier) - { (Plus - {-(Identifier)-} - {-(Integer)-}) - ->(RShift - {+(Identifier)+} - {+(Integer)+}) }) - (Assignment - { (Identifier) - ->(Identifier) } - { (RShift - {-(Identifier)-} - {-(Integer)-}) - ->(DividedBy - {+(Identifier)+} - {+(Integer)+}) }) - (Assignment - { (Identifier) - ->(Identifier) } - { (DividedBy - {-(Identifier)-} - {-(Integer)-}) - ->(Plus - {+(Identifier)+} - {+(Integer)+}) })) diff --git a/test/fixtures/python/corpus/augmented-assignment.diffB-A.txt b/test/fixtures/python/corpus/augmented-assignment.diffB-A.txt deleted file mode 100644 index 0a04264e28..0000000000 --- a/test/fixtures/python/corpus/augmented-assignment.diffB-A.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Assignment - (Identifier) - { (RShift - {-(Identifier)-} - {-(Integer)-}) - ->(Plus - {+(Identifier)+} - {+(Integer)+}) }) - (Assignment - { (Identifier) - ->(Identifier) } - { (DividedBy - {-(Identifier)-} - {-(Integer)-}) - ->(RShift - {+(Identifier)+} - {+(Integer)+}) }) - (Assignment - { (Identifier) - ->(Identifier) } - { (Plus - {-(Identifier)-} - {-(Integer)-}) - ->(DividedBy - {+(Identifier)+} - {+(Integer)+}) })) diff --git a/test/fixtures/python/corpus/augmented-assignment.parseA.txt b/test/fixtures/python/corpus/augmented-assignment.parseA.txt deleted file mode 100644 index 9abfe9a16e..0000000000 --- a/test/fixtures/python/corpus/augmented-assignment.parseA.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - (Integer))) - (Assignment - (Identifier) - (RShift - (Identifier) - (Integer))) - (Assignment - (Identifier) - (DividedBy - (Identifier) - (Integer)))) diff --git a/test/fixtures/python/corpus/augmented-assignment.parseB.txt b/test/fixtures/python/corpus/augmented-assignment.parseB.txt deleted file mode 100644 index c8e6d106cf..0000000000 --- a/test/fixtures/python/corpus/augmented-assignment.parseB.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Assignment - (Identifier) - (RShift - (Identifier) - (Integer))) - (Assignment - (Identifier) - (DividedBy - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Plus - (Identifier) - (Integer)))) diff --git a/test/fixtures/python/corpus/await.parseA.txt b/test/fixtures/python/corpus/await.parseA.txt deleted file mode 100644 index 0cdfe52de0..0000000000 --- a/test/fixtures/python/corpus/await.parseA.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Call - (Identifier) - (Plus - (Integer) - (Integer)) - (Empty)) - (Call - (Identifier) - (Identifier) - (Empty))) diff --git a/test/fixtures/python/corpus/await.parseB.txt b/test/fixtures/python/corpus/await.parseB.txt deleted file mode 100644 index 0cdfe52de0..0000000000 --- a/test/fixtures/python/corpus/await.parseB.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Call - (Identifier) - (Plus - (Integer) - (Integer)) - (Empty)) - (Call - (Identifier) - (Identifier) - (Empty))) diff --git a/test/fixtures/python/corpus/binary-operator.parseA.txt b/test/fixtures/python/corpus/binary-operator.parseA.txt deleted file mode 100644 index f4df7c95bd..0000000000 --- a/test/fixtures/python/corpus/binary-operator.parseA.txt +++ /dev/null @@ -1,37 +0,0 @@ -(Statements - (Plus - (Identifier) - (Identifier)) - (Minus - (Identifier) - (Identifier)) - (Times - (Identifier) - (Identifier)) - (DividedBy - (Identifier) - (Identifier)) - (Modulo - (Identifier) - (Identifier)) - (FloorDivision - (Identifier) - (Identifier)) - (Power - (Identifier) - (Identifier)) - (BOr - (Identifier) - (Identifier)) - (BAnd - (Identifier) - (Identifier)) - (BXOr - (Identifier) - (Identifier)) - (LShift - (Identifier) - (Identifier)) - (RShift - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/binary-operator.parseB.txt b/test/fixtures/python/corpus/binary-operator.parseB.txt deleted file mode 100644 index c98dc76271..0000000000 --- a/test/fixtures/python/corpus/binary-operator.parseB.txt +++ /dev/null @@ -1,37 +0,0 @@ -(Statements - (RShift - (Identifier) - (Identifier)) - (LShift - (Identifier) - (Identifier)) - (BXOr - (Identifier) - (Identifier)) - (BAnd - (Identifier) - (Identifier)) - (Modulo - (Identifier) - (Identifier)) - (Power - (Identifier) - (Identifier)) - (FloorDivision - (Identifier) - (Identifier)) - (Modulo - (Identifier) - (Identifier)) - (DividedBy - (Identifier) - (Identifier)) - (Times - (Identifier) - (Identifier)) - (Minus - (Identifier) - (Identifier)) - (Plus - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/boolean-operator.parseA.txt b/test/fixtures/python/corpus/boolean-operator.parseA.txt deleted file mode 100644 index c7052e7787..0000000000 --- a/test/fixtures/python/corpus/boolean-operator.parseA.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (And - (Identifier) - (Identifier)) - (Or - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/boolean-operator.parseB.txt b/test/fixtures/python/corpus/boolean-operator.parseB.txt deleted file mode 100644 index 1180fe094b..0000000000 --- a/test/fixtures/python/corpus/boolean-operator.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Or - (Identifier) - (Identifier)) - (And - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/boolean.parseA.txt b/test/fixtures/python/corpus/boolean.parseA.txt deleted file mode 100644 index e5b167feef..0000000000 --- a/test/fixtures/python/corpus/boolean.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Boolean) - (Boolean) - (Boolean)) diff --git a/test/fixtures/python/corpus/boolean.parseB.txt b/test/fixtures/python/corpus/boolean.parseB.txt deleted file mode 100644 index e5b167feef..0000000000 --- a/test/fixtures/python/corpus/boolean.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Boolean) - (Boolean) - (Boolean)) diff --git a/test/fixtures/python/corpus/break-statement.parseA.txt b/test/fixtures/python/corpus/break-statement.parseA.txt deleted file mode 100644 index 58c1a6e14e..0000000000 --- a/test/fixtures/python/corpus/break-statement.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Break - (Empty))) diff --git a/test/fixtures/python/corpus/break-statement.parseB.txt b/test/fixtures/python/corpus/break-statement.parseB.txt deleted file mode 100644 index fb40ca7bd6..0000000000 --- a/test/fixtures/python/corpus/break-statement.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Break - (Empty)) - (Break - (Empty))) diff --git a/test/fixtures/python/corpus/call.parseA.txt b/test/fixtures/python/corpus/call.parseA.txt deleted file mode 100644 index 523c4a8258..0000000000 --- a/test/fixtures/python/corpus/call.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Identifier) - (Empty))) diff --git a/test/fixtures/python/corpus/call.parseB.txt b/test/fixtures/python/corpus/call.parseB.txt deleted file mode 100644 index a6ac94e1d6..0000000000 --- a/test/fixtures/python/corpus/call.parseB.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (Call - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Identifier) - (Empty)) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Integer) - (Empty))) diff --git a/test/fixtures/python/corpus/class-definition.parseA.txt b/test/fixtures/python/corpus/class-definition.parseA.txt deleted file mode 100644 index 2e29243133..0000000000 --- a/test/fixtures/python/corpus/class-definition.parseA.txt +++ /dev/null @@ -1,41 +0,0 @@ -(Statements - (Class - (Identifier) - (Statements - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (Statements - (Return - (Identifier)))))) - (Class - (Identifier) - (Statements - (NoOp - (Empty)))) - (Class - (Identifier) - (Identifier) - (Statements - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (Statements - (Return - (Empty)))))) - (Class - (Identifier) - (Identifier) - (Statements - (Assignment - (Identifier) - (Identifier) - (Empty)) - (Assignment - (Subscript - (Identifier) - (Identifier)) - (Identifier) - (Empty))))) diff --git a/test/fixtures/python/corpus/class-definition.parseB.txt b/test/fixtures/python/corpus/class-definition.parseB.txt deleted file mode 100644 index 1ae9a23fa9..0000000000 --- a/test/fixtures/python/corpus/class-definition.parseB.txt +++ /dev/null @@ -1,36 +0,0 @@ -(Statements - (Class - (Identifier) - (Identifier) - (Statements - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (Statements - (Return - (Empty)))))) - (Class - (Identifier) - (Statements - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (Statements - (Return - (Identifier)))))) - (Class - (Identifier) - (Identifier) - (Statements - (Assignment - (Identifier) - (Identifier) - (Empty)) - (Assignment - (Subscript - (Identifier) - (Identifier)) - (Identifier) - (Empty))))) diff --git a/test/fixtures/python/corpus/comment.parseA.txt b/test/fixtures/python/corpus/comment.parseA.txt deleted file mode 100644 index c5a20a732b..0000000000 --- a/test/fixtures/python/corpus/comment.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Context - (Comment) - (Comment) - (Empty))) diff --git a/test/fixtures/python/corpus/comment.parseB.txt b/test/fixtures/python/corpus/comment.parseB.txt deleted file mode 100644 index 64b336a63d..0000000000 --- a/test/fixtures/python/corpus/comment.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Context - (Comment) - (Comment) - (Comment) - (Empty))) diff --git a/test/fixtures/python/corpus/comparison-operator.parseA.txt b/test/fixtures/python/corpus/comparison-operator.parseA.txt deleted file mode 100644 index 82030142db..0000000000 --- a/test/fixtures/python/corpus/comparison-operator.parseA.txt +++ /dev/null @@ -1,35 +0,0 @@ -(Statements - (LessThan - (Identifier) - (Identifier)) - (LessThanEqual - (Identifier) - (Identifier)) - (Not - (Equal - (Identifier) - (Identifier))) - (GreaterThanEqual - (Identifier) - (Identifier)) - (GreaterThan - (Identifier) - (Identifier)) - (Not - (Equal - (Identifier) - (Identifier))) - (Member - (Identifier) - (Identifier)) - (Equal - (Identifier) - (Identifier)) - (Not - (Member - (Identifier) - (Identifier))) - (Not - (Equal - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/comparison-operator.parseB.txt b/test/fixtures/python/corpus/comparison-operator.parseB.txt deleted file mode 100644 index a9647fe008..0000000000 --- a/test/fixtures/python/corpus/comparison-operator.parseB.txt +++ /dev/null @@ -1,35 +0,0 @@ -(Statements - (Not - (Equal - (Identifier) - (Identifier))) - (Not - (Member - (Identifier) - (Identifier))) - (Equal - (Identifier) - (Identifier)) - (Member - (Identifier) - (Identifier)) - (Not - (Equal - (Identifier) - (Identifier))) - (GreaterThan - (Identifier) - (Identifier)) - (GreaterThanEqual - (Identifier) - (Identifier)) - (Not - (Equal - (Identifier) - (Identifier))) - (LessThanEqual - (Identifier) - (Identifier)) - (LessThan - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/concatenated-string.parseA.txt b/test/fixtures/python/corpus/concatenated-string.parseA.txt deleted file mode 100644 index db13714024..0000000000 --- a/test/fixtures/python/corpus/concatenated-string.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Statements - (TextElement) - (TextElement) - (TextElement))) diff --git a/test/fixtures/python/corpus/concatenated-string.parseB.txt b/test/fixtures/python/corpus/concatenated-string.parseB.txt deleted file mode 100644 index b7376182f7..0000000000 --- a/test/fixtures/python/corpus/concatenated-string.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Statements - (TextElement) - (TextElement) - (TextElement) - (TextElement))) diff --git a/test/fixtures/python/corpus/conditional-expression.parseA.txt b/test/fixtures/python/corpus/conditional-expression.parseA.txt deleted file mode 100644 index 67d8d9b070..0000000000 --- a/test/fixtures/python/corpus/conditional-expression.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (If - (Identifier) - (Call - (Identifier) - (Empty)) - (Identifier)) - (Assignment - (Identifier) - (If - (Identifier) - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/conditional-expression.parseB.txt b/test/fixtures/python/corpus/conditional-expression.parseB.txt deleted file mode 100644 index 0f588f6e6a..0000000000 --- a/test/fixtures/python/corpus/conditional-expression.parseB.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Assignment - (Identifier) - (If - (Identifier) - (Identifier) - (Identifier))) - (If - (Identifier) - (Call - (Identifier) - (Empty)) - (Call - (Identifier) - (Empty)))) diff --git a/test/fixtures/python/corpus/continue-statement.parseA.txt b/test/fixtures/python/corpus/continue-statement.parseA.txt deleted file mode 100644 index 00420c4272..0000000000 --- a/test/fixtures/python/corpus/continue-statement.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Continue - (Empty))) diff --git a/test/fixtures/python/corpus/continue-statement.parseB.txt b/test/fixtures/python/corpus/continue-statement.parseB.txt deleted file mode 100644 index 5f95ddf982..0000000000 --- a/test/fixtures/python/corpus/continue-statement.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Continue - (Empty)) - (Continue - (Empty))) diff --git a/test/fixtures/python/corpus/decorated-definition.diffA-B.txt b/test/fixtures/python/corpus/decorated-definition.diffA-B.txt deleted file mode 100644 index 072e0c725c..0000000000 --- a/test/fixtures/python/corpus/decorated-definition.diffA-B.txt +++ /dev/null @@ -1,57 +0,0 @@ -(Statements - (Decorator - (Identifier) - (Class - { (Identifier) - ->(Identifier) } - (Statements - (Decorator - (Identifier) - (Statements) - (Decorator - { (Identifier) - ->(Identifier) } - {+(Identifier)+} - {-(Integer)-} - (Decorator - { (Identifier) - ->(Identifier) } - {+(Identifier)+} - {-(Statements - {-(Integer)-} - {-(Integer)-})-} - (Decorator - (Identifier) - {+(Statements - {+(Integer)+} - {+(Assignment - {+(Identifier)+} - {+(Boolean)+})+} - {+(Identifier)+} - {+(Identifier)+})+} - {-(Assignment - {-(Identifier)-} - {-(Boolean)-})-} - { (Decorator - {-(Identifier)-} - {-(Identifier)-} - {-(Decorator - {-(Identifier)-} - {-(Identifier)-} - {-(Decorator - {-(Identifier)-} - {-(Statements - {-(Integer)-} - {-(Assignment - {-(Identifier)-} - {-(Boolean)-})-} - {-(Identifier)-} - {-(Identifier)-})-} - {-(Function - {-(Identifier)-} - {-(Statements - {-(Identifier)-})-})-})-})-}) - ->(Function - {+(Identifier)+} - {+(Statements - {+(Identifier)+})+}) })))))))) diff --git a/test/fixtures/python/corpus/decorated-definition.diffB-A.txt b/test/fixtures/python/corpus/decorated-definition.diffB-A.txt deleted file mode 100644 index b6c20f57e2..0000000000 --- a/test/fixtures/python/corpus/decorated-definition.diffB-A.txt +++ /dev/null @@ -1,57 +0,0 @@ -(Statements - (Decorator - (Identifier) - (Class - { (Identifier) - ->(Identifier) } - (Statements - (Decorator - (Identifier) - (Statements) - (Decorator - { (Identifier) - ->(Identifier) } - {+(Integer)+} - {-(Identifier)-} - (Decorator - { (Identifier) - ->(Identifier) } - {+(Statements - {+(Integer)+} - {+(Integer)+})+} - {-(Identifier)-} - (Decorator - (Identifier) - {+(Assignment - {+(Identifier)+} - {+(Boolean)+})+} - {-(Statements - {-(Integer)-} - {-(Assignment - {-(Identifier)-} - {-(Boolean)-})-} - {-(Identifier)-} - {-(Identifier)-})-} - { (Function - {-(Identifier)-} - {-(Statements - {-(Identifier)-})-}) - ->(Decorator - {+(Identifier)+} - {+(Identifier)+} - {+(Decorator - {+(Identifier)+} - {+(Identifier)+} - {+(Decorator - {+(Identifier)+} - {+(Statements - {+(Integer)+} - {+(Assignment - {+(Identifier)+} - {+(Boolean)+})+} - {+(Identifier)+} - {+(Identifier)+})+} - {+(Function - {+(Identifier)+} - {+(Statements - {+(Identifier)+})+})+})+})+}) })))))))) diff --git a/test/fixtures/python/corpus/decorated-definition.parseA.txt b/test/fixtures/python/corpus/decorated-definition.parseA.txt deleted file mode 100644 index 47de1c27df..0000000000 --- a/test/fixtures/python/corpus/decorated-definition.parseA.txt +++ /dev/null @@ -1,41 +0,0 @@ -(Statements - (Decorator - (Identifier) - (Class - (Identifier) - (Statements - (Decorator - (Identifier) - (Statements) - (Decorator - (Identifier) - (Integer) - (Decorator - (Identifier) - (Statements - (Integer) - (Integer)) - (Decorator - (Identifier) - (Assignment - (Identifier) - (Boolean)) - (Decorator - (Identifier) - (Identifier) - (Decorator - (Identifier) - (Identifier) - (Decorator - (Identifier) - (Statements - (Integer) - (Assignment - (Identifier) - (Boolean)) - (Identifier) - (Identifier)) - (Function - (Identifier) - (Statements - (Identifier)))))))))))))) diff --git a/test/fixtures/python/corpus/decorated-definition.parseB.txt b/test/fixtures/python/corpus/decorated-definition.parseB.txt deleted file mode 100644 index 43852a59ab..0000000000 --- a/test/fixtures/python/corpus/decorated-definition.parseB.txt +++ /dev/null @@ -1,28 +0,0 @@ -(Statements - (Decorator - (Identifier) - (Class - (Identifier) - (Statements - (Decorator - (Identifier) - (Statements) - (Decorator - (Identifier) - (Identifier) - (Decorator - (Identifier) - (Identifier) - (Decorator - (Identifier) - (Statements - (Integer) - (Assignment - (Identifier) - (Boolean)) - (Identifier) - (Identifier)) - (Function - (Identifier) - (Statements - (Identifier))))))))))) diff --git a/test/fixtures/python/corpus/delete-statement.parseA.txt b/test/fixtures/python/corpus/delete-statement.parseA.txt deleted file mode 100644 index 1a9774e505..0000000000 --- a/test/fixtures/python/corpus/delete-statement.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Call - (Identifier) - (Subscript - (Identifier) - (Integer)) - (Subscript - (Identifier) - (Integer)) - (Empty))) diff --git a/test/fixtures/python/corpus/delete-statement.parseB.txt b/test/fixtures/python/corpus/delete-statement.parseB.txt deleted file mode 100644 index 1a9774e505..0000000000 --- a/test/fixtures/python/corpus/delete-statement.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Call - (Identifier) - (Subscript - (Identifier) - (Integer)) - (Subscript - (Identifier) - (Integer)) - (Empty))) diff --git a/test/fixtures/python/corpus/dictionary-comprehension.parseA.txt b/test/fixtures/python/corpus/dictionary-comprehension.parseA.txt deleted file mode 100644 index 112c242499..0000000000 --- a/test/fixtures/python/corpus/dictionary-comprehension.parseA.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Comprehension - (KeyValue - (Identifier) - (Identifier)) - (Statements - (Identifier) - (Identifier))) - (Comprehension - (KeyValue - (Identifier) - (Identifier)) - (Statements - (Statements - (Identifier) - (Identifier)) - (Identifier)))) diff --git a/test/fixtures/python/corpus/dictionary-comprehension.parseB.txt b/test/fixtures/python/corpus/dictionary-comprehension.parseB.txt deleted file mode 100644 index 9d95fa0cb8..0000000000 --- a/test/fixtures/python/corpus/dictionary-comprehension.parseB.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Comprehension - (KeyValue - (Identifier) - (Identifier)) - (Statements - (Statements - (Identifier) - (Identifier)) - (Identifier))) - (Comprehension - (KeyValue - (Identifier) - (Integer)) - (Statements - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/dictionary.parseA.txt b/test/fixtures/python/corpus/dictionary.parseA.txt deleted file mode 100644 index bb9afdff05..0000000000 --- a/test/fixtures/python/corpus/dictionary.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Hash) - (Hash - (KeyValue - (Identifier) - (Integer))) - (Hash - (KeyValue - (Identifier) - (Identifier)) - (KeyValue - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/dictionary.parseB.txt b/test/fixtures/python/corpus/dictionary.parseB.txt deleted file mode 100644 index ab1a5246e4..0000000000 --- a/test/fixtures/python/corpus/dictionary.parseB.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Hash - (KeyValue - (Identifier) - (Integer))) - (Hash) - (Assignment - (Identifier) - (Hash - (Context - (Comment) - (KeyValue - (Identifier) - (Identifier))) - (KeyValue - (Identifier) - (Identifier))))) diff --git a/test/fixtures/python/corpus/dotted-name.parseA.txt b/test/fixtures/python/corpus/dotted-name.parseA.txt deleted file mode 100644 index 96ac53b2be..0000000000 --- a/test/fixtures/python/corpus/dotted-name.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (MemberAccess - (Identifier) - (Identifier)) - (MemberAccess - (MemberAccess - (Identifier) - (Identifier)) - (Identifier))) diff --git a/test/fixtures/python/corpus/dotted-name.parseB.txt b/test/fixtures/python/corpus/dotted-name.parseB.txt deleted file mode 100644 index 8e6cef6008..0000000000 --- a/test/fixtures/python/corpus/dotted-name.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (MemberAccess - (MemberAccess - (Identifier) - (Identifier)) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/ellipsis.parseA.txt b/test/fixtures/python/corpus/ellipsis.parseA.txt deleted file mode 100644 index 76b3ebba69..0000000000 --- a/test/fixtures/python/corpus/ellipsis.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Ellipsis) - (Ellipsis)) diff --git a/test/fixtures/python/corpus/ellipsis.parseB.txt b/test/fixtures/python/corpus/ellipsis.parseB.txt deleted file mode 100644 index e7209aaaaf..0000000000 --- a/test/fixtures/python/corpus/ellipsis.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Ellipsis)) diff --git a/test/fixtures/python/corpus/exec-statement.parseA.txt b/test/fixtures/python/corpus/exec-statement.parseA.txt deleted file mode 100644 index f4c14c4d1c..0000000000 --- a/test/fixtures/python/corpus/exec-statement.parseA.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Call - (Identifier) - (TextElement) - (Empty)) - (Call - (Identifier) - (TextElement) - (Null) - (Empty)) - (Call - (Identifier) - (TextElement) - (Identifier) - (Identifier) - (Empty))) diff --git a/test/fixtures/python/corpus/exec-statement.parseB.txt b/test/fixtures/python/corpus/exec-statement.parseB.txt deleted file mode 100644 index 588cb9ec0c..0000000000 --- a/test/fixtures/python/corpus/exec-statement.parseB.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Call - (Identifier) - (TextElement) - (Identifier) - (Empty)) - (Call - (Identifier) - (TextElement) - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (TextElement) - (Empty))) diff --git a/test/fixtures/python/corpus/expression-statement.parseA.txt b/test/fixtures/python/corpus/expression-statement.parseA.txt deleted file mode 100644 index 847b5a0741..0000000000 --- a/test/fixtures/python/corpus/expression-statement.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Identifier) - (Plus - (Identifier) - (Identifier)) - (Statements - (Integer) - (Integer) - (Integer)) - (Statements - (Integer) - (Integer) - (Integer))) diff --git a/test/fixtures/python/corpus/expression-statement.parseB.txt b/test/fixtures/python/corpus/expression-statement.parseB.txt deleted file mode 100644 index 61e8ba8f18..0000000000 --- a/test/fixtures/python/corpus/expression-statement.parseB.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Statements - (Integer) - (Integer) - (Integer)) - (Identifier) - (Statements - (Integer) - (Integer) - (Integer)) - (Plus - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/float.parseA.txt b/test/fixtures/python/corpus/float.parseA.txt deleted file mode 100644 index c3cd2858d4..0000000000 --- a/test/fixtures/python/corpus/float.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Negate - (Float)) - (Float) - (Float) - (Float) - (Float) - (Float) - (Float) - (Float) - (Float) - (Float)) diff --git a/test/fixtures/python/corpus/float.parseB.txt b/test/fixtures/python/corpus/float.parseB.txt deleted file mode 100644 index c3cd2858d4..0000000000 --- a/test/fixtures/python/corpus/float.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Negate - (Float)) - (Float) - (Float) - (Float) - (Float) - (Float) - (Float) - (Float) - (Float) - (Float)) diff --git a/test/fixtures/python/corpus/for-statement.parseA.txt b/test/fixtures/python/corpus/for-statement.parseA.txt deleted file mode 100644 index 98ae9a0fe7..0000000000 --- a/test/fixtures/python/corpus/for-statement.parseA.txt +++ /dev/null @@ -1,37 +0,0 @@ -(Statements - (Else - (ForEach - (Statements - (Identifier) - (Identifier)) - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (ForEach - (Statements - (Identifier) - (Identifier)) - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)))))) - (Call - (Identifier) - (Identifier) - (Empty))) - (ForEach - (Identifier) - (Array - (Tuple - (Integer)) - (Tuple - (Integer)) - (Tuple - (Integer))) - (Statements - (Identifier)))) diff --git a/test/fixtures/python/corpus/for-statement.parseB.txt b/test/fixtures/python/corpus/for-statement.parseB.txt deleted file mode 100644 index ccd3a7212b..0000000000 --- a/test/fixtures/python/corpus/for-statement.parseB.txt +++ /dev/null @@ -1,37 +0,0 @@ -(Statements - (ForEach - (Identifier) - (Array - (Tuple - (Integer)) - (Tuple - (Integer)) - (Tuple - (Integer))) - (Statements - (Identifier))) - (Else - (ForEach - (Statements - (Identifier) - (Identifier)) - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (ForEach - (Statements - (Identifier) - (Identifier)) - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)))))) - (Call - (Identifier) - (Identifier) - (Empty)))) diff --git a/test/fixtures/python/corpus/function-definition.parseA.txt b/test/fixtures/python/corpus/function-definition.parseA.txt deleted file mode 100644 index f74f932116..0000000000 --- a/test/fixtures/python/corpus/function-definition.parseA.txt +++ /dev/null @@ -1,35 +0,0 @@ -(Statements - (Function - (Identifier) - (Statements - (Identifier))) - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (Statements - (Identifier))) - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (Identifier) - (Statements - (Identifier))) - (Function - (Identifier) - (Assignment - (Identifier) - (Identifier)) - (Statements - (Identifier))) - (Function - (Identifier) - (Annotation - (Assignment - (Identifier) - (TextElement)) - (Identifier)) - (Identifier) - (Statements - (Identifier)))) diff --git a/test/fixtures/python/corpus/function-definition.parseB.txt b/test/fixtures/python/corpus/function-definition.parseB.txt deleted file mode 100644 index a6d40239f9..0000000000 --- a/test/fixtures/python/corpus/function-definition.parseB.txt +++ /dev/null @@ -1,28 +0,0 @@ -(Statements - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (Identifier) - (Statements - (Identifier))) - (Function - (Identifier) - (Statements - (Identifier))) - (Function - (Identifier) - (RequiredParameter - (Identifier)) - (Statements - (Identifier))) - (Function - (Identifier) - (Annotation - (Assignment - (Identifier) - (Integer)) - (Identifier)) - (Identifier) - (Statements - (Identifier)))) diff --git a/test/fixtures/python/corpus/future_import_statement.parseA.txt b/test/fixtures/python/corpus/future_import_statement.parseA.txt deleted file mode 100644 index 5acbd33bf7..0000000000 --- a/test/fixtures/python/corpus/future_import_statement.parseA.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (FutureImport - (Alias - (Identifier) - (Identifier))) - (FutureImport - (Alias - (Identifier) - (Identifier)) - (Alias - (Identifier) - (Identifier))) - (FutureImport - (Alias - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/future_import_statement.parseB.txt b/test/fixtures/python/corpus/future_import_statement.parseB.txt deleted file mode 100644 index 5acbd33bf7..0000000000 --- a/test/fixtures/python/corpus/future_import_statement.parseB.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (FutureImport - (Alias - (Identifier) - (Identifier))) - (FutureImport - (Alias - (Identifier) - (Identifier)) - (Alias - (Identifier) - (Identifier))) - (FutureImport - (Alias - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/generator-expression.parseA.txt b/test/fixtures/python/corpus/generator-expression.parseA.txt deleted file mode 100644 index ead6841ee0..0000000000 --- a/test/fixtures/python/corpus/generator-expression.parseA.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Comprehension - (Identifier) - (Statements - (Identifier) - (Identifier))) - (Comprehension - (Identifier) - (Statements - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/generator-expression.parseB.txt b/test/fixtures/python/corpus/generator-expression.parseB.txt deleted file mode 100644 index 9afbdfa933..0000000000 --- a/test/fixtures/python/corpus/generator-expression.parseB.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Comprehension - (Identifier) - (Statements - (Identifier) - (Identifier))) - (Comprehension - (Plus - (Identifier) - (Integer)) - (Statements - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/global-statement.parseA.txt b/test/fixtures/python/corpus/global-statement.parseA.txt deleted file mode 100644 index e1dc965034..0000000000 --- a/test/fixtures/python/corpus/global-statement.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Identifier) - (Empty))) diff --git a/test/fixtures/python/corpus/global-statement.parseB.txt b/test/fixtures/python/corpus/global-statement.parseB.txt deleted file mode 100644 index 3f92988c54..0000000000 --- a/test/fixtures/python/corpus/global-statement.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Empty))) diff --git a/test/fixtures/python/corpus/identifier.parseA.txt b/test/fixtures/python/corpus/identifier.parseA.txt deleted file mode 100644 index 5f0ab64c18..0000000000 --- a/test/fixtures/python/corpus/identifier.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Identifier)) diff --git a/test/fixtures/python/corpus/identifier.parseB.txt b/test/fixtures/python/corpus/identifier.parseB.txt deleted file mode 100644 index 8aac190e13..0000000000 --- a/test/fixtures/python/corpus/identifier.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Identifier) - (Identifier)) diff --git a/test/fixtures/python/corpus/if-statement.parseA.txt b/test/fixtures/python/corpus/if-statement.parseA.txt deleted file mode 100644 index d66f56a4f4..0000000000 --- a/test/fixtures/python/corpus/if-statement.parseA.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (If - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Statements - (If - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Statements)) - (Statements - (Identifier) - (Identifier))))) diff --git a/test/fixtures/python/corpus/if-statement.parseB.txt b/test/fixtures/python/corpus/if-statement.parseB.txt deleted file mode 100644 index f50e9e432e..0000000000 --- a/test/fixtures/python/corpus/if-statement.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (If - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Statements))) diff --git a/test/fixtures/python/corpus/import-from-statement.parseA.txt b/test/fixtures/python/corpus/import-from-statement.parseA.txt deleted file mode 100644 index 48056679dc..0000000000 --- a/test/fixtures/python/corpus/import-from-statement.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Import - (Alias - (Identifier) - (Identifier))) - (Import - (Alias - (Identifier) - (Identifier)) - (Alias - (Identifier) - (Identifier))) - (Import) - (Import - (Alias - (Identifier) - (Identifier))) - (Import - (Alias - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/import-from-statement.parseB.txt b/test/fixtures/python/corpus/import-from-statement.parseB.txt deleted file mode 100644 index 68623b6636..0000000000 --- a/test/fixtures/python/corpus/import-from-statement.parseB.txt +++ /dev/null @@ -1,28 +0,0 @@ -(Statements - (Import - (Alias - (Identifier) - (Identifier))) - (Import - (Alias - (Identifier) - (Identifier)) - (Alias - (Identifier) - (Identifier))) - (Import) - (Import - (Alias - (Identifier) - (Identifier)) - (Alias - (Identifier) - (Identifier))) - (Import - (Alias - (Identifier) - (Identifier))) - (Import - (Alias - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/import-statement.parseA.txt b/test/fixtures/python/corpus/import-statement.parseA.txt deleted file mode 100644 index bd21ce77bc..0000000000 --- a/test/fixtures/python/corpus/import-statement.parseA.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Statements - (QualifiedImport - (Identifier)) - (QualifiedAliasedImport - (Identifier))) - (Statements - (QualifiedAliasedImport - (Identifier)) - (QualifiedImport - (Identifier))) - (QualifiedImport - (Identifier) - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/import-statement.parseB.txt b/test/fixtures/python/corpus/import-statement.parseB.txt deleted file mode 100644 index 529ee2b2b1..0000000000 --- a/test/fixtures/python/corpus/import-statement.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Statements - (QualifiedImport - (Identifier)) - (QualifiedImport - (Identifier))) - (QualifiedAliasedImport - (Identifier)) - (QualifiedImport - (Identifier) - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/integer.parseA.txt b/test/fixtures/python/corpus/integer.parseA.txt deleted file mode 100644 index d8be2686b7..0000000000 --- a/test/fixtures/python/corpus/integer.parseA.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Negate - (Integer)) - (Integer) - (Integer) - (Integer) - (Negate - (Integer)) - (Integer) - (Integer) - (Integer) - (Integer) - (Integer) - (Integer) - (Integer) - (Integer)) diff --git a/test/fixtures/python/corpus/integer.parseB.txt b/test/fixtures/python/corpus/integer.parseB.txt deleted file mode 100644 index d8be2686b7..0000000000 --- a/test/fixtures/python/corpus/integer.parseB.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Negate - (Integer)) - (Integer) - (Integer) - (Integer) - (Negate - (Integer)) - (Integer) - (Integer) - (Integer) - (Integer) - (Integer) - (Integer) - (Integer) - (Integer)) diff --git a/test/fixtures/python/corpus/keyword-identifier.parseA.txt b/test/fixtures/python/corpus/keyword-identifier.parseA.txt deleted file mode 100644 index 8aac190e13..0000000000 --- a/test/fixtures/python/corpus/keyword-identifier.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Identifier) - (Identifier)) diff --git a/test/fixtures/python/corpus/keyword-identifier.parseB.txt b/test/fixtures/python/corpus/keyword-identifier.parseB.txt deleted file mode 100644 index 8aac190e13..0000000000 --- a/test/fixtures/python/corpus/keyword-identifier.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Identifier) - (Identifier)) diff --git a/test/fixtures/python/corpus/lambda.parseA.txt b/test/fixtures/python/corpus/lambda.parseA.txt deleted file mode 100644 index 4cd5157114..0000000000 --- a/test/fixtures/python/corpus/lambda.parseA.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Function - (Empty) - (Statements - (Plus - (Integer) - (Integer))))) diff --git a/test/fixtures/python/corpus/lambda.parseB.txt b/test/fixtures/python/corpus/lambda.parseB.txt deleted file mode 100644 index fb0cf2df5f..0000000000 --- a/test/fixtures/python/corpus/lambda.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Function - (Empty) - (Identifier) - (Statements - (Plus - (Identifier) - (Integer))))) diff --git a/test/fixtures/python/corpus/list-comprehension.parseA.txt b/test/fixtures/python/corpus/list-comprehension.parseA.txt deleted file mode 100644 index 669c723df4..0000000000 --- a/test/fixtures/python/corpus/list-comprehension.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Comprehension - (Identifier) - (Statements - (Identifier) - (Identifier))) - (Comprehension - (Identifier) - (Statements - (Statements - (Identifier) - (Identifier)) - (Identifier)))) diff --git a/test/fixtures/python/corpus/list-comprehension.parseB.txt b/test/fixtures/python/corpus/list-comprehension.parseB.txt deleted file mode 100644 index fcddcd1b96..0000000000 --- a/test/fixtures/python/corpus/list-comprehension.parseB.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Comprehension - (Identifier) - (Statements - (Statements - (Identifier) - (Identifier)) - (Call - (Identifier) - (Empty)) - (Statements - (Identifier) - (Identifier)) - (Call - (Identifier) - (Empty)))) - (Comprehension - (Plus - (Identifier) - (Integer)) - (Statements - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/list.parseA.txt b/test/fixtures/python/corpus/list.parseA.txt deleted file mode 100644 index 8d90301274..0000000000 --- a/test/fixtures/python/corpus/list.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Array) - (Array - (Integer) - (Integer) - (Integer)) - (Array - (Identifier) - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/list.parseB.txt b/test/fixtures/python/corpus/list.parseB.txt deleted file mode 100644 index b8b3d71a90..0000000000 --- a/test/fixtures/python/corpus/list.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Array - (Identifier)) - (Array - (Integer) - (Integer)) - (Array - (Identifier))) diff --git a/test/fixtures/python/corpus/non-local-statement.parseA.txt b/test/fixtures/python/corpus/non-local-statement.parseA.txt deleted file mode 100644 index 3e6149a155..0000000000 --- a/test/fixtures/python/corpus/non-local-statement.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (Empty))) diff --git a/test/fixtures/python/corpus/non-local-statement.parseB.txt b/test/fixtures/python/corpus/non-local-statement.parseB.txt deleted file mode 100644 index 3e6149a155..0000000000 --- a/test/fixtures/python/corpus/non-local-statement.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (Empty))) diff --git a/test/fixtures/python/corpus/none.parseA.txt b/test/fixtures/python/corpus/none.parseA.txt deleted file mode 100644 index 4af9c5927a..0000000000 --- a/test/fixtures/python/corpus/none.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Null) - (Null)) diff --git a/test/fixtures/python/corpus/none.parseB.txt b/test/fixtures/python/corpus/none.parseB.txt deleted file mode 100644 index 5c722556e5..0000000000 --- a/test/fixtures/python/corpus/none.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Null)) diff --git a/test/fixtures/python/corpus/not.parseA.txt b/test/fixtures/python/corpus/not.parseA.txt deleted file mode 100644 index 2aac4ecc86..0000000000 --- a/test/fixtures/python/corpus/not.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Not - (Identifier))) diff --git a/test/fixtures/python/corpus/not.parseB.txt b/test/fixtures/python/corpus/not.parseB.txt deleted file mode 100644 index 8a8d2c1445..0000000000 --- a/test/fixtures/python/corpus/not.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Not - (Identifier)) - (Not - (Identifier))) diff --git a/test/fixtures/python/corpus/pass-statement.parseA.txt b/test/fixtures/python/corpus/pass-statement.parseA.txt deleted file mode 100644 index acbee74d6e..0000000000 --- a/test/fixtures/python/corpus/pass-statement.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (NoOp - (Empty))) diff --git a/test/fixtures/python/corpus/pass-statement.parseB.txt b/test/fixtures/python/corpus/pass-statement.parseB.txt deleted file mode 100644 index ce27612bdc..0000000000 --- a/test/fixtures/python/corpus/pass-statement.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (NoOp - (Empty)) - (NoOp - (Empty))) diff --git a/test/fixtures/python/corpus/print-statement.parseA.txt b/test/fixtures/python/corpus/print-statement.parseA.txt deleted file mode 100644 index dc1c75d2f2..0000000000 --- a/test/fixtures/python/corpus/print-statement.parseA.txt +++ /dev/null @@ -1,25 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Or - (Integer) - (Integer)) - (Empty)) - (Call - (Identifier) - (Or - (Integer) - (Integer)) - (Or - (Integer) - (Integer)) - (Empty))) diff --git a/test/fixtures/python/corpus/print-statement.parseB.txt b/test/fixtures/python/corpus/print-statement.parseB.txt deleted file mode 100644 index dc1c75d2f2..0000000000 --- a/test/fixtures/python/corpus/print-statement.parseB.txt +++ /dev/null @@ -1,25 +0,0 @@ -(Statements - (Call - (Identifier) - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Or - (Integer) - (Integer)) - (Empty)) - (Call - (Identifier) - (Or - (Integer) - (Integer)) - (Or - (Integer) - (Integer)) - (Empty))) diff --git a/test/fixtures/python/corpus/raise-statement.parseA.txt b/test/fixtures/python/corpus/raise-statement.parseA.txt deleted file mode 100644 index b0ee65fa0e..0000000000 --- a/test/fixtures/python/corpus/raise-statement.parseA.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Throw - (Statements)) - (Throw - (Call - (Identifier) - (TextElement) - (Empty))) - (Throw - (Statements - (Call - (Identifier) - (TextElement) - (Empty)) - (Identifier)))) diff --git a/test/fixtures/python/corpus/raise-statement.parseB.txt b/test/fixtures/python/corpus/raise-statement.parseB.txt deleted file mode 100644 index b6730223e7..0000000000 --- a/test/fixtures/python/corpus/raise-statement.parseB.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Throw - (Call - (Identifier) - (TextElement) - (Empty))) - (Throw - (Statements - (Call - (Identifier) - (TextElement) - (Empty)) - (Identifier))) - (Throw - (Statements))) diff --git a/test/fixtures/python/corpus/return-statement.parseA.txt b/test/fixtures/python/corpus/return-statement.parseA.txt deleted file mode 100644 index cd8b4535cf..0000000000 --- a/test/fixtures/python/corpus/return-statement.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Return - (Empty)) - (Return - (Statements - (Plus - (Identifier) - (Identifier)) - (Identifier))) - (Return - (Not - (Identifier)))) diff --git a/test/fixtures/python/corpus/return-statement.parseB.txt b/test/fixtures/python/corpus/return-statement.parseB.txt deleted file mode 100644 index 86edac90aa..0000000000 --- a/test/fixtures/python/corpus/return-statement.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Return - (Statements - (Plus - (Identifier) - (Identifier)) - (Identifier))) - (Return - (Empty)) - (Return - (Not - (Identifier)))) diff --git a/test/fixtures/python/corpus/set-comprehension.parseA.txt b/test/fixtures/python/corpus/set-comprehension.parseA.txt deleted file mode 100644 index ead6841ee0..0000000000 --- a/test/fixtures/python/corpus/set-comprehension.parseA.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Comprehension - (Identifier) - (Statements - (Identifier) - (Identifier))) - (Comprehension - (Identifier) - (Statements - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/set-comprehension.parseB.txt b/test/fixtures/python/corpus/set-comprehension.parseB.txt deleted file mode 100644 index 9afbdfa933..0000000000 --- a/test/fixtures/python/corpus/set-comprehension.parseB.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Comprehension - (Identifier) - (Statements - (Identifier) - (Identifier))) - (Comprehension - (Plus - (Identifier) - (Integer)) - (Statements - (Identifier) - (Identifier)))) diff --git a/test/fixtures/python/corpus/set.parseA.txt b/test/fixtures/python/corpus/set.parseA.txt deleted file mode 100644 index a34a7adcdb..0000000000 --- a/test/fixtures/python/corpus/set.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Hash) - (Set - (Integer) - (Integer) - (Integer))) diff --git a/test/fixtures/python/corpus/set.parseB.txt b/test/fixtures/python/corpus/set.parseB.txt deleted file mode 100644 index 2ca89b7cde..0000000000 --- a/test/fixtures/python/corpus/set.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Set - (Integer)) - (Set - (Integer) - (Integer) - (Integer))) diff --git a/test/fixtures/python/corpus/slice.parseA.txt b/test/fixtures/python/corpus/slice.parseA.txt deleted file mode 100644 index bca8cd11b7..0000000000 --- a/test/fixtures/python/corpus/slice.parseA.txt +++ /dev/null @@ -1,26 +0,0 @@ -(Statements - (Subscript - (Identifier) - (Enumeration - (Empty) - (Empty) - (Empty))) - (Subscript - (Identifier) - (Enumeration - (Integer) - (Empty) - (Empty))) - (Subscript - (Identifier) - (Enumeration - (Integer) - (Integer) - (Empty)) - (Ellipsis)) - (Subscript - (Identifier) - (Enumeration - (Empty) - (Empty) - (Empty)))) diff --git a/test/fixtures/python/corpus/slice.parseB.txt b/test/fixtures/python/corpus/slice.parseB.txt deleted file mode 100644 index aee117b123..0000000000 --- a/test/fixtures/python/corpus/slice.parseB.txt +++ /dev/null @@ -1,26 +0,0 @@ -(Statements - (Subscript - (Identifier) - (Enumeration - (Integer) - (Integer) - (Empty)) - (Ellipsis)) - (Subscript - (Identifier) - (Enumeration - (Empty) - (Empty) - (Empty))) - (Subscript - (Identifier) - (Enumeration - (Integer) - (Empty) - (Empty))) - (Subscript - (Identifier) - (Enumeration - (Empty) - (Empty) - (Empty)))) diff --git a/test/fixtures/python/corpus/string.parseA.txt b/test/fixtures/python/corpus/string.parseA.txt deleted file mode 100644 index f7fef4dfea..0000000000 --- a/test/fixtures/python/corpus/string.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement)) diff --git a/test/fixtures/python/corpus/string.parseB.txt b/test/fixtures/python/corpus/string.parseB.txt deleted file mode 100644 index 9d589ddfd7..0000000000 --- a/test/fixtures/python/corpus/string.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement)) diff --git a/test/fixtures/python/corpus/subscript.parseA.txt b/test/fixtures/python/corpus/subscript.parseA.txt deleted file mode 100644 index e2c7fbd55a..0000000000 --- a/test/fixtures/python/corpus/subscript.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Subscript - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/subscript.parseB.txt b/test/fixtures/python/corpus/subscript.parseB.txt deleted file mode 100644 index e2c7fbd55a..0000000000 --- a/test/fixtures/python/corpus/subscript.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Subscript - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/try-statement.parseA.txt b/test/fixtures/python/corpus/try-statement.parseA.txt deleted file mode 100644 index 82828c65ea..0000000000 --- a/test/fixtures/python/corpus/try-statement.parseA.txt +++ /dev/null @@ -1,41 +0,0 @@ -(Statements - (Try - (Statements - (Identifier) - (Identifier)) - (Catch - (Statements - (Identifier) - (Statements - (Identifier) - (Identifier))) - (Statements)) - (Catch - (Let - (Identifier) - (Identifier) - (Empty)) - (Statements - (Identifier) - (Identifier))) - (Catch - (Statements - (Identifier) - (Identifier) - (Statements - (Identifier) - (Identifier))) - (Statements)) - (Catch - (Statements - (Identifier) - (Identifier)) - (Statements))) - (Try - (Statements - (Identifier) - (Identifier)) - (Finally - (Statements - (Identifier) - (Identifier))))) diff --git a/test/fixtures/python/corpus/try-statement.parseB.txt b/test/fixtures/python/corpus/try-statement.parseB.txt deleted file mode 100644 index 6a18c7a54b..0000000000 --- a/test/fixtures/python/corpus/try-statement.parseB.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Try - (Identifier) - (Finally - (Identifier))) - (Try - (Identifier) - (Catch - (Statements - (Identifier) - (Identifier)) - (Statements)) - (Catch - (Let - (Identifier) - (Identifier) - (Empty)) - (Identifier)) - (Catch - (Statements - (Identifier) - (Identifier) - (Identifier)) - (Statements)) - (Catch - (Identifier) - (Statements)))) diff --git a/test/fixtures/python/corpus/tuple.parseA.txt b/test/fixtures/python/corpus/tuple.parseA.txt deleted file mode 100644 index 22c207c41b..0000000000 --- a/test/fixtures/python/corpus/tuple.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Tuple - (Identifier) - (Identifier)) - (Tuple - (Identifier) - (Identifier) - (Identifier))) diff --git a/test/fixtures/python/corpus/tuple.parseB.txt b/test/fixtures/python/corpus/tuple.parseB.txt deleted file mode 100644 index 0cf31e5b2c..0000000000 --- a/test/fixtures/python/corpus/tuple.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Tuple - (Identifier) - (Identifier) - (Identifier)) - (Tuple - (Identifier) - (Identifier)) - (Identifier)) diff --git a/test/fixtures/python/corpus/unary-operator.diffB-A.txt b/test/fixtures/python/corpus/unary-operator.diffB-A.txt deleted file mode 100644 index a0086cd4b9..0000000000 --- a/test/fixtures/python/corpus/unary-operator.diffB-A.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements -{+(Negate - {+(Identifier)+})+} -{+(Identifier)+} - (Complement - { (Identifier) - ->(Identifier) }) -{-(Negate - {-(Identifier)-})-} -{-(Identifier)-}) diff --git a/test/fixtures/python/corpus/unary-operator.parseA.txt b/test/fixtures/python/corpus/unary-operator.parseA.txt deleted file mode 100644 index e92f638ae9..0000000000 --- a/test/fixtures/python/corpus/unary-operator.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Negate - (Identifier)) - (Identifier) - (Complement - (Identifier))) diff --git a/test/fixtures/python/corpus/unary-operator.parseB.txt b/test/fixtures/python/corpus/unary-operator.parseB.txt deleted file mode 100644 index f3d6e2da65..0000000000 --- a/test/fixtures/python/corpus/unary-operator.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Complement - (Identifier)) - (Negate - (Identifier)) - (Identifier)) diff --git a/test/fixtures/python/corpus/while-statement.parseA.txt b/test/fixtures/python/corpus/while-statement.parseA.txt deleted file mode 100644 index f8687d813d..0000000000 --- a/test/fixtures/python/corpus/while-statement.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (While - (Identifier) - (Statements - (NoOp - (Empty)) - (Break - (Empty)) - (Continue - (Empty))))) diff --git a/test/fixtures/python/corpus/while-statement.parseB.txt b/test/fixtures/python/corpus/while-statement.parseB.txt deleted file mode 100644 index a6059e837a..0000000000 --- a/test/fixtures/python/corpus/while-statement.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (While - (Identifier) - (Statements - (Break - (Empty)) - (Continue - (Empty)) - (NoOp - (Empty))))) diff --git a/test/fixtures/python/corpus/with-statement.parseA.txt b/test/fixtures/python/corpus/with-statement.parseA.txt deleted file mode 100644 index b5a13bb953..0000000000 --- a/test/fixtures/python/corpus/with-statement.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Let - (Identifier) - (Identifier) - (Statements - (Identifier)))) diff --git a/test/fixtures/python/corpus/with-statement.parseB.txt b/test/fixtures/python/corpus/with-statement.parseB.txt deleted file mode 100644 index b5a13bb953..0000000000 --- a/test/fixtures/python/corpus/with-statement.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Let - (Identifier) - (Identifier) - (Statements - (Identifier)))) diff --git a/test/fixtures/python/corpus/with.parseA.txt b/test/fixtures/python/corpus/with.parseA.txt deleted file mode 100644 index 43c0db99ef..0000000000 --- a/test/fixtures/python/corpus/with.parseA.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (Let - (Identifier) - (Call - (Identifier) - (Identifier) - (TextElement) - (Empty)) - (Statements - (Assignment - (Identifier) - (Boolean)) - (ForEach - (Identifier) - (Identifier) - (Statements - (Assignment - (Identifier) - (Boolean))))))) diff --git a/test/fixtures/python/corpus/with.parseB.txt b/test/fixtures/python/corpus/with.parseB.txt deleted file mode 100644 index 603995fc91..0000000000 --- a/test/fixtures/python/corpus/with.parseB.txt +++ /dev/null @@ -1,32 +0,0 @@ -(Statements - (Let - (Empty) - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (Assignment - (Identifier) - (Boolean)))) - (Let - (Empty) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (TextElement) - (Identifier) - (Empty)) - (Let - (Empty) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (TextElement) - (Identifier) - (Empty)) - (Statements - (Identifier))))) diff --git a/test/fixtures/python/corpus/yield.parseA.txt b/test/fixtures/python/corpus/yield.parseA.txt deleted file mode 100644 index 8663d7d6f6..0000000000 --- a/test/fixtures/python/corpus/yield.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Yield - (Empty))) diff --git a/test/fixtures/python/corpus/yield.parseB.txt b/test/fixtures/python/corpus/yield.parseB.txt deleted file mode 100644 index 0f843e453b..0000000000 --- a/test/fixtures/python/corpus/yield.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Yield - (Empty)) - (Yield - (Empty))) diff --git a/test/fixtures/ruby/corpus/alias.parseA.txt b/test/fixtures/ruby/corpus/alias.parseA.txt deleted file mode 100644 index 861f80cd12..0000000000 --- a/test/fixtures/ruby/corpus/alias.parseA.txt +++ /dev/null @@ -1,29 +0,0 @@ -(Statements - (Call - (Identifier) - (SymbolElement) - (SymbolElement) - (Empty)) - (Call - (Identifier) - (Send - (Identifier)) - (Send - (Identifier)) - (Empty)) - (Call - (Identifier) - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Send - (Identifier)) - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Identifier) - (Empty))) diff --git a/test/fixtures/ruby/corpus/and-or.parseA.txt b/test/fixtures/ruby/corpus/and-or.parseA.txt deleted file mode 100644 index cb6c2ab49d..0000000000 --- a/test/fixtures/ruby/corpus/and-or.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (LowPrecedenceAnd - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/and-or.parseB.txt b/test/fixtures/ruby/corpus/and-or.parseB.txt deleted file mode 100644 index 2a0a6e6467..0000000000 --- a/test/fixtures/ruby/corpus/and-or.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (LowPrecedenceOr - (Send - (Identifier)) - (Send - (Identifier))) - (LowPrecedenceAnd - (LowPrecedenceOr - (Send - (Identifier)) - (Send - (Identifier))) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/array.parseA.txt b/test/fixtures/ruby/corpus/array.parseA.txt deleted file mode 100644 index d32cf5a626..0000000000 --- a/test/fixtures/ruby/corpus/array.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Array - (Integer) - (Integer) - (Integer))) diff --git a/test/fixtures/ruby/corpus/array.parseB.txt b/test/fixtures/ruby/corpus/array.parseB.txt deleted file mode 100644 index 23b9ce5ed1..0000000000 --- a/test/fixtures/ruby/corpus/array.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Array - (TextElement) - (TextElement) - (TextElement))) diff --git a/test/fixtures/ruby/corpus/assignment.parseA.txt b/test/fixtures/ruby/corpus/assignment.parseA.txt deleted file mode 100644 index 96467e900e..0000000000 --- a/test/fixtures/ruby/corpus/assignment.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Integer))) diff --git a/test/fixtures/ruby/corpus/assignment.parseB.txt b/test/fixtures/ruby/corpus/assignment.parseB.txt deleted file mode 100644 index 96467e900e..0000000000 --- a/test/fixtures/ruby/corpus/assignment.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Integer))) diff --git a/test/fixtures/ruby/corpus/begin-block.parseA.txt b/test/fixtures/ruby/corpus/begin-block.parseA.txt deleted file mode 100644 index 7a735f831f..0000000000 --- a/test/fixtures/ruby/corpus/begin-block.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (ScopeEntry - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/begin-block.parseB.txt b/test/fixtures/ruby/corpus/begin-block.parseB.txt deleted file mode 100644 index bfa9115b8e..0000000000 --- a/test/fixtures/ruby/corpus/begin-block.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Send - (Identifier)) - (ScopeEntry - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/begin.parseA.txt b/test/fixtures/ruby/corpus/begin.parseA.txt deleted file mode 100644 index c78fdebfec..0000000000 --- a/test/fixtures/ruby/corpus/begin.parseA.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Statements - (Try - (Statements))))) diff --git a/test/fixtures/ruby/corpus/begin.parseB.txt b/test/fixtures/ruby/corpus/begin.parseB.txt deleted file mode 100644 index 48f91279a9..0000000000 --- a/test/fixtures/ruby/corpus/begin.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Statements - (Try - (Send - (Identifier) - (TextElement)))))) diff --git a/test/fixtures/ruby/corpus/binary.parseA.txt b/test/fixtures/ruby/corpus/binary.parseA.txt deleted file mode 100644 index 18236c7264..0000000000 --- a/test/fixtures/ruby/corpus/binary.parseA.txt +++ /dev/null @@ -1,121 +0,0 @@ -(Statements - (And - (Send - (Identifier)) - (Send - (Identifier))) - (LowPrecedenceAnd - (Send - (Identifier)) - (Send - (Identifier))) - (LowPrecedenceOr - (Send - (Identifier)) - (Send - (Identifier))) - (Or - (Send - (Identifier)) - (Send - (Identifier))) - (Plus - (Send - (Identifier)) - (Send - (Identifier))) - (Context - (Comment) - (LShift - (Send - (Identifier)) - (Send - (Identifier)))) - (RShift - (Send - (Identifier)) - (Send - (Identifier))) - (BOr - (Send - (Identifier)) - (Send - (Identifier))) - (BAnd - (Send - (Identifier)) - (Send - (Identifier))) - (BXOr - (Send - (Identifier)) - (Send - (Identifier))) - (Equal - (Send - (Identifier)) - (Send - (Identifier))) - (Not - (Equal - (Send - (Identifier)) - (Send - (Identifier)))) - (Equal - (Send - (Identifier)) - (Send - (Identifier))) - (Comparison - (Send - (Identifier)) - (Send - (Identifier))) - (Matches - (Send - (Identifier)) - (Send - (Identifier))) - (NotMatches - (Send - (Identifier)) - (Send - (Identifier))) - (LessThan - (Send - (Identifier)) - (Send - (Identifier))) - (LessThanEqual - (Send - (Identifier)) - (Send - (Identifier))) - (GreaterThan - (Send - (Identifier)) - (Send - (Identifier))) - (GreaterThanEqual - (Send - (Identifier)) - (Send - (Identifier))) - (Context - (Comment) - (DividedBy - (Send - (Identifier)) - (Send - (Identifier)))) - (Modulo - (Send - (Identifier)) - (Send - (Identifier))) - (Power - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/bitwise-operator.parseA.txt b/test/fixtures/ruby/corpus/bitwise-operator.parseA.txt deleted file mode 100644 index 54eee4aabe..0000000000 --- a/test/fixtures/ruby/corpus/bitwise-operator.parseA.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (BOr - (Send - (Identifier)) - (Send - (Identifier))) - (RShift - (Send - (Identifier)) - (Send - (Identifier))) - (BXOr - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/bitwise-operator.parseB.txt b/test/fixtures/ruby/corpus/bitwise-operator.parseB.txt deleted file mode 100644 index bf057bbf14..0000000000 --- a/test/fixtures/ruby/corpus/bitwise-operator.parseB.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (BAnd - (Send - (Identifier)) - (Send - (Identifier))) - (LShift - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/boolean-operator.parseA.txt b/test/fixtures/ruby/corpus/boolean-operator.parseA.txt deleted file mode 100644 index 14f55cb032..0000000000 --- a/test/fixtures/ruby/corpus/boolean-operator.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Or - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/boolean-operator.parseB.txt b/test/fixtures/ruby/corpus/boolean-operator.parseB.txt deleted file mode 100644 index 86762f3f76..0000000000 --- a/test/fixtures/ruby/corpus/boolean-operator.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (And - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/break.parseA.txt b/test/fixtures/ruby/corpus/break.parseA.txt deleted file mode 100644 index 4cbb026038..0000000000 --- a/test/fixtures/ruby/corpus/break.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (While - (Send - (Identifier)) - (Break - (Empty)))) diff --git a/test/fixtures/ruby/corpus/break.parseB.txt b/test/fixtures/ruby/corpus/break.parseB.txt deleted file mode 100644 index 1bc83882c4..0000000000 --- a/test/fixtures/ruby/corpus/break.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (While - (Not - (Send - (Identifier))) - (Break - (Empty)))) diff --git a/test/fixtures/ruby/corpus/calls.parseA.txt b/test/fixtures/ruby/corpus/calls.parseA.txt deleted file mode 100644 index 0cec91b1f2..0000000000 --- a/test/fixtures/ruby/corpus/calls.parseA.txt +++ /dev/null @@ -1,32 +0,0 @@ -(Statements - (Send - (Identifier) - (Send - (Identifier)) - (Send - (Identifier)) - (KeyValue - (SymbolElement) - (Integer)) - (KeyValue - (SymbolElement) - (Boolean))) - (Send - (Send - (Identifier)) - (Identifier)) - (Send - (Identifier) - (Send - (Identifier)) - (Send - (Identifier))) - (Send - (Identifier) - (Identifier)) - (Send - (Identifier) - (Identifier)) - (Send - (Identifier) - (Identifier))) diff --git a/test/fixtures/ruby/corpus/chained-string.parseA.txt b/test/fixtures/ruby/corpus/chained-string.parseA.txt deleted file mode 100644 index 61cbbe9cf0..0000000000 --- a/test/fixtures/ruby/corpus/chained-string.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Statements - (TextElement) - (TextElement))) diff --git a/test/fixtures/ruby/corpus/class.parseA.txt b/test/fixtures/ruby/corpus/class.parseA.txt deleted file mode 100644 index ad9d8e46ab..0000000000 --- a/test/fixtures/ruby/corpus/class.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Class - (Identifier) - (Identifier) - (Method - (Empty) - (Identifier) - (Statements))) - (Class - (ScopeResolution - (Identifier) - (Identifier)) - (Statements))) diff --git a/test/fixtures/ruby/corpus/class.parseB.txt b/test/fixtures/ruby/corpus/class.parseB.txt deleted file mode 100644 index 6aff83ea36..0000000000 --- a/test/fixtures/ruby/corpus/class.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Class - (Identifier) - (Method - (Empty) - (Identifier) - (Statements)))) diff --git a/test/fixtures/ruby/corpus/comment.parseA.txt b/test/fixtures/ruby/corpus/comment.parseA.txt deleted file mode 100644 index 4568b6b783..0000000000 --- a/test/fixtures/ruby/corpus/comment.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Context - (Comment) - (Empty))) diff --git a/test/fixtures/ruby/corpus/comment.parseB.txt b/test/fixtures/ruby/corpus/comment.parseB.txt deleted file mode 100644 index 4568b6b783..0000000000 --- a/test/fixtures/ruby/corpus/comment.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Context - (Comment) - (Empty))) diff --git a/test/fixtures/ruby/corpus/comparision-operator.parseA.txt b/test/fixtures/ruby/corpus/comparision-operator.parseA.txt deleted file mode 100644 index 6db4d3ba2f..0000000000 --- a/test/fixtures/ruby/corpus/comparision-operator.parseA.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (LessThan - (Send - (Identifier)) - (Send - (Identifier))) - (GreaterThan - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/comparision-operator.parseB.txt b/test/fixtures/ruby/corpus/comparision-operator.parseB.txt deleted file mode 100644 index c01a2cd302..0000000000 --- a/test/fixtures/ruby/corpus/comparision-operator.parseB.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (LessThanEqual - (Send - (Identifier)) - (Send - (Identifier))) - (GreaterThanEqual - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/conditional-assignment.parseA.txt b/test/fixtures/ruby/corpus/conditional-assignment.parseA.txt deleted file mode 100644 index f07b6e939e..0000000000 --- a/test/fixtures/ruby/corpus/conditional-assignment.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Or - (Identifier) - (Integer)))) diff --git a/test/fixtures/ruby/corpus/conditional-assignment.parseB.txt b/test/fixtures/ruby/corpus/conditional-assignment.parseB.txt deleted file mode 100644 index 37805c5380..0000000000 --- a/test/fixtures/ruby/corpus/conditional-assignment.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (Identifier) - (And - (Identifier) - (Integer)))) diff --git a/test/fixtures/ruby/corpus/delimiter.parseA.txt b/test/fixtures/ruby/corpus/delimiter.parseA.txt deleted file mode 100644 index 0709fbb9e9..0000000000 --- a/test/fixtures/ruby/corpus/delimiter.parseA.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement)) diff --git a/test/fixtures/ruby/corpus/delimiter.parseB.txt b/test/fixtures/ruby/corpus/delimiter.parseB.txt deleted file mode 100644 index 0709fbb9e9..0000000000 --- a/test/fixtures/ruby/corpus/delimiter.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement) - (TextElement)) diff --git a/test/fixtures/ruby/corpus/element-reference.parseA.txt b/test/fixtures/ruby/corpus/element-reference.parseA.txt deleted file mode 100644 index 05cbedc133..0000000000 --- a/test/fixtures/ruby/corpus/element-reference.parseA.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Subscript - (Send - (Identifier)) - (Send - (Identifier))) - (Subscript - (Send - (Identifier)) - (SymbolElement)) - (Assignment - (Subscript - (Send - (Identifier)) - (Send - (Identifier))) - (Integer))) diff --git a/test/fixtures/ruby/corpus/element-reference.parseB.txt b/test/fixtures/ruby/corpus/element-reference.parseB.txt deleted file mode 100644 index f3afa9d5dd..0000000000 --- a/test/fixtures/ruby/corpus/element-reference.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Subscript - (Send - (Identifier)) - (TextElement)) - (Subscript - (Send - (Identifier)) - (SymbolElement))) diff --git a/test/fixtures/ruby/corpus/else.parseA.txt b/test/fixtures/ruby/corpus/else.parseA.txt deleted file mode 100644 index 142cb9e55b..0000000000 --- a/test/fixtures/ruby/corpus/else.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Try - (Statements - (Send - (Identifier)) - (Else - (Empty) - (Statements))))) diff --git a/test/fixtures/ruby/corpus/else.parseB.txt b/test/fixtures/ruby/corpus/else.parseB.txt deleted file mode 100644 index ba36aecf18..0000000000 --- a/test/fixtures/ruby/corpus/else.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Try - (Statements - (Send - (Identifier)) - (Else - (Empty) - (Send - (Identifier)))))) diff --git a/test/fixtures/ruby/corpus/elsif.parseA.txt b/test/fixtures/ruby/corpus/elsif.parseA.txt deleted file mode 100644 index ca6b3d6068..0000000000 --- a/test/fixtures/ruby/corpus/elsif.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (If - (Send - (Identifier)) - (Statements - (Send - (Identifier))) - (If - (Send - (Identifier)) - (Statements) - (Empty)))) diff --git a/test/fixtures/ruby/corpus/elsif.parseB.txt b/test/fixtures/ruby/corpus/elsif.parseB.txt deleted file mode 100644 index bb1e52af4f..0000000000 --- a/test/fixtures/ruby/corpus/elsif.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (If - (Send - (Identifier)) - (Statements - (Send - (Identifier))) - (If - (Send - (Identifier)) - (Statements - (Send - (Identifier))) - (Empty)))) diff --git a/test/fixtures/ruby/corpus/empty-statement.parseA.txt b/test/fixtures/ruby/corpus/empty-statement.parseA.txt deleted file mode 100644 index 04eca4c779..0000000000 --- a/test/fixtures/ruby/corpus/empty-statement.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Empty)) diff --git a/test/fixtures/ruby/corpus/end-block.parseA.txt b/test/fixtures/ruby/corpus/end-block.parseA.txt deleted file mode 100644 index 919071711a..0000000000 --- a/test/fixtures/ruby/corpus/end-block.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (ScopeExit - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/end-block.parseB.txt b/test/fixtures/ruby/corpus/end-block.parseB.txt deleted file mode 100644 index 53f70e1cde..0000000000 --- a/test/fixtures/ruby/corpus/end-block.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Send - (Identifier)) - (ScopeExit - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/ensure.parseA.txt b/test/fixtures/ruby/corpus/ensure.parseA.txt deleted file mode 100644 index a454eb9849..0000000000 --- a/test/fixtures/ruby/corpus/ensure.parseA.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Try - (Statements - (Send - (Identifier)) - (Finally - (Statements))))) diff --git a/test/fixtures/ruby/corpus/ensure.parseB.txt b/test/fixtures/ruby/corpus/ensure.parseB.txt deleted file mode 100644 index 449aef23a7..0000000000 --- a/test/fixtures/ruby/corpus/ensure.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Try - (Statements - (Send - (Identifier)) - (Finally - (Send - (Identifier)))))) diff --git a/test/fixtures/ruby/corpus/for.diffB-A.txt b/test/fixtures/ruby/corpus/for.diffB-A.txt deleted file mode 100644 index 145df1768a..0000000000 --- a/test/fixtures/ruby/corpus/for.diffB-A.txt +++ /dev/null @@ -1,47 +0,0 @@ -(Statements -{+(ForEach - {+(Statements - {+(Send - {+(Identifier)+})+})+} - {+(Send - {+(Identifier)+})+} - {+(Send - {+(Identifier)+})+})+} - (ForEach - (Statements - (Send - { (Identifier) - ->(Identifier) }) - {+(Send - {+(Identifier)+})+}) - { (Array - {-(Integer)-} - {-(Integer)-} - {-(Integer)-}) - ->(Send - {+(Identifier)+}) } - (Send - { (Identifier) - ->(Identifier) } - {-(Send - {-(Identifier)-})-})) -{+(ForEach - {+(Statements - {+(Send - {+(Identifier)+})+})+} - {+(Enumeration - {+(Integer)+} - {+(Integer)+} - {+(Empty)+})+} - {+(Boolean)+})+} -{+(ForEach - {+(Statements - {+(Send - {+(Identifier)+})+} - {+(Send - {+(Identifier)+})+})+} - {+(Enumeration - {+(Integer)+} - {+(Integer)+} - {+(Empty)+})+} - {+(Boolean)+})+}) diff --git a/test/fixtures/ruby/corpus/for.parseA.txt b/test/fixtures/ruby/corpus/for.parseA.txt deleted file mode 100644 index dd475f04be..0000000000 --- a/test/fixtures/ruby/corpus/for.parseA.txt +++ /dev/null @@ -1,39 +0,0 @@ -(Statements - (ForEach - (Statements - (Send - (Identifier))) - (Send - (Identifier)) - (Send - (Identifier))) - (ForEach - (Statements - (Send - (Identifier)) - (Send - (Identifier))) - (Send - (Identifier)) - (Send - (Identifier))) - (ForEach - (Statements - (Send - (Identifier))) - (Enumeration - (Integer) - (Integer) - (Empty)) - (Boolean)) - (ForEach - (Statements - (Send - (Identifier)) - (Send - (Identifier))) - (Enumeration - (Integer) - (Integer) - (Empty)) - (Boolean))) diff --git a/test/fixtures/ruby/corpus/for.parseB.txt b/test/fixtures/ruby/corpus/for.parseB.txt deleted file mode 100644 index 267b02aa07..0000000000 --- a/test/fixtures/ruby/corpus/for.parseB.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (ForEach - (Statements - (Send - (Identifier))) - (Array - (Integer) - (Integer) - (Integer)) - (Send - (Identifier) - (Send - (Identifier))))) diff --git a/test/fixtures/ruby/corpus/hash.parseA.txt b/test/fixtures/ruby/corpus/hash.parseA.txt deleted file mode 100644 index ce5412404c..0000000000 --- a/test/fixtures/ruby/corpus/hash.parseA.txt +++ /dev/null @@ -1,34 +0,0 @@ -(Statements - (Hash - (KeyValue - (SymbolElement) - (TextElement)) - (KeyValue - (SymbolElement) - (Integer)) - (KeyValue - (TextElement) - (Boolean)) - (KeyValue - (SymbolElement) - (Integer))) - (Hash) - (Hash - (Context - (Comment) - (KeyValue - (SymbolElement) - (Integer))) - (Context - (Comment) - (Comment) - (KeyValue - (TextElement) - (Integer))) - (Context - (Comment) - (Empty))) - (Hash - (Context - (Comment) - (Empty)))) diff --git a/test/fixtures/ruby/corpus/hash.parseB.txt b/test/fixtures/ruby/corpus/hash.parseB.txt deleted file mode 100644 index 2c5ace52ea..0000000000 --- a/test/fixtures/ruby/corpus/hash.parseB.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Hash - (KeyValue - (SymbolElement) - (TextElement)) - (KeyValue - (SymbolElement) - (Integer)) - (KeyValue - (SymbolElement) - (Boolean)))) diff --git a/test/fixtures/ruby/corpus/heredoc.diffA-B.txt b/test/fixtures/ruby/corpus/heredoc.diffA-B.txt deleted file mode 100644 index d758bdc9d7..0000000000 --- a/test/fixtures/ruby/corpus/heredoc.diffA-B.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements -{+(Send - {+(Send - {+(Identifier)+} - {+(TextElement)+} - {+(Statements - {+(TextElement)+})+})+} - {+(Identifier)+})+} -{-(TextElement)-} -{-(Statements - {-(TextElement)-})-}) diff --git a/test/fixtures/ruby/corpus/heredoc.diffB-A.txt b/test/fixtures/ruby/corpus/heredoc.diffB-A.txt deleted file mode 100644 index 4612846303..0000000000 --- a/test/fixtures/ruby/corpus/heredoc.diffB-A.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements -{+(TextElement)+} -{+(Statements - {+(TextElement)+})+} -{-(Send - {-(Send - {-(Identifier)-} - {-(TextElement)-} - {-(Statements - {-(TextElement)-})-})-} - {-(Identifier)-})-}) diff --git a/test/fixtures/ruby/corpus/heredoc.parseA.txt b/test/fixtures/ruby/corpus/heredoc.parseA.txt deleted file mode 100644 index 2609a9d5e5..0000000000 --- a/test/fixtures/ruby/corpus/heredoc.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (TextElement) - (Statements - (TextElement))) diff --git a/test/fixtures/ruby/corpus/heredoc.parseB.txt b/test/fixtures/ruby/corpus/heredoc.parseB.txt deleted file mode 100644 index b9c81795e4..0000000000 --- a/test/fixtures/ruby/corpus/heredoc.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Send - (Send - (Identifier) - (TextElement) - (Statements - (TextElement))) - (Identifier))) diff --git a/test/fixtures/ruby/corpus/if-unless-modifiers.parseA.txt b/test/fixtures/ruby/corpus/if-unless-modifiers.parseA.txt deleted file mode 100644 index 84d59247dd..0000000000 --- a/test/fixtures/ruby/corpus/if-unless-modifiers.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (If - (Not - (Send - (Identifier))) - (Send - (Identifier)) - (Empty))) diff --git a/test/fixtures/ruby/corpus/if-unless-modifiers.parseB.txt b/test/fixtures/ruby/corpus/if-unless-modifiers.parseB.txt deleted file mode 100644 index 6e4333e8e9..0000000000 --- a/test/fixtures/ruby/corpus/if-unless-modifiers.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (If - (Send - (Identifier)) - (Send - (Identifier)) - (Empty))) diff --git a/test/fixtures/ruby/corpus/if.parseA.txt b/test/fixtures/ruby/corpus/if.parseA.txt deleted file mode 100644 index ea7e7f39b4..0000000000 --- a/test/fixtures/ruby/corpus/if.parseA.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (If - (Send - (Identifier)) - (Statements - (Send - (Identifier))) - (If - (Send - (Identifier)) - (Statements - (Send - (Identifier))) - (Send - (Identifier))))) diff --git a/test/fixtures/ruby/corpus/if.parseB.txt b/test/fixtures/ruby/corpus/if.parseB.txt deleted file mode 100644 index e0e74289da..0000000000 --- a/test/fixtures/ruby/corpus/if.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (If - (Send - (Identifier)) - (Statements) - (Empty)) - (If - (Send - (Identifier)) - (Statements - (Statements)) - (Empty))) diff --git a/test/fixtures/ruby/corpus/interpolation.parseA.txt b/test/fixtures/ruby/corpus/interpolation.parseA.txt deleted file mode 100644 index 4f20121efa..0000000000 --- a/test/fixtures/ruby/corpus/interpolation.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Symbol - (InterpolationElement - (Send - (Identifier)))) - (String - (InterpolationElement - (Send - (Identifier))))) diff --git a/test/fixtures/ruby/corpus/interpolation.parseB.txt b/test/fixtures/ruby/corpus/interpolation.parseB.txt deleted file mode 100644 index 4f20121efa..0000000000 --- a/test/fixtures/ruby/corpus/interpolation.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Symbol - (InterpolationElement - (Send - (Identifier)))) - (String - (InterpolationElement - (Send - (Identifier))))) diff --git a/test/fixtures/ruby/corpus/keywords.parseA.txt b/test/fixtures/ruby/corpus/keywords.parseA.txt deleted file mode 100644 index 8b7d4d0bf3..0000000000 --- a/test/fixtures/ruby/corpus/keywords.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (File) - (Line) - (Send - (Identifier))) diff --git a/test/fixtures/ruby/corpus/lambda-dash-rocket.parseA.txt b/test/fixtures/ruby/corpus/lambda-dash-rocket.parseA.txt deleted file mode 100644 index bd2fdcda52..0000000000 --- a/test/fixtures/ruby/corpus/lambda-dash-rocket.parseA.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Function - (Empty) - (Identifier) - (Identifier) - (Identifier) - (Function - (Empty) - (Statements - (Integer) - (Integer))))) diff --git a/test/fixtures/ruby/corpus/lambda-dash-rocket.parseB.txt b/test/fixtures/ruby/corpus/lambda-dash-rocket.parseB.txt deleted file mode 100644 index 71a75c95eb..0000000000 --- a/test/fixtures/ruby/corpus/lambda-dash-rocket.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Function - (Empty) - (Function - (Empty) - (Send - (Identifier))))) diff --git a/test/fixtures/ruby/corpus/lambda.parseA.txt b/test/fixtures/ruby/corpus/lambda.parseA.txt deleted file mode 100644 index ae28ba4aef..0000000000 --- a/test/fixtures/ruby/corpus/lambda.parseA.txt +++ /dev/null @@ -1,47 +0,0 @@ -(Statements - (Send - (Identifier) - (Function - (Empty) - (Statements))) - (Send - (Identifier) - (Function - (Empty) - (Send - (Identifier)))) - (Send - (Identifier) - (Function - (Empty) - (Identifier) - (Identifier) - (Identifier) - (Integer))) - (Function - (Empty) - (Function - (Empty) - (Statements))) - (Function - (Empty) - (Function - (Empty) - (Send - (Identifier)))) - (Function - (Empty) - (Identifier) - (Function - (Empty) - (Integer))) - (Function - (Empty) - (Identifier) - (Identifier) - (Statements - (Identifier) - (Identifier)) - (Function - (Empty) - (Statements)))) diff --git a/test/fixtures/ruby/corpus/lambda.parseB.txt b/test/fixtures/ruby/corpus/lambda.parseB.txt deleted file mode 100644 index c40754edce..0000000000 --- a/test/fixtures/ruby/corpus/lambda.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Send - (Identifier) - (Function - (Empty) - (Identifier) - (Plus - (Identifier) - (Integer))))) diff --git a/test/fixtures/ruby/corpus/literals.parseA.txt b/test/fixtures/ruby/corpus/literals.parseA.txt deleted file mode 100644 index fa7aa2096a..0000000000 --- a/test/fixtures/ruby/corpus/literals.parseA.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Boolean) - (Boolean) - (Null) - (SymbolElement) - (Integer) - (This) - (ZSuper) - (Enumeration - (Integer) - (Integer) - (Empty)) - (Enumeration - (Integer) - (Integer) - (Empty))) diff --git a/test/fixtures/ruby/corpus/math-assignment.diffA-B.txt b/test/fixtures/ruby/corpus/math-assignment.diffA-B.txt deleted file mode 100644 index 8a0f00e517..0000000000 --- a/test/fixtures/ruby/corpus/math-assignment.diffA-B.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - { (Integer) - ->(Integer) })) - (Assignment - (Identifier) - (Minus - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Times - (Identifier) - (Integer))) - (Assignment - (Identifier) - (DividedBy - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Power - (Identifier) - (Integer)))) diff --git a/test/fixtures/ruby/corpus/math-assignment.diffB-A.txt b/test/fixtures/ruby/corpus/math-assignment.diffB-A.txt deleted file mode 100644 index 8a0f00e517..0000000000 --- a/test/fixtures/ruby/corpus/math-assignment.diffB-A.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - { (Integer) - ->(Integer) })) - (Assignment - (Identifier) - (Minus - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Times - (Identifier) - (Integer))) - (Assignment - (Identifier) - (DividedBy - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Power - (Identifier) - (Integer)))) diff --git a/test/fixtures/ruby/corpus/math-assignment.parseA.txt b/test/fixtures/ruby/corpus/math-assignment.parseA.txt deleted file mode 100644 index f63b8be096..0000000000 --- a/test/fixtures/ruby/corpus/math-assignment.parseA.txt +++ /dev/null @@ -1,26 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Minus - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Times - (Identifier) - (Integer))) - (Assignment - (Identifier) - (DividedBy - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Power - (Identifier) - (Integer)))) diff --git a/test/fixtures/ruby/corpus/math-assignment.parseB.txt b/test/fixtures/ruby/corpus/math-assignment.parseB.txt deleted file mode 100644 index f63b8be096..0000000000 --- a/test/fixtures/ruby/corpus/math-assignment.parseB.txt +++ /dev/null @@ -1,26 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Minus - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Times - (Identifier) - (Integer))) - (Assignment - (Identifier) - (DividedBy - (Identifier) - (Integer))) - (Assignment - (Identifier) - (Power - (Identifier) - (Integer)))) diff --git a/test/fixtures/ruby/corpus/method-calls-hash-args.parseA.txt b/test/fixtures/ruby/corpus/method-calls-hash-args.parseA.txt deleted file mode 100644 index 2b2b46314d..0000000000 --- a/test/fixtures/ruby/corpus/method-calls-hash-args.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Send - (Identifier) - (KeyValue - (SymbolElement) - (Boolean)))) diff --git a/test/fixtures/ruby/corpus/method-calls-hash-args.parseB.txt b/test/fixtures/ruby/corpus/method-calls-hash-args.parseB.txt deleted file mode 100644 index 1a14b4d3b7..0000000000 --- a/test/fixtures/ruby/corpus/method-calls-hash-args.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Send - (Identifier) - (KeyValue - (SymbolElement) - (Boolean)) - (KeyValue - (SymbolElement) - (Integer)))) diff --git a/test/fixtures/ruby/corpus/method-calls-keyword-args.parseA.txt b/test/fixtures/ruby/corpus/method-calls-keyword-args.parseA.txt deleted file mode 100644 index 2b2b46314d..0000000000 --- a/test/fixtures/ruby/corpus/method-calls-keyword-args.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Send - (Identifier) - (KeyValue - (SymbolElement) - (Boolean)))) diff --git a/test/fixtures/ruby/corpus/method-calls-keyword-args.parseB.txt b/test/fixtures/ruby/corpus/method-calls-keyword-args.parseB.txt deleted file mode 100644 index 1a14b4d3b7..0000000000 --- a/test/fixtures/ruby/corpus/method-calls-keyword-args.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Send - (Identifier) - (KeyValue - (SymbolElement) - (Boolean)) - (KeyValue - (SymbolElement) - (Integer)))) diff --git a/test/fixtures/ruby/corpus/method-calls.parseA.txt b/test/fixtures/ruby/corpus/method-calls.parseA.txt deleted file mode 100644 index 6f5fc6b0e7..0000000000 --- a/test/fixtures/ruby/corpus/method-calls.parseA.txt +++ /dev/null @@ -1,36 +0,0 @@ -(Statements - (Send - (Send - (Identifier)) - (Identifier)) - (Send - (Identifier) - (Send - (Identifier)) - (Send - (Identifier)) - (KeyValue - (SymbolElement) - (Integer)) - (KeyValue - (SymbolElement) - (Integer))) - (Send - (Identifier) - (Send - (Identifier) - (Send - (Identifier)))) - (Send - (Identifier) - (KeyValue - (Array) - (Integer)) - (Identifier) - (Identifier) - (Function - (Empty) - (Identifier) - (Function - (Empty) - (Integer))))) diff --git a/test/fixtures/ruby/corpus/method-calls.parseB.txt b/test/fixtures/ruby/corpus/method-calls.parseB.txt deleted file mode 100644 index e8f5425831..0000000000 --- a/test/fixtures/ruby/corpus/method-calls.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Send - (Identifier))) diff --git a/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseA.txt b/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseA.txt deleted file mode 100644 index ebb34bf77e..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseB.txt b/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseB.txt deleted file mode 100644 index 25509296ec..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration-keyword-param.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration-param-default.parseA.txt b/test/fixtures/ruby/corpus/method-declaration-param-default.parseA.txt deleted file mode 100644 index ebb34bf77e..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration-param-default.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration-param-default.parseB.txt b/test/fixtures/ruby/corpus/method-declaration-param-default.parseB.txt deleted file mode 100644 index 25509296ec..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration-param-default.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration-params.parseA.txt b/test/fixtures/ruby/corpus/method-declaration-params.parseA.txt deleted file mode 100644 index 25509296ec..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration-params.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration-params.parseB.txt b/test/fixtures/ruby/corpus/method-declaration-params.parseB.txt deleted file mode 100644 index 5747b6d24f..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration-params.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Identifier) - (Identifier) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseA.txt b/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseA.txt deleted file mode 100644 index ebb34bf77e..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseB.txt b/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseB.txt deleted file mode 100644 index 25509296ec..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration-required-keyword-param.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseA.txt b/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseA.txt deleted file mode 100644 index 25509296ec..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseB.txt b/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseB.txt deleted file mode 100644 index 9fb912132a..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration-unnamed-param.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Identifier) - (Empty) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration.parseA.txt b/test/fixtures/ruby/corpus/method-declaration.parseA.txt deleted file mode 100644 index ebb34bf77e..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/method-declaration.parseB.txt b/test/fixtures/ruby/corpus/method-declaration.parseB.txt deleted file mode 100644 index 87671e4b8d..0000000000 --- a/test/fixtures/ruby/corpus/method-declaration.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Identifier) - (Statements - (Send - (Identifier))))) diff --git a/test/fixtures/ruby/corpus/method-invocation.parseA.txt b/test/fixtures/ruby/corpus/method-invocation.parseA.txt deleted file mode 100644 index b56a39555f..0000000000 --- a/test/fixtures/ruby/corpus/method-invocation.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Send - (Identifier)) - (Send - (Send - (Identifier)) - (Identifier)) - (Send - (Identifier))) diff --git a/test/fixtures/ruby/corpus/method-invocation.parseB.txt b/test/fixtures/ruby/corpus/method-invocation.parseB.txt deleted file mode 100644 index 5b0d9738f0..0000000000 --- a/test/fixtures/ruby/corpus/method-invocation.parseB.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Send - (Identifier) - (TextElement)) - (Send - (Send - (Identifier)) - (Identifier)) - (Send - (Identifier) - (Integer) - (Integer)) - (Send - (Identifier) - (Integer) - (Integer))) diff --git a/test/fixtures/ruby/corpus/methods.parseA.txt b/test/fixtures/ruby/corpus/methods.parseA.txt deleted file mode 100644 index 886b1c1ca7..0000000000 --- a/test/fixtures/ruby/corpus/methods.parseA.txt +++ /dev/null @@ -1,42 +0,0 @@ -(Statements - (Method - (Empty) - (Identifier) - (Statements)) - (Method - (Empty) - (Identifier) - (Statements)) - (Method - (Empty) - (Identifier) - (Identifier) - (Statements)) - (Method - (Empty) - (Identifier) - (Identifier) - (Identifier) - (Identifier) - (Empty) - (Statements)) - (Method - (Empty) - (Identifier) - (Identifier) - (Statements)) - (Method - (Empty) - (Identifier) - (Identifier) - (Statements)) - (Method - (This) - (Identifier) - (Statements)) - (Method - (This) - (Identifier) - (Identifier) - (Identifier) - (Statements))) diff --git a/test/fixtures/ruby/corpus/misc.parseA.txt b/test/fixtures/ruby/corpus/misc.parseA.txt deleted file mode 100644 index 4b36d2e1d3..0000000000 --- a/test/fixtures/ruby/corpus/misc.parseA.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Send - (Identifier) - (Send - (Identifier)) - (Function - (Empty) - (Statements))) - (Send - (Send - (Identifier)) - (Identifier) - (Function - (Empty) - (Identifier) - (Identifier) - (Identifier) - (Statements))) - (Send - (Identifier) - (Send - (Identifier)) - (Function - (Empty) - (Identifier) - (Statements))) - (Identifier)) diff --git a/test/fixtures/ruby/corpus/module.parseA.txt b/test/fixtures/ruby/corpus/module.parseA.txt deleted file mode 100644 index cef5fd7ce9..0000000000 --- a/test/fixtures/ruby/corpus/module.parseA.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Module - (Identifier)) - (Module - (ScopeResolution - (Identifier) - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/module.parseB.txt b/test/fixtures/ruby/corpus/module.parseB.txt deleted file mode 100644 index f7f87e0e5f..0000000000 --- a/test/fixtures/ruby/corpus/module.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Module - (Identifier) - (Method - (Empty) - (Identifier) - (Statements)))) diff --git a/test/fixtures/ruby/corpus/multiple-assignments.parseA.txt b/test/fixtures/ruby/corpus/multiple-assignments.parseA.txt deleted file mode 100644 index 9e5c76e94b..0000000000 --- a/test/fixtures/ruby/corpus/multiple-assignments.parseA.txt +++ /dev/null @@ -1,59 +0,0 @@ -(Statements - (Assignment - (Statements - (Identifier) - (Identifier) - (Identifier)) - (Array - (Integer) - (Integer) - (Integer))) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Array - (Integer) - (Integer))) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Array - (Integer) - (Integer))) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Array - (Integer) - (Integer))) - (Assignment - (Statements - (Identifier) - (Identifier)) - (Identifier)) - (Assignment - (Statements - (Send - (This) - (Identifier)) - (Send - (This) - (Identifier))) - (Statements - (Send - (Send - (Identifier)) - (Identifier)) - (Send - (Send - (Identifier)) - (Identifier)))) - (Assignment - (Statements - (Statements - (Identifier) - (Identifier))) - (Identifier))) diff --git a/test/fixtures/ruby/corpus/multiple-assignments.parseB.txt b/test/fixtures/ruby/corpus/multiple-assignments.parseB.txt deleted file mode 100644 index ce115f4296..0000000000 --- a/test/fixtures/ruby/corpus/multiple-assignments.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Assignment - (Statements - (Identifier) - (Identifier)) - (Array - (Integer) - (Integer) - (Integer)))) diff --git a/test/fixtures/ruby/corpus/next.parseA.txt b/test/fixtures/ruby/corpus/next.parseA.txt deleted file mode 100644 index 58c02e1196..0000000000 --- a/test/fixtures/ruby/corpus/next.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (ForEach - (Statements - (Send - (Identifier))) - (Send - (Identifier)) - (Continue - (Empty)))) diff --git a/test/fixtures/ruby/corpus/number.parseA.txt b/test/fixtures/ruby/corpus/number.parseA.txt deleted file mode 100644 index d3d0be8bab..0000000000 --- a/test/fixtures/ruby/corpus/number.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Integer) - (Integer) - (Integer) - (Integer) - (Integer) - (Integer) - (Float)) diff --git a/test/fixtures/ruby/corpus/number.parseB.txt b/test/fixtures/ruby/corpus/number.parseB.txt deleted file mode 100644 index d3d0be8bab..0000000000 --- a/test/fixtures/ruby/corpus/number.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Integer) - (Integer) - (Integer) - (Integer) - (Integer) - (Integer) - (Float)) diff --git a/test/fixtures/ruby/corpus/percent-array.parseA.txt b/test/fixtures/ruby/corpus/percent-array.parseA.txt deleted file mode 100644 index 4de5832a5c..0000000000 --- a/test/fixtures/ruby/corpus/percent-array.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Array - (TextElement) - (TextElement))) diff --git a/test/fixtures/ruby/corpus/percent-array.parseB.txt b/test/fixtures/ruby/corpus/percent-array.parseB.txt deleted file mode 100644 index dd58c587a7..0000000000 --- a/test/fixtures/ruby/corpus/percent-array.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Array - (TextElement) - (String - (InterpolationElement - (Send - (Identifier)))) - (TextElement))) diff --git a/test/fixtures/ruby/corpus/pseudo-variables.parseA.txt b/test/fixtures/ruby/corpus/pseudo-variables.parseA.txt deleted file mode 100644 index 9c12ea12ac..0000000000 --- a/test/fixtures/ruby/corpus/pseudo-variables.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Null) - (This) - (Boolean) - (Boolean)) diff --git a/test/fixtures/ruby/corpus/pseudo-variables.parseB.txt b/test/fixtures/ruby/corpus/pseudo-variables.parseB.txt deleted file mode 100644 index 53598286c4..0000000000 --- a/test/fixtures/ruby/corpus/pseudo-variables.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (This) - (Null) - (Boolean) - (Boolean)) diff --git a/test/fixtures/ruby/corpus/regex.parseA.txt b/test/fixtures/ruby/corpus/regex.parseA.txt deleted file mode 100644 index b154d3ebe6..0000000000 --- a/test/fixtures/ruby/corpus/regex.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Regex)) diff --git a/test/fixtures/ruby/corpus/regex.parseB.txt b/test/fixtures/ruby/corpus/regex.parseB.txt deleted file mode 100644 index 1d4342edd2..0000000000 --- a/test/fixtures/ruby/corpus/regex.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Regex) - (Regex)) diff --git a/test/fixtures/ruby/corpus/relational-operator.parseA.txt b/test/fixtures/ruby/corpus/relational-operator.parseA.txt deleted file mode 100644 index 05d6e44363..0000000000 --- a/test/fixtures/ruby/corpus/relational-operator.parseA.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Equal - (Send - (Identifier)) - (Send - (Identifier))) - (Not - (Equal - (Send - (Identifier)) - (Send - (Identifier)))) - (Equal - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/relational-operator.parseB.txt b/test/fixtures/ruby/corpus/relational-operator.parseB.txt deleted file mode 100644 index f637867c53..0000000000 --- a/test/fixtures/ruby/corpus/relational-operator.parseB.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (Comparison - (Send - (Identifier)) - (Send - (Identifier))) - (Matches - (Send - (Identifier)) - (Send - (Identifier))) - (Assignment - (Identifier) - (Not - (Send - (Identifier))))) diff --git a/test/fixtures/ruby/corpus/require.parseA.txt b/test/fixtures/ruby/corpus/require.parseA.txt deleted file mode 100644 index 43f3ca463c..0000000000 --- a/test/fixtures/ruby/corpus/require.parseA.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Require - (TextElement)) - (Send - (Identifier) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/require.parseB.txt b/test/fixtures/ruby/corpus/require.parseB.txt deleted file mode 100644 index 14ab3f7e85..0000000000 --- a/test/fixtures/ruby/corpus/require.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Require - (TextElement)) - (Send - (Identifier) - (SymbolElement) - (TextElement))) diff --git a/test/fixtures/ruby/corpus/rescue-empty.parseA.txt b/test/fixtures/ruby/corpus/rescue-empty.parseA.txt deleted file mode 100644 index 23369a90d1..0000000000 --- a/test/fixtures/ruby/corpus/rescue-empty.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Try - (Statements - (Send - (Identifier)) - (Catch - (Statements) - (Statements))))) diff --git a/test/fixtures/ruby/corpus/rescue-empty.parseB.txt b/test/fixtures/ruby/corpus/rescue-empty.parseB.txt deleted file mode 100644 index 047d5c62c3..0000000000 --- a/test/fixtures/ruby/corpus/rescue-empty.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Try - (Statements - (Send - (Identifier)) - (Catch - (Statements) - (Send - (Identifier)))))) diff --git a/test/fixtures/ruby/corpus/rescue-last-ex.parseA.txt b/test/fixtures/ruby/corpus/rescue-last-ex.parseA.txt deleted file mode 100644 index f9b9a94841..0000000000 --- a/test/fixtures/ruby/corpus/rescue-last-ex.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Try - (Statements - (Send - (Identifier)) - (Catch - (Statements - (Statements - (Identifier)) - (Statements - (Send - (Identifier)))) - (Statements))))) diff --git a/test/fixtures/ruby/corpus/rescue-last-ex.parseB.txt b/test/fixtures/ruby/corpus/rescue-last-ex.parseB.txt deleted file mode 100644 index abc7249bc8..0000000000 --- a/test/fixtures/ruby/corpus/rescue-last-ex.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (Try - (Statements - (Send - (Identifier)) - (Catch - (Statements - (Statements - (Identifier)) - (Statements - (Send - (Identifier)))) - (Send - (Identifier)))))) diff --git a/test/fixtures/ruby/corpus/rescue-modifier.parseA.txt b/test/fixtures/ruby/corpus/rescue-modifier.parseA.txt deleted file mode 100644 index 7bccd36407..0000000000 --- a/test/fixtures/ruby/corpus/rescue-modifier.parseA.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Try - (Send - (Identifier)) - (Catch - (Null) - (Empty)))) diff --git a/test/fixtures/ruby/corpus/rescue-modifier.parseB.txt b/test/fixtures/ruby/corpus/rescue-modifier.parseB.txt deleted file mode 100644 index e73b54b068..0000000000 --- a/test/fixtures/ruby/corpus/rescue-modifier.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Try - (Send - (Identifier)) - (Catch - (Boolean) - (Empty)))) diff --git a/test/fixtures/ruby/corpus/rescue-modifier2.parseA.txt b/test/fixtures/ruby/corpus/rescue-modifier2.parseA.txt deleted file mode 100644 index 7bccd36407..0000000000 --- a/test/fixtures/ruby/corpus/rescue-modifier2.parseA.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Try - (Send - (Identifier)) - (Catch - (Null) - (Empty)))) diff --git a/test/fixtures/ruby/corpus/rescue-modifier2.parseB.txt b/test/fixtures/ruby/corpus/rescue-modifier2.parseB.txt deleted file mode 100644 index 7bccd36407..0000000000 --- a/test/fixtures/ruby/corpus/rescue-modifier2.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Try - (Send - (Identifier)) - (Catch - (Null) - (Empty)))) diff --git a/test/fixtures/ruby/corpus/rescue.diffA-B.txt b/test/fixtures/ruby/corpus/rescue.diffA-B.txt deleted file mode 100644 index 556a95dd05..0000000000 --- a/test/fixtures/ruby/corpus/rescue.diffA-B.txt +++ /dev/null @@ -1,65 +0,0 @@ -(Statements -{+(Try - {+(Statements - {+(Send - {+(Identifier)+})+} - {+(Catch - {+(Statements - {+(Statements - {+(Send - {+(Identifier)+})+})+})+} - {+(Send - {+(Identifier)+})+})+})+})+} -{-(Try - {-(Statements - {-(Send - {-(Identifier)-})-} - {-(Catch - {-(Statements - {-(Statements - {-(Identifier)-})-})-} - {-(Catch - {-(Statements - {-(Statements - {-(Identifier)-} - {-(Identifier)-})-} - {-(Statements - {-(Send - {-(Identifier)-})-})-})-} - {-(Send - {-(Identifier)-})-})-})-} - {-(Else - {-(Empty)-} - {-(Send - {-(Identifier)-})-})-} - {-(Finally - {-(Send - {-(Identifier)-})-})-})-})-} -{-(Method - {-(Empty)-} - {-(Identifier)-} - {-(Statements - {-(Catch - {-(Statements - {-(Statements - {-(Identifier)-})-})-} - {-(Catch - {-(Statements - {-(Statements - {-(Identifier)-} - {-(Identifier)-})-} - {-(Statements - {-(Send - {-(Identifier)-})-})-})-} - {-(Statements)-})-})-} - {-(Else - {-(Empty)-} - {-(Statements)-})-} - {-(Finally - {-(Statements)-})-})-})-} -{-(Try - {-(Send - {-(Identifier)-})-} - {-(Catch - {-(Null)-} - {-(Empty)-})-})-}) diff --git a/test/fixtures/ruby/corpus/rescue.diffB-A.txt b/test/fixtures/ruby/corpus/rescue.diffB-A.txt deleted file mode 100644 index a81cb19bc4..0000000000 --- a/test/fixtures/ruby/corpus/rescue.diffB-A.txt +++ /dev/null @@ -1,64 +0,0 @@ -(Statements -{+(Try - {+(Statements - {+(Send - {+(Identifier)+})+} - {+(Catch - {+(Statements - {+(Statements - {+(Identifier)+})+})+} - {+(Catch - {+(Statements - {+(Statements - {+(Identifier)+} - {+(Identifier)+})+} - {+(Statements - {+(Send - {+(Identifier)+})+})+})+} - {+(Send - {+(Identifier)+})+})+})+} - {+(Else - {+(Empty)+} - {+(Send - {+(Identifier)+})+})+} - {+(Finally - {+(Send - {+(Identifier)+})+})+})+})+} -{+(Method - {+(Empty)+} - {+(Identifier)+} - {+(Statements - {+(Catch - {+(Statements - {+(Statements - {+(Identifier)+})+})+} - {+(Catch - {+(Statements - {+(Statements - {+(Identifier)+} - {+(Identifier)+})+} - {+(Statements - {+(Send - {+(Identifier)+})+})+})+} - {+(Statements)+})+})+} - {+(Else - {+(Empty)+} - {+(Statements)+})+} - {+(Finally - {+(Statements)+})+})+})+} - (Try - { (Statements - {-(Send - {-(Identifier)-})-} - {-(Catch - {-(Statements - {-(Statements - {-(Send - {-(Identifier)-})-})-})-} - {-(Send - {-(Identifier)-})-})-}) - ->(Send - {+(Identifier)+}) } - {+(Catch - {+(Null)+} - {+(Empty)+})+})) diff --git a/test/fixtures/ruby/corpus/rescue.parseA.txt b/test/fixtures/ruby/corpus/rescue.parseA.txt deleted file mode 100644 index 5c078a1c98..0000000000 --- a/test/fixtures/ruby/corpus/rescue.parseA.txt +++ /dev/null @@ -1,54 +0,0 @@ -(Statements - (Try - (Statements - (Send - (Identifier)) - (Catch - (Statements - (Statements - (Identifier))) - (Catch - (Statements - (Statements - (Identifier) - (Identifier)) - (Statements - (Send - (Identifier)))) - (Send - (Identifier)))) - (Else - (Empty) - (Send - (Identifier))) - (Finally - (Send - (Identifier))))) - (Method - (Empty) - (Identifier) - (Statements - (Catch - (Statements - (Statements - (Identifier))) - (Catch - (Statements - (Statements - (Identifier) - (Identifier)) - (Statements - (Send - (Identifier)))) - (Statements))) - (Else - (Empty) - (Statements)) - (Finally - (Statements)))) - (Try - (Send - (Identifier)) - (Catch - (Null) - (Empty)))) diff --git a/test/fixtures/ruby/corpus/rescue.parseB.txt b/test/fixtures/ruby/corpus/rescue.parseB.txt deleted file mode 100644 index a6eb894bd7..0000000000 --- a/test/fixtures/ruby/corpus/rescue.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Try - (Statements - (Send - (Identifier)) - (Catch - (Statements - (Statements - (Send - (Identifier)))) - (Send - (Identifier)))))) diff --git a/test/fixtures/ruby/corpus/return.parseA.txt b/test/fixtures/ruby/corpus/return.parseA.txt deleted file mode 100644 index 4391a3ea15..0000000000 --- a/test/fixtures/ruby/corpus/return.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Return - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/return.parseB.txt b/test/fixtures/ruby/corpus/return.parseB.txt deleted file mode 100644 index 878ee5e753..0000000000 --- a/test/fixtures/ruby/corpus/return.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Empty))) diff --git a/test/fixtures/ruby/corpus/singleton-class.parseA.txt b/test/fixtures/ruby/corpus/singleton-class.parseA.txt deleted file mode 100644 index 0c1ba3aa41..0000000000 --- a/test/fixtures/ruby/corpus/singleton-class.parseA.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Class - (This) - (Statements)) - (Class - (ScopeResolution - (Identifier) - (Identifier)) - (Send - (Identifier) - (SymbolElement)))) diff --git a/test/fixtures/ruby/corpus/string.parseA.txt b/test/fixtures/ruby/corpus/string.parseA.txt deleted file mode 100644 index 6cbd0b0810..0000000000 --- a/test/fixtures/ruby/corpus/string.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (TextElement) - (TextElement)) diff --git a/test/fixtures/ruby/corpus/string.parseB.txt b/test/fixtures/ruby/corpus/string.parseB.txt deleted file mode 100644 index 6cbd0b0810..0000000000 --- a/test/fixtures/ruby/corpus/string.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (TextElement) - (TextElement)) diff --git a/test/fixtures/ruby/corpus/subshell.parseA.txt b/test/fixtures/ruby/corpus/subshell.parseA.txt deleted file mode 100644 index 244724dcdd..0000000000 --- a/test/fixtures/ruby/corpus/subshell.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (TextElement)) diff --git a/test/fixtures/ruby/corpus/subshell.parseB.txt b/test/fixtures/ruby/corpus/subshell.parseB.txt deleted file mode 100644 index 244724dcdd..0000000000 --- a/test/fixtures/ruby/corpus/subshell.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (TextElement)) diff --git a/test/fixtures/ruby/corpus/symbol.parseA.txt b/test/fixtures/ruby/corpus/symbol.parseA.txt deleted file mode 100644 index 7813bf0022..0000000000 --- a/test/fixtures/ruby/corpus/symbol.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (SymbolElement) - (SymbolElement) - (SymbolElement)) diff --git a/test/fixtures/ruby/corpus/symbol.parseB.txt b/test/fixtures/ruby/corpus/symbol.parseB.txt deleted file mode 100644 index 7813bf0022..0000000000 --- a/test/fixtures/ruby/corpus/symbol.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (SymbolElement) - (SymbolElement) - (SymbolElement)) diff --git a/test/fixtures/ruby/corpus/ternary.parseA.txt b/test/fixtures/ruby/corpus/ternary.parseA.txt deleted file mode 100644 index 5c1b86d1b4..0000000000 --- a/test/fixtures/ruby/corpus/ternary.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (If - (Send - (Identifier)) - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/ternary.parseB.txt b/test/fixtures/ruby/corpus/ternary.parseB.txt deleted file mode 100644 index 5c1b86d1b4..0000000000 --- a/test/fixtures/ruby/corpus/ternary.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (If - (Send - (Identifier)) - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/unary.parseA.txt b/test/fixtures/ruby/corpus/unary.parseA.txt deleted file mode 100644 index 668327e6f6..0000000000 --- a/test/fixtures/ruby/corpus/unary.parseA.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Complement - (Send - (Identifier))) - (Not - (Send - (Identifier))) - (Negate - (Send - (Identifier))) - (Send - (Identifier)) - (Not - (Send - (Identifier))) - (Call - (Identifier) - (Send - (Identifier)) - (Empty))) diff --git a/test/fixtures/ruby/corpus/undef.parseA.txt b/test/fixtures/ruby/corpus/undef.parseA.txt deleted file mode 100644 index a92760ae67..0000000000 --- a/test/fixtures/ruby/corpus/undef.parseA.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Call - (Identifier) - (SymbolElement) - (Empty)) - (Call - (Identifier) - (Send - (Identifier)) - (Empty)) - (Call - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (Identifier) - (Empty)) - (Call - (Identifier) - (SymbolElement) - (SymbolElement) - (Empty))) diff --git a/test/fixtures/ruby/corpus/unless.parseA.txt b/test/fixtures/ruby/corpus/unless.parseA.txt deleted file mode 100644 index 05c6cc1bfe..0000000000 --- a/test/fixtures/ruby/corpus/unless.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (If - (Not - (Send - (Identifier))) - (Statements - (Send - (Identifier))) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/unless.parseB.txt b/test/fixtures/ruby/corpus/unless.parseB.txt deleted file mode 100644 index 15fe526392..0000000000 --- a/test/fixtures/ruby/corpus/unless.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (If - (Not - (Send - (Identifier))) - (Statements) - (Empty)) - (If - (Not - (Send - (Identifier))) - (Statements - (Statements)) - (Empty))) diff --git a/test/fixtures/ruby/corpus/until.parseA.txt b/test/fixtures/ruby/corpus/until.parseA.txt deleted file mode 100644 index f36973e6f4..0000000000 --- a/test/fixtures/ruby/corpus/until.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (While - (Not - (Send - (Identifier))) - (Statements)) - (While - (Not - (Send - (Identifier))) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/until.parseB.txt b/test/fixtures/ruby/corpus/until.parseB.txt deleted file mode 100644 index 35145db609..0000000000 --- a/test/fixtures/ruby/corpus/until.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (While - (Not - (Send - (Identifier))) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/when-else.parseA.txt b/test/fixtures/ruby/corpus/when-else.parseA.txt deleted file mode 100644 index 4ad38cef00..0000000000 --- a/test/fixtures/ruby/corpus/when-else.parseA.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Match - (Send - (Identifier)) - (Statements - (Pattern - (Statements - (Send - (Identifier))) - (Statements)) - (Pattern - (Statements - (Send - (Identifier)) - (Send - (Identifier))) - (Statements - (Send - (Identifier)))) - (Statements)))) diff --git a/test/fixtures/ruby/corpus/when-else.parseB.txt b/test/fixtures/ruby/corpus/when-else.parseB.txt deleted file mode 100644 index f813939bb6..0000000000 --- a/test/fixtures/ruby/corpus/when-else.parseB.txt +++ /dev/null @@ -1,24 +0,0 @@ -(Statements - (Match - (Send - (Identifier)) - (Statements - (Pattern - (Statements - (Send - (Identifier))) - (Statements - (Send - (Identifier)))) - (Pattern - (Statements - (Send - (Identifier))) - (Statements)) - (Pattern - (Statements - (Send - (Identifier))) - (Statements)) - (Send - (Identifier))))) diff --git a/test/fixtures/ruby/corpus/when.parseA.txt b/test/fixtures/ruby/corpus/when.parseA.txt deleted file mode 100644 index f7fca45997..0000000000 --- a/test/fixtures/ruby/corpus/when.parseA.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Match - (Send - (Identifier)) - (Statements - (Pattern - (Statements - (Send - (Identifier))) - (Statements)))) - (Match - (Empty) - (Statements - (Pattern - (Statements - (Boolean)) - (Statements - (TextElement)))))) diff --git a/test/fixtures/ruby/corpus/when.parseB.txt b/test/fixtures/ruby/corpus/when.parseB.txt deleted file mode 100644 index 2144c5a901..0000000000 --- a/test/fixtures/ruby/corpus/when.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Match - (Send - (Identifier)) - (Statements - (Pattern - (Statements - (Send - (Identifier))) - (Statements - (Send - (Identifier)))) - (Pattern - (Statements - (Send - (Identifier)) - (Send - (Identifier))) - (Statements)) - (Send - (Identifier))))) diff --git a/test/fixtures/ruby/corpus/while.parseA.txt b/test/fixtures/ruby/corpus/while.parseA.txt deleted file mode 100644 index 088b940d46..0000000000 --- a/test/fixtures/ruby/corpus/while.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (While - (Send - (Identifier)) - (Statements)) - (While - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/while.parseB.txt b/test/fixtures/ruby/corpus/while.parseB.txt deleted file mode 100644 index 76e7e17258..0000000000 --- a/test/fixtures/ruby/corpus/while.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (While - (Send - (Identifier)) - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/yield.parseA.txt b/test/fixtures/ruby/corpus/yield.parseA.txt deleted file mode 100644 index e144574f98..0000000000 --- a/test/fixtures/ruby/corpus/yield.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Yield - (Send - (Identifier)))) diff --git a/test/fixtures/ruby/corpus/yield.parseB.txt b/test/fixtures/ruby/corpus/yield.parseB.txt deleted file mode 100644 index 8663d7d6f6..0000000000 --- a/test/fixtures/ruby/corpus/yield.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Yield - (Empty))) diff --git a/test/fixtures/ruby/toc/methods.X.rb b/test/fixtures/ruby/toc/methods.X.rb deleted file mode 100644 index 9e5982e7b7..0000000000 --- a/test/fixtures/ruby/toc/methods.X.rb +++ /dev/null @@ -1,2 +0,0 @@ -def bar -en diff --git a/test/fixtures/tsx/corpus/jsx-elements.parseA.txt b/test/fixtures/tsx/corpus/jsx-elements.parseA.txt deleted file mode 100644 index 85d98a0356..0000000000 --- a/test/fixtures/tsx/corpus/jsx-elements.parseA.txt +++ /dev/null @@ -1,46 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (JsxElement - (JsxOpeningElement - (Identifier) - (JsxExpression - (Call - (Identifier) - (MemberAccess - (Identifier) - (Identifier)) - (Empty)))) - (JsxExpression - (Identifier)) - (JsxClosingElement - (Identifier))))) - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (JsxElement - (JsxOpeningElement - (NestedIdentifier - (Identifier) - (Identifier))) - (JsxClosingElement - (NestedIdentifier - (Identifier) - (Identifier)))))) - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (JsxSelfClosingElement - (NestedIdentifier - (Identifier) - (Identifier)) - (JsxAttribute - (Identifier) - (Empty)) - (JsxAttribute - (Identifier) - (TextElement)))))) diff --git a/test/fixtures/tsx/corpus/jsx-elements.parseB.txt b/test/fixtures/tsx/corpus/jsx-elements.parseB.txt deleted file mode 100644 index 32aee1e269..0000000000 --- a/test/fixtures/tsx/corpus/jsx-elements.parseB.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (JsxElement - (JsxOpeningElement - (Identifier) - (JsxAttribute - (Identifier) - (JsxExpression - (MemberAccess - (Identifier) - (Identifier))))) - (JsxExpression - (Identifier)) - (JsxClosingElement - (Identifier)))))) diff --git a/test/fixtures/typescript/corpus/ambient-declarations.parseA.txt b/test/fixtures/typescript/corpus/ambient-declarations.parseA.txt deleted file mode 100644 index 0e5696b91f..0000000000 --- a/test/fixtures/typescript/corpus/ambient-declarations.parseA.txt +++ /dev/null @@ -1,104 +0,0 @@ -(Statements - (AmbientDeclaration - (Class - (TypeIdentifier) - (PublicFieldDefinition - (Empty) - (Annotation - (TypeIdentifier)) - (Identifier) - (Empty)))) - (AmbientDeclaration - (VariableDeclaration - (Assignment - (Annotation - (PredefinedType)) - (Identifier) - (Empty)))) - (AmbientDeclaration - (AmbientFunction - (Empty) - (Annotation - (PredefinedType)) - (Identifier) - (RequiredParameter - (Empty) - (Annotation - (PredefinedType)) - (Identifier) - (Empty)))) - (AmbientDeclaration - (InternalModule - (Identifier) - (AmbientFunction - (Empty) - (Annotation - (PredefinedType)) - (Identifier) - (RequiredParameter - (Empty) - (Annotation - (PredefinedType)) - (Identifier) - (Empty))) - (VariableDeclaration - (Assignment - (Annotation - (PredefinedType)) - (Identifier) - (Empty))) - (InterfaceDeclaration - (Empty) - (TypeIdentifier) - (ObjectType - (PropertySignature - (Empty) - (Annotation - (PredefinedType)) - (Identifier)))) - (InterfaceDeclaration - (Empty) - (TypeIdentifier) - (ObjectType - (PropertySignature - (Empty) - (Annotation - (PredefinedType)) - (Identifier)) - (PropertySignature - (Empty) - (Annotation - (PredefinedType)) - (Identifier)) - (PropertySignature - (Empty) - (Annotation - (PredefinedType)) - (Identifier)))))) - (AmbientDeclaration - (Class - (TypeIdentifier) - (Statements - (MethodSignature - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Annotation - (PredefinedType)) - (Identifier) - (Empty))) - (PublicFieldDefinition - (Empty) - (Annotation - (PredefinedType)) - (Identifier) - (Empty)) - (MethodSignature - (Empty) - (Empty) - (Annotation - (PredefinedType)) - (Identifier)))))) diff --git a/test/fixtures/typescript/corpus/ambient-declarations.parseB.txt b/test/fixtures/typescript/corpus/ambient-declarations.parseB.txt deleted file mode 100644 index 2fec8da71d..0000000000 --- a/test/fixtures/typescript/corpus/ambient-declarations.parseB.txt +++ /dev/null @@ -1,46 +0,0 @@ -(Statements - (AmbientDeclaration - (InternalModule - (Identifier))) - (AmbientDeclaration - (Class - (TypeIdentifier) - (Statements))) - (AmbientDeclaration - (InterfaceDeclaration - (Empty) - (TypeIdentifier) - (ObjectType))) - (AmbientDeclaration - (Class - (TypeIdentifier) - (Statements - (MethodSignature - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Annotation - (PredefinedType)) - (Identifier) - (Empty))) - (PublicFieldDefinition - (Empty) - (Annotation - (PredefinedType)) - (Identifier) - (Empty)) - (MethodSignature - (Empty) - (Empty) - (Annotation - (PredefinedType)) - (Identifier))))) - (AmbientDeclaration - (AmbientFunction - (Empty) - (Annotation - (TypeIdentifier)) - (Identifier)))) diff --git a/test/fixtures/typescript/corpus/ambient-exports.parseA.txt b/test/fixtures/typescript/corpus/ambient-exports.parseA.txt deleted file mode 100644 index 4100349235..0000000000 --- a/test/fixtures/typescript/corpus/ambient-exports.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (DefaultExport - (Class - (TypeIdentifier) - (Statements)))) diff --git a/test/fixtures/typescript/corpus/ambient-exports.parseB.txt b/test/fixtures/typescript/corpus/ambient-exports.parseB.txt deleted file mode 100644 index 2146552c12..0000000000 --- a/test/fixtures/typescript/corpus/ambient-exports.parseB.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (DefaultExport - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Annotation - (PredefinedType)) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Annotation - (PredefinedType)) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Hash - (ShorthandPropertyIdentifier) - (ShorthandPropertyIdentifier))))))) diff --git a/test/fixtures/typescript/corpus/ambient-type-declarations.parseA.txt b/test/fixtures/typescript/corpus/ambient-type-declarations.parseA.txt deleted file mode 100644 index 77768814a8..0000000000 --- a/test/fixtures/typescript/corpus/ambient-type-declarations.parseA.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (AmbientDeclaration - (TypeAlias - (Empty) - (TypeIdentifier) - (Union - (Union - (Union - (PredefinedType) - (PredefinedType)) - (TypeIdentifier)) - (GenericType - (TypeIdentifier) - (TypeArguments - (Union - (Union - (PredefinedType) - (PredefinedType)) - (TypeIdentifier)))))))) diff --git a/test/fixtures/typescript/corpus/ambient-type-declarations.parseB.txt b/test/fixtures/typescript/corpus/ambient-type-declarations.parseB.txt deleted file mode 100644 index 2ba3584861..0000000000 --- a/test/fixtures/typescript/corpus/ambient-type-declarations.parseB.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (TypeAlias - (Empty) - (TypeIdentifier) - (Union - (Union - (Union - (PredefinedType) - (PredefinedType)) - (TypeIdentifier)) - (GenericType - (TypeIdentifier) - (TypeArguments - (Union - (Union - (PredefinedType) - (PredefinedType)) - (TypeIdentifier))))))) diff --git a/test/fixtures/typescript/corpus/anonymous-function.parseA.txt b/test/fixtures/typescript/corpus/anonymous-function.parseA.txt deleted file mode 100644 index a0268da01b..0000000000 --- a/test/fixtures/typescript/corpus/anonymous-function.parseA.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Plus - (Identifier) - (Identifier)))))) diff --git a/test/fixtures/typescript/corpus/anonymous-function.parseB.txt b/test/fixtures/typescript/corpus/anonymous-function.parseB.txt deleted file mode 100644 index 34c5cb21e2..0000000000 --- a/test/fixtures/typescript/corpus/anonymous-function.parseB.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Times - (Identifier) - (Identifier)))))) diff --git a/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseA.txt b/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseA.txt deleted file mode 100644 index 7b029338cd..0000000000 --- a/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock - (Return - (TextElement))))) diff --git a/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseB.txt b/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseB.txt deleted file mode 100644 index 7b029338cd..0000000000 --- a/test/fixtures/typescript/corpus/anonymous-parameterless-function.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock - (Return - (TextElement))))) diff --git a/test/fixtures/typescript/corpus/array-type.parseA.txt b/test/fixtures/typescript/corpus/array-type.parseA.txt deleted file mode 100644 index 3155372a92..0000000000 --- a/test/fixtures/typescript/corpus/array-type.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (ArrayType - (TypeIdentifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/array-type.parseB.txt b/test/fixtures/typescript/corpus/array-type.parseB.txt deleted file mode 100644 index 60d64c00a2..0000000000 --- a/test/fixtures/typescript/corpus/array-type.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (Tuple - (TypeIdentifier) - (TypeIdentifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/array.parseA.txt b/test/fixtures/typescript/corpus/array.parseA.txt deleted file mode 100644 index d5891f355d..0000000000 --- a/test/fixtures/typescript/corpus/array.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Array - (TextElement))) diff --git a/test/fixtures/typescript/corpus/array.parseB.txt b/test/fixtures/typescript/corpus/array.parseB.txt deleted file mode 100644 index 4de5832a5c..0000000000 --- a/test/fixtures/typescript/corpus/array.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Array - (TextElement) - (TextElement))) diff --git a/test/fixtures/typescript/corpus/arrow-function.parseA.txt b/test/fixtures/typescript/corpus/arrow-function.parseA.txt deleted file mode 100644 index b232ac3bd9..0000000000 --- a/test/fixtures/typescript/corpus/arrow-function.parseA.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier))))) diff --git a/test/fixtures/typescript/corpus/arrow-function.parseB.txt b/test/fixtures/typescript/corpus/arrow-function.parseB.txt deleted file mode 100644 index b232ac3bd9..0000000000 --- a/test/fixtures/typescript/corpus/arrow-function.parseB.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier))))) diff --git a/test/fixtures/typescript/corpus/assignment-pattern.parseA.txt b/test/fixtures/typescript/corpus/assignment-pattern.parseA.txt deleted file mode 100644 index 2db3947eee..0000000000 --- a/test/fixtures/typescript/corpus/assignment-pattern.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Empty) - (Hash - (Assignment - (ShorthandPropertyIdentifier) - (Float))) - (Identifier)))) diff --git a/test/fixtures/typescript/corpus/assignment-pattern.parseB.txt b/test/fixtures/typescript/corpus/assignment-pattern.parseB.txt deleted file mode 100644 index 2db3947eee..0000000000 --- a/test/fixtures/typescript/corpus/assignment-pattern.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Empty) - (Hash - (Assignment - (ShorthandPropertyIdentifier) - (Float))) - (Identifier)))) diff --git a/test/fixtures/typescript/corpus/assignment.parseA.txt b/test/fixtures/typescript/corpus/assignment.parseA.txt deleted file mode 100644 index e68803f140..0000000000 --- a/test/fixtures/typescript/corpus/assignment.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Float))) diff --git a/test/fixtures/typescript/corpus/assignment.parseB.txt b/test/fixtures/typescript/corpus/assignment.parseB.txt deleted file mode 100644 index e68803f140..0000000000 --- a/test/fixtures/typescript/corpus/assignment.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Float))) diff --git a/test/fixtures/typescript/corpus/bitwise-operator.parseA.txt b/test/fixtures/typescript/corpus/bitwise-operator.parseA.txt deleted file mode 100644 index 3be6465cf4..0000000000 --- a/test/fixtures/typescript/corpus/bitwise-operator.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (RShift - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/bitwise-operator.parseB.txt b/test/fixtures/typescript/corpus/bitwise-operator.parseB.txt deleted file mode 100644 index 3be6465cf4..0000000000 --- a/test/fixtures/typescript/corpus/bitwise-operator.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (RShift - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/boolean-operator.parseA.txt b/test/fixtures/typescript/corpus/boolean-operator.parseA.txt deleted file mode 100644 index 90cabac734..0000000000 --- a/test/fixtures/typescript/corpus/boolean-operator.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Or - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/boolean-operator.parseB.txt b/test/fixtures/typescript/corpus/boolean-operator.parseB.txt deleted file mode 100644 index 8fa994bf72..0000000000 --- a/test/fixtures/typescript/corpus/boolean-operator.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (And - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/break.parseA.txt b/test/fixtures/typescript/corpus/break.parseA.txt deleted file mode 100644 index 7e374ef006..0000000000 --- a/test/fixtures/typescript/corpus/break.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (For - (Assignment - (Identifier) - (Float)) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (If - (StrictEqual - (Identifier) - (Float)) - (Statements - (Break - (Empty))) - (Empty)) - (Empty) - (Identifier)))) diff --git a/test/fixtures/typescript/corpus/break.parseB.txt b/test/fixtures/typescript/corpus/break.parseB.txt deleted file mode 100644 index 33b8ce8987..0000000000 --- a/test/fixtures/typescript/corpus/break.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (For - (Assignment - (Identifier) - (Float)) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (If - (StrictEqual - (Identifier) - (Float)) - (Statements - (Continue - (Empty))) - (Empty)) - (Empty) - (Identifier)))) diff --git a/test/fixtures/typescript/corpus/chained-callbacks.parseA.txt b/test/fixtures/typescript/corpus/chained-callbacks.parseA.txt deleted file mode 100644 index 0b0623d664..0000000000 --- a/test/fixtures/typescript/corpus/chained-callbacks.parseA.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Call - (MemberAccess - (This) - (Identifier)) - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (MemberAccess - (Identifier) - (Identifier))))) - (Empty))) diff --git a/test/fixtures/typescript/corpus/chained-callbacks.parseB.txt b/test/fixtures/typescript/corpus/chained-callbacks.parseB.txt deleted file mode 100644 index 0b0623d664..0000000000 --- a/test/fixtures/typescript/corpus/chained-callbacks.parseB.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (Call - (MemberAccess - (This) - (Identifier)) - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (MemberAccess - (Identifier) - (Identifier))))) - (Empty))) diff --git a/test/fixtures/typescript/corpus/chained-property-access.parseA.txt b/test/fixtures/typescript/corpus/chained-property-access.parseA.txt deleted file mode 100644 index 52d3691117..0000000000 --- a/test/fixtures/typescript/corpus/chained-property-access.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Return - (Call - (MemberAccess - (Call - (MemberAccess - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Empty)) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)) - (Empty)) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/chained-property-access.parseB.txt b/test/fixtures/typescript/corpus/chained-property-access.parseB.txt deleted file mode 100644 index 52d3691117..0000000000 --- a/test/fixtures/typescript/corpus/chained-property-access.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Return - (Call - (MemberAccess - (Call - (MemberAccess - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Empty)) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)) - (Empty)) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/class.parseA.txt b/test/fixtures/typescript/corpus/class.parseA.txt deleted file mode 100644 index b28d443e01..0000000000 --- a/test/fixtures/typescript/corpus/class.parseA.txt +++ /dev/null @@ -1,57 +0,0 @@ -(Statements - (Class - (TypeParameter - (TypeIdentifier) - (Empty) - (Empty)) - (TypeIdentifier) - (ExtendsClause - (TypeIdentifier)) - (Statements - (PublicFieldDefinition - (Empty) - (Empty) - (Identifier) - (Float)) - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier)))) - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier)))) - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier))))))) diff --git a/test/fixtures/typescript/corpus/class.parseB.txt b/test/fixtures/typescript/corpus/class.parseB.txt deleted file mode 100644 index 53891b9f93..0000000000 --- a/test/fixtures/typescript/corpus/class.parseB.txt +++ /dev/null @@ -1,52 +0,0 @@ -(Statements - (Class - (TypeParameter - (TypeIdentifier) - (Empty) - (Empty)) - (TypeIdentifier) - (ExtendsClause - (TypeIdentifier)) - (Statements - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier)))) - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier)))) - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Identifier))))))) diff --git a/test/fixtures/typescript/corpus/comma-operator.parseA.txt b/test/fixtures/typescript/corpus/comma-operator.parseA.txt deleted file mode 100644 index 06fbde18ff..0000000000 --- a/test/fixtures/typescript/corpus/comma-operator.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (SequenceExpression - (Assignment - (Identifier) - (Float)) - (Assignment - (Identifier) - (Float)))) diff --git a/test/fixtures/typescript/corpus/comma-operator.parseB.txt b/test/fixtures/typescript/corpus/comma-operator.parseB.txt deleted file mode 100644 index acf60ac42a..0000000000 --- a/test/fixtures/typescript/corpus/comma-operator.parseB.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Hash - (KeyValue - (Identifier) - (SequenceExpression - (Float) - (SequenceExpression - (Plus - (Float) - (Float)) - (Float))))))) diff --git a/test/fixtures/typescript/corpus/comment.parseA.txt b/test/fixtures/typescript/corpus/comment.parseA.txt deleted file mode 100644 index 4568b6b783..0000000000 --- a/test/fixtures/typescript/corpus/comment.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Context - (Comment) - (Empty))) diff --git a/test/fixtures/typescript/corpus/comment.parseB.txt b/test/fixtures/typescript/corpus/comment.parseB.txt deleted file mode 100644 index 4568b6b783..0000000000 --- a/test/fixtures/typescript/corpus/comment.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Context - (Comment) - (Empty))) diff --git a/test/fixtures/typescript/corpus/constructor-call.parseA.txt b/test/fixtures/typescript/corpus/constructor-call.parseA.txt deleted file mode 100644 index 64b4f69b77..0000000000 --- a/test/fixtures/typescript/corpus/constructor-call.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (New - (MemberAccess - (Identifier) - (Identifier)) - (Empty) - (Float) - (TextElement))) diff --git a/test/fixtures/typescript/corpus/constructor-call.parseB.txt b/test/fixtures/typescript/corpus/constructor-call.parseB.txt deleted file mode 100644 index 64b4f69b77..0000000000 --- a/test/fixtures/typescript/corpus/constructor-call.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (New - (MemberAccess - (Identifier) - (Identifier)) - (Empty) - (Float) - (TextElement))) diff --git a/test/fixtures/typescript/corpus/continue.parseA.txt b/test/fixtures/typescript/corpus/continue.parseA.txt deleted file mode 100644 index 33b8ce8987..0000000000 --- a/test/fixtures/typescript/corpus/continue.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (For - (Assignment - (Identifier) - (Float)) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (If - (StrictEqual - (Identifier) - (Float)) - (Statements - (Continue - (Empty))) - (Empty)) - (Empty) - (Identifier)))) diff --git a/test/fixtures/typescript/corpus/continue.parseB.txt b/test/fixtures/typescript/corpus/continue.parseB.txt deleted file mode 100644 index 7e374ef006..0000000000 --- a/test/fixtures/typescript/corpus/continue.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (For - (Assignment - (Identifier) - (Float)) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (If - (StrictEqual - (Identifier) - (Float)) - (Statements - (Break - (Empty))) - (Empty)) - (Empty) - (Identifier)))) diff --git a/test/fixtures/typescript/corpus/delete-operator.parseA.txt b/test/fixtures/typescript/corpus/delete-operator.parseA.txt deleted file mode 100644 index 1f1a1d58f3..0000000000 --- a/test/fixtures/typescript/corpus/delete-operator.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Delete - (Subscript - (Identifier) - (TextElement)))) diff --git a/test/fixtures/typescript/corpus/delete-operator.parseB.txt b/test/fixtures/typescript/corpus/delete-operator.parseB.txt deleted file mode 100644 index 310b7babec..0000000000 --- a/test/fixtures/typescript/corpus/delete-operator.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Delete - (MemberAccess - (Identifier) - (Identifier)))) diff --git a/test/fixtures/typescript/corpus/do-while-statement.parseA.txt b/test/fixtures/typescript/corpus/do-while-statement.parseA.txt deleted file mode 100644 index d518e0b65e..0000000000 --- a/test/fixtures/typescript/corpus/do-while-statement.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (DoWhile - (Boolean) - (Statements - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty))))) diff --git a/test/fixtures/typescript/corpus/do-while-statement.parseB.txt b/test/fixtures/typescript/corpus/do-while-statement.parseB.txt deleted file mode 100644 index d518e0b65e..0000000000 --- a/test/fixtures/typescript/corpus/do-while-statement.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (DoWhile - (Boolean) - (Statements - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty))))) diff --git a/test/fixtures/typescript/corpus/export-assignments.parseA.txt b/test/fixtures/typescript/corpus/export-assignments.parseA.txt deleted file mode 100644 index bd229965b2..0000000000 --- a/test/fixtures/typescript/corpus/export-assignments.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (DefaultExport - (Identifier))) diff --git a/test/fixtures/typescript/corpus/export-assignments.parseB.txt b/test/fixtures/typescript/corpus/export-assignments.parseB.txt deleted file mode 100644 index 6a9255a582..0000000000 --- a/test/fixtures/typescript/corpus/export-assignments.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Identifier))) diff --git a/test/fixtures/typescript/corpus/export.diffA-B.txt b/test/fixtures/typescript/corpus/export.diffA-B.txt deleted file mode 100644 index 76d438714d..0000000000 --- a/test/fixtures/typescript/corpus/export.diffA-B.txt +++ /dev/null @@ -1,77 +0,0 @@ -(Statements -{ (QualifiedExport) -->(QualifiedExport) } -{ (QualifiedExport) -->(QualifiedExport) } - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)) - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)) - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)))) - (DefaultExport - (VariableDeclaration - {-(Assignment - {-(Empty)-} - {-(Identifier)-} - {-(Identifier)-})-} - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - { (Empty) - ->(Identifier) }) - {+(Assignment - {+(Empty)+} - {+(Identifier)+} - {+(Empty)+})+} - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)))) - (DefaultExport - { (Identifier) - ->(Identifier) }) -{+(DefaultExport - {+(Function - {+(Empty)+} - {+(Empty)+} - {+(Identifier)+} - {+(StatementBlock)+})+})+} - (DefaultExport - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock))) -{+(QualifiedExport)+} -{+(DefaultExport - {+(TextElement)+})+} -{+(QualifiedExportFrom)+} -{+(QualifiedExportFrom)+} -{-(DefaultExport - {-(Function - {-(Empty)-} - {-(Empty)-} - {-(Identifier)-} - {-(StatementBlock)-})-})-} -{-(QualifiedExport)-} -{-(DefaultExport - {-(TextElement)-})-} -{-(QualifiedExportFrom)-} -{-(QualifiedExportFrom)-}) diff --git a/test/fixtures/typescript/corpus/export.diffB-A.txt b/test/fixtures/typescript/corpus/export.diffB-A.txt deleted file mode 100644 index d042a32b3c..0000000000 --- a/test/fixtures/typescript/corpus/export.diffB-A.txt +++ /dev/null @@ -1,79 +0,0 @@ -(Statements -{ (QualifiedExport) -->(QualifiedExport) } -{ (QualifiedExport) -->(QualifiedExport) } - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)) - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)) - (Assignment - (Empty) - { (Identifier) - ->(Identifier) } - (Empty)))) - (DefaultExport - (VariableDeclaration - {+(Assignment - {+(Empty)+} - {+(Identifier)+} - {+(Identifier)+})+} - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - { (Identifier) - ->(Empty) }) - {+(Assignment - {+(Empty)+} - {+(Identifier)+} - {+(Empty)+})+} - {-(Assignment - {-(Empty)-} - {-(Identifier)-} - {-(Empty)-})-} - {-(Assignment - {-(Empty)-} - {-(Identifier)-} - {-(Empty)-})-})) - (DefaultExport - { (Identifier) - ->(Identifier) }) -{-(DefaultExport - {-(Function - {-(Empty)-} - {-(Empty)-} - {-(Identifier)-} - {-(StatementBlock)-})-})-} - (DefaultExport - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock))) -{+(DefaultExport - {+(Function - {+(Empty)+} - {+(Empty)+} - {+(Identifier)+} - {+(StatementBlock)+})+})+} -{ (QualifiedExport) -->(QualifiedExport) } - (DefaultExport - { (TextElement) - ->(TextElement) }) -{ (QualifiedExportFrom) -->(QualifiedExportFrom) } -{ (QualifiedExportFrom) -->(QualifiedExportFrom) }) diff --git a/test/fixtures/typescript/corpus/export.parseA.txt b/test/fixtures/typescript/corpus/export.parseA.txt deleted file mode 100644 index 2a01fba805..0000000000 --- a/test/fixtures/typescript/corpus/export.parseA.txt +++ /dev/null @@ -1,54 +0,0 @@ -(Statements - (QualifiedExport) - (QualifiedExport) - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)))) - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)))) - (DefaultExport - (Identifier)) - (DefaultExport - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock))) - (DefaultExport - (Function - (Empty) - (Empty) - (Identifier) - (StatementBlock))) - (QualifiedExport) - (DefaultExport - (TextElement)) - (QualifiedExportFrom) - (QualifiedExportFrom)) diff --git a/test/fixtures/typescript/corpus/export.parseB.txt b/test/fixtures/typescript/corpus/export.parseB.txt deleted file mode 100644 index a341a4f860..0000000000 --- a/test/fixtures/typescript/corpus/export.parseB.txt +++ /dev/null @@ -1,54 +0,0 @@ -(Statements - (QualifiedExport) - (QualifiedExport) - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)))) - (DefaultExport - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - (Identifier)) - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Empty)))) - (DefaultExport - (Identifier)) - (DefaultExport - (Function - (Empty) - (Empty) - (Identifier) - (StatementBlock))) - (DefaultExport - (Function - (Empty) - (Empty) - (Empty) - (StatementBlock))) - (QualifiedExport) - (DefaultExport - (TextElement)) - (QualifiedExportFrom) - (QualifiedExportFrom)) diff --git a/test/fixtures/typescript/corpus/false.parseA.txt b/test/fixtures/typescript/corpus/false.parseA.txt deleted file mode 100644 index 25d98872e4..0000000000 --- a/test/fixtures/typescript/corpus/false.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Boolean)) diff --git a/test/fixtures/typescript/corpus/false.parseB.txt b/test/fixtures/typescript/corpus/false.parseB.txt deleted file mode 100644 index 02e3c2a135..0000000000 --- a/test/fixtures/typescript/corpus/false.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Boolean))) diff --git a/test/fixtures/typescript/corpus/for-in-statement.parseA.txt b/test/fixtures/typescript/corpus/for-in-statement.parseA.txt deleted file mode 100644 index 6becb7a8dd..0000000000 --- a/test/fixtures/typescript/corpus/for-in-statement.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (ForEach - (Identifier) - (Identifier) - (Statements - (Call - (Identifier) - (Empty))))) diff --git a/test/fixtures/typescript/corpus/for-in-statement.parseB.txt b/test/fixtures/typescript/corpus/for-in-statement.parseB.txt deleted file mode 100644 index 6becb7a8dd..0000000000 --- a/test/fixtures/typescript/corpus/for-in-statement.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (ForEach - (Identifier) - (Identifier) - (Statements - (Call - (Identifier) - (Empty))))) diff --git a/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseA.txt b/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseA.txt deleted file mode 100644 index a83600b055..0000000000 --- a/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseA.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (For - (And - (Member - (Identifier) - (Identifier)) - (Assignment - (Identifier) - (Float))) - (LessThan - (Identifier) - (Identifier)) - (Update - (Identifier)) - (Statements - (Call - (Identifier) - (Empty))))) diff --git a/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseB.txt b/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseB.txt deleted file mode 100644 index a83600b055..0000000000 --- a/test/fixtures/typescript/corpus/for-loop-with-in-statement.parseB.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (For - (And - (Member - (Identifier) - (Identifier)) - (Assignment - (Identifier) - (Float))) - (LessThan - (Identifier) - (Identifier)) - (Update - (Identifier)) - (Statements - (Call - (Identifier) - (Empty))))) diff --git a/test/fixtures/typescript/corpus/for-of-statement.diffA-B.txt b/test/fixtures/typescript/corpus/for-of-statement.diffA-B.txt deleted file mode 100644 index a17ddbf189..0000000000 --- a/test/fixtures/typescript/corpus/for-of-statement.diffA-B.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (ForOf - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Statements - (Call - (Identifier) - { (Identifier) - ->(Identifier) } - (Empty)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/for-of-statement.diffB-A.txt b/test/fixtures/typescript/corpus/for-of-statement.diffB-A.txt deleted file mode 100644 index a17ddbf189..0000000000 --- a/test/fixtures/typescript/corpus/for-of-statement.diffB-A.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (ForOf - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Statements - (Call - (Identifier) - { (Identifier) - ->(Identifier) } - (Empty)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/for-of-statement.parseA.txt b/test/fixtures/typescript/corpus/for-of-statement.parseA.txt deleted file mode 100644 index f7defa7f3c..0000000000 --- a/test/fixtures/typescript/corpus/for-of-statement.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (ForOf - (Identifier) - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/for-of-statement.parseB.txt b/test/fixtures/typescript/corpus/for-of-statement.parseB.txt deleted file mode 100644 index f7defa7f3c..0000000000 --- a/test/fixtures/typescript/corpus/for-of-statement.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (ForOf - (Identifier) - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/for-statement.parseA.txt b/test/fixtures/typescript/corpus/for-statement.parseA.txt deleted file mode 100644 index 883d1fd1a6..0000000000 --- a/test/fixtures/typescript/corpus/for-statement.parseA.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (For - (SequenceExpression - (Assignment - (Identifier) - (Float)) - (Call - (Identifier) - (Empty))) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (Call - (Identifier) - (Identifier) - (Empty))))) diff --git a/test/fixtures/typescript/corpus/for-statement.parseB.txt b/test/fixtures/typescript/corpus/for-statement.parseB.txt deleted file mode 100644 index 883d1fd1a6..0000000000 --- a/test/fixtures/typescript/corpus/for-statement.parseB.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (For - (SequenceExpression - (Assignment - (Identifier) - (Float)) - (Call - (Identifier) - (Empty))) - (LessThan - (Identifier) - (Float)) - (Update - (Identifier)) - (Statements - (Call - (Identifier) - (Identifier) - (Empty))))) diff --git a/test/fixtures/typescript/corpus/function-call-args.parseA.txt b/test/fixtures/typescript/corpus/function-call-args.parseA.txt deleted file mode 100644 index ed0a647fd0..0000000000 --- a/test/fixtures/typescript/corpus/function-call-args.parseA.txt +++ /dev/null @@ -1,30 +0,0 @@ -(Statements - (Call - (Identifier) - (Float) - (TextElement) - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty)) - (Return - (Identifier)))) - (Boolean) - (Empty))) diff --git a/test/fixtures/typescript/corpus/function-call-args.parseB.txt b/test/fixtures/typescript/corpus/function-call-args.parseB.txt deleted file mode 100644 index ed0a647fd0..0000000000 --- a/test/fixtures/typescript/corpus/function-call-args.parseB.txt +++ /dev/null @@ -1,30 +0,0 @@ -(Statements - (Call - (Identifier) - (Float) - (TextElement) - (Function - (Empty) - (Empty) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty)) - (Return - (Identifier)))) - (Boolean) - (Empty))) diff --git a/test/fixtures/typescript/corpus/function-call.parseA.txt b/test/fixtures/typescript/corpus/function-call.parseA.txt deleted file mode 100644 index 3c5298c688..0000000000 --- a/test/fixtures/typescript/corpus/function-call.parseA.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Call - (TypeIdentifier) - (Identifier) - (Identifier) - (TextElement) - (Empty))) diff --git a/test/fixtures/typescript/corpus/function-call.parseB.txt b/test/fixtures/typescript/corpus/function-call.parseB.txt deleted file mode 100644 index 3c5298c688..0000000000 --- a/test/fixtures/typescript/corpus/function-call.parseB.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Call - (TypeIdentifier) - (Identifier) - (Identifier) - (TextElement) - (Empty))) diff --git a/test/fixtures/typescript/corpus/function-type.parseA.txt b/test/fixtures/typescript/corpus/function-type.parseA.txt deleted file mode 100644 index 9f45697c91..0000000000 --- a/test/fixtures/typescript/corpus/function-type.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (FunctionType - (Empty) - (TypeIdentifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/function-type.parseB.txt b/test/fixtures/typescript/corpus/function-type.parseB.txt deleted file mode 100644 index 3155372a92..0000000000 --- a/test/fixtures/typescript/corpus/function-type.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (ArrayType - (TypeIdentifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/function.diffA-B.txt b/test/fixtures/typescript/corpus/function.diffA-B.txt deleted file mode 100644 index aa2138fe45..0000000000 --- a/test/fixtures/typescript/corpus/function.diffA-B.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Function - {+(Empty)+} - {+(Annotation - {+(TypeIdentifier)+})+} - {-(TypeParameters - {-(TypeParameter - {-(TypeIdentifier)-} - {-(Empty)-} - {-(Empty)-})-})-} - {-(Annotation - {-(PredefinedType)-})-} - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - { (Identifier) - ->(Identifier) })) - (Empty)) diff --git a/test/fixtures/typescript/corpus/function.diffB-A.txt b/test/fixtures/typescript/corpus/function.diffB-A.txt deleted file mode 100644 index b6c5b3058a..0000000000 --- a/test/fixtures/typescript/corpus/function.diffB-A.txt +++ /dev/null @@ -1,27 +0,0 @@ -(Statements - (Function - {+(TypeParameters - {+(TypeParameter - {+(TypeIdentifier)+} - {+(Empty)+} - {+(Empty)+})+})+} - {+(Annotation - {+(PredefinedType)+})+} - {-(Empty)-} - {-(Annotation - {-(TypeIdentifier)-})-} - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - { (Identifier) - ->(Identifier) })) - (Empty)) diff --git a/test/fixtures/typescript/corpus/function.parseA.txt b/test/fixtures/typescript/corpus/function.parseA.txt deleted file mode 100644 index 8c3d9c46cd..0000000000 --- a/test/fixtures/typescript/corpus/function.parseA.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Function - (TypeParameters - (TypeParameter - (TypeIdentifier) - (Empty) - (Empty))) - (Annotation - (PredefinedType)) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Identifier))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/function.parseB.txt b/test/fixtures/typescript/corpus/function.parseB.txt deleted file mode 100644 index 24c40aa100..0000000000 --- a/test/fixtures/typescript/corpus/function.parseB.txt +++ /dev/null @@ -1,19 +0,0 @@ -(Statements - (Function - (Empty) - (Annotation - (TypeIdentifier)) - (Empty) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Identifier))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/generator-function.parseA.txt b/test/fixtures/typescript/corpus/generator-function.parseA.txt deleted file mode 100644 index 797e02cc53..0000000000 --- a/test/fixtures/typescript/corpus/generator-function.parseA.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Yield - (Empty)) - (Yield - (Identifier)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/generator-function.parseB.txt b/test/fixtures/typescript/corpus/generator-function.parseB.txt deleted file mode 100644 index 797e02cc53..0000000000 --- a/test/fixtures/typescript/corpus/generator-function.parseB.txt +++ /dev/null @@ -1,21 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Yield - (Empty)) - (Yield - (Identifier)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/identifier.parseA.txt b/test/fixtures/typescript/corpus/identifier.parseA.txt deleted file mode 100644 index 5f0ab64c18..0000000000 --- a/test/fixtures/typescript/corpus/identifier.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Identifier)) diff --git a/test/fixtures/typescript/corpus/identifier.parseB.txt b/test/fixtures/typescript/corpus/identifier.parseB.txt deleted file mode 100644 index 5f0ab64c18..0000000000 --- a/test/fixtures/typescript/corpus/identifier.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Identifier)) diff --git a/test/fixtures/typescript/corpus/if-else.parseA.txt b/test/fixtures/typescript/corpus/if-else.parseA.txt deleted file mode 100644 index 09d6781342..0000000000 --- a/test/fixtures/typescript/corpus/if-else.parseA.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (If - (Identifier) - (Identifier) - (If - (Identifier) - (Identifier) - (If - (Identifier) - (Identifier) - (If - (Identifier) - (Identifier) - (Identifier)))))) diff --git a/test/fixtures/typescript/corpus/if-else.parseB.txt b/test/fixtures/typescript/corpus/if-else.parseB.txt deleted file mode 100644 index 49c8b8af13..0000000000 --- a/test/fixtures/typescript/corpus/if-else.parseB.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (If - (Identifier) - (Identifier) - (If - (Identifier) - (Statements - (Identifier)) - (If - (Identifier) - (Identifier) - (If - (Identifier) - (Statements - (Identifier)) - (Identifier)))))) diff --git a/test/fixtures/typescript/corpus/if.parseA.txt b/test/fixtures/typescript/corpus/if.parseA.txt deleted file mode 100644 index 63f3ac3212..0000000000 --- a/test/fixtures/typescript/corpus/if.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (If - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty))) - (Empty))) diff --git a/test/fixtures/typescript/corpus/if.parseB.txt b/test/fixtures/typescript/corpus/if.parseB.txt deleted file mode 100644 index 0b58858fd8..0000000000 --- a/test/fixtures/typescript/corpus/if.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (If - (MemberAccess - (Identifier) - (Identifier)) - (Statements - (Call - (Identifier) - (Identifier) - (Empty)) - (Identifier)) - (Empty))) diff --git a/test/fixtures/typescript/corpus/import.diffA-B.txt b/test/fixtures/typescript/corpus/import.diffA-B.txt deleted file mode 100644 index 304e3666f1..0000000000 --- a/test/fixtures/typescript/corpus/import.diffA-B.txt +++ /dev/null @@ -1,31 +0,0 @@ -(Statements -{ (Import) -->(Import) } -{ (QualifiedAliasedImport - {-(Identifier)-}) -->(QualifiedAliasedImport - {+(Identifier)+}) } -{+(Import)+} -{+(Import)+} -{+(Import)+} -{+(Statements - {+(Import)+} - {+(Import)+})+} -{+(Statements - {+(Import)+} - {+(QualifiedAliasedImport - {+(Identifier)+})+})+} -{+(SideEffectImport)+} -{-(Import)-} -{-(Import)-} -{-(Import)-} -{-(Statements - {-(Import)-} - {-(Import)-})-} -{-(Statements - {-(Import)-} - {-(QualifiedAliasedImport - {-(Identifier)-})-})-} -{-(SideEffectImport)-} -{-(QualifiedAliasedImport - {-(Identifier)-})-}) diff --git a/test/fixtures/typescript/corpus/import.diffB-A.txt b/test/fixtures/typescript/corpus/import.diffB-A.txt deleted file mode 100644 index b83608474b..0000000000 --- a/test/fixtures/typescript/corpus/import.diffB-A.txt +++ /dev/null @@ -1,31 +0,0 @@ -(Statements -{ (Import) -->(Import) } -{ (QualifiedAliasedImport - {-(Identifier)-}) -->(QualifiedAliasedImport - {+(Identifier)+}) } -{+(Import)+} -{+(Import)+} -{+(Import)+} -{+(Statements - {+(Import)+} - {+(Import)+})+} -{+(Statements - {+(Import)+} - {+(QualifiedAliasedImport - {+(Identifier)+})+})+} -{+(SideEffectImport)+} -{+(QualifiedAliasedImport - {+(Identifier)+})+} -{-(Import)-} -{-(Import)-} -{-(Import)-} -{-(Statements - {-(Import)-} - {-(Import)-})-} -{-(Statements - {-(Import)-} - {-(QualifiedAliasedImport - {-(Identifier)-})-})-} -{-(SideEffectImport)-}) diff --git a/test/fixtures/typescript/corpus/import.parseA.txt b/test/fixtures/typescript/corpus/import.parseA.txt deleted file mode 100644 index df178a4be3..0000000000 --- a/test/fixtures/typescript/corpus/import.parseA.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Import) - (QualifiedAliasedImport - (Identifier)) - (Import) - (Import) - (Import) - (Statements - (Import) - (Import)) - (Statements - (Import) - (QualifiedAliasedImport - (Identifier))) - (SideEffectImport) - (QualifiedAliasedImport - (Identifier))) diff --git a/test/fixtures/typescript/corpus/import.parseB.txt b/test/fixtures/typescript/corpus/import.parseB.txt deleted file mode 100644 index 828eb6ea72..0000000000 --- a/test/fixtures/typescript/corpus/import.parseB.txt +++ /dev/null @@ -1,15 +0,0 @@ -(Statements - (Import) - (QualifiedAliasedImport - (Identifier)) - (Import) - (Import) - (Import) - (Statements - (Import) - (Import)) - (Statements - (Import) - (QualifiedAliasedImport - (Identifier))) - (SideEffectImport)) diff --git a/test/fixtures/typescript/corpus/interface.parseA.txt b/test/fixtures/typescript/corpus/interface.parseA.txt deleted file mode 100644 index c0f9720bab..0000000000 --- a/test/fixtures/typescript/corpus/interface.parseA.txt +++ /dev/null @@ -1,20 +0,0 @@ -(Statements - (InterfaceDeclaration - (TypeParameters - (TypeParameter - (TypeIdentifier) - (Empty) - (Empty))) - (TypeIdentifier) - (ObjectType - (PropertySignature - (Empty) - (Annotation - (LiteralType - (TextElement))) - (Identifier)) - (PropertySignature - (Readonly) - (Annotation - (TypeIdentifier)) - (Identifier))))) diff --git a/test/fixtures/typescript/corpus/interface.parseB.txt b/test/fixtures/typescript/corpus/interface.parseB.txt deleted file mode 100644 index bce55cc4da..0000000000 --- a/test/fixtures/typescript/corpus/interface.parseB.txt +++ /dev/null @@ -1,16 +0,0 @@ -(Statements - (InterfaceDeclaration - (Empty) - (TypeIdentifier) - (ObjectType - (PropertySignature - (Empty) - (Annotation - (LiteralType - (TextElement))) - (Identifier)) - (PropertySignature - (Readonly) - (Annotation - (TypeIdentifier)) - (Identifier))))) diff --git a/test/fixtures/typescript/corpus/intersection-type.parseA.txt b/test/fixtures/typescript/corpus/intersection-type.parseA.txt deleted file mode 100644 index 65cacc725e..0000000000 --- a/test/fixtures/typescript/corpus/intersection-type.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (Union - (TypeIdentifier) - (TypeIdentifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/intersection-type.parseB.txt b/test/fixtures/typescript/corpus/intersection-type.parseB.txt deleted file mode 100644 index 0d8b6cb087..0000000000 --- a/test/fixtures/typescript/corpus/intersection-type.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (Intersection - (TypeIdentifier) - (TypeIdentifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/math-assignment-operator.diffA-B.txt b/test/fixtures/typescript/corpus/math-assignment-operator.diffA-B.txt deleted file mode 100644 index b1aa79ef31..0000000000 --- a/test/fixtures/typescript/corpus/math-assignment-operator.diffA-B.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - { (Float) - ->(Float) }))) diff --git a/test/fixtures/typescript/corpus/math-assignment-operator.diffB-A.txt b/test/fixtures/typescript/corpus/math-assignment-operator.diffB-A.txt deleted file mode 100644 index b1aa79ef31..0000000000 --- a/test/fixtures/typescript/corpus/math-assignment-operator.diffB-A.txt +++ /dev/null @@ -1,7 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - { (Float) - ->(Float) }))) diff --git a/test/fixtures/typescript/corpus/math-assignment-operator.parseA.txt b/test/fixtures/typescript/corpus/math-assignment-operator.parseA.txt deleted file mode 100644 index 5403b2a5e3..0000000000 --- a/test/fixtures/typescript/corpus/math-assignment-operator.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - (Float)))) diff --git a/test/fixtures/typescript/corpus/math-assignment-operator.parseB.txt b/test/fixtures/typescript/corpus/math-assignment-operator.parseB.txt deleted file mode 100644 index 5403b2a5e3..0000000000 --- a/test/fixtures/typescript/corpus/math-assignment-operator.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (Identifier) - (Plus - (Identifier) - (Float)))) diff --git a/test/fixtures/typescript/corpus/math-operator.parseA.txt b/test/fixtures/typescript/corpus/math-operator.parseA.txt deleted file mode 100644 index 023fa5c6af..0000000000 --- a/test/fixtures/typescript/corpus/math-operator.parseA.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Minus - (Plus - (Identifier) - (Times - (Identifier) - (Float))) - (Modulo - (Identifier) - (Float)))) diff --git a/test/fixtures/typescript/corpus/math-operator.parseB.txt b/test/fixtures/typescript/corpus/math-operator.parseB.txt deleted file mode 100644 index 023fa5c6af..0000000000 --- a/test/fixtures/typescript/corpus/math-operator.parseB.txt +++ /dev/null @@ -1,10 +0,0 @@ -(Statements - (Minus - (Plus - (Identifier) - (Times - (Identifier) - (Float))) - (Modulo - (Identifier) - (Float)))) diff --git a/test/fixtures/typescript/corpus/member-access-assignment.parseA.txt b/test/fixtures/typescript/corpus/member-access-assignment.parseA.txt deleted file mode 100644 index a4d2743694..0000000000 --- a/test/fixtures/typescript/corpus/member-access-assignment.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (MemberAccess - (Identifier) - (Identifier)) - (Float))) diff --git a/test/fixtures/typescript/corpus/member-access-assignment.parseB.txt b/test/fixtures/typescript/corpus/member-access-assignment.parseB.txt deleted file mode 100644 index a4d2743694..0000000000 --- a/test/fixtures/typescript/corpus/member-access-assignment.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (MemberAccess - (Identifier) - (Identifier)) - (Float))) diff --git a/test/fixtures/typescript/corpus/member-access.parseA.txt b/test/fixtures/typescript/corpus/member-access.parseA.txt deleted file mode 100644 index 70674960a3..0000000000 --- a/test/fixtures/typescript/corpus/member-access.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (MemberAccess - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/member-access.parseB.txt b/test/fixtures/typescript/corpus/member-access.parseB.txt deleted file mode 100644 index 70674960a3..0000000000 --- a/test/fixtures/typescript/corpus/member-access.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (MemberAccess - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/method-call.parseA.txt b/test/fixtures/typescript/corpus/method-call.parseA.txt deleted file mode 100644 index 447b0ae78c..0000000000 --- a/test/fixtures/typescript/corpus/method-call.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (TextElement) - (Empty))) diff --git a/test/fixtures/typescript/corpus/method-call.parseB.txt b/test/fixtures/typescript/corpus/method-call.parseB.txt deleted file mode 100644 index 447b0ae78c..0000000000 --- a/test/fixtures/typescript/corpus/method-call.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (TextElement) - (Empty))) diff --git a/test/fixtures/typescript/corpus/method-definition.parseA.txt b/test/fixtures/typescript/corpus/method-definition.parseA.txt deleted file mode 100644 index 7b254a73a5..0000000000 --- a/test/fixtures/typescript/corpus/method-definition.parseA.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Class - (TypeIdentifier) - (Method - (Empty) - (Empty) - (Annotation - (TypeIdentifier)) - (Empty) - (Identifier) - (StatementBlock)))) diff --git a/test/fixtures/typescript/corpus/method-definition.parseB.txt b/test/fixtures/typescript/corpus/method-definition.parseB.txt deleted file mode 100644 index 6b5bc9186f..0000000000 --- a/test/fixtures/typescript/corpus/method-definition.parseB.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Class - (TypeIdentifier) - (Method - (Readonly) - (Empty) - (Annotation - (PredefinedType)) - (Empty) - (Identifier) - (StatementBlock)))) diff --git a/test/fixtures/typescript/corpus/module-declarations.parseA.txt b/test/fixtures/typescript/corpus/module-declarations.parseA.txt deleted file mode 100644 index 93d305e376..0000000000 --- a/test/fixtures/typescript/corpus/module-declarations.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Module - (Identifier))) diff --git a/test/fixtures/typescript/corpus/module-declarations.parseB.txt b/test/fixtures/typescript/corpus/module-declarations.parseB.txt deleted file mode 100644 index 63b454b608..0000000000 --- a/test/fixtures/typescript/corpus/module-declarations.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (AmbientDeclaration - (InternalModule - (Identifier)))) diff --git a/test/fixtures/typescript/corpus/named-function.parseA.txt b/test/fixtures/typescript/corpus/named-function.parseA.txt deleted file mode 100644 index c1953a1de1..0000000000 --- a/test/fixtures/typescript/corpus/named-function.parseA.txt +++ /dev/null @@ -1,18 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Identifier))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/named-function.parseB.txt b/test/fixtures/typescript/corpus/named-function.parseB.txt deleted file mode 100644 index 635f5b4bbf..0000000000 --- a/test/fixtures/typescript/corpus/named-function.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (StatementBlock - (Return - (Boolean)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/nested-do-while-in-function.parseA.txt b/test/fixtures/typescript/corpus/nested-do-while-in-function.parseA.txt deleted file mode 100644 index 1686da7c10..0000000000 --- a/test/fixtures/typescript/corpus/nested-do-while-in-function.parseA.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (DoWhile - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty))))))) diff --git a/test/fixtures/typescript/corpus/nested-do-while-in-function.parseB.txt b/test/fixtures/typescript/corpus/nested-do-while-in-function.parseB.txt deleted file mode 100644 index 1686da7c10..0000000000 --- a/test/fixtures/typescript/corpus/nested-do-while-in-function.parseB.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (DoWhile - (Identifier) - (Statements - (Call - (Identifier) - (Identifier) - (Empty))))))) diff --git a/test/fixtures/typescript/corpus/nested-functions.parseA.txt b/test/fixtures/typescript/corpus/nested-functions.parseA.txt deleted file mode 100644 index e2ed7efc63..0000000000 --- a/test/fixtures/typescript/corpus/nested-functions.parseA.txt +++ /dev/null @@ -1,43 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty)) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty))))))) diff --git a/test/fixtures/typescript/corpus/nested-functions.parseB.txt b/test/fixtures/typescript/corpus/nested-functions.parseB.txt deleted file mode 100644 index e2ed7efc63..0000000000 --- a/test/fixtures/typescript/corpus/nested-functions.parseB.txt +++ /dev/null @@ -1,43 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Function - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty)) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Identifier) - (Empty))))))) diff --git a/test/fixtures/typescript/corpus/null.parseA.txt b/test/fixtures/typescript/corpus/null.parseA.txt deleted file mode 100644 index 5c722556e5..0000000000 --- a/test/fixtures/typescript/corpus/null.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Null)) diff --git a/test/fixtures/typescript/corpus/null.parseB.txt b/test/fixtures/typescript/corpus/null.parseB.txt deleted file mode 100644 index 24f16825d6..0000000000 --- a/test/fixtures/typescript/corpus/null.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Null))) diff --git a/test/fixtures/typescript/corpus/number.parseA.txt b/test/fixtures/typescript/corpus/number.parseA.txt deleted file mode 100644 index ca689125a1..0000000000 --- a/test/fixtures/typescript/corpus/number.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Float)) diff --git a/test/fixtures/typescript/corpus/number.parseB.txt b/test/fixtures/typescript/corpus/number.parseB.txt deleted file mode 100644 index ca689125a1..0000000000 --- a/test/fixtures/typescript/corpus/number.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Float)) diff --git a/test/fixtures/typescript/corpus/object.parseA.txt b/test/fixtures/typescript/corpus/object.parseA.txt deleted file mode 100644 index 7a96e8f9f7..0000000000 --- a/test/fixtures/typescript/corpus/object.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Hash - (KeyValue - (TextElement) - (TextElement)))) diff --git a/test/fixtures/typescript/corpus/object.parseB.txt b/test/fixtures/typescript/corpus/object.parseB.txt deleted file mode 100644 index a992629117..0000000000 --- a/test/fixtures/typescript/corpus/object.parseB.txt +++ /dev/null @@ -1,11 +0,0 @@ -(Statements - (Hash - (KeyValue - (TextElement) - (TextElement)) - (KeyValue - (TextElement) - (TextElement)) - (KeyValue - (TextElement) - (TextElement)))) diff --git a/test/fixtures/typescript/corpus/objects-with-methods.parseA.txt b/test/fixtures/typescript/corpus/objects-with-methods.parseA.txt deleted file mode 100644 index 510dcd7652..0000000000 --- a/test/fixtures/typescript/corpus/objects-with-methods.parseA.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Hash - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Plus - (Identifier) - (Identifier))))))) diff --git a/test/fixtures/typescript/corpus/objects-with-methods.parseB.txt b/test/fixtures/typescript/corpus/objects-with-methods.parseB.txt deleted file mode 100644 index 112b1b8d75..0000000000 --- a/test/fixtures/typescript/corpus/objects-with-methods.parseB.txt +++ /dev/null @@ -1,23 +0,0 @@ -(Statements - (Hash - (Method - (Empty) - (Empty) - (Empty) - (Empty) - (Identifier) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (RequiredParameter - (Empty) - (Empty) - (Identifier) - (Empty)) - (StatementBlock - (Return - (Minus - (Identifier) - (Identifier))))))) diff --git a/test/fixtures/typescript/corpus/public-field-definition.parseA.txt b/test/fixtures/typescript/corpus/public-field-definition.parseA.txt deleted file mode 100644 index 2d2f35fd11..0000000000 --- a/test/fixtures/typescript/corpus/public-field-definition.parseA.txt +++ /dev/null @@ -1,65 +0,0 @@ -(Statements - (Class - (TypeIdentifier) - (Statements - (PublicFieldDefinition - (Readonly) - (Empty) - (Identifier) - (Empty)) - (PublicFieldDefinition - (Readonly) - (Empty) - (Identifier) - (Empty)) - (PublicFieldDefinition - (Readonly) - (Empty) - (Identifier) - (Empty)) - (PublicFieldDefinition - (Readonly) - (Empty) - (Identifier) - (Float)) - (PublicFieldDefinition - (Readonly) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Empty) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Empty) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Readonly) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Readonly) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Empty) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Empty) - (Empty) - (Identifier) - (Float))))) diff --git a/test/fixtures/typescript/corpus/public-field-definition.parseB.txt b/test/fixtures/typescript/corpus/public-field-definition.parseB.txt deleted file mode 100644 index 9f41c6195c..0000000000 --- a/test/fixtures/typescript/corpus/public-field-definition.parseB.txt +++ /dev/null @@ -1,66 +0,0 @@ -(Statements - (Class - (TypeIdentifier) - (Statements - (PublicFieldDefinition - (Readonly) - (Empty) - (Identifier) - (Empty)) - (PublicFieldDefinition - (Readonly) - (Empty) - (Identifier) - (Empty)) - (PublicFieldDefinition - (Readonly) - (Empty) - (Identifier) - (Empty)) - (PublicFieldDefinition - (Readonly) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Empty) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Empty) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Empty) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Empty) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Readonly) - (Annotation - (TypeIdentifier)) - (Identifier) - (TextElement)) - (PublicFieldDefinition - (Empty) - (Annotation - (TypeIdentifier)) - (Identifier) - (Float)) - (PublicFieldDefinition - (Empty) - (Empty) - (Identifier) - (Float))))) diff --git a/test/fixtures/typescript/corpus/regex.parseA.txt b/test/fixtures/typescript/corpus/regex.parseA.txt deleted file mode 100644 index b154d3ebe6..0000000000 --- a/test/fixtures/typescript/corpus/regex.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Regex)) diff --git a/test/fixtures/typescript/corpus/regex.parseB.txt b/test/fixtures/typescript/corpus/regex.parseB.txt deleted file mode 100644 index b154d3ebe6..0000000000 --- a/test/fixtures/typescript/corpus/regex.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Regex)) diff --git a/test/fixtures/typescript/corpus/relational-operator.parseA.txt b/test/fixtures/typescript/corpus/relational-operator.parseA.txt deleted file mode 100644 index 4bacd5c818..0000000000 --- a/test/fixtures/typescript/corpus/relational-operator.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (LessThan - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/relational-operator.parseB.txt b/test/fixtures/typescript/corpus/relational-operator.parseB.txt deleted file mode 100644 index eb9125c713..0000000000 --- a/test/fixtures/typescript/corpus/relational-operator.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (LessThanEqual - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/return-statement.parseA.txt b/test/fixtures/typescript/corpus/return-statement.parseA.txt deleted file mode 100644 index fd629221ea..0000000000 --- a/test/fixtures/typescript/corpus/return-statement.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Float))) diff --git a/test/fixtures/typescript/corpus/return-statement.parseB.txt b/test/fixtures/typescript/corpus/return-statement.parseB.txt deleted file mode 100644 index 878ee5e753..0000000000 --- a/test/fixtures/typescript/corpus/return-statement.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Empty))) diff --git a/test/fixtures/typescript/corpus/string.parseA.txt b/test/fixtures/typescript/corpus/string.parseA.txt deleted file mode 100644 index 244724dcdd..0000000000 --- a/test/fixtures/typescript/corpus/string.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (TextElement)) diff --git a/test/fixtures/typescript/corpus/string.parseB.txt b/test/fixtures/typescript/corpus/string.parseB.txt deleted file mode 100644 index 244724dcdd..0000000000 --- a/test/fixtures/typescript/corpus/string.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (TextElement)) diff --git a/test/fixtures/typescript/corpus/subscript-access-assignment.parseA.txt b/test/fixtures/typescript/corpus/subscript-access-assignment.parseA.txt deleted file mode 100644 index 065c52c81e..0000000000 --- a/test/fixtures/typescript/corpus/subscript-access-assignment.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (Subscript - (Identifier) - (TextElement)) - (Float))) diff --git a/test/fixtures/typescript/corpus/subscript-access-assignment.parseB.txt b/test/fixtures/typescript/corpus/subscript-access-assignment.parseB.txt deleted file mode 100644 index 065c52c81e..0000000000 --- a/test/fixtures/typescript/corpus/subscript-access-assignment.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Assignment - (Subscript - (Identifier) - (TextElement)) - (Float))) diff --git a/test/fixtures/typescript/corpus/subscript-access-string.parseA.txt b/test/fixtures/typescript/corpus/subscript-access-string.parseA.txt deleted file mode 100644 index 5d5853ad77..0000000000 --- a/test/fixtures/typescript/corpus/subscript-access-string.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Subscript - (Identifier) - (TextElement))) diff --git a/test/fixtures/typescript/corpus/subscript-access-string.parseB.txt b/test/fixtures/typescript/corpus/subscript-access-string.parseB.txt deleted file mode 100644 index 5d5853ad77..0000000000 --- a/test/fixtures/typescript/corpus/subscript-access-string.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Subscript - (Identifier) - (TextElement))) diff --git a/test/fixtures/typescript/corpus/subscript-access-variable.parseA.txt b/test/fixtures/typescript/corpus/subscript-access-variable.parseA.txt deleted file mode 100644 index e2c7fbd55a..0000000000 --- a/test/fixtures/typescript/corpus/subscript-access-variable.parseA.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Subscript - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/subscript-access-variable.parseB.txt b/test/fixtures/typescript/corpus/subscript-access-variable.parseB.txt deleted file mode 100644 index e2c7fbd55a..0000000000 --- a/test/fixtures/typescript/corpus/subscript-access-variable.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Subscript - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/switch-statement.parseA.txt b/test/fixtures/typescript/corpus/switch-statement.parseA.txt deleted file mode 100644 index 50a633ec51..0000000000 --- a/test/fixtures/typescript/corpus/switch-statement.parseA.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Match - (Float) - (Statements - (Pattern - (Float) - (Statements - (Float))) - (Pattern - (Float) - (Statements - (Float))) - (Pattern - (Float) - (Statements - (Float))))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/switch-statement.parseB.txt b/test/fixtures/typescript/corpus/switch-statement.parseB.txt deleted file mode 100644 index 50a633ec51..0000000000 --- a/test/fixtures/typescript/corpus/switch-statement.parseB.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Match - (Float) - (Statements - (Pattern - (Float) - (Statements - (Float))) - (Pattern - (Float) - (Statements - (Float))) - (Pattern - (Float) - (Statements - (Float))))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/template-string.parseA.txt b/test/fixtures/typescript/corpus/template-string.parseA.txt deleted file mode 100644 index d6d776fad5..0000000000 --- a/test/fixtures/typescript/corpus/template-string.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (String)) diff --git a/test/fixtures/typescript/corpus/template-string.parseB.txt b/test/fixtures/typescript/corpus/template-string.parseB.txt deleted file mode 100644 index d6d776fad5..0000000000 --- a/test/fixtures/typescript/corpus/template-string.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (String)) diff --git a/test/fixtures/typescript/corpus/ternary.parseA.txt b/test/fixtures/typescript/corpus/ternary.parseA.txt deleted file mode 100644 index ff5f03d892..0000000000 --- a/test/fixtures/typescript/corpus/ternary.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (If - (Identifier) - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/ternary.parseB.txt b/test/fixtures/typescript/corpus/ternary.parseB.txt deleted file mode 100644 index 93db1d9d28..0000000000 --- a/test/fixtures/typescript/corpus/ternary.parseB.txt +++ /dev/null @@ -1,17 +0,0 @@ -(Statements - (Assignment - (MemberAccess - (Identifier) - (Identifier)) - (If - (MemberAccess - (Identifier) - (Identifier)) - (MemberAccess - (Identifier) - (Identifier)) - (MemberAccess - (MemberAccess - (Identifier) - (Identifier)) - (Identifier))))) diff --git a/test/fixtures/typescript/corpus/this-expression.parseA.txt b/test/fixtures/typescript/corpus/this-expression.parseA.txt deleted file mode 100644 index 2fce35ed58..0000000000 --- a/test/fixtures/typescript/corpus/this-expression.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (This)) diff --git a/test/fixtures/typescript/corpus/this-expression.parseB.txt b/test/fixtures/typescript/corpus/this-expression.parseB.txt deleted file mode 100644 index 2ebca766a5..0000000000 --- a/test/fixtures/typescript/corpus/this-expression.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (This))) diff --git a/test/fixtures/typescript/corpus/throw-statement.parseA.txt b/test/fixtures/typescript/corpus/throw-statement.parseA.txt deleted file mode 100644 index dbba82efaf..0000000000 --- a/test/fixtures/typescript/corpus/throw-statement.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Throw - (New - (Identifier) - (Empty) - (TextElement)))) diff --git a/test/fixtures/typescript/corpus/throw-statement.parseB.txt b/test/fixtures/typescript/corpus/throw-statement.parseB.txt deleted file mode 100644 index dbba82efaf..0000000000 --- a/test/fixtures/typescript/corpus/throw-statement.parseB.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (Throw - (New - (Identifier) - (Empty) - (TextElement)))) diff --git a/test/fixtures/typescript/corpus/true.parseA.txt b/test/fixtures/typescript/corpus/true.parseA.txt deleted file mode 100644 index 25d98872e4..0000000000 --- a/test/fixtures/typescript/corpus/true.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Boolean)) diff --git a/test/fixtures/typescript/corpus/true.parseB.txt b/test/fixtures/typescript/corpus/true.parseB.txt deleted file mode 100644 index 02e3c2a135..0000000000 --- a/test/fixtures/typescript/corpus/true.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Boolean))) diff --git a/test/fixtures/typescript/corpus/try-statement.parseA.txt b/test/fixtures/typescript/corpus/try-statement.parseA.txt deleted file mode 100644 index 00902f2752..0000000000 --- a/test/fixtures/typescript/corpus/try-statement.parseA.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Try - (Statements - (Identifier)) - (Catch - (Empty) - (Statements - (Identifier))) - (Finally - (Statements - (Identifier)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/try-statement.parseB.txt b/test/fixtures/typescript/corpus/try-statement.parseB.txt deleted file mode 100644 index 00902f2752..0000000000 --- a/test/fixtures/typescript/corpus/try-statement.parseB.txt +++ /dev/null @@ -1,12 +0,0 @@ -(Statements - (Try - (Statements - (Identifier)) - (Catch - (Empty) - (Statements - (Identifier))) - (Finally - (Statements - (Identifier)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/tuple-type.parseA.txt b/test/fixtures/typescript/corpus/tuple-type.parseA.txt deleted file mode 100644 index 60d64c00a2..0000000000 --- a/test/fixtures/typescript/corpus/tuple-type.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (Tuple - (TypeIdentifier) - (TypeIdentifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/tuple-type.parseB.txt b/test/fixtures/typescript/corpus/tuple-type.parseB.txt deleted file mode 100644 index 0d8b6cb087..0000000000 --- a/test/fixtures/typescript/corpus/tuple-type.parseB.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (Intersection - (TypeIdentifier) - (TypeIdentifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/type-assertions.parseA.txt b/test/fixtures/typescript/corpus/type-assertions.parseA.txt deleted file mode 100644 index 8af389ea29..0000000000 --- a/test/fixtures/typescript/corpus/type-assertions.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (TypeAssertion - (TypeArguments - (PredefinedType)) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/type-assertions.parseB.txt b/test/fixtures/typescript/corpus/type-assertions.parseB.txt deleted file mode 100644 index ffba56a63d..0000000000 --- a/test/fixtures/typescript/corpus/type-assertions.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (Cast - (Identifier) - (PredefinedType))) diff --git a/test/fixtures/typescript/corpus/type-operator.parseA.txt b/test/fixtures/typescript/corpus/type-operator.parseA.txt deleted file mode 100644 index f20b037531..0000000000 --- a/test/fixtures/typescript/corpus/type-operator.parseA.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Typeof - (Identifier))) diff --git a/test/fixtures/typescript/corpus/type-operator.parseB.txt b/test/fixtures/typescript/corpus/type-operator.parseB.txt deleted file mode 100644 index 6087bffacc..0000000000 --- a/test/fixtures/typescript/corpus/type-operator.parseB.txt +++ /dev/null @@ -1,4 +0,0 @@ -(Statements - (InstanceOf - (Identifier) - (Identifier))) diff --git a/test/fixtures/typescript/corpus/typeof-types.parseA.txt b/test/fixtures/typescript/corpus/typeof-types.parseA.txt deleted file mode 100644 index 993d76461d..0000000000 --- a/test/fixtures/typescript/corpus/typeof-types.parseA.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (TypeIdentifier)) - (Identifier) - (Empty))) - (VariableDeclaration - (Assignment - (Annotation - (TypeQuery - (Identifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/typeof-types.parseB.txt b/test/fixtures/typescript/corpus/typeof-types.parseB.txt deleted file mode 100644 index 4a77aaa669..0000000000 --- a/test/fixtures/typescript/corpus/typeof-types.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (TypeQuery - (Identifier))) - (Identifier) - (Empty))) - (VariableDeclaration - (Assignment - (Annotation - (TypeIdentifier)) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/undefined.parseA.txt b/test/fixtures/typescript/corpus/undefined.parseA.txt deleted file mode 100644 index ea5e6fca6d..0000000000 --- a/test/fixtures/typescript/corpus/undefined.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Undefined)) diff --git a/test/fixtures/typescript/corpus/undefined.parseB.txt b/test/fixtures/typescript/corpus/undefined.parseB.txt deleted file mode 100644 index 58c1a9eaf1..0000000000 --- a/test/fixtures/typescript/corpus/undefined.parseB.txt +++ /dev/null @@ -1,3 +0,0 @@ -(Statements - (Return - (Undefined))) diff --git a/test/fixtures/typescript/corpus/union-type.parseA.txt b/test/fixtures/typescript/corpus/union-type.parseA.txt deleted file mode 100644 index 0d8b6cb087..0000000000 --- a/test/fixtures/typescript/corpus/union-type.parseA.txt +++ /dev/null @@ -1,9 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (Intersection - (TypeIdentifier) - (TypeIdentifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/union-type.parseB.txt b/test/fixtures/typescript/corpus/union-type.parseB.txt deleted file mode 100644 index 34575c8629..0000000000 --- a/test/fixtures/typescript/corpus/union-type.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Annotation - (TypeQuery - (Identifier))) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/var-declaration.parseA.txt b/test/fixtures/typescript/corpus/var-declaration.parseA.txt deleted file mode 100644 index 1634cc36e7..0000000000 --- a/test/fixtures/typescript/corpus/var-declaration.parseA.txt +++ /dev/null @@ -1,6 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Float)))) diff --git a/test/fixtures/typescript/corpus/var-declaration.parseB.txt b/test/fixtures/typescript/corpus/var-declaration.parseB.txt deleted file mode 100644 index 2ffadbf28e..0000000000 --- a/test/fixtures/typescript/corpus/var-declaration.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Empty)) - (Assignment - (Empty) - (Identifier) - (Hash)) - (Assignment - (Empty) - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/variable.parseA.txt b/test/fixtures/typescript/corpus/variable.parseA.txt deleted file mode 100644 index 5f0ab64c18..0000000000 --- a/test/fixtures/typescript/corpus/variable.parseA.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Identifier)) diff --git a/test/fixtures/typescript/corpus/variable.parseB.txt b/test/fixtures/typescript/corpus/variable.parseB.txt deleted file mode 100644 index 5f0ab64c18..0000000000 --- a/test/fixtures/typescript/corpus/variable.parseB.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Statements - (Identifier)) diff --git a/test/fixtures/typescript/corpus/void-operator.parseA.txt b/test/fixtures/typescript/corpus/void-operator.parseA.txt deleted file mode 100644 index 71bb378919..0000000000 --- a/test/fixtures/typescript/corpus/void-operator.parseA.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Void - (Call - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/void-operator.parseB.txt b/test/fixtures/typescript/corpus/void-operator.parseB.txt deleted file mode 100644 index 71bb378919..0000000000 --- a/test/fixtures/typescript/corpus/void-operator.parseB.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Statements - (Void - (Call - (Identifier) - (Empty)))) diff --git a/test/fixtures/typescript/corpus/while-statement.parseA.txt b/test/fixtures/typescript/corpus/while-statement.parseA.txt deleted file mode 100644 index 9d2e8f0d85..0000000000 --- a/test/fixtures/typescript/corpus/while-statement.parseA.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (While - (Identifier) - (Statements - (Call - (Identifier) - (Empty)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/while-statement.parseB.txt b/test/fixtures/typescript/corpus/while-statement.parseB.txt deleted file mode 100644 index 9d2e8f0d85..0000000000 --- a/test/fixtures/typescript/corpus/while-statement.parseB.txt +++ /dev/null @@ -1,8 +0,0 @@ -(Statements - (While - (Identifier) - (Statements - (Call - (Identifier) - (Empty)))) - (Empty)) diff --git a/test/fixtures/typescript/corpus/yield.parseA.txt b/test/fixtures/typescript/corpus/yield.parseA.txt deleted file mode 100644 index c1ee0ed8ee..0000000000 --- a/test/fixtures/typescript/corpus/yield.parseA.txt +++ /dev/null @@ -1,13 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (StatementBlock - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Float))) - (Yield - (Identifier))))) diff --git a/test/fixtures/typescript/corpus/yield.parseB.txt b/test/fixtures/typescript/corpus/yield.parseB.txt deleted file mode 100644 index 149b2ad448..0000000000 --- a/test/fixtures/typescript/corpus/yield.parseB.txt +++ /dev/null @@ -1,14 +0,0 @@ -(Statements - (Function - (Empty) - (Empty) - (Identifier) - (StatementBlock - (VariableDeclaration - (Assignment - (Empty) - (Identifier) - (Float))) - (Yield - (Update - (Identifier)))))) diff --git a/vendor/haskell-tree-sitter b/vendor/haskell-tree-sitter deleted file mode 160000 index aa1b3c7441..0000000000 --- a/vendor/haskell-tree-sitter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aa1b3c74410a71648a5301d6241566dfe79165a4